diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-12-07 04:19:43 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-12-09 23:56:21 (GMT) |
commit | bb07641213dfc4c949707500c3d665fae5f4b9f0 (patch) | |
tree | a0fa5f74703fdc4f5718ea9eebdb1949bad705a3 /src/declarative | |
parent | dd3859f06f6949b0e16097306f2be7baece41833 (diff) | |
download | Qt-bb07641213dfc4c949707500c3d665fae5f4b9f0.zip Qt-bb07641213dfc4c949707500c3d665fae5f4b9f0.tar.gz Qt-bb07641213dfc4c949707500c3d665fae5f4b9f0.tar.bz2 |
QDeclarativeProperty doc improvements
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativeproperty.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index df0917f..60edd64 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -77,15 +77,28 @@ a property on a specific object instance. To read a property's value, programme QDeclarativeProperty instance and call the read() method. Likewise to write a property value the write() method is used. +For example, for the following QML code: + +\qml +// MyItem.qml +import QtQuick 1.0 + +Text { text: "A bit of text" } +\endqml + +The \l Text object's properties could be accessed using QDeclarativeProperty, like this: + \code +#include <QDeclarativeProperty> +#include <QGraphicsObject> -QObject *object = declarativeComponent.create(); +... -QDeclarativeProperty property(object, "font.pixelSize"); +QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml")); +QDeclarativeProperty property(view.rootObject(), "font.pixelSize"); qWarning() << "Current pixel size:" << property.read().toInt(); property.write(24); qWarning() << "Pixel size should now be 24:" << property.read().toInt(); - \endcode */ |