summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeproperty.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-12-07 14:19:43 +1000
committerBea Lam <bea.lam@nokia.com>2010-12-10 09:56:21 +1000
commitbb07641213dfc4c949707500c3d665fae5f4b9f0 (patch)
treea0fa5f74703fdc4f5718ea9eebdb1949bad705a3 /src/declarative/qml/qdeclarativeproperty.cpp
parentdd3859f06f6949b0e16097306f2be7baece41833 (diff)
QDeclarativeProperty doc improvements
Diffstat (limited to 'src/declarative/qml/qdeclarativeproperty.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index df0917f6e8..60edd64249 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
*/