Use Q_DECLARE_OPERATORS_FOR_FLAGS in same namespace as flags definition

Having the macro's definition of the operator| in the namespace of the
flags argument improves/unbreaks things for the argument-dependent
lookup of unqualified function names, e.g. when flags are combined in
calls of other methods, but there is some other operator| defined in the
namespace of the current code.

Given Q_DECLARE_OPERATORS_FOR_FLAGS creates inlined functions, this
should be a source and binary compatible change.

Qt did similar for Qt 5.12 in
https://codereview.qt-project.org/c/qt/qtbase/+/225348
This commit is contained in:
Friedrich W. H. Kossebau 2020-08-23 17:42:24 +02:00
parent 3509283d63
commit 3f8469acb1
2 changed files with 7 additions and 6 deletions

View File

@ -305,8 +305,8 @@ private:
//Q_PRIVATE_SLOT(d, void updateSizes())
};
Q_DECLARE_OPERATORS_FOR_FLAGS(FrameSvg::EnabledBorders)
} // Plasma namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::FrameSvg::EnabledBorders)
#endif // multiple inclusion guard

View File

@ -297,10 +297,11 @@ PLASMA_EXPORT Types::Direction locationToDirection(Types::Location location);
**/
PLASMA_EXPORT Types::Direction locationToInverseDirection(Types::Location location);
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::ComponentTypes)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::BackgroundFlags)
} // Plasma namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::BackgroundFlags)
#endif // multiple inclusion guard