summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-04-15 13:58:55 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-04-16 13:52:12 +0200
commit0c651768475aa882d606efe51d10fedc44b87566 (patch)
tree6d828b77002442ace2ca6105d193abec55567b2c /src/corelib/kernel/qobject.cpp
parent487dd80bce9c6006f349ccb09222e1c308200f0a (diff)
Docs: show more relevant and correct way of using Q_FLAG
The snippet didn't quote the QLibrary header correctly, and didn't register the flags type, but only the enum type with the meta object system. Update example to use QItemSelectionModel instead as a more relevant class for readers, and restructure the text a bit. Change-Id: I572e2aaac4601087e7aa6d2ea7a8f8fd65d82539 Fixes: QTBUG-83474 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 8be10ed601..23e4e1163c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4493,16 +4493,15 @@ QDebug operator<<(QDebug dbg, const QObject *o)
that values of a given enum can be used as flags and combined using the
bitwise OR operator. For namespaces use \l Q_FLAG_NS() instead.
- The macro must be placed after the enum declaration.
+ The macro must be placed after the enum declaration. The declaration of
+ the flags type is done using the \l Q_DECLARE_FLAGS() macro.
- For example, in QLibrary, the \l{QLibrary::LoadHints}{LoadHints} flag is
+ For example, in QItemSelectionModel, the
+ \l{QItemSelectionModel::SelectionFlags}{SelectionFlags} flag is
declared in the following way:
\snippet code/src_corelib_kernel_qobject.cpp 39
- The declaration of the flags themselves is performed in the public section
- of the QLibrary class itself, using the \l Q_DECLARE_FLAGS() macro.
-
\note The Q_FLAG macro takes care of registering individual flag values
with the meta-object system, so it is unnecessary to use Q_ENUM()
in addition to this macro.