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>
This commit is contained in:
Fan RuiJie 2021-10-15 16:40:44 +08:00
parent 347e74cafa
commit ab1904363a

View File

@ -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; }