summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/extending-tutorial.qdoc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-23 19:04:14 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-23 19:04:14 (GMT)
commit0727c544915427372951b1c30715a09e473ec494 (patch)
treef91fa94a5a3f693470e37235f60df66afb454968 /doc/src/declarative/extending-tutorial.qdoc
parent7df48c278ed8a8e589ef674f95f8b1098d067789 (diff)
parentbe7edc40324bb135548888853df28bf94eb2aa79 (diff)
downloadQt-0727c544915427372951b1c30715a09e473ec494.zip
Qt-0727c544915427372951b1c30715a09e473ec494.tar.gz
Qt-0727c544915427372951b1c30715a09e473ec494.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (42 commits) Update QtDeclarative def files Fix crash in MouseArea Compile Fixes undeleted timers (and endless warning from the event loop about Remove unneeded member variable. Fix test. Generalize qml "registration" Fix compiler warning Fix TextInput echoMode autotest on Linux Reuse QML lexer to simplify .pragma script logic Fix TextEdit text attribute and text stored in the internal QTextDocument having different contents Remove QDeclarativeItem::childrenChanged() signal overload Update QtGui and QtDeclarative def files Make rootContext and engine pointers in QDeclarativeView API const Add additional QVariant benchmarks. Allow MouseArea dragging to filter mouse events from descendants Expand QDeclarativeExtensionPlugin docs Add missing snippet files Expand QtObject doc Indicate default values ...
Diffstat (limited to 'doc/src/declarative/extending-tutorial.qdoc')
-rw-r--r--doc/src/declarative/extending-tutorial.qdoc26
1 files changed, 20 insertions, 6 deletions
diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc
index cc93e86..bc849b0 100644
--- a/doc/src/declarative/extending-tutorial.qdoc
+++ b/doc/src/declarative/extending-tutorial.qdoc
@@ -260,20 +260,34 @@ custom QML types may see unexpected behavior if bindings are not implemented.
\example declarative/tutorials/extending/chapter4-customPropertyTypes
The \c PieChart type currently has a string-type property and a color-type property.
-It could have many other types of properties. For example, we could add an
-integer-type property to store an identifier for each pie chart:
+It could have many other types of properties. For example, it could have an
+enum-type property to store a display mode for each chart:
\code
+ // C++
class PieChart : public QDeclarativeItem
{
+ Q_ENUMS(DisplayMode)
+ Q_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode)
...
- Q_PROPERTY(int id READ id WRITE setId)
+
public:
- ...
- int id() const;
- void setId(int id);
+ enum DisplayMode {
+ MultiLevel,
+ Exploded,
+ ThreeDimensional
+ };
+
+ void setDisplayMode(DisplayMode mode);
+ DisplayMode displayMode() const;
...
};
+
+ // QML
+ PieChart {
+ ...
+ displayMode: PieChart.Exploded
+ }
\endcode
We can also use various other property types. QML has built-in support for the following