diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-15 13:58:55 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-16 13:52:12 +0200 |
commit | 0c651768475aa882d606efe51d10fedc44b87566 (patch) | |
tree | 6d828b77002442ace2ca6105d193abec55567b2c /src/corelib/doc | |
parent | 487dd80bce9c6006f349ccb09222e1c308200f0a (diff) | |
download | qtbase-0c651768475aa882d606efe51d10fedc44b87566.tar.gz |
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/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp index 43bcc22720..fddda64b19 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp @@ -403,20 +403,28 @@ public: //! [39] -class QLibrary : public QObject +class QItemSelectionModel : public QObject { Q_OBJECT public: ... - - enum LoadHint { - ResolveAllSymbolsHint = 0x01, - ExportExternalSymbolsHint = 0x02, - LoadArchiveMemberHint = 0x04 + enum SelectionFlag { + NoUpdate = 0x0000, + Clear = 0x0001, + Select = 0x0002, + Deselect = 0x0004, + Toggle = 0x0008, + Current = 0x0010, + Rows = 0x0020, + Columns = 0x0040, + SelectCurrent = Select | Current, + ToggleCurrent = Toggle | Current, + ClearAndSelect = Clear | Select }; - Q_DECLARE_FLAGS(LoadHints, LoadHint) - Q_FLAG(LoadHint) + + Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) + Q_FLAG(SelectionFlags) ... } //! [39] |