summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-24 01:39:59 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-24 01:39:59 (GMT)
commitc19a55e55996851325cb0ad421af5dc2e8e9164a (patch)
treea35b8954fec090e98817d52b8fa668fb68b671da /doc
parenta7946186fbc56430eeda1fd37b7dbd0852efa893 (diff)
parent3639261fb803c25af17bf8c1563521477da7d1a6 (diff)
downloadQt-c19a55e55996851325cb0ad421af5dc2e8e9164a.zip
Qt-c19a55e55996851325cb0ad421af5dc2e8e9164a.tar.gz
Qt-c19a55e55996851325cb0ad421af5dc2e8e9164a.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/animation.qdoc6
-rw-r--r--doc/src/declarative/example-slideswitch.qdoc134
-rw-r--r--doc/src/declarative/examples.qdoc50
-rw-r--r--doc/src/declarative/globalobject.qdoc20
-rw-r--r--doc/src/declarative/qmlintro.qdoc24
-rw-r--r--doc/src/declarative/qmlreference.qdoc16
-rw-r--r--doc/src/declarative/qmlstates.qdoc4
-rw-r--r--doc/src/declarative/qmlviewer.qdoc2
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc32
9 files changed, 218 insertions, 70 deletions
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 1314493..d05a444 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -186,7 +186,7 @@ Transition {
}
\endcode
-To insert an explicit animation into your transition, you can use \target and \property as normal.
+To insert an explicit animation into your transition, you can use \c target and \c property as normal.
\code
Transition {
@@ -214,8 +214,8 @@ Transition {
\section1 Property Behaviors
-A property behavior specifies a default animation to run whenever the property's value changes, regardless
-of what caused the change. Unlike Transition, Behavior doesn't provide a way to indicate that a Behavior
+A \l{Behavior}{property behavior} specifies a default animation to run whenever the property's value changes, regardless
+of what caused the change. Unlike Transition, \l Behavior doesn't provide a way to indicate that a Behavior
should only apply under certain circumstances.
In the following snippet, we specify that we want the x position of redRect to be animated
diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc
new file mode 100644
index 0000000..c942918
--- /dev/null
+++ b/doc/src/declarative/example-slideswitch.qdoc
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlexampletoggleswitch.html
+\title QML Example - Toggle Switch
+
+This example shows how to create a reusable switch component in QML.
+
+The code for this example can be found in the \c $QTDIR/examples/declarative/slideswitch directory.
+
+\section1 Overview
+
+The elements that composed the switch are:
+
+\list
+\o a \c on property (the interface to interact with the switch),
+\o two images (the background image and the knob),
+\o two mouse regions for user interation (on the background image and on the knob),
+\o two states (a \e on state and a \e off state),
+\o two functions or slots to react to the user interation (\c toggle() and \c dorelease()),
+\o and a transition that describe how to go from one state to the other.
+\endlist
+
+\section1 Switch.qml
+\snippet examples/declarative/slideswitch/content/Switch.qml 0
+
+\section1 Walkthrough
+
+\section2 Interface
+\snippet examples/declarative/slideswitch/content/Switch.qml 1
+
+This property is the interface of the switch. By default, the switch is off and this property is \c false.
+It can be used to activate/disactivate the switch or to query its current state.
+
+In this example:
+
+\qml
+Switch { id: mySwitch; on: true }
+Text { text: "The switch is on"; visible: mySwitch.on == true }
+\endqml
+
+the text will only be visible when the switch is on.
+
+\section2 Images and user interaction
+\snippet examples/declarative/slideswitch/content/Switch.qml 4
+
+First, we create the background image of the switch.
+In order for the switch to toggle when the user clicks on the background, we add a \l{MouseRegion} as a child item of the image.
+A \c MouseRegion has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a
+\c toggle() function. We will see what this function does in a moment.
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 5
+
+Then, we place the image of the knob on top of the background.
+The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag
+property of the \c MouseRegion is for. We also want to toggle the switch if the knob is released between state. We handle this case
+in the \c dorelease() function that is called in the \c onReleased property.
+
+\section2 States
+\snippet examples/declarative/slideswitch/content/Switch.qml 6
+
+We define the two states of the switch:
+\list
+\o In the \e on state the knob is on the right (\c x position is 78) and the \c on property is \c true.
+\o In the \e off state the knob is on the left (\c x position is 1) and the \c on property is \c false.
+\endlist
+
+For more information on states see \l{qmlstates}{QML States}.
+
+\section2 Functions
+
+We add two ECMAScript functions to our switch:
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 2
+
+This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two
+states (\e on and \e off).
+
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 3
+
+This second function is called when the knob is released and we want to make sure that the knob does not end up between states
+(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing.
+
+For more information on scripts see \l{qmlecmascript.html}{ECMAScript Blocks}.
+
+\section2 Transition
+\snippet examples/declarative/slideswitch/content/Switch.qml 7
+
+At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78.
+In order for the the knob to move smoothly we add a transistion that will animate the \c x property with an easing curve for a duration of 200ms.
+
+For more information on transitions see \l{state-transitions}{QML Transitions}.
+
+*/
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index 9d66089..7950f66 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -65,47 +65,25 @@ or
Many other simple examples can be found under the \c examples/declarative sub
directory. Some can be run directly using the viewer like those above, and
-others require you to build and run an executable. More sophisticated demos of
-large applications can be found under the \c demos/declarative sub directory.
-These are intended to show more integrated functionality rather than to be
+others require you to build and run an executable. More sophisticated demos of
+large applications can be found under the \c demos/declarative sub directory.
+These are intended to show more integrated functionality rather than to be
instructive on specific elements.
\section1 Examples
These will be documented, and demonstrate how to achieve various things in QML.
-\raw HTML
-<center>
-<table cellspacing="10">
-<tr>
-<td>
-\endraw
-\image dial-example.gif
-\raw HTML
-</td>
-<td>
-\endraw
-\image switch-example.gif
-\raw HTML
-</td>
-<td>
-\endraw
-\image declarative-adv-tutorial4.gif
-\raw HTML
-</td>
-</tr>
-<tr>
-<td>
-<center>Elastic Dial</center>
-</td>
-<td>
-<center>Touch Toggle Switch</center>
-</td>
-<td>
-<center>Samegame</center>
-</td>
-</table>
-</center>
-\endraw
+\table
+\row
+ \o Elastic Dial
+ \o \image dial-example.gif
+\row
+ \o \l{qmlexampletoggleswitch.html}{Toggle Switch}
+ \o \image switch-example.gif
+\row
+ \o \l{Advanced Tutorial}{SameGame}
+ \o \image declarative-adv-tutorial4.gif
+\endtable
*/
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index e983ad0..e3c8b9a 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -64,7 +64,7 @@ files.
The Qt object contains all enums in the Qt namespace. For example, you can
access the AlignLeft member of the Qt::AlignmentFlag enum with \c Qt.AlignLeft.
-For a full list of enums, see the Qt Namespace documentation.
+For a full list of enums, see the \l{Qt Namespace} documentation.
\section2 Types
The Qt object also contains helper functions for creating objects of specific
@@ -88,20 +88,20 @@ This function returns a Color with the specified \c red, \c green, \c blue and \
This function returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components. All components should be in the range 0-1 inclusive.
\section3 Qt.rect(int x, int y, int width, int height)
-This function returns a Rect with the top-left corner at \c x,\c y and the specified \c width and \c height.
+This function returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height.
\section3 Qt.point(int x, int y)
This function returns a Point with the specified \c x and \c y coordinates.
\section3 Qt.size(int width, int height)
-This function returns as Size with the specified width and height.
+This function returns as Size with the specified \c width and \c height.
\section3 Qt.vector3d(real x, real y, real z)
-This function returns a Vector3D with the specified x, y and z.
+This function returns a Vector3D with the specified \c x, \c y and \c z.
\section2 Functions
The Qt object also contains the following miscellaneous functions which expose Qt functionality for use in QML.
\section3 Qt.lighter(color baseColor)
This function returns a color 50% lighter than \c baseColor. See QColor::lighter() for further details.
\section3 Qt.darker(color baseColor)
-This function returns a color 50% darker than \c baseColor. See QColor::lighter() for further details.
+This function returns a color 50% darker than \c baseColor. See QColor::darker() for further details.
\section3 Qt.tint(color baseColor, color tintColor)
This function allows tinting one color with another.
@@ -117,6 +117,16 @@ This function returns a color 50% darker than \c baseColor. See QColor::lighter(
\section3 Qt.closestAngle(number fromAngle, number toAngle)
This function returns an equivalent angle to toAngle, such that the difference between fromAngle and toAngle is never more than 180 degrees. This is useful when animating angles using a NumberAnimation, which does not know about equivalent angles, when you always want to take the shortest path.
+For example, the following would rotate myItem counterclockwise from 350 degrees to 10 degrees, for a total of 340 degrees of rotation.
+\qml
+NumberAnimation { target: myItem; property: "rotation"; from: 350; to: 10 }
+\endqml
+
+while the following would rotate myItem clockwise from 350 degrees to 370 degrees (which is visually equivilant to 10 degrees), for a total of 20 degrees of rotation.
+\qml
+NumberAnimation { target: myItem; property: "rotation"; from: 350; to: Qt.closetAngle(350, 10) }
+\endqml
+
\section3 Qt.playSound(url soundLocation)
This function plays the audio file located at \c soundLocation. Only .wav files are supported.
diff --git a/doc/src/declarative/qmlintro.qdoc b/doc/src/declarative/qmlintro.qdoc
index f84d614..ab9416b 100644
--- a/doc/src/declarative/qmlintro.qdoc
+++ b/doc/src/declarative/qmlintro.qdoc
@@ -239,8 +239,8 @@ Image {
\section2 Default properties
-Each object type can specify one of its list properties as its default property.
-If a list property has been declared as the default property, the property tag can be omitted.
+Each object type can specify one of its list or object properties as its default property.
+If a property has been declared as the default property, the property tag can be omitted.
For example this code:
\code
@@ -263,9 +263,27 @@ State {
because \c changes is the default property of the \c State type.
-\section2 Dot Properties
+\section2 Grouped Properties
+In some cases properties form a logical group and use a 'dot' or grouped notation
+to show this.
+Grouped properties can be written like this:
+\qml
+Text {
+ font.pixelSize: 12
+ font.bold: true
+}
+\endqml
+
+or like this:
+\qml
+Text {
+ font { pixelSize: 12; bold: true }
+}
+\endqml
+
+In the element documentation grouped properties are shown using the 'dot' notation.
\section2 Attached Properties
\target attached-properties
diff --git a/doc/src/declarative/qmlreference.qdoc b/doc/src/declarative/qmlreference.qdoc
index f17e9d7..2c79aeb 100644
--- a/doc/src/declarative/qmlreference.qdoc
+++ b/doc/src/declarative/qmlreference.qdoc
@@ -45,16 +45,22 @@
\target qtdeclarativemainpage
- QML is a language for building highly dynamic and fluid applications. It is targetted at the sorts of user
- interface (and the sorts of hardware) in embedded devices such as phones, media
- players, and set-top boxes. It is also appropriate for highly custom desktop
+ QML is a language for building the animation rich,
+ highly fluid user interfaces that are becoming common in portable consumer
+ electronics devices such as mobile phones, media players, set-top boxes and
+ netbooks. It is also appropriate for highly custom desktop
user interfaces, or special elements in more traditional desktop user interfaces.
Building fluid applications is done declaratively, rather than procedurally.
That is, you specify \e what the UI should look like and how it should behave
rather than specifying step-by-step \e how to build it. Specifying a UI declaratively
does not just include the layout of the interface items, but also the way each
- individual item looks and behaves and the overall flow of the application.
+ individual item looks and behaves and the overall flow of the application.
+
+ The QML elements provide a sophisticated set of graphical and behavioral building
+ blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
+ ranging in complexity from simple buttons and sliders, to complete
+ internet-enabled applications like a \l {http://www.flickr.com}{Flickr} photo browser.
Getting Started:
\list
@@ -69,6 +75,7 @@
\o \l {QML Documents}
\o \l {Property Binding}
\o \l {ECMAScript Blocks}
+ \o \l {QML Scope}
\o \l {Network Transparency}
\o \l {qmlmodels}{Data Models}
\o \l {anchor-layout}{Anchor-based Layout}
@@ -82,5 +89,6 @@
QML Reference:
\list
\o \l {elements}{QML Elements}
+ \o \l {QML Global Object}
\endlist
*/
diff --git a/doc/src/declarative/qmlstates.qdoc b/doc/src/declarative/qmlstates.qdoc
index 261e3f5..ddb0fc8 100644
--- a/doc/src/declarative/qmlstates.qdoc
+++ b/doc/src/declarative/qmlstates.qdoc
@@ -3,7 +3,7 @@
\target qmlstates
\title QML States
-QML states describe user interface configurations, including:
+QML states typically describe user interface configurations, including:
\list
\o What UI elements are present
\o The properties of those elements (including how they behave)
@@ -52,7 +52,7 @@ To animate state changes, you can use \l{state-transitions}{transitions}.
Other things you can do in a state change:
\list
\o override signal handlers with PropertyChanges
-\o change an item's parent with ParentChange
+\o change an item's visual parent with ParentChange
\o change an item's anchors with AnchorChanges
\o run some script with StateChangeScript
\endlist
diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc
index f153df2..df96535 100644
--- a/doc/src/declarative/qmlviewer.qdoc
+++ b/doc/src/declarative/qmlviewer.qdoc
@@ -71,7 +71,7 @@
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
- Object { property real time: 12345 }
+ QtObject { property real time: 12345 }
\endcode
Any QML can be used in the dummy data files. You could even animate the
fictional data!
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index ea8e198..e46cbab 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -45,29 +45,29 @@
\ingroup modules
\brief The Qt Declarative module provides a declarative framework for building
-highly dynamic, custom UIs
+highly dynamic, custom user interfaces.
-Qt Declarative aids programmers and designers in building the animation rich,
-highly fluid user interfaces that are becoming common in portable consumer
-electronics devices, such as mobile phones, media players, set-top boxes and
-netbooks. The Qt Declarative module provides an engine for interpreting the
-declarative QML language, and a rich set of \l {QML Elements} that can be used
+Qt Declarative aids programmers and designers in building the animation rich,
+highly fluid user interfaces that are becoming common in portable consumer
+electronics devices, such as mobile phones, media players, set-top boxes and
+netbooks. The Qt Declarative module provides an engine for interpreting the
+declarative QML language, and a rich set of \l {QML Elements}{QML elements} that can be used
from QML.
QML is an extension to \l {http://www.ecma-international.org/publications/standards/Ecma-262.htm}
-{ECMAScript}, that provides a mechanism to declaratively build an object tree
-of \l {QML Elements}. QML improves the integration between ECMAScript and Qt's
-existing QObject based type system, adds support for automatic
-\l {Property Binding}s and provides \l {Network Transparency} at the language
+{ECMAScript}, that provides a mechanism to declaratively build an object tree
+of QML elements. QML improves the integration between ECMAScript and Qt's
+existing QObject based type system, adds support for automatic
+\l {Property Binding}{property bindings} and provides \l {Network Transparency}{network transparency} at the language
level.
-The \l {QML Elements} are a sophisticated set of graphical and behavioral building
-blocks. \l {QML Elements} are combined together in \l {QML Documents} to build components
-ranging in complexity from simple pushbuttons and sliders, to complete
-internet-enabled applications like a \l {http://www.flickr.com}{flickr} photo browser.
+The QML elements are a sophisticated set of graphical and behavioral building
+blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
+ranging in complexity from simple buttons and sliders, to complete
+internet-enabled applications like a \l {http://www.flickr.com}{Flickr} photo browser.
Qt Declarative builds on \l {QML for Qt programmers}{Qt's existing strengths}.
-QML can be be used to incrementally extend an existing application or to build
+QML can be be used to incrementally extend an existing application or to build
completely new applications. QML is fully \l {Extending QML}{extensible from C++}.
\section1 Getting Started:
@@ -76,7 +76,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+
\o \l {Tutorial}{Tutorial: 'Hello World'}
\o \l {advtutorial.html}{Tutorial: 'Same Game'}
\o \l {QML Examples and Walkthroughs}
-\o \l {Using QML in C++ Applications}
+\o \l {Using QML in C++ Applications}
\endlist
\section1 Core QML Features: