From 3f8469acb19d9f4781245070619f3f817257f9a3 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Sun, 23 Aug 2020 17:42:24 +0200 Subject: [PATCH] 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 --- src/plasma/framesvg.h | 4 ++-- src/plasma/plasma.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plasma/framesvg.h b/src/plasma/framesvg.h index bea526267..00a71872c 100644 --- a/src/plasma/framesvg.h +++ b/src/plasma/framesvg.h @@ -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 diff --git a/src/plasma/plasma.h b/src/plasma/plasma.h index 6f6d89541..a2a5efd70 100644 --- a/src/plasma/plasma.h +++ b/src/plasma/plasma.h @@ -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