diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2014-08-10 19:23:35 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-03-03 13:31:44 +0000 |
commit | bfb92c03e0d8e7a3a65b64d1f2f5b89f442e2b8a (patch) | |
tree | ab2ef605168a07724687431bdcaba5d3530b3ff3 /src/corelib/doc/src/objectmodel | |
parent | b13432747578cb3a1121b8cf9e870396b0bb53c2 (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/src/objectmodel')
-rw-r--r-- | src/corelib/doc/src/objectmodel/properties.qdoc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc index 5db1410e6f..abb0720fe9 100644 --- a/src/corelib/doc/src/objectmodel/properties.qdoc +++ b/src/corelib/doc/src/objectmodel/properties.qdoc @@ -207,7 +207,7 @@ section of the class. The required \c READ function is named \c priority, and we include a \c WRITE function named \c setPriority. The enumeration type must be registered with the \l {Meta-Object - System} using the Q_ENUMS() macro. Registering an enumeration type + System} using the Q_ENUM() macro. Registering an enumeration type makes the enumerator names available for use in calls to QObject::setProperty(). We must also provide our own declarations for the \c READ and \c WRITE functions. The declaration of MyClass @@ -228,18 +228,18 @@ In the example, the enumeration type that is the property type is declared in MyClass and registered with the \l{Meta-Object System} - using the Q_ENUMS() macro. This makes the enumeration values + using the Q_ENUM() macro. This makes the enumeration values available as strings for use as in the call to \l{QObject::}{setProperty()}. Had the enumeration type been declared in another class, its fully qualified name (i.e., OtherClass::Priority) would be required, and that other class would also have to inherit QObject and register - the enumeration type there using the Q_ENUMS() macro. + the enumeration type there using the Q_ENUM() macro. - A similar macro, Q_FLAGS(), is also available. Like Q_ENUMS(), it + A similar macro, Q_FLAG(), is also available. Like Q_ENUM(), it registers an enumeration type, but it marks the type as being a set of \e flags, i.e. values that can be OR'd together. An I/O class might have enumeration values \c Read and \c Write and then - QObject::setProperty() could accept \c{Read | Write}. Q_FLAGS() + QObject::setProperty() could accept \c{Read | Write}. Q_FLAG() should be used to register this enumeration type. \section1 Dynamic Properties |