aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-11 14:21:25 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-11 14:23:49 +0100
commit4f581f22d707fd226a56400817c9e47e54116589 (patch)
tree92ea37da8941459797c5a6415abae2b8c02e9f9f
parent73623b69477352f901aa0d02a667bd2438a91491 (diff)
downloadlibquotient-4f581f22d707fd226a56400817c9e47e54116589.tar.gz
libquotient-4f581f22d707fd226a56400817c9e47e54116589.zip
Better documentation for QUO_DECLARE_FLAGS[_NS]
-rw-r--r--lib/quotient_common.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/quotient_common.h b/lib/quotient_common.h
index b3fb3efa..2b785a39 100644
--- a/lib/quotient_common.h
+++ b/lib/quotient_common.h
@@ -9,17 +9,33 @@
#include <array>
-// See https://bugreports.qt.io/browse/QTBUG-82295 - despite the comment that
-// Q_FLAG[_NS] "should" be applied to the enum only, Qt doesn't allow to wrap
-// a flag type into a QVariant then. The macros below define Q_FLAG[_NS] and on
-// top of that add Q_ENUM[_NS]_IMPL which is a part of Q_ENUM() macro that
-// enables the metatype data but goes under the moc radar to avoid double
-// registration of the same data in the map defined in moc_*.cpp
+
+//! \brief Quotient replacement for the Q_FLAG/Q_DECLARE_FLAGS combination
+//!
+//! Although the comment in QTBUG-82295 says that Q_FLAG[_NS] "should" be
+//! applied to the enum type only, Qt then doesn't allow to wrap the
+//! corresponding flag type (defined with Q_DECLARE_FLAGS) into a QVariant.
+//! This macro defines Q_FLAG and on top of that adds Q_ENUM_IMPL which is
+//! a part of Q_ENUM() macro that enables the metatype data but goes under
+//! the moc radar to avoid double registration of the same data in the map
+//! defined in moc_*.cpp.
+//!
+//! Simply put, instead of using Q_FLAG/Q_DECLARE_FLAGS combo (and struggling
+//! to figure out what you should pass to Q_FLAG if you want to make it
+//! wrappable in a QVariant) use the macro below, and things will just work.
+//!
+//! \sa https://bugreports.qt.io/browse/QTBUG-82295
#define QUO_DECLARE_FLAGS(Flags, Enum) \
Q_DECLARE_FLAGS(Flags, Enum) \
Q_ENUM_IMPL(Enum) \
Q_FLAG(Flags)
+//! \brief Quotient replacement for the Q_FLAG_NS/Q_DECLARE_FLAGS combination
+//!
+//! This is the equivalent of QUO_DECLARE_FLAGS for enums declared at the
+//! namespace level (be sure to provide Q_NAMESPACE _in the same file_
+//! as the enum definition and this macro).
+//! \sa QUO_DECLARE_FLAGS
#define QUO_DECLARE_FLAGS_NS(Flags, Enum) \
Q_DECLARE_FLAGS(Flags, Enum) \
Q_ENUM_NS_IMPL(Enum) \