summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-08-10 19:23:35 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2015-03-03 13:31:44 +0000
commitbfb92c03e0d8e7a3a65b64d1f2f5b89f442e2b8a (patch)
treeab2ef605168a07724687431bdcaba5d3530b3ff3 /src/corelib/doc/snippets
parentb13432747578cb3a1121b8cf9e870396b0bb53c2 (diff)
Document Q_ENUM and Q_FLAG
[ChangeLog][QtCore] Q_ENUMS and Q_FLAGS have been deprecated, and replaced by Q_ENUM and Q_FLAG macros. These two new macros automatically register the enum with the Qt metatype system, allowing automatic conversion to or from string in QVariant, or to show the strings by QDebug operators. They also enable the new QMetaEnum::fromType function. Change-Id: I80cccd7ad3fc46b11aee2fe50681a8126debf972 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/corelib/doc/snippets')
-rw-r--r--src/corelib/doc/snippets/code/doc_src_properties.cpp2
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp17
2 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_properties.cpp b/src/corelib/doc/snippets/code/doc_src_properties.cpp
index d07c7cb947..8978d1a067 100644
--- a/src/corelib/doc/snippets/code/doc_src_properties.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_properties.cpp
@@ -93,13 +93,13 @@ class MyClass : public QObject
{
Q_OBJECT
Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
- Q_ENUMS(Priority)
public:
MyClass(QObject *parent = 0);
~MyClass();
enum Priority { High, Low, VeryHigh, VeryLow };
+ Q_ENUM(Priority)
void setPriority(Priority priority)
{
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 0bf67fce31..b0048014a4 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
@@ -376,38 +376,37 @@ Q_PROPERTY(QString title READ title WRITE setTitle USER true)
class MyClass : public QObject
{
Q_OBJECT
- Q_ENUMS(Priority)
public:
MyClass(QObject *parent = 0);
~MyClass();
enum Priority { High, Low, VeryHigh, VeryLow };
+ Q_ENUM(Priority)
void setPriority(Priority priority);
Priority priority() const;
};
//! [38]
-//! [39a]
+//! [39]
class QLibrary : public QObject
{
- ...
- Q_FLAGS(LoadHint LoadHints)
- ...
-//! [39a]
+ Q_OBJECT
-//! [39b]
- ...
public:
+ ...
+
enum LoadHint {
ResolveAllSymbolsHint = 0x01,
ExportExternalSymbolsHint = 0x02,
LoadArchiveMemberHint = 0x04
};
Q_DECLARE_FLAGS(LoadHints, LoadHint)
+ Q_FLAG(LoadHints)
...
-//! [39b]
+}
+//! [39]
//! [40]