summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
commit55ff179342bfb67b6f2592d7b1df66e1f3c6a350 (patch)
tree266b6e82ae4de9c1eb2f0c2d2c2310f774a55089 /doc
parent0713442baa4120050e85c13998797415bb40efce (diff)
parente4f5a81869e75a998278c19134f2772fefd998fe (diff)
downloadQt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.zip
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.gz
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/advtutorial.qdoc13
-rw-r--r--doc/src/declarative/animation.qdoc16
-rw-r--r--doc/src/declarative/basictypes.qdoc23
-rw-r--r--doc/src/declarative/declarativeui.qdoc11
-rw-r--r--doc/src/declarative/dynamicobjects.qdoc4
-rw-r--r--doc/src/declarative/elements.qdoc263
-rw-r--r--doc/src/declarative/examples.qdoc20
-rw-r--r--doc/src/declarative/extending-tutorial.qdoc14
-rw-r--r--doc/src/declarative/extending.qdoc105
-rw-r--r--doc/src/declarative/focus.qdoc6
-rw-r--r--doc/src/declarative/globalobject.qdoc8
-rw-r--r--doc/src/declarative/modules.qdoc15
-rw-r--r--doc/src/declarative/network.qdoc4
-rw-r--r--doc/src/declarative/pics/imageprovider.pngbin0 -> 420 bytes
-rw-r--r--doc/src/declarative/qdeclarativedebugging.qdoc8
-rw-r--r--doc/src/declarative/qdeclarativei18n.qdoc11
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc347
-rw-r--r--doc/src/declarative/qdeclarativestates.qdoc3
-rw-r--r--doc/src/declarative/qml-intro.qdoc24
-rw-r--r--doc/src/declarative/qmlruntime.qdoc275
-rw-r--r--doc/src/declarative/qmlviewer.qdoc234
-rw-r--r--doc/src/declarative/tutorial.qdoc6
-rw-r--r--doc/src/examples/qml-examples.qdoc34
-rw-r--r--doc/src/examples/qml-webbrowser.qdoc40
-rw-r--r--doc/src/external-resources.qdoc7
-rw-r--r--doc/src/images/qml-abstractitemmodel-example.pngbin0 -> 4478 bytes
-rw-r--r--doc/src/images/qml-focus-example.pngbin43921 -> 31370 bytes
-rw-r--r--doc/src/images/qml-imageprovider-example.pngbin0 -> 2259 bytes
-rw-r--r--doc/src/images/qml-xmlhttprequest-example.pngbin21311 -> 20934 bytes
-rw-r--r--doc/src/index.qdoc6
-rw-r--r--doc/src/platforms/symbian-introduction.qdoc11
-rw-r--r--doc/src/snippets/code/doc_src_symbian-introduction.qdoc3
-rw-r--r--doc/src/snippets/declarative/gridview/gridview.qml6
-rw-r--r--doc/src/snippets/declarative/listview/listview.qml10
-rw-r--r--doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml2
-rw-r--r--doc/src/template/images/bullet_up.pngbin253 -> 210 bytes
-rwxr-xr-xdoc/src/template/scripts/functions.js17
-rwxr-xr-xdoc/src/template/style/style.css67
38 files changed, 987 insertions, 626 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc
index 9c72e95..afedb44 100644
--- a/doc/src/declarative/advtutorial.qdoc
+++ b/doc/src/declarative/advtutorial.qdoc
@@ -164,7 +164,7 @@ The \c createBlock() function creates a block from the \c Block.qml file
and moves the new block to its position on the game canvas. This involves several steps:
\list
-\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml.
+\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml.
If the component is ready, we can call \c createObject() to create an instance of the \c Block item.
\o If \c createObject() returned null (i.e. if there was an error while
loading the object), print the error information.
@@ -306,18 +306,17 @@ In anticipation of the new block animations, \c Block.qml file is now renamed to
\section3 Animating block movement
First we will animate the blocks so that they move in a fluid manner. QML has a number of methods for adding fluid
-movement, and in this case we're going to use the \l SpringFollow element to add an animation with a spring-like
-movement. In \c BoomBlock.qml, we apply a \l SpringFollow
-to the \c x and \c y properties so that the block will follow and animate its movement towards the
-position specified by the new \c targetX and \c targetY properties (whose values will be set by \c samegame.js).
-Here is the code added to \c BoomBlock.qml:
+movement, and in this case we're going to use the \l Behavior element to add a \l SpringAnimation.
+In \c BoomBlock.qml, we apply a \l SpringAnimation behavior to the \c x and \c y properties so that the
+block will follow and animate its movement in a spring-like fashion towards the specified position (whose
+values will be set by \c samegame.js).Here is the code added to \c BoomBlock.qml:
\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 1
The \c spring and \c damping values can be changed to modify the spring-like effect of the animation.
The \c {enabled: spawned} setting refers to the \c spawned value that is set from \c createBlock() in \c samegame.js.
-This ensures the \l SpringFollow on the \c x is only enabled after \c createBlock() has set the block to
+This ensures the \l SpringAnimation on the \c x is only enabled after \c createBlock() has set the block to
the correct position. Otherwise, the blocks will slide out of the corner (0,0) when a game begins, instead of falling
from the top in rows. (Try commenting out \c {enabled: spawned} and see for yourself.)
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 13202ee..c5333df 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -71,13 +71,15 @@ to explicitly set the \c target and \c property to animate.
Animations can be joined into a group using SequentialAnimation and ParallelAnimation.
+See the \l {declarative/animation/basics}{Animation basics example} for a demonstration of creating and combining multiple animations in QML.
+
\target state-transitions
\section1 Transitions
-QML transitions describe animations to perform when \l{qmlstates}{state} changes occur. A transition
+\l Transition elements describe the animations to perform when \l{qmlstates}{state} changes occur. A transition
can only be triggered by a state change.
-For example, a transition could describe how an item moves from its initial position to its new position:
+For example, a \l Transition could describe how an item moves from its initial position to its new position:
\snippet doc/src/snippets/declarative/animation.qml transitions-1
@@ -108,9 +110,13 @@ making use of both sequential and parallel animations:
\snippet doc/src/snippets/declarative/animation.qml transitions-3
+
+See \l {declarative/animation/states}{States and Transitions example} for a simple example of how transitions can be applied.
+
+
\section1 Property Behaviors
-A \l{Behavior}{property behavior} specifies a default animation to run whenever the property's value changes, regardless
+A property \l {Behavior}{behavior} specifies a default animation to run whenever the property's value changes, regardless
of what caused the change. The \c enabled property can be used to force a \l Behavior
to only apply under certain circumstances.
@@ -119,7 +125,7 @@ whenever it changes. The animation will last 300 milliseconds and use an \l{Prop
\snippet doc/src/snippets/declarative/animation.qml behavior
-Like using an animation as a value source, when used in a Behavior and animation does not need to specify
+Like using an animation as a value source, when used in a \l Behavior and animation does not need to specify
a \c target or \c property.
To trigger this behavior, we could enter a state that changes \c x:
@@ -149,4 +155,6 @@ If \c x were bound to another property, triggering the binding would also trigge
If a state change has a transition animation matching a property with a \l Behavior, the transition animation
will override the \l Behavior for that state change.
+The \l {declarative/animation/behaviors}{Behaviors example} shows how behaviors can be used to provide animations.
+
*/
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
index 159f40d..109e6d5 100644
--- a/doc/src/declarative/basictypes.qdoc
+++ b/doc/src/declarative/basictypes.qdoc
@@ -400,3 +400,26 @@
\sa {QML Basic Types}
*/
+
+/*!
+ \qmlbasictype enumeration
+ \ingroup qmlbasictypes
+
+ \brief An enumeration type consists of a set of named values.
+
+ An enumeration type consists of a set of named values.
+
+ An enumeration value may be specifed as either a string:
+ \qml
+ Text { horizontalAlignment: "AlignRight" }
+ \endqml
+
+ or as \c {<Element>.<value>}:
+ \qml
+ Text { horizontalAlignment: Text.AlignRight }
+ \endqml
+
+ The second form is preferred.
+
+ \sa {QML Basic Types}
+*/
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index f113147..cd27c40 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -74,15 +74,15 @@ application or to build completely new applications. QML is fully \l
\list
\o \l {QML Documents}
\o \l {Property Binding}
-\o \l {Integrating JavaScript}
-\o \l {QML Scope}
\o \l {Network Transparency}
+\o \l {QML Scope}
+\o \l {Integrating JavaScript}
\o \l {Data Models}
\o \l {anchor-layout.html}{Anchor-based Layout}
\o \l {qdeclarativestates.html}{States}
\o \l {qdeclarativeanimation.html}{Animation}
-\o \l {qdeclarativemodules.html}{Modules}
\o \l {qdeclarativefocus.html}{Keyboard Focus}
+\o \l {qdeclarativemodules.html}{Modules}
\o \l {Extending types from QML}
\o \l {qdeclarativedynamicobjects.html}{Dynamic Object Creation}
\o \l {qmlruntime.html}{The Qt Declarative Runtime}
@@ -90,10 +90,10 @@ application or to build completely new applications. QML is fully \l
\section1 Using QML with C++
\list
-\o \l {Tutorial: Writing QML extensions with C++}
-\o \l {Extending QML in C++}
\o \l {Using QML in C++ Applications}
\o \l {Integrating QML with existing Qt UI code}
+\o \l {Tutorial: Writing QML extensions with C++}
+\o \l {Extending QML in C++}
\endlist
\section1 Reference
@@ -104,6 +104,7 @@ application or to build completely new applications. QML is fully \l
\o \l {QML Security}
\o \l {QtDeclarative Module}
\o \l {Debugging QML}
+\o \l {QML Viewer}
\o \l {QML Performance}
\o \l {QML Coding Conventions}
\endlist
diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc
index de65a12..a5e53a9 100644
--- a/doc/src/declarative/dynamicobjects.qdoc
+++ b/doc/src/declarative/dynamicobjects.qdoc
@@ -39,8 +39,12 @@ QML also supports the dynamic creation of objects from within JavaScript
code. This is useful if the existing QML elements do not fit the needs of your
application, and there are no C++ components involved.
+See the {declarative/toys/dynamicscene}{Dynamic Scene example} for a demonstration
+of the concepts discussed on this page.
+
\section1 Creating Objects Dynamically
+
There are two ways to create objects dynamically from JavaScript. You can either call
\l {QML:Qt::createComponent()}{Qt.createComponent()} to create
a component which instantiates items, or use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 2c36d12..0edd242 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -32,169 +32,106 @@
The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module.
-\table 80%
-\header
-\o \bold {States}
-\o \bold {Animation and Transitions}
-\o \bold {Working with Data}
-\o \bold {Utility}
-\row
-
-\o
-\list
-\o \l State
-\o \l PropertyChanges
-\o \l StateGroup
-\o \l StateChangeScript
-\o \l ParentChange (Item-specific)
-\o \l AnchorChanges (Item-specific)
-\endlist
-
-\o
-\list
-\o \l PropertyAnimation
-\o \l NumberAnimation
-\o \l ColorAnimation
-\o \l RotationAnimation
-\o \l SequentialAnimation
-\o \l ParallelAnimation
-\o \l PauseAnimation
-\o \l ParentAnimation
-\o \l AnchorAnimation
-\o \l SmoothedAnimation
-\o \l Vector3dAnimation
-\o \l PropertyAction
-\o \l ScriptAction
-\o \l Transition
-\o \l SmoothedFollow
-\o \l SpringFollow
-\o \l Behavior
-\endlist
-
-\o
-\list
-\o \l Binding
-\o \l ListModel
-\list
-\o \l ListElement
-\endlist
-\o \l VisualItemModel
-\o \l VisualDataModel
-\o \l Package
-\o \l XmlListModel
-\list
-\o \l XmlRole
-\endlist
-\endlist
-
-\o
-\list
-\o \l Connections
-\o \l Component
-\o \l Timer
-\o \l QtObject
-\o \l WorkerScript
-\endlist
-
-\header
-\o \bold {Basic Visual Items}
-\o \bold {Basic Interaction Items}
-\o \bold {Utility}
-\o \bold {Transforms}
-
-\row
-\o
-\list
-\o \l Item
-\o \l Rectangle
- \list
- \o \l Gradient
- \list
- \o \l GradientStop
- \endlist
- \endlist
-\o \l Image
-\o \l BorderImage
-\o \l AnimatedImage
-\o \l Text
-\o \l TextInput
- \list
- \o \l IntValidator
- \o \l DoubleValidator
- \o \l RegExpValidator
- \endlist
-\o \l TextEdit
-\endlist
-
-\o
-\list
-\o \l MouseArea
-\o \l FocusScope
-\o \l Flickable
-\o \l Flipable
-\o \l GestureArea (experimental)
-\endlist
-
-\o
-\list
-\o \l Loader
-\o \l Repeater
-\o \l SystemPalette
-\o \l FontLoader
-\o \l LayoutItem
-\endlist
-
-\o
-\list
-\o \l Scale
-\o \l Rotation
-\o \l Translate
-\endlist
-
-\header
-\o \bold {Views}
-\o \bold {Positioners}
-\o \bold {Effects}
-\o
-
-\row
-\o
-
-\target xmlViews
-\list
-\o \l ListView
-\o \l GridView
-\o \l PathView
- \list
- \o \l Path
- \list
- \o \l PathLine
- \o \l PathQuad
- \o \l PathCubic
- \o \l PathAttribute
- \o \l PathPercent
- \endlist
- \endlist
-\o \l WebView
-\endlist
-
-\o
-\list
-\o \l Column
-\o \l Row
-\o \l Grid
-\o \l Flow
-\endlist
-
-\o
-\list
-\o \l Particles (experimental)
- \list
- \o \l ParticleMotionLinear
- \o \l ParticleMotionGravity
- \o \l ParticleMotionWander
- \endlist
-\endlist
+\table
+\header \o {2,1} \bold {Basic Visual Items}
+\row \o \l {Item} \o Basic item element inherited by all visual items in QML
+\row \o \l {Rectangle} \o Basic visual rectangle element
+\row \o \l {Gradient} \o Defines a gradient between two or more colors
+\row \o \l {GradientStop} \o Defines a color used in a \l {Gradient}
+\row \o \l {Image} \o Allows the use of bitmaps to a scene
+\row \o \l {BorderImage} (Item-specific) \o Defines an image as a border
+\row \o \l {AnimatedImage} \o For playing animations stored as a series of frames
+\row \o \l {Text} \o Allows the use of formatted text in a scene
+\row \o \l {TextInput} \o Displays an editable line of text
+\row \o \l {IntValidator} \o Validator for integer values
+\row \o \l {DoubleValidator} \o Validator for non-integer values
+\row \o \l {RegExpValidator} \o Validator for string regular expressions
+\row \o \l {TextEdit} \o Displays multiple lines of editable formatted text
+
+\header \o {2,1} \bold {Basic Interaction Items}
+\row \o \l {MouseArea} \o Handles mouse interactions
+\row \o \l {FocusScope} \o For keyboard focus handling
+\row \o \l {Flickable} \o Provides a surface that can be "flicked"
+\row \o \l {Flipable} \o Provides a surface that produces flipping effects
+\row \o \l {GestureArea} (experimental) \o Enables simple gesture handling
+
+\header \o {2,1} \bold {States}
+\row \o \l {State} \o Defines sets of configurations of objects and properties
+\row \o \l {PropertyChanges} \o Describes property changes within a state
+\row \o \l {StateGroup} \o Contains a set of states and state transitions
+\row \o \l {StateChangeScript} \o Allows script binding in a state
+\row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change
+\row \o \l {AnchorChanges} \o Change the anchors of an item in a state
+
+\header \o {2,1} \bold {Animation and Transitions}
+\row \o \l {Behavior} \o Specifies a default animation for property changes
+\row \o \l {SequentialAnimation} \o Runs animations sequentially
+\row \o \l {ParallelAnimation} \o Runs animations in parallel
+\row \o \l {PropertyAnimation} \o Animates property changes
+\row \o \l {NumberAnimation} \o Animates properties of type qreal
+\row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d
+\row \o \l {ColorAnimation} \o Animates color changes
+\row \o \l {RotationAnimation} \o Animates rotations
+\row \o \l {ParentAnimation} \o Animates parent changes
+\row \o \l {AnchorAnimation} \o Animates anchor changes
+\row \o \l {PauseAnimation} \o Pauses an animation
+\row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value
+\row \o \l {SpringAnimation} \o Allows a property to track a value in a spring-like motion
+\row \o \l {PropertyAction} \o Sets immediate property changes during animation
+\row \o \l {ScriptAction} \o Runs scripts during an animation
+\row \o \l {Transition} \o Animates transitions during state changes
+
+\header \o {2,1} \bold {Working with Data}
+\row \o \l {Binding} \o Binds any value to any property
+\row \o \l {ListModel} \o Defines a list of data
+\row \o \l {ListElement} \o Defines a data item in a \l {ListModel}
+\row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate
+\row \o \l {VisualDataModel} \o Encapsulates a model and a delegate
+\row \o \l {Package} \o Collection that enables sharing of items within different views
+\row \o \l {XmlListModel} \o Specifies a model using XPath expressions
+\row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel}
+
+\header \o {2,1} \bold {Views}
+\row \o \l {ListView} \o Provides a list visualization of a model
+\row \o \l {GridView} \o Provides a grid visualization of a model
+\row \o \l {PathView} \o Visualizes a model's contents along a path
+\row \o \l {Path} \o Defines a path used by \l {PathView}
+\row \o \l {PathLine} \o Defines a line in \l {Path}
+\row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path}
+\row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path}
+\row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path}
+\row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path}
+\row \o \l {WebView} \o Allows the addition of web content to a canvas
+
+\header \o {2,1} \bold {Positioners}
+\row \o \l {Column} \o Arranges its children vertically
+\row \o \l {Row} \o Arranges its children horizontally
+\row \o \l {Grid} \o Positions its children in a grid
+\row \o \l {Flow} \o Positions its children with wrapping support
+
+\header \o {2,1} \bold {Utility}
+\row \o \l {Connections} \o Explicitly connects signals and signal handlers
+\row \o \l {Component} \o Encapsulate QML items as a component
+\row \o \l {Timer} \o Provides timed triggers
+\row \o \l {QtObject} \o Basic element containing only the objectName property
+\row \o \l {WorkerScript} \o Enables the use of threads in QML
+\row \o \l {Loader} \o Controls the loading of items or components
+\row \o \l {Repeater} \o Uses a model to create multiples of components
+\row \o \l {SystemPalette} \o Provides access to the Qt palettes
+\row \o \l {FontLoader} \o Loads fonts by name or URL
+\row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts
+
+\header \o {2,1} \bold {Transforms}
+\row \o \l {Scale} \o Assigns item scaling behaviors
+\row \o \l {Rotation} \o Assigns item rotation behaviors
+\row \o \l {Translate} \o Assigns item translation behaviors
+
+\header \o {2,1} \bold {Effects}
+\row \o \l {Particles} (experimental) \o Generates and animates particles
+\row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles}
+\row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles}
+\row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles}
\endtable
+
*/
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index 7b02d33..8a24228 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -36,11 +36,18 @@ Qt includes a set of examples and demos that show how to use various aspects
of QML. The examples are small demonstrations of particular QML components,
while the demos contain more complete and functional applications.
-To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qmlviewer}
-command-line application. For example, from your build directory, run:
+To run the examples and demos, open them in Qt Creator or use the included
+\l {QML Viewer} tool. The \l {QML Viewer} can be run from the command line:
\code
- bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml
+ qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml
+\endcode
+
+On Mac OS X, you can run the included "QMLViewer" application from the
+Finder, or use the command line:
+
+\code
+ QMLViewer.app/Contents/MacOS/QMLViewer $QTDIR/demos/declarative/samegame/samegame.qml
\endcode
@@ -168,11 +175,14 @@ The examples can be found in Qt's \c examples/declarative directory.
\list
\o \l{declarative/modelviews/gridview}{GridView}
\o \l{declarative/modelviews/listview}{ListView}
-\o \l{declarative/modelviews/objectlistmodel}{Object ListModel}
\o \l{declarative/modelviews/package}{Package}
\o \l{declarative/modelviews/parallax}{Parallax}
-\o \l{declarative/modelviews/stringlistmodel}{String ListModel}
\o \l{declarative/modelviews/visualitemmodel}{VisualItemModel}
+
+\o \l{declarative/modelviews/stringlistmodel}{String ListModel}
+\o \l{declarative/modelviews/objectlistmodel}{Object ListModel}
+\o \l{declarative/modelviews/abstractitemmodel}{AbstractItemModel}
+
\o \l{declarative/modelviews/webview}{WebView}
\endlist
diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc
index 0cb3a7d..2cf00b9 100644
--- a/doc/src/declarative/extending-tutorial.qdoc
+++ b/doc/src/declarative/extending-tutorial.qdoc
@@ -116,9 +116,9 @@ Now we can build and run the application. Try it yourself with the code in Qt's
\example declarative/tutorials/extending/chapter1-basics
At the moment, the \c app.qml is run from within a C++ application.
-This may seem odd if you're used to running QML files with the standard \c qml tool.
+This may seem odd if you're used to running QML files with the \l {QML Viewer}.
Later on, we'll show how to create a plugin so that you can run \c app.qml using the
-\c qml tool instead.
+\l {QML Viewer} instead.
*/
@@ -301,8 +301,8 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom
Currently the \c Musician and \c Instrument types are used by \c app.qml,
which is displayed using a QDeclarativeView in a C++ application. An alternative
way to use our QML extension is to create a plugin library to make it available
-to the QML engine. This means we could load \c app.qml using the standard \c qml tool
-(or some other QML runtime application) instead of writing a \c main.cpp file and
+to the QML engine. This means we could load \c app.qml using the \l {QML Viewer}
+(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and
loading our own C++ application.
To create a plugin library, we need:
@@ -337,12 +337,14 @@ of the example project) can be found in the "lib" subdirectory:
\quotefile declarative/tutorials/extending/chapter5-plugins/qmldir
Now we have a plugin, and instead of having a main.cpp and an executable, we can build
-the project and then run the QML file directly using the \c qml tool:
+the project and then load the QML file in the \l {QML Viewer}:
\code
- qml app.qml
+ qmlviewer app.qml
\endcode
+(On Mac OS X, you can launch the "QMLViewer" application instead.)
+
Notice the "import Music 1.0" statement has disappeared from \c app.qml. This is
because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to
having Musician.qml and Instrument.qml files inside the project directory, which could both
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 6476dfb..3acfbdf 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -65,20 +65,22 @@ template<typename T>
int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
\endcode
-Calling qmlRegisterType() registers the C++ type \a T with the QML system, and makes it available in QML
-under the name \a qmlName in library \a uri version \a versionMajor.versionMinor.
-The \a qmlName can be the same as the C++ type name.
+Calling qmlRegisterType() registers the C++ type \a T with the QML
+system, and makes it available in QML under the name \a qmlName in
+library \a uri version \a versionMajor.versionMinor. The \a qmlName
+can be the same as the C++ type name.
Type \a T must be a concrete type that inherits QObject and has a default
constructor.
+
\endquotation
-Types can be registered by libraries (such as Qt does), application code,
-or by plugins (see QDeclarativeExtensionPlugin).
+Types can be registered by libraries, application code, or by plugins
+(see QDeclarativeExtensionPlugin).
-Once registered, all of the \l {Qt's Property System}{properties} of a supported
-type are available for use within QML. QML has intrinsic support for properties
-of these types:
+Once registered, all \l {Qt's Property System}{properties} of the
+supported types are available in QML. QML has intrinsic support for
+properties of these types:
\list
\o bool
@@ -94,9 +96,14 @@ of these types:
\o QVariant
\endlist
-QML is typesafe. Attempting to assign an invalid value to a property will
-generate an error. For example, assuming the name property of the \c Person
-element had a type of QString, this would cause an error:
+When a property of a supported type is added to a C++ class, in a QML
+element based on the C++ class, a \e{value-changed} signal handler
+will be available. See \l{Signal Support} below.
+
+QML is typesafe. Attempting to assign an invalid value to a property
+will generate an error. For example, assuming the \e{name} property
+of the \c Person element had a type of QString, this would cause an
+error:
\code
Person {
@@ -412,7 +419,20 @@ value will not be accessible from script.
implement the onPartyStarted signal property.
If you want to use signals from items not created in QML, you can access their
-signals with the \l {Connections} element.
+signals with the \l {Connections} element.
+
+Additionally, if a property is added to a C++ class, all QML elements
+based on that C++ class will have a \e{value-changed} signal handler
+for that property. The name of the signal handler is
+\e{on<Property-name>Changed}, with the first letter of the property
+name being upper case.
+
+\note The QML signal handler will always be named
+on<Property-name>Changed, regardless of the name used for the NOTIFY
+signal in C++. We recommend using <property-name>Changed() for the
+NOTIFY signal in C++.
+
+See also \l {Extending types from QML}.
\section1 Property Value Sources
@@ -684,10 +704,6 @@ of some of the types. For the remaining types the default values are undefined.
\row \o color \o #000000 (black)
\endtable
-If specified, the optional "default" attribute marks the new property as the
-types default property, overriding any existing default property. Using the
-default attribute twice in the same type block is an error.
-
The following example shows how to declare a new "innerColor" property that
controls the color of the inner rectangle.
@@ -705,6 +721,63 @@ controls the color of the inner rectangle.
}
\endcode
+
+\section3 Property signal handlers
+
+Adding a property to an item automatically adds a \e{value-changed}
+signal handler to the item. The signal hander is named
+\c{on<Property_name>Changed}, with the first letter of the property
+name being upper case.
+
+Signal handlers can have arbitrary JavaScript code assigned. The following
+example shows how to output to a text console a new value of property
+\c{innerColor} whenever the value of this property changes.
+
+\code
+ Rectangle {
+ id: rect
+ property color innerColor: "black"
+
+ onInnerColorChanged: { console.log(rect.innerColor); }
+ }
+\endcode
+
+
+\section3 Setting default properties
+
+The optional \c default attribute for a property marks it as the \e {default property}
+for a type. This allows other items to specify the default property's value
+as child elements. For example, the \l Item element's default property is its
+\l{Item::children}{children} property. This allows the children of an \l Item
+to be set like this:
+
+\qml
+Item {
+ Rectangle {}
+ Rectangle {}
+}
+\endqml
+
+If the \l{Item::children}{children} property was not the default property for
+\l Item, its value would have to be set like this instead:
+
+\qml
+Item {
+ children: [
+ Rectangle {}
+ Rectangle {}
+ ]
+}
+\endqml
+
+See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a
+demonstration of using default properties.
+
+Specifying a default property overrides any existing default property (for
+example, any default property inherited from a parent item). Using the
+default attribute twice in the same type block is an error.
+
+
\target qml-property-aliases
\section2 Property aliases
diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc
index 699ebcb..0dd5eb3 100644
--- a/doc/src/declarative/focus.qdoc
+++ b/doc/src/declarative/focus.qdoc
@@ -87,7 +87,7 @@ Text {
An \l Item requests focus by setting the \c {Item::focus} property to true.
For very simple cases simply setting the \c {Item::focus} property is sometimes
-sufficient. If we run the following example with the \l {Qt Declarative UI Runtime}{qml} tool, we see that
+sufficient. If we run the following example with the \l {QML Viewer}, we see that
the \c {keyHandler} element has \e {active focus} and pressing the 'A', 'B'
or 'C' keys modifies the text appropriately.
@@ -266,6 +266,10 @@ When a QML item explicitly relinquishes focus (by setting its
does not automatically select another element to receive focus. That is, it
is possible for there to be no currently \e {active focus}.
+See the {declarative/keyinteraction/focus}{Keyboard Focus example} for a
+demonstration of moving keyboard focus between multiple areas using FocusScope
+elements.
+
\section1 Advanced uses of Focus Scopes
Focus scopes allow focus to allocation to be easily partitioned. Several
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index ecbaa9e..a9aee2f 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -35,7 +35,7 @@ Contains all the properties of the JavaScript global object, plus:
\section1 Qt Object
-The \l{Qt}{Qt object} provides useful enums and functions from Qt, for use in all QML
+The \l{QmlGlobalQtObject}{Qt object} provides useful enums and functions from Qt, for use in all QML
files.
\section1 XMLHttpRequest
@@ -114,6 +114,9 @@ browser. The following objects and properties are supported by the QML implemen
\endtable
+The \l{declarative/xml/xmlhttprequest}{XMLHttpRequest example} demonstrates how to
+use the XMLHttpRequest object to make a request and read the response headers.
+
\section1 Offline Storage API
\section2 Database API
@@ -132,6 +135,9 @@ The API can be used from JavaScript functions in your QML:
The API conforms to the Synchronous API of the HTML5 Web Database API,
\link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink.
+The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of
+using the Offline Storage API.
+
\section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db))
Returns the database identified by \e identifier. If the database does not already exist, it
diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
index 02a2f5f..938222a 100644
--- a/doc/src/declarative/modules.qdoc
+++ b/doc/src/declarative/modules.qdoc
@@ -72,7 +72,7 @@ The second exception is explained in more detail in the section below on Namespa
\section2 The Import Path
Installed modules are searched for on the import path.
-The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path.
+The \c -I option to the \l {QML Viewer} adds paths to the import path.
From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to
using \l QDeclarativeEngine::addImportPath().
@@ -103,9 +103,16 @@ the \c qmldir file. Types which you do not wish to export to users of your modul
may be marked with the \c internal keyword: \c internal <TypeName> <File>.
The same type can be provided by different files in different versions, in which
-case later earlier versions (eg. 1.2) must precede earlier versions (eg. 1.0),
+case later versions (eg. 1.2) must precede earlier versions (eg. 1.0),
since the \e first name-version match is used and a request for a version of a type
-can be fulfilled by one defined in an earlier version of the module.
+can be fulfilled by one defined in an earlier version of the module. If a user attempts
+to import a version earlier than the earliest provided or later than the latest provided,
+an error results, but if the user imports a version within the range of versions provided,
+even if no type is specific to that version, no error results.
+
+A single module, in all versions, may only be provided in a single directory (and a single \c qmldir file).
+If multiple are provided, only the first in the search path will be used (regardless of whether other versions
+are provided by directories later in the search path).
Installed and remote files without a namespace \e must be referred to by version information described above,
local files \e may have it.
@@ -122,7 +129,7 @@ to the module.
of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce
a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows.
By default the engine searches for the plugin library in the directory containing the \c qmldir
-file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the
+file. The \c -P option to the \l {QML Viewer} adds paths to the
plugin search path.
From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to
using \l QDeclarativeEngine::addPluginPath().
diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc
index b0d19e2..60359de 100644
--- a/doc/src/declarative/network.qdoc
+++ b/doc/src/declarative/network.qdoc
@@ -54,7 +54,7 @@ Network transparency is supported throughout QML, for example:
\o WebViews - the \c url property of WebView (obviously!)
\endlist
-Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load
+Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load
\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine
will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file.
For example if the qmldir file contains the line "World World.qml", it will load
@@ -119,7 +119,7 @@ All network access from QML is managed by a QNetworkAccessManager set on the QDe
By default, this is an unmodified Qt QNetworkAccessManager. You may set a different manager by
providing a QDeclarativeNetworkAccessManagerFactory and setting it via
QDeclarativeEngine::setNetworkAccessManagerFactory().
-For example, the \l {Qt Declarative UI Runtime}{qml} tool sets a QDeclarativeNetworkAccessManagerFactory which
+For example, the \l {QML Viewer} sets a QDeclarativeNetworkAccessManagerFactory which
creates QNetworkAccessManager that trusts HTTP Expiry headers to avoid network cache checks,
allows HTTP Pipelining, adds a persistent HTTP CookieJar, a simple disk cache, and supports proxy settings.
diff --git a/doc/src/declarative/pics/imageprovider.png b/doc/src/declarative/pics/imageprovider.png
new file mode 100644
index 0000000..422103c
--- /dev/null
+++ b/doc/src/declarative/pics/imageprovider.png
Binary files differ
diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc
index da6e407..ea21852 100644
--- a/doc/src/declarative/qdeclarativedebugging.qdoc
+++ b/doc/src/declarative/qdeclarativedebugging.qdoc
@@ -47,7 +47,7 @@ Rectangle {
When a transition doesn't look quite right, it can be helpful to view it in slow
motion to see what is happening more clearly. This functionality is supported
-in the \l {Qt Declarative UI Runtime}{qmlviewer} tool: to enable this,
+in the \l {QML Viewer} tool: to enable this,
click on the "Debugging" menu, then "Slow Down Animations".
@@ -64,7 +64,7 @@ import Qt 4.7
Rectangle { width: 100; height: 100 }
\endqml
-If you set \c {QML_IMPORT_TRACE=1} before running the \l {Qt Declarative UI Runtime}{qmlviewer}
+If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer}
(or your QML C++ application), you will see output similar to this:
\code
@@ -85,11 +85,11 @@ show QML debugging information and options for your application, including
object inspection, property monitoring and application frame-rate analysis.
Creator can be used to debug both local and remote QML applications. To
-enable remote debugging, start the \l {Qt Declarative UI Runtime}{qml} tool
+enable remote debugging, start the \l {QML Viewer}
on the remote device with a debugging port defined, like this:
\code
- QML_DEBUG_SERVER_PORT=3768 qml myqmlfile.qml
+ QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml
\endcode
In Creator, open the project settings pane and set the server and port
diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc
index c16dea3..b6e6c6e 100644
--- a/doc/src/declarative/qdeclarativei18n.qdoc
+++ b/doc/src/declarative/qdeclarativei18n.qdoc
@@ -49,7 +49,7 @@ capabilities are described more fully in:
\o \l {Qt Linguist Manual}
\endlist
-You can test a translation with the \l {Qt Declarative UI Runtime}{qml} tool using the -translation option.
+You can test a translation with the \l {QML Viewer} using the -translation option.
\section1 Example
@@ -61,8 +61,8 @@ hello.qml:
import Qt 4.7
Rectangle {
- width: 200; height: 200
- Text { text: qsTr("Hello"); anchors.centerIn: parent }
+ width: 200; height: 200
+ Text { text: qsTr("Hello"); anchors.centerIn: parent }
}
\endqml
@@ -76,6 +76,9 @@ a translation and create the release file \c hello.qm.
Finally, we can test the translation:
\code
-qml -translation hello.qm hello.qml
+qmlviewer -translation hello.qm hello.qml
\endcode
+
+
+You can see a complete example and source code in the {declarative/i18n}{QML Internationalization example}.
*/
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index bb17896..b44e6f2 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -30,63 +30,67 @@
\target qmlmodels
\title Data Models
-Some QML Items use Data Models to provide the data to be displayed.
+QML items such as ListView, GridView and \l Repeater require Data Models
+that provide the data to be displayed.
These items typically require a \e delegate component that
creates an instance for each item in the model. Models may be static, or
have items modified, inserted, removed or moved dynamically.
Data is provided to the delegate via named data roles which the
-delegate may bind to. The roles are exposed as properties of the
-\e model context property, though this property is set as a default property
-of the delegate so, unless there is a naming clash with a
-property in the delegate, the roles are usually accessed unqualified. The
-example below would have a clash between the \e color role of the model and
-the \e color property of the Rectangle. The clash is avoided by referencing
-the \e color property of the model by its full name: \e model.color.
+delegate may bind to. Here is a ListModel with two roles, \e type and \e age,
+and a ListView with a delegate that binds to these roles to display their
+values:
-\code
-ListModel {
- id: myModel
- ListElement { color: "red" }
- ListElement { color: "green" }
-}
+\qml
+import Qt 4.7
+
+Item {
+ width: 200; height: 250
+
+ ListModel {
+ id: myModel
+ ListElement { type: "Dog"; age: 8 }
+ ListElement { type: "Cat"; age: 5 }
+ }
-Component {
- id: myDelegate
- Rectangle {
- width: 20; height: 20
- color: model.color
+ Component {
+ id: myDelegate
+ Text { text: type + ", " + age }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: myModel
+ delegate: myDelegate
}
}
-\endcode
+\endqml
-A special \e index role containing the index of the item in the model
-is also available.
+If there is a naming clash between the model's properties and the delegate's
+properties, the roles can be accessed with the qualified \e model name instead.
+For example, if a \l Text element had \e type or \e age properties, the text in the
+above example would display those property values instead of the \e type and \e age values
+from the model item. In this case, the properties could have been referenced as
+\c model.type and \c model.age instead to ensure the delegate displays the
+property values from the model item.
-\e Note: the index role will be set to -1 if the item is removed from
+A special \e index role containing the index of the item in the model
+is also available to the delegate. Note this index is set to -1 if the item is removed from
the model. If you bind to the index role, be sure that the logic
accounts for the possibility of index being -1, i.e. that the item
-is no longer valid. Usually the item will shortly be destroyed, but
-it is possible to delay delegate destruction in some views via a delayRemove
-attached property.
+is no longer valid. (Usually the item will shortly be destroyed, but
+it is possible to delay delegate destruction in some views via a \c delayRemove
+attached property.)
-Models that do not have named roles will have the data provided via
-the \e modelData role. The \e modelData role is also provided for
-Models that have only one role. In this case the \e modelData role
+Models that do not have named roles (such as the QStringList model shown below)
+will have the data provided via the \e modelData role. The \e modelData role is also provided for
+models that have only one role. In this case the \e modelData role
contains the same data as the named role.
-There are a number of QML elements that operate using data models:
+QML provides several types of data models among the built-in set of
+QML elements. In addition, models can be created with C++ and then
+made available to QML components.
-\list
-\o ListView
-\o GridView
-\o PathView
-\o \l Repeater
-\endlist
-
-QML supports several types of data model, which may be provided by QML
-or C++ (via QDeclarativeContext::setContextProperty() or as plugin types,
-for example).
\section1 QML Data Models
@@ -98,6 +102,7 @@ available roles are specified by the \l ListElement properties.
\code
ListModel {
id: fruitModel
+
ListElement {
name: "Apple"
cost: 2.45
@@ -117,30 +122,26 @@ The above model has two roles, \e name and \e cost. These can be bound
to by a ListView delegate, for example:
\code
-Component {
- id: fruitDelegate
- Row {
+ListView {
+ width: 200; height: 250
+ model: fruitModel
+ delegate: Row {
Text { text: "Fruit: " + name }
Text { text: "Cost: $" + cost }
}
}
-ListView {
- model: fruitModel
- delegate: fruitDelegate
-}
\endcode
-It is also possible to manipulate the ListModel directly via JavaScript.
-In this case, the first item inserted will determine the roles available
-to any views using the model. For example, if an empty ListModel is
-created and populated via JavaScript the roles provided by the first
+ListModel provides methods to manipulate the ListModel directly via JavaScript.
+In this case, the first item inserted determines the roles available
+to any views that are using the model. For example, if an empty ListModel is
+created and populated via JavaScript, the roles provided by the first
insertion are the only roles that will be shown in the view:
\code
Item {
- ListModel {
- id: fruitModel
- }
+ ListModel { id: fruitModel }
+
MouseArea {
anchors.fill: parent
onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"})
@@ -148,9 +149,9 @@ Item {
}
\endcode
-When the MouseArea is clicked fruitModel will have two roles, "cost" and "name".
+When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name.
Even if subsequent roles are added, only the first two will be handled by views
-using the model.
+using the model. To reset the roles available in the model, call ListModel::clear().
\section2 XmlListModel
@@ -170,11 +171,17 @@ XmlListModel {
}
\endcode
+The \l{demos/declarative/rssnews}{RSS News demo} shows how XmlListModel can
+be used to display an RSS feed.
+
\section2 VisualItemModel
-VisualItemModel allows QML items to be provided as a model. This model contains
-both the data and delegate (its child items). This model does not provide any roles.
+VisualItemModel allows QML items to be provided as a model.
+
+This model contains both the data and delegate; the child items of a
+VisualItemModel provide the contents of the delegate. The model
+does not provide any roles.
\code
VisualItemModel {
@@ -197,15 +204,74 @@ will be positioned by the view.
\section1 C++ Data Models
-Models defined in C++ can be made available to QML either from a C++ application or from a
-\l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+Models can be defined in C++ and then made available to QML. This is useful
+for exposing existing C++ data models or otherwise complex datasets to QML.
+
+A C++ model class can be defined as a QStringList, a QList<QObject*> or a
+QAbstractItemModel.
+
+\section2 QStringList
+
+A model may be a simple QStringList, which provides the contents of the list via the \e modelData role.
+
+Here is a ListView with a delegate that references its model item's
+value using the \c modelData role:
+
+\snippet examples/declarative/modelviews/stringlistmodel/view.qml 0
+
+A Qt application can load this QML document and set the value of \c myModel
+to a QStringList:
+
+\snippet examples/declarative/modelviews/stringlistmodel/main.cpp 0
+
+The complete example is available in Qt's \l {declarative/modelviews/stringlistmodel}{examples/declarative/modelviews/stringlistmodel} directory.
+
+\note There is no way for the view to know that the contents of a QStringList
+have changed. If the QStringList changes, it will be necessary to reset
+the model by calling QDeclarativeContext::setContextProperty() again.
+
+
+\section2 QList<QObject*>
+
+A list of QObject* values can also be used as a model. A QList<QObject*> provides
+the properties of the objects in the list as roles.
+
+The following application creates a \c DataObject class that with
+Q_PROPERTY values that will be accessible as named roles when a
+QList<DataObject*> is exposed to QML:
+
+\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 0
+\dots 4
+\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1
+\codeline
+\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0
+\dots
+
+The QObject* is available as the \c modelData property. As a convenience,
+the properties of the object are also made available directly in the
+delegate's context. Here, \c view.qml references the \c DataModel properties in
+the ListView delegate:
+
+\snippet examples/declarative/modelviews/objectlistmodel/view.qml 0
+
+Note the use of the fully qualified access to the \c color property.
+The properties of the object are not replicated in the \c model
+object, since they are easily available via the \c modelData
+object.
+
+The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory.
+
+Note: There is no way for the view to know that the contents of a QList
+have changed. If the QList changes, it will be necessary to reset
+the model by calling QDeclarativeContext::setContextProperty() again.
+
\section2 QAbstractItemModel
A model can be defined by subclassing QAbstractItemModel.
-QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method.
-The default role names set by Qt are:
+The roles of a QAbstractItemModel subclass can be exposed to QML by calling
+QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
\table
\header
@@ -219,22 +285,34 @@ The default role names set by Qt are:
\o decoration
\endtable
-The model could be made available to QML either directly:
+Here is an application with a QAbstractListModel subclass named \c AnimalModel
+that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() to set the
+role names for accessing the properties via QML:
-\code
-QDeclarativeContext *ctxt = view.rootContext();
-MyModel *model = new MyModel; // subclass of QAbstractItemModel
-ctxt->setContextProperty("myModel", model);
-\endcode
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 0
+\dots
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 1
+\dots
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 2
+\codeline
+\snippet examples/declarative/modelviews/abstractitemmodel/model.cpp 0
+\codeline
+\snippet examples/declarative/modelviews/abstractitemmodel/main.cpp 0
+\dots
+
+This model is displayed by a ListView delegate that accesses the \e type and \e size
+roles:
+
+\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0
-or by registering the subclass as a new QML type in
-a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory.
-QAbstractItemModel presents a heirachy of tables, but views currently provided by QML
+QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML
can only display list data.
-In order to display child lists of a heirachical model
+In order to display child lists of a hierarchical model
the VisualDataModel element provides several properties and functions for use
with models of type QAbstractItemModel:
+
\list
\o \e hasModelChildren role property to determine whether a node has child nodes.
\o \l VisualDataModel::rootIndex allows the root node to be specifed
@@ -243,100 +321,51 @@ with models of type QAbstractItemModel:
\endlist
-\section2 QStringList
+\section2 Exposing C++ data models to QML
-A model may be a simple QStringList, which provides the contents of the list via the \e modelData role:
+The above examples use QDeclarativeContext::setContextProperty() to set
+model values directly in QML components. An alternative to this is to
+register the C++ model class as a QML type from a QML C++ plugin using
+QDeclarativeExtensionPlugin. This would allow the model classes to be
+created directly as elements within QML:
\table
-\row
-\o
-\code
-// main.cpp
-QStringList dataList;
-dataList.append("Fred");
-dataList.append("Ginger");
-dataList.append("Skipper");
-
-QDeclarativeContext *ctxt = view.rootContext();
-ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
-\endcode
+\row
\o
\code
-// main.qml
-ListView {
- width: 100
- height: 100
- anchors.fill: parent
- model: myModel
- delegate: Component {
- Rectangle {
- height: 25
- Text { text: modelData }
- }
- }
-}
-\endcode
-\endtable
-
-\note There is no way for the view to know that the contents of a QStringList
-have changed. If the QStringList is changed, it will be necessary to reset
-the model by calling QDeclarativeContext::setContextProperty() again.
-
-
-\section2 QList<QObject*>
-
-QList<QObject*> provides the properties of the objects in the list as roles.
-
-\code
-class DataObject : public QObject
+class MyModelPlugin : public QDeclarativeExtensionPlugin
{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString color READ color WRITE setColor)
-...
-};
-
-QList<QObject*> dataList;
-dataList.append(new DataObject("Item 1", "red"));
-dataList.append(new DataObject("Item 2", "green"));
-dataList.append(new DataObject("Item 3", "blue"));
-dataList.append(new DataObject("Item 4", "yellow"));
+public:
+ void registerTypes(const char *uri)
+ {
+ qmlRegisterType<MyModel>(uri, 1, 0,
+ "MyModel");
+ }
+}
-QDeclarativeContext *ctxt = view.rootContext();
-ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin);
\endcode
-The QObject* is available as the \c modelData property. As a convenience,
-the properties of the object are also made available directly in the
-delegate's context:
+\o
+\qml
+MyModel {
+ id: myModel
+ ListElement { someProperty: "some value" }
+}
-\code
ListView {
- width: 100
- height: 100
- anchors.fill: parent
- model: myModel
- delegate: Component {
- Rectangle {
- height: 25
- width: 100
- color: model.modelData.color
- Text { text: name }
- }
- }
+ width: 200; height: 250
+ model: myModel
+ delegate: Text { text: someProperty }
}
-\endcode
+\endqml
-Note the use of the fully qualified access to the \c color property.
-The properties of the object are not replicated in the \c model
-object, since they are easily available via the modelData
-object.
+\endtable
+
+See \l {Tutorial: Writing QML extensions with C++} for details on writing QML C++
+plugins.
-Note: There is no way for the view to know that the contents of a QList
-have changed. If the QList is changed, it will be necessary to reset
-the model by calling QDeclarativeContext::setContextProperty() again.
\section1 Other Data Models
@@ -344,14 +373,13 @@ the model by calling QDeclarativeContext::setContextProperty() again.
\section2 An Integer
-An Integer specifies a model containing the integer number of elements.
-There are no data roles.
+An integer can be used to specify a model that contains a certain number
+of elements. In this case, the model does not have any data roles.
The following example creates a ListView with five elements:
\code
Item {
- width: 200
- height: 250
+ width: 200; height: 250
Component {
id: itemDelegate
@@ -370,7 +398,7 @@ Item {
\section2 An Object Instance
-An Object Instance specifies a model with a single Object element. The
+An object instance can be used to specify a model with a single object element. The
properties of the object are provided as roles.
The example below creates a list with one item, showing the color of the
@@ -379,6 +407,8 @@ to avoid clashing with \e color property of the Text element in the delegate.
\code
Rectangle {
+ width: 200; height: 250
+
Text {
id: myText
text: "Hello"
@@ -387,10 +417,9 @@ Rectangle {
Component {
id: myDelegate
- Text {
- text: model.color
- }
+ Text { text: model.color }
}
+
ListView {
anchors.fill: parent
anchors.topMargin: 30
diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc
index ef5bf98..6461925 100644
--- a/doc/src/declarative/qdeclarativestates.qdoc
+++ b/doc/src/declarative/qdeclarativestates.qdoc
@@ -82,4 +82,7 @@ Other things you can do in a state change:
\o Run some script with StateChangeScript
\endlist
+
+The {declarative/animation/states}{States and Transitions example} demonstrates how to declare a basic set of states and then apply animated transitions between them.
+
*/
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index ac79496..fbab001 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -105,9 +105,17 @@ This is a valid QML script. To run it, copy it and save it to a file, say
myexample.qml, and on the command line run the command
\code
- qml myexample.qml
+ qmlviewer myexample.qml
\endcode
+On Mac OS X, open the "QMLViewer" application instead and open the
+\c myexample.qml file, or run it from the command line:
+
+ \code
+ QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml
+ \endcode
+
+
It will create a very boring rectangle in its own window.
@@ -915,16 +923,18 @@ the rotation of the needle image. Notice this piece of code in Dial where
the change in \c value modifies the position of the needle.
\code
- SpringFollow on angle {
- spring: 1.4
- damping: .15
- to: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
+ angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
+ Behavior on angle {
+ SpringAnimation {
+ spring: 1.4
+ damping: .15
+ }
}
\endcode
This is part of the \c needleRotation that rotates the needle and causes the
-rotation of its shadow. \l SpringFollow is an element that modifies the value
-of that rotation angle \e to and mimics the oscillatory behavior of a spring,
+rotation of its shadow. \l SpringAnimation is an element that modifies the value
+of that rotation \e angle and mimics the oscillatory behavior of a spring,
with the appropriate \e spring constant to control the acceleration and the \e
damping to control how quickly the effect dies away.
diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc
index 15d8567..d44e774 100644
--- a/doc/src/declarative/qmlruntime.qdoc
+++ b/doc/src/declarative/qmlruntime.qdoc
@@ -26,172 +26,117 @@
****************************************************************************/
/*!
- \page qmlruntime.html
- \title Qt Declarative UI Runtime
- \keyword QML Viewer
- \ingroup qttools
-
- This page documents the \e{Declarative UI Runtime} for the Qt GUI
- toolkit, and the \QQV which can be used to run apps
- written for the runtime. The \QQV reads a declarative
- user interface definition (\c .qml) file and displays the user interface it describes.
-
- QML is a runtime, as you can run plain QML files which pull in their required modules.
- To run apps with the QML runtime, you can either start the runtime
- from your own application (using a QDeclarativeView) or with the simple \QQV.
- The launcher can be installed in a production environment, assuming that it is not already
- present in the system. It is generally packaged alongside Qt.
-
- To deploy an application using the QML runtime, you have two options:
-
- \list
- \o Write your own Qt application including a QDeclarative view and deploy it the same as
- any other Qt application (not discussed further on this page), or
- \o Write a main QML file for your application, and run your application using the included \QQV.
- \endlist
-
- To run an application with the \QQV, pass the filename as an argument:
-
- \code
- qmlviewer myQmlFile.qml
- \endcode
-
- Deploying a QML application via the \QQV allows for QML only deployments, but can also
- include custom C++ modules just as easily. Below is an example of how you might structure
- a complex application deployed via the QML runtime, it is a listing of the files that would
- be included in the deployment package.
-
- \code
- MyApp.qml
- MyAppCore/qmldir
- MyAppCore/libMyAppCore.so
- MyAppCore/MyAppCore.dll
- MyAppCore/AnAppElement.qml
- MyAppCore/AnotherElement.qml
- MyAppCore/images/Logo.png
- OtherModule/qmldir
- OtherModule/OtherElement.qml
- \endcode
-
- Note that this example is for deploying the example to both windows and linux. You will still need to compile the C++
- modules for each target platform, but you can deploy multiple versions of the modules across platforms with different naming conventions,
- as the appropriate module file is chosen based on platform naming conventions. The C++
- modules must contain a QDeclarativeExtentionPlugin subclass.
-
- The application would be executed either with your own application, the command 'qmlviewer MyApp.qml' or by
- opening the file if your system has the \QQV registered as the handler for QML files. The MyApp.qml file would have access
- to all of the deployed types using the import statements such as the following:
-
- \code
- import "MyAppCore"
- import "OtherModule" 1.0 as Other
- \endcode
-
- \section1 Qt QML Viewer functionality
- The \QQV implements some additional functionality to help it supporting
- myriad applications. If you implement your own application, you may also wish to reimplement
- some or all of this functionality. However, much of this functionality is intended to aid the prototyping of
- QML applications and may not be necessary for a deployed application.
-
- \section2 Options
-
- When run with the \c -help option, \c qmlviewer shows available options.
-
- \section2 Translations
-
- When the launcher loads an initial QML file, it will install a translation file from
- a "i18n" subdirectory relative to that initial QML file. The actual translation file
- loaded will be according to the system locale and have the form
- "qml_<language>.qm", where <language> is a two-letter ISO 639 language,
- such as "qml_fr.qm", optionally followed by an underscore and an uppercase two-letter ISO 3166 country
- code, such as "qml_fr_FR.qm" or "qml_fr_CA.qm".
-
- Such files can be created using \l{Qt Linguist}.
-
- See the \l{scripting.html#internationalization}{Qt Internationalization} documentation for information about how to make
- the JavaScript in QML files use translatable strings.
-
- Additionally, the launcher will load translation files specified on the
- command line via the \c -translation option.
-
- \section2 Dummy Data
-
- The secondary use of the launcher is to allow QML files to be viewed with
- dummy data. This is useful when prototyping the UI, as the dummy data can
- be later replaced with actual data and bindings from a C++ plugin.
- To provide dummy data: create a directory called "dummydata" in the same directory as
- the target QML file and create files there with the "qml" extension.
- All such files will be loaded as QML objects and bound to the root
- context as a property with the name of the file (without ".qml").
-
- To replace this with real data, you simply bind the real object to
- the root context in C++.
-
- For example, if the Qt application has a "clock.time" property
- that is a qreal from 0 to 86400 representing the number of seconds since
- midnight, dummy data for this could be provided by \c dummydata/clock.qml:
- \code
- QtObject { property real time: 12345 }
- \endcode
- Any QML can be used in the dummy data files. You could even animate the
- fictional data!
-
- \section2 Runtime Object
-
- All applications using the launcher will have access to the \c runtime
- property on the root context. This property contains several pieces of
- information about the runtime environment of the application.
-
- \section3 Screen Orientation
-
- A special piece of dummy data which is integrated into the launcher is
- a simple orientation property. The orientation can be set via the
- settings menu in the application, or by pressing Ctrl+T to rotate it.
-
- To use this from within your QML file, access \c runtime.orientation,
- which can be one of the following values:
-
- \list
- \o \c Orientation.Portrait
- \o \c Orientation.Landscape
- \o \c Orientation.PortraitInverted (Portrait orientation, upside-down)
- \o \c Orientation.LandscapeInverted (Landscape orientation, upside-down)
- \endlist
-
- These values can be bound to in your application. For example:
-
- \code
- Item {
- state: (runtime.orientation == Orientation.Landscape) ? 'landscape' : ''
+\page qmlruntime.html
+\title Qt Declarative UI Runtime
+
+QML documents are loaded and executed by the QML runtime. This includes the
+Declarative UI engine along with the built-in QML elements and plugin modules,
+and it also provides access to third-party QML elements and modules.
+
+Applications that use QML need to invoke the QML runtime in order to
+execute QML documents. This can be done by creating a QDeclarativeView
+or a QDeclarativeEngine, as described below. In addition, the Declarative UI
+package includes the \QQV tool, which loads \c .qml files. This tool is
+useful for developing and testing QML code without the need to write
+a C++ application to load the QML runtime.
+
+
+
+\section1 Deploying QML-based applications
+
+To deploy an application that uses QML, the QML runtime must be invoked by
+the application. This is done by writing a Qt C++ application that loads the
+QDeclarativeEngine by either:
+
+\list
+\o Loading the QML file through a QDeclarativeView instance, or
+\o Creating a QDeclarativeEngine instance and loading QML files with QDeclarativeComponent
+\endlist
+
+
+\section2 Deploying with QDeclarativeView
+
+QDeclarativeView is a QWidget-based class that is able to load QML files.
+For example, if there is a QML file, \c application.qml, like this:
+
+\qml
+ import Qt 4.7
+
+ Rectangle { width: 100; height: 100; color: "red" }
+\endqml
+
+It can be loaded in a Qt application's \c main.cpp file like this:
+
+\code
+ #include <QApplication>
+ #include <QDeclarativeView>
+
+ int main(int argc, char *argv[])
+ {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile("application.qml"));
+ view.show();
+
+ return app.exec();
}
- \endcode
-
- This allows your application to respond to changes in the screen's orientation. The launcher
- will automatically update this on some platforms (currently the N900 only) to match the physical
- screen's orientation. On other plaforms orientation changes will only happen when explictly asked for.
-
- \section3 Window Active
-
- The \c runtime.isActiveWindow property tells whether the main window of the launcher is currently active
- or not. This is especially useful for embedded devices when you want to pause parts of your application,
- including animations, when your application loses focus or goes to the background.
-
- The example below, stops the animation when the application's window is deactivated and resumes on activation:
-
- \code
- Item {
- width: 300; height: 200
- Rectangle {
- width: 100; height: 100
- color: "green"
- SequentialAnimation on x {
- running: runtime.isActiveWindow
- loops: Animation.Infinite
- NumberAnimation {to: 200}
- NumberAnimation {to: 0}
- }
- }
+\endcode
+
+This creates a QWidget-based view that displays the contents of
+\c application.qml.
+
+The application's \c .pro \l{qmake Project Files}{project file} must specify
+the \c declarative module for the \c QT variable. For example:
+
+\code
+ TEMPLATE += app
+ QT += gui declarative
+ SOURCES += main.cpp
+\endcode
+
+
+\section2 Creating a QDeclarativeEngine directly
+
+If \c application.qml does not have any graphical components, or if it is
+preferred to avoid QDeclarativeView for other reasons, the QDeclarativeEngine
+can be constructed directly instead. In this case, \c application.qml is
+loaded as a QDeclarativeComponent instance rather than placed into a view:
+
+\code
+ #include <QCoreApplication>
+ #include <QDeclarativeEngine>
+
+ int main(int argc, char *argv[])
+ {
+ QCoreApplication app(argc, argv);
+
+ QDeclarativeEngine engine;
+ QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext());
+
+ QDeclarativeComponent component(&engine, "application.qml");
+ QObject *window = component.create(windowContext);
+
+ // ... delete window and windowContext when necessary
+
+ return app.exec();
}
- \endcode
+\endcode
+
+See \l {Using QML in C++ Applications} for more information about using
+QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well
+as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}.
+
+
+
+\section1 Developing and prototyping with QML Viewer
+
+The Declarative UI package includes a QML runtime tool, the \QQV, which loads
+and displays QML documents. This is useful during the application development
+phase for prototyping QML-based applications without writing your own C++
+applications to invoke the QML runtime.
+
+See the \l{QML Viewer} documentation for more details.
*/
+
diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc
new file mode 100644
index 0000000..5efc0ce
--- /dev/null
+++ b/doc/src/declarative/qmlviewer.qdoc
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+
+\page qmlviewer.html
+\title QML Viewer
+\ingroup qttools
+
+The Declarative UI package includes \QQV, a tool for loading QML documents that
+makes it easy to quickly develop and debug QML applications. It invokes the QML
+runtime to load QML documents and also includes additional features useful for
+the development of QML-based applications.
+
+The QML Viewer is a tool for testing and developing QML applications. It is
+\e not intended for use in a production environment and should not be used for the
+deployment of QML applications. In those cases, the QML runtime should be invoked
+from a Qt application instead; see \l {Qt Declarative UI Runtime} for more
+information.
+
+The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file
+with the viewer, run the viewer and select the file to be opened, or provide the
+file path on the command line:
+
+\code
+ qmlviewer myqmlfile.qml
+\endcode
+
+On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You
+can launch the viewer by opening the QMLViewer application from the Finder, or
+from the command line:
+
+\code
+ QMLViewer.app/Contents/MacOS/QMLViewer myqmlfile.qml
+\endcode
+
+The QML Viewer has a number of configuration options involving features such as
+fullscreen display, module import path configurations, video recording of QML
+animations, and OpenGL support.
+
+To see the configuration options, run \c qmlviewer with the \c -help argument.
+
+
+\section1 Adding module import paths
+
+Additional module import paths can be provided using the \c -I flag.
+For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates
+a C++ plugin identified as \c com.nokia.TimeExample. Since this has a namespaced
+identifier, the viewer has to be run with the \c -I flag from the example's
+base directory:
+
+\code
+qmlviewer -I . plugins.qml
+\endcode
+
+This adds the current directory to the import path so that the viewer will
+find the plugin in the \c com/nokia/TimeExample directory.
+
+Note by default, the current directory is included in the import search path,
+but namespaced modules like \c com.nokia.TimeExample are not found unless
+the path is explicitly added.
+
+
+\section1 Loading translation files
+
+When the QML Viewer loads a QML file, it installs a translation file from a
+"i18n" subdirectory relative to that initial file. This directory should contain
+translation files named "qml_<language>.qm", where <language> is a two-letter
+ISO 639 language, such as "qml_fr.qm", optionally followed by an underscore and
+an uppercase two-letter ISO 3166 country code, such as "qml_fr_FR.qm" or
+"qml_fr_CA.qm".
+
+Such files can be created using \l {Qt Linguist}.
+
+The actual translation file that is loaded depends on the system locale.
+Additionally, the viewer will load any translation files specified on the command
+line via the \c -translation option.
+
+See the \l{declarative/i18n}{QML i18n example} for an example. Also, the
+\l{scripting.html#internationalization}{Qt Internationalization} documentation
+shows how JavaScript code in QML files can be made to use translatable strings.
+
+
+\section1 Loading placeholder data with QML Viewer
+
+Often, QML applications are prototyped with fake data that is later replaced
+by real data sources from C++ plugins. QML Viewer assists in this aspect by
+loading fake data into the application context: it looks for a directory named
+"dummydata" in the same directory as the target QML file, and any \c .qml
+files in that directory are loaded as QML objects and bound to the root context
+as properties named after the files.
+
+For example, this QML document refers to a \c lottoNumbers property which does
+not actually exist within the document:
+
+\qml
+import Qt 4.7
+
+ListView {
+ width: 200; height: 300
+ model: lottoNumbers
+ delegate: Text { text: number }
+}
+\endqml
+
+If within the document's directory, there is a "dummydata" directory which
+contains a \c lottoNumbers.qml file like this:
+
+\qml
+import Qt 4.7
+
+ListModel {
+ ListElement { number: 23 }
+ ListElement { number: 44 }
+ ListElement { number: 78 }
+}
+\endqml
+
+Then this model would be automatically loaded into the ListView in the previous document.
+
+Child properties are included when loaded from dummy data. The following document
+refers to a \c clock.time property:
+
+\qml
+import Qt 4.7
+Text { text: clock.time }
+\endqml
+
+The text value could be filled by a \c dummydata/clock.qml file with a \c time
+property in the root context:
+
+\qml
+import Qt 4.7
+QtObject { property int time: 54321 }
+\endqml
+
+To replace this with real data, you can simply bind the real data object to
+the root context in C++ using QDeclarativeContext::setContextProperty(). This
+is detailed in \l {Using QML in C++ Applications}.
+
+\section1 Using the \c runtime object
+
+QML applications that are loaded with the QML Viewer have access to a special
+\c runtime property on the root context. This property provides additional
+information about the application's runtime environment through the following properties:
+
+\table
+\row
+
+\o \c runtime.isActiveWindow
+
+\o This property indicates whether the QML Viewer window is the current active
+window on the system. It is useful for "pausing" an application, particularly
+animations, when the QML Viewer loses focus or moves to the background.
+
+For example, the following animation is only played when the QML Viewer is
+the active window:
+
+\qml
+Rectangle {
+ width: 200; height: 200
+
+ ColorAnimation on color {
+ running: runtime.isActiveWindow
+ loops: Animation.Infinite
+ from: "green"; to: "blue"; duration: 2000
+ }
+}
+\endqml
+
+\row
+
+\o \c runtime.orientation
+
+\o This property indicates the current orientation of the QML Viewer. On the
+N900 platform, this property automatically updates to reflect the device's
+actual orientation; on other platforms, this indicates the orientation currently
+selected in the QML Viewer's \e {Settings -> Properties} menu. The
+\c orientation value can be one of the following:
+
+\list
+\o \c Orientation.Portrait
+\o \c Orientation.Landscape
+\o \c Orientation.PortraitInverted (Portrait orientation, upside-down)
+\o \c Orientation.LandscapeInverted (Landscape orientation, upside-down)
+\endlist
+
+When the viewer's orientation changes, the appearance of the loaded QML document
+does not change unless it has been set to respond to changes in
+\c runtime.orientation. For example, the following Rectangle changes its
+aspect ratio depending on the orientation of the QML Viewer:
+
+\qml
+Rectangle {
+ id: window
+ width: 640; height: 480
+
+ states: State {
+ name: "landscape"
+ PropertyChanges { target: window; width: 480; height: 640 }
+ }
+ state: (runtime.orientation == Orientation.Landscape
+ || runtime.orientation == Orientation.LandscapeInverted) ? 'landscape' : ''
+}
+\endqml
+
+\endtable
+
+*/
+
diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc
index 252c11e..7a97eb1 100644
--- a/doc/src/declarative/tutorial.qdoc
+++ b/doc/src/declarative/tutorial.qdoc
@@ -101,11 +101,11 @@ The \c font.pointSize and \c font.bold properties are related to fonts and use t
\section2 Viewing the example
-To view what you have created, run the \l{Qt Declarative UI Runtime}{qml} tool (located in the \c bin directory) with your filename as the first argument.
+To view what you have created, run the \l{QML Viewer} tool (located in the \c bin directory) with your filename as the first argument.
For example, to run the provided completed Tutorial 1 example from the install location, you would type:
\code
-bin/qml $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml
+bin/qmlviewer $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml
\endcode
*/
@@ -222,5 +222,5 @@ This is equivalent to writing the two transitions separately.
The \l ParallelAnimation element makes sure that the two types of animations (number and color) start at the same time.
We could also run them one after the other by using \l SequentialAnimation instead.
-For more details on states and transitions, see \l {QML States}.
+For more details on states and transitions, see \l {QML States} and the {declarative/animation/states}{states and transitions example}.
*/
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index 211ee4b..ce53677 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -196,6 +196,9 @@
\o \l{declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout}{QGraphicsGridLayout}
\o \l{declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout}{QGraphicsLinearLayout}
\endlist
+
+ Also see \l {Integrating QML with existing Qt UI code} for information on using QML
+ in Qt applications that use the Graphics View framework or ordinary QWidget-based views.
*/
/*!
@@ -211,8 +214,10 @@
\title C++ Extensions: Image Provider
\example declarative/cppextensions/imageprovider
- This examples shows how to use QDeclarativeImageProvider to serve images asynchronously
- into a QML item.
+ This examples shows how to use QDeclarativeImageProvider to serve images
+ to QML image elements.
+
+ \image qml-imageprovider-example.png
*/
/*!
@@ -252,6 +257,15 @@
*/
/*!
+ \title Models and Views: AbstractItemModel
+ \example declarative/modelviews/abstractitemmodel
+
+ This example shows how to use a QAbstractItemModel subclass as a model in QML.
+
+ \image qml-abstractitemmodel-example.png
+*/
+
+/*!
\title Models and Views: GridView
\example declarative/modelviews/gridview
@@ -306,8 +320,7 @@
\title Models and Views: Object ListModel
\example declarative/modelviews/objectlistmodel
- This example shows how to create a C++ extension that exposes a
- QList<QObject*> as a model in QML.
+ This example shows how to use a QList<QObject*> as a model in QML.
\image qml-objectlistmodel-example.png
*/
@@ -334,8 +347,7 @@
\title Models and Views: String ListModel
\example declarative/modelviews/stringlistmodel
- This example shows how to create a C++ extension that exposes a
- QStringList as a model in QML.
+ This example shows how to use a QStringList as a model in QML.
\image qml-stringlistmodel-example.png
*/
@@ -465,7 +477,7 @@
This example displays a set of clocks with different times for different cities.
Each clock is created by combining \l Image elements with \l Rotation transforms
- and \l SpringFollow animations.
+ and \l SpringAnimation behaviors.
\image qml-clocks-example.png
*/
@@ -505,7 +517,7 @@
\title Toys: TV Tennis
\example declarative/toys/tvtennis
- This example shows how to use animation components such as \l SpringFollow,
+ This example shows how to use animation components such as \l SpringAnimation,
\l SequentialAnimation and \l PropertyAction to create a game of TV tennis.
\image qml-tvtennis-example.png
@@ -533,7 +545,7 @@
\example declarative/ui-components/dialcontrol
This example shows how to create a dial-type control. It combines
- \l Image elements with \l Rotation transforms and \l SpringFollow animations
+ \l Image elements with \l Rotation transforms and \l SpringAnimatino behaviors
to produce an interactive speedometer-type dial.
\image qml-dialcontrol-example.png
@@ -601,7 +613,9 @@
\title UI Components: Tab Widget
\example declarative/ui-components/tabwidget
- This example shows how to create a tab widget.
+ This example shows how to create a tab widget. It also demonstrates how
+ \l {Setting default properties}{default properties} can be used to collect and
+ assemble the child items declared within an \l Item.
\image qml-tabwidget-example.png
*/
diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc
index da6f600..a3cef66 100644
--- a/doc/src/examples/qml-webbrowser.qdoc
+++ b/doc/src/examples/qml-webbrowser.qdoc
@@ -6,41 +6,27 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
- \title Web Browser
+ \title QML Web Browser
\example demos/declarative/webbrowser
This demo shows how to write a simple web browser in QML by combining the
diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc
index bf22c67..5c6108a 100644
--- a/doc/src/external-resources.qdoc
+++ b/doc/src/external-resources.qdoc
@@ -410,8 +410,13 @@
*/
/*!
+ \externalpage http://www.iso.org/iso/date_and_time_format
+ \title ISO 8601
+*/
+
+/*!
\externalpage http://opensource.org/licenses/bsd-license.php
- \title New and Modified BSD Licenses
+ \title BSD License
*/
/*!
diff --git a/doc/src/images/qml-abstractitemmodel-example.png b/doc/src/images/qml-abstractitemmodel-example.png
new file mode 100644
index 0000000..1d7ff19
--- /dev/null
+++ b/doc/src/images/qml-abstractitemmodel-example.png
Binary files differ
diff --git a/doc/src/images/qml-focus-example.png b/doc/src/images/qml-focus-example.png
index 0ec2bff..107d2cb 100644
--- a/doc/src/images/qml-focus-example.png
+++ b/doc/src/images/qml-focus-example.png
Binary files differ
diff --git a/doc/src/images/qml-imageprovider-example.png b/doc/src/images/qml-imageprovider-example.png
new file mode 100644
index 0000000..e82548a
--- /dev/null
+++ b/doc/src/images/qml-imageprovider-example.png
Binary files differ
diff --git a/doc/src/images/qml-xmlhttprequest-example.png b/doc/src/images/qml-xmlhttprequest-example.png
index 68e7d27..f585613 100644
--- a/doc/src/images/qml-xmlhttprequest-example.png
+++ b/doc/src/images/qml-xmlhttprequest-example.png
Binary files differ
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index da50a6d..18a1746 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -70,15 +70,15 @@
<li><a href="declarativeui.html">Device UI's &amp; Qt Quick</a></li>
<li><a href="qt-gui-concepts.html">Desktop UI components</a></li>
<li><a href="platform-specific.html">Platform-specific info</a></li>
- <li><a href="qt-graphics.html">Graphics, Painting &amp Printing</a></li>
- <li><a href="qt-network.html">Input/Output &amp networking</a></li>
+ <li><a href="qt-graphics.html">Graphics, Painting &amp; Printing</a></li>
+ <li><a href="qt-network.html">Input/Output &amp; networking</a></li>
</ul>
</div>
<div class="sectionlist">
<ul>
<li><a href="model-view-programming.html">Model/View programming</a></li>
<li><a href="technology-apis.html">Qt API's for other technologies</a></li>
- <li><a href="best-practices.html">Qt How-to's &amp best practices</a></li>
+ <li><a href="best-practices.html">Qt How-to's &amp; best practices</a></li>
<li><a href="developing-with-qt.html">Cross-platform development</a></li>
</ul>
</div>
diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc
index 335dfcb..e5f0e62 100644
--- a/doc/src/platforms/symbian-introduction.qdoc
+++ b/doc/src/platforms/symbian-introduction.qdoc
@@ -119,6 +119,7 @@
\row \o \c release-armv5 \o Build release binaries for hardware using RVCT.
\row \o \c run \o Run the application on the emulator.
\row \o \c runonphone \o Run the application on a device.
+ \row \o \c deploy \o Deploys the project into a device.
\row \o \c sis \o Create signed \c .sis file for project.
\row \o \c unsigned_sis \o Create unsigned \c .sis file for project.
\row \o \c installer_sis \o Create signed \l{Smart Installer}{smart installer}
@@ -190,7 +191,7 @@
By default empty.
\endtable
- The suppported options for \c QT_SIS_OPTIONS:
+ The supported options for \c QT_SIS_OPTIONS:
\target Supported options for QT_SIS_OPTIONS
\table
@@ -204,7 +205,7 @@
\endtable
Execute the \c{createpackage.pl} script without any
- parameters for detailed information about options. By default no otions are given.
+ parameters for detailed information about options. By default no options are given.
For example:
@@ -214,9 +215,9 @@
\snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 3
- If you want to install the program immediately, make sure that the device
- is connected to the computer in "PC Suite" mode, and run \c sis target
- with the \c QT_SIS_OPTIONS=-i, like this:
+ If you want to install the program immediately after creating \c .sis file,
+ make sure that the device is connected to the computer in "PC Suite" mode,
+ and use \c deploy target instead of \c sis target:
\snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5
diff --git a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc
index 60c69c0..a2ea686 100644
--- a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc
+++ b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc
@@ -63,6 +63,5 @@
//! [4]
//! [5]
- set QT_SIS_OPTIONS=-i
- make sis
+ make deploy
//! [5]
diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml
index 7377cee..e92a429 100644
--- a/doc/src/snippets/declarative/gridview/gridview.qml
+++ b/doc/src/snippets/declarative/gridview/gridview.qml
@@ -108,8 +108,10 @@ Component {
Rectangle {
width: view.cellWidth; height: view.cellHeight
color: "lightsteelblue"; radius: 5
- SpringFollow on x { to: view.currentItem.x; spring: 3; damping: 0.2 }
- SpringFollow on y { to: view.currentItem.y; spring: 3; damping: 0.2 }
+ x: view.currentItem.x
+ y: view.currentItem.y
+ Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
+ Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
}
}
diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml
index 0c6dfd4..cde820e 100644
--- a/doc/src/snippets/declarative/listview/listview.qml
+++ b/doc/src/snippets/declarative/listview/listview.qml
@@ -99,10 +99,12 @@ Component {
Rectangle {
width: 180; height: 40
color: "lightsteelblue"; radius: 5
- SpringFollow on y {
- to: list.currentItem.y
- spring: 3
- damping: 0.2
+ y: list.currentItem.y
+ Behavior on y {
+ SpringAnimation {
+ spring: 3
+ damping: 0.2
+ }
}
}
}
diff --git a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml
index 835ca32..9e759f9 100644
--- a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml
+++ b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml
@@ -55,7 +55,7 @@ ListView {
MouseArea {
anchors.fill: parent
onClicked: {
- if (hasModelChildren)
+ if (model.hasModelChildren)
view.model.rootIndex = view.model.modelIndex(index)
}
}
diff --git a/doc/src/template/images/bullet_up.png b/doc/src/template/images/bullet_up.png
index 285e741..7de2f06 100644
--- a/doc/src/template/images/bullet_up.png
+++ b/doc/src/template/images/bullet_up.png
Binary files differ
diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js
index 2723ff2..faa4ca4 100755
--- a/doc/src/template/scripts/functions.js
+++ b/doc/src/template/scripts/functions.js
@@ -63,11 +63,9 @@ function processNokiaData(response){
if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'APIPage'){
lookupCount++;
-
for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){
full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue;
full_li_element = full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd;
-
$('#ul001').append(full_li_element);
$('#ul001 .defaultLink').css('display','none');
@@ -77,7 +75,6 @@ function processNokiaData(response){
if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){
articleCount++;
-
for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){
full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue;
full_li_element =full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd ;
@@ -103,10 +100,13 @@ function processNokiaData(response){
if(i==propertyTags.length){$('#pageType').removeClass('loading');}
}
+ if(lookupCount > 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('<li class=\"menuAlert liveResult hit\">Found ' + lookupCount + ' hits</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');}
+ if(articleCount > 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('<li class=\"menuAlert liveResult hit\">Found ' + articleCount + ' hits</li>');$('#ul002 li').css('display','block');}
+ if(exampleCount > 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('<li class=\"menuAlert liveResult hit\">Found ' + articleCount + ' hits</li>');$('#ul003 li').css('display','block');}
- if(lookupCount == 0){$('#ul001').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');}
- if(articleCount == 0){$('#ul002').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');}
- if(exampleCount == 0){$('#ul003').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');}
+ if(lookupCount == 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');}
+ if(articleCount == 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');}
+ if(exampleCount == 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');}
// reset count variables;
lookupCount=0;
articleCount = 0;
@@ -121,6 +121,7 @@ function CheckEmptyAndLoadList()
var pageVal = $('title').html();
$('#feedUrl').remove();
$('#pageVal').remove();
+ $('.menuAlert').remove();
$('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">');
$('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">');
$('.liveResult').remove();
@@ -170,6 +171,7 @@ else
if (this.timer) clearTimeout(this.timer);
this.timer = setTimeout(function () {
$('#pageType').addClass('loading');
+ $('.searching').remove();
$('.list ul').prepend('<li class="menuAlert searching">Searching...</li>');
$.ajax({
contentType: "application/x-www-form-urlencoded",
@@ -180,7 +182,8 @@ else
success: function (response, textStatus) {
$('.liveResult').remove();
- $('#pageType').removeClass('loading');
+ $('.searching').remove();
+ $('#pageType').removeClass('loading');
$('.list ul').prepend('<li class="menuAlert searching">Searching...</li>');
processNokiaData(response);
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 78a21f6..184a832 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -18,6 +18,8 @@
fieldset, img
{
border: 0;
+ height:100%;
+ width:100%
}
address, caption, cite, code, dfn, em, strong, th, var, optgroup
{
@@ -239,7 +241,7 @@
width: 158px;
height: 19px;
padding: 0;
- border: none;
+ border: 0px;
outline: none;
font: 13px/1.2 Verdana;
}
@@ -328,13 +330,18 @@
{
background: url(../images/box_bg.png) repeat-x 0 bottom;
}
- .sidebar .box ul li.menuAlert
+ .sidebar .box ul li.noMatch
{
background: none;
- color:gray;
+ color:#FF2A00;
font-style:italic;
}
-
+ .sidebar .box ul li.hit
+ {
+ background: none;
+ color:#AAD2F0;
+ font-style:italic;
+ }
.wrap
{
@@ -490,11 +497,20 @@
}
.wrap .content h2
{
- font: 600 16px/1.2 Arial;
+
+ border-bottom:1px solid #DDDDDD;
+ font:600 16px/1.2 Arial;
+ margin-top:15px;
+ width:100%;
+
}
.wrap .content h3
{
font: 600 14px/1.2 Arial;
+ /*border-bottom:1px solid #DDDDDD;*/
+ font:600 16px/1.2 Arial;
+ margin-top:15px;
+ width:100%;
}
.wrap .content p
{
@@ -742,6 +758,7 @@
pre
{
border: 1px solid #DDDDDD;
+ -moz-border-radius: 7px 7px 7px 7px;
margin: 0 20px 10px 10px;
padding: 20px 15px 20px 20px;
overflow-x: auto;
@@ -755,7 +772,7 @@
font-size: 11px;
/*min-width: 395px;*/
margin-bottom: 25px;
- display: inline-block;
+ /* display: inline-block;*/
}
thead
{
@@ -820,12 +837,14 @@
}
.qmlreadonly
{
+ padding-left: 5px;
float: right;
color: #254117;
}
.qmldefault
{
+ padding-left: 5px;
float: right;
color: red;
}
@@ -846,7 +865,7 @@
position: fixed;
top: 100px;
left: 33%;
- height: 190px;
+ height: 230px;
width: 400px;
padding: 5px;
background-color: #e6e7e8;
@@ -870,12 +889,25 @@
height: 120px;
margin: 0px 25px 10px 15px;
}
+ #noteHead
+ {
+ font-weight:bold;
+ padding:10px 10px 10px 20px;
+ }
#feedsubmit
{
display: inline;
float: right;
margin: 4px 32px 0 0;
}
+
+ .note
+ {
+ font-size:7pt;
+ padding-bottom:3px;
+ padding-left:20px;
+ }
+
#blurpage
{
display: none;
@@ -994,6 +1026,7 @@
}
h3.fn, span.fn
{
+ -moz-border-radius:7px 7px 7px 7px;
background-color: #F6F6F6;
border-width: 1px;
border-style: solid;
@@ -1011,6 +1044,7 @@
border-width: 1px;
border-style: solid;
border-color: #E6E6E6;
+ -moz-border-radius: 7px 7px 7px 7px;
width:100%;
}
@@ -1170,6 +1204,7 @@ vertical-align:top;
width:100%;
background-color:#F6F6F6;
border:1px solid #E6E6E6;
+-moz-border-radius: 7px 7px 7px 7px;
font-size:12pt;
padding-left:10px;
margin-top:10px;
@@ -1219,7 +1254,23 @@ pre.highlightedCode {
list-style-type:decimal;
}
-
+ .navTop{
+ float:right;
+ display:block;
+ padding-right:15px;
+ /*margin-top:10px;*/
+ }
+
+ .wrap .content .toc h3{
+ border-bottom:0px;
+ margin-top:0px;
+ }
+
+ .wrap .content .toc h3 a:hover{
+ color:#00732F;
+ text-decoration:none;
+ }
+
/* end of screen media */
/* start of print media */