summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-01-13 12:13:07 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-01-13 12:13:07 (GMT)
commitcd0772335cc9bcedd582cacc834bf4609ca650b0 (patch)
treed79fd07b683ec0ff107c05c79490cd1073af70e4 /doc
parentc96c83df302fe35b9ac98528b288a8ed2ac65286 (diff)
downloadQt-cd0772335cc9bcedd582cacc834bf4609ca650b0.zip
Qt-cd0772335cc9bcedd582cacc834bf4609ca650b0.tar.gz
Qt-cd0772335cc9bcedd582cacc834bf4609ca650b0.tar.bz2
doc: This bug wasn't really a bug; it just required clarification.
The reported bug was actually not a bug. It is ok to pass the enum value as a string here, because the enumeration type has been registered with the meta-object system with the Q_ENUMS() macro. However, I have added a bit of text to clarify things a bit. Task-number: QTBUG-7158
Diffstat (limited to 'doc')
-rw-r--r--doc/src/objectmodel/properties.qdoc19
-rw-r--r--doc/src/snippets/code/doc_src_properties.qdoc2
2 files changed, 12 insertions, 9 deletions
diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc
index 076c544..a807caf 100644
--- a/doc/src/objectmodel/properties.qdoc
+++ b/doc/src/objectmodel/properties.qdoc
@@ -208,17 +208,20 @@
the property type. The meta-object compiler enforces these
requirements.
- Given a pointer to an instance of MyClass or a pointer to an
- instance of QObject that happens to be an instance of MyClass, we
- have two ways to set its priority property.
+ Given a pointer to an instance of MyClass or a pointer to a
+ QObject that is an instance of MyClass, we have two ways to set
+ its priority property:
\snippet doc/src/snippets/code/doc_src_properties.qdoc 6
- In the example, the enumeration type used for the property type
- was locally declared in MyClass. Had it been declared in another
- class, its fully qualified name (i.e., OtherClass::Priority) would
- be required. In addition, that other class must also inherit
- QObject and register the enum type using Q_ENUMS().
+ 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
+ available as strings for use as in the call to 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.
A similar macro, Q_FLAGS(), is also available. Like Q_ENUMS(), it
registers an enumeration type, but it marks the type as being a
diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc
index 38cc139..962d930 100644
--- a/doc/src/snippets/code/doc_src_properties.qdoc
+++ b/doc/src/snippets/code/doc_src_properties.qdoc
@@ -112,7 +112,7 @@ MyClass *myinstance = new MyClass;
QObject *object = myinstance;
myinstance->setPriority(MyClass::VeryHigh);
-object->setProperty("priority", (int)MyClass::VeryHigh);
+object->setProperty("priority", "VeryHigh");
//! [6]