Skip to content

Commit

Permalink
Fix warnings due to enums in QSizePolicy
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Fan RuiJie committed Oct 21, 2021
1 parent 347e74c commit ab19043
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/widgets/kernel/qsizepolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ class Q_WIDGETS_EXPORT QSizePolicy
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; }
Expand Down

0 comments on commit ab19043

Please sign in to comment.