From 3c4782d33dc95de80d0d17328b5027cc50d6c03d Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Sat, 27 Jun 2026 21:38:34 +0900
Subject: Fix warnings when using operators on different enum types.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In C++20, using '-Wdeprecated-enum-enum-conversion' results in a lot of warnings when compiling pretty much any application that uses widgets.
This is a typical warning message:

/usr/include/tqt3/tqsizepolicy.h:84:57: warning: bitwise operation between different enumeration types ‘TQSizePolicy::SizeType’ and ‘TQSizePolicy::SizePolicy_Internal’ is deprecated [-Wdeprecated-enum-enum-conversion]
   84 |     bool mayGrowHorizontally() const { return horData() & MayGrow || horData() == Ignored; }

Co-authored-by: Opencode/MiMo V2.5 Free
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 src/kernel/tqsizepolicy.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/kernel/tqsizepolicy.h b/src/kernel/tqsizepolicy.h
index bab360cc4..7ca0004fc 100644
--- a/src/kernel/tqsizepolicy.h
+++ b/src/kernel/tqsizepolicy.h
@@ -79,15 +79,15 @@ public:
     SizeType horData() const { return (SizeType)( data & HMask ); }
     SizeType verData() const { return (SizeType)( (data & VMask) >> HSize ); }
 
-    bool mayShrinkHorizontally() const { return horData() & MayShrink || horData() == Ignored; }
-    bool mayShrinkVertically() const { return verData() & MayShrink || verData() == Ignored; }
-    bool mayGrowHorizontally() const { return horData() & MayGrow || horData() == Ignored; }
-    bool mayGrowVertically() const { return verData() & MayGrow || verData() == Ignored; }
+    bool mayShrinkHorizontally() const { return (horData() & static_cast<SizeType>(MayShrink)) || (horData() == Ignored); }
+    bool mayShrinkVertically()   const { return (verData() & static_cast<SizeType>(MayShrink)) || (verData() == Ignored); }
+    bool mayGrowHorizontally()   const { return (horData() & static_cast<SizeType>(MayGrow))   || (horData() == Ignored); }
+    bool mayGrowVertically()     const { return (verData() & static_cast<SizeType>(MayGrow))   || (verData() == Ignored); }
 
     ExpandData expanding() const
     {
-	return (ExpandData)( (int)(verData() & ExpMask ? Vertically : 0) |
-			     (int)(horData() & ExpMask ? Horizontally : 0) );
+	return static_cast<ExpandData>( ((verData() & static_cast<SizeType>(ExpMask)) ? Vertically : 0) |
+					((horData() & static_cast<SizeType>(ExpMask)) ? Horizontally : 0) );
     }
 
     void setHorData( SizeType d ) { data = (TQ_UINT32)(data & ~HMask) | d; }
-- 
cgit v1.2.3

