diff options
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/doc_src_properties.qdoc')
-rw-r--r-- | doc/codesnippets/doc/src/snippets/code/doc_src_properties.qdoc | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/doc_src_properties.qdoc b/doc/codesnippets/doc/src/snippets/code/doc_src_properties.qdoc deleted file mode 100644 index 377cc9c14..000000000 --- a/doc/codesnippets/doc/src/snippets/code/doc_src_properties.qdoc +++ /dev/null @@ -1,78 +0,0 @@ -//! [0] -Q_PROPERTY(type name - READ getFunction - [WRITE setFunction] - [RESET resetFunction] - [NOTIFY notifySignal] - [DESIGNABLE bool] - [SCRIPTABLE bool] - [STORED bool] - [USER bool]) -//! [0] - - -//! [1] -Q_PROPERTY(bool focus READ hasFocus) -Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) -Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) -//! [1] - - -//! [2] -Q_PROPERTY(QDate date READ getDate WRITE setDate) -//! [2] - - -//! [3] -QPushButton *button = new QPushButton; -QObject *object = button; - -button->setDown(true); -object->setProperty("down", true); -//! [3] - - -//! [4] -QObject *object = ... -const QMetaObject *metaobject = object->metaObject(); -int count = metaobject->propertyCount(); -for (int i=0; i<count; ++i) { - QMetaProperty metaproperty = metaobject->property(i); - const char *name = metaproperty.name(); - QVariant value = object->property(name); - ... -} -//! [4] - - -//! [5] -class MyClass : public QObject -{ - Q_OBJECT - Q_PROPERTY(Priority priority READ priority WRITE setPriority) - Q_ENUMS(Priority) - -public: - MyClass(QObject *parent = 0); - ~MyClass(); - - enum Priority { High, Low, VeryHigh, VeryLow }; - - void setPriority(Priority priority); - Priority priority() const; -}; -//! [5] - - -//! [6] -MyClass *myinstance = new MyClass; -QObject *object = myinstance; - -myinstance->setPriority(MyClass::VeryHigh); -object->setProperty("priority", "VeryHigh"); -//! [6] - - -//! [7] -Q_CLASSINFO("Version", "3.0.0") -//! [7] |