diff options
Diffstat (limited to 'doc/src/snippets')
-rw-r--r-- | doc/src/snippets/code/doc_src_properties.qdoc | 17 | ||||
-rw-r--r-- | doc/src/snippets/moc/myclass2.h | 7 |
2 files changed, 19 insertions, 5 deletions
diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc index 7704160..a4ed409 100644 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ b/doc/src/snippets/code/doc_src_properties.qdoc @@ -91,7 +91,7 @@ for (int i=0; i<count; ++i) { class MyClass : public QObject { Q_OBJECT - Q_PROPERTY(Priority priority READ priority WRITE setPriority) + Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) Q_ENUMS(Priority) public: @@ -100,8 +100,19 @@ public: enum Priority { High, Low, VeryHigh, VeryLow }; - void setPriority(Priority priority); - Priority priority() const; + void setPriority(Priority priority) + { + m_priority = priority; + emit priorityChanged(priority); + } + Priority priority() const + { return m_priority; } + +signals: + void priorityChanged(Priority); + +private: + Priority m_priority; }; //! [5] diff --git a/doc/src/snippets/moc/myclass2.h b/doc/src/snippets/moc/myclass2.h index ca79515..daea23c 100644 --- a/doc/src/snippets/moc/myclass2.h +++ b/doc/src/snippets/moc/myclass2.h @@ -58,8 +58,11 @@ public: MyClass(QObject *parent = 0); ~MyClass(); - void setPriority(Priority priority); - Priority priority() const; + void setPriority(Priority priority) { m_priority = priority; } + Priority priority() const { return m_priority; } + +private: + Priority m_priority; }; //! [0] |