diff options
author | Fan RuiJie <fanruijie@uniontech.com> | 2021-10-15 16:40:44 +0800 |
---|---|---|
committer | Fan RuiJie <fanruijie@uniontech.com> | 2021-10-21 19:31:27 +0000 |
commit | ab1904363a87656b4ddec77ee9978082a25dadcd (patch) | |
tree | 347a1c6f4ebc87969b4bce2fe5547a29a3e5bf84 /src/widgets/kernel/qsizepolicy.h | |
parent | 347e74cafa7f0431d807f52574a2e19537946d8f (diff) |
Fix warnings due to enums in QSizePolicy
gcc 11 generates warnings as
"bitwise operation between different enumeration types
'QSizePolicy::Policy' and 'QSizePolicy::PolicyFlag' is deprecated"
in C++20.
Fixes: QTBUG-93810
Pick-to: 6.2 5.15
Change-Id: If8a796b33a772cc1a561eb0b6bc4def8f9f54bc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qsizepolicy.h')
-rw-r--r-- | src/widgets/kernel/qsizepolicy.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 24db99354b..5e948175f3 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -108,9 +108,10 @@ public: constexpr void setVerticalPolicy(Policy d) noexcept { bits.verPolicy = d; } void setControlType(ControlType type) noexcept; + // ### Qt 7: consider making Policy a QFlags and removing these casts constexpr Qt::Orientations expandingDirections() const noexcept { - return ( (verticalPolicy() & int(ExpandFlag)) ? Qt::Vertical : Qt::Orientations() ) - | ( (horizontalPolicy() & int(ExpandFlag)) ? Qt::Horizontal : Qt::Orientations() ) ; + return ( (verticalPolicy() & static_cast<Policy>(ExpandFlag)) ? Qt::Vertical : Qt::Orientations() ) + | ( (horizontalPolicy() & static_cast<Policy>(ExpandFlag)) ? Qt::Horizontal : Qt::Orientations() ) ; } constexpr void setHeightForWidth(bool b) noexcept { bits.hfw = b; } |