summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-08-30 14:58:04 +0200
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-08-30 14:58:04 +0200
commitbe69c316c56379d2b955491ffc54754018079dec (patch)
treec7305db1cbfcc2886928e099450fc56dbc9e9db7 /doc
parent308cc906b80a1cfffde6604f158705101670b824 (diff)
parentb4a7eadb28a49ace84994dcff665b1cabae69652 (diff)
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1.git into doc-4.7
Conflicts: doc/src/getting-started/examples.qdoc doc/src/index.qdoc
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/animation.qdoc19
-rw-r--r--doc/src/declarative/declarativeui.qdoc100
-rw-r--r--doc/src/declarative/dynamicobjects.qdoc2
-rw-r--r--doc/src/declarative/elements.qdoc252
-rw-r--r--doc/src/declarative/extending.qdoc17
-rw-r--r--doc/src/declarative/qml-intro.qdoc444
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc10
-rw-r--r--doc/src/declarative/qtprogrammers.qdoc3
-rw-r--r--doc/src/deployment/deployment.qdoc6
-rw-r--r--doc/src/development/qtestlib.qdoc2
-rw-r--r--doc/src/examples/diagramscene.qdoc3
-rw-r--r--doc/src/examples/qml-examples.qdoc1
-rw-r--r--doc/src/examples/qml-extending.qdoc14
-rw-r--r--doc/src/examples/qml-minehunt.qdoc2
-rw-r--r--doc/src/examples/simpletreemodel.qdoc7
-rw-r--r--doc/src/external-resources.qdoc15
-rw-r--r--doc/src/frameworks-technologies/accessible.qdoc1
-rw-r--r--doc/src/frameworks-technologies/containers.qdoc1
-rw-r--r--doc/src/frameworks-technologies/graphicsview.qdoc2
-rw-r--r--doc/src/frameworks-technologies/ipc.qdoc1
-rw-r--r--doc/src/frameworks-technologies/model-view-programming.qdoc1
-rw-r--r--doc/src/frameworks-technologies/plugins-howto.qdoc2
-rw-r--r--doc/src/frameworks-technologies/richtext.qdoc3
-rw-r--r--doc/src/getting-started/demos.qdoc18
-rw-r--r--doc/src/getting-started/examples.qdoc6
-rw-r--r--doc/src/getting-started/gettingstartedqml.qdoc2043
-rw-r--r--doc/src/getting-started/gettingstartedqt.qdoc6
-rw-r--r--doc/src/getting-started/installation.qdoc10
-rw-r--r--doc/src/howtos/openvg.qdoc2
-rw-r--r--doc/src/images/qml-image-example.pngbin58184 -> 49584 bytes
-rw-r--r--doc/src/index.qdoc33
-rw-r--r--doc/src/internationalization/i18n.qdoc2
-rw-r--r--doc/src/modules.qdoc6
-rw-r--r--doc/src/objectmodel/properties.qdoc7
-rw-r--r--doc/src/overviews.qdoc32
-rw-r--r--doc/src/painting-and-printing/paintsystem.qdoc2
-rw-r--r--doc/src/platforms/x11overlays.qdoc1
-rw-r--r--doc/src/porting/qt4-mainwindow.qdoc5
-rw-r--r--doc/src/qt4-intro.qdoc8
-rw-r--r--doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp10
-rw-r--r--doc/src/snippets/declarative/loader/KeyReader.qml53
-rw-r--r--doc/src/snippets/declarative/loader/MyItem.qml55
-rw-r--r--doc/src/snippets/declarative/loader/connections.qml57
-rw-r--r--doc/src/snippets/declarative/loader/focus.qml62
-rw-r--r--doc/src/snippets/declarative/loader/simple.qml54
-rw-r--r--doc/src/snippets/declarative/propertyaction.qml86
-rw-r--r--doc/src/snippets/declarative/propertychanges.qml92
-rw-r--r--doc/src/snippets/declarative/qml-intro/anchors1.qml56
-rw-r--r--doc/src/snippets/declarative/qml-intro/anchors2.qml58
-rw-r--r--doc/src/snippets/declarative/qml-intro/anchors3.qml65
-rw-r--r--doc/src/snippets/declarative/qml-intro/basic-syntax.qml48
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world1.qml53
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world2.qml56
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world3.qml57
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world4.qml61
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world5.qml65
-rw-r--r--doc/src/snippets/declarative/qml-intro/number-animation1.qml64
-rw-r--r--doc/src/snippets/declarative/qml-intro/number-animation2.qml66
-rw-r--r--doc/src/snippets/declarative/qml-intro/rectangle.qml50
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation1.qml65
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation2.qml73
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation3.qml88
-rw-r--r--doc/src/snippets/declarative/qml-intro/states1.qml94
-rw-r--r--doc/src/snippets/declarative/qml-intro/transformations1.qml80
-rw-r--r--doc/src/snippets/declarative/rotationanimation.qml3
-rw-r--r--doc/src/template/style/narrow.css7
-rwxr-xr-xdoc/src/template/style/style.css47
-rw-r--r--doc/src/widgets-and-layouts/layout.qdoc1
-rw-r--r--doc/src/widgets-and-layouts/stylesheet.qdoc1
-rw-r--r--doc/src/xml-processing/xquery-introduction.qdoc1
-rw-r--r--doc/src/zh_CN/bughowto.qdoc53
71 files changed, 3077 insertions, 1693 deletions
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 7416341785..53a0c55ce9 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -156,11 +156,13 @@ The \l {PropertyAnimation::}{to} property is also required to specify the new
\section2 Standalone Animations
Animations can also be created as ordinary QML objects that are not bound to
-any particular objects and properties. An example:
+any particular objects and properties. Here is an example, using a
+PropertyAnimation object. The animation is explicitly started when the
+\l Rectangle is clicked:
\snippet doc/src/snippets/declarative/animation-standalone.qml 0
-A standalone animation is not running by default and must be started explicitly
+A standalone animation object is not running by default and must be started explicitly
using the \l {Animation::}{running} property or \l {Animation::}{start()} and
\l {Animation::}{stop()} methods. Since the animation is not bound to a
particular object or property, it must define the \l
@@ -183,10 +185,13 @@ object and add it to an item's \l {Item::}{transitions} property. An example:
\snippet doc/src/snippets/declarative/animation-transitions.qml 0
-When the \l Rectangle changes to the \e moved state, its \c x and \c y property
-values are changed by the PropertyChanges object, and the PropertyAnimation
-defined within the \l Transition is triggered on these properties. The
-animation will not be applied at any time other than during the state change.
+The PropertyChanges object in the \e moved state defines that when the
+\l Rectangle is in this state, its position should be changed
+to (50, 50). When the \l Rectangle changes to the \e moved state, the
+\l Transition will be triggered, and the transition's \l PropertyAnimation will
+animate the changes in the \c x and \c y properties to their new values.
+The animation will not be applied at any time other than during the state
+change.
Notice the example does not set any \l {PropertyAnimation::}{from} and \l
{PropertyAnimation::}{to} values for the PropertyAnimation. As a convenience,
@@ -234,7 +239,7 @@ and rotation changes.
A ColorAnimation allows color values for the \l {ColorAnimation::}{from}
and \l {ColorAnimation::}{to} properties. The
-following animates the rectangle's \l {Rectangle::color} property:
+following animates the rectangle's \l {Rectangle::}{color} property:
\snippet doc/src/snippets/declarative/animation-elements.qml color
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index ce35f26da9..e1c947381f 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -28,12 +28,14 @@
/*!
\title Qt Quick
\page qtquick.html
+\ingroup qt-gui-concepts
+
\brief Qt Quick provides a declarative framework for building highly
dynamic, custom user interfaces.
Qt Quick provides a declarative framework for building highly dynamic,
-custom user interfaces from a rich set of \l {QML Elements}{QML elements}.
+custom user interfaces from a rich set of \l{QML Elements}{QML elements}.
Qt Quick helps programmers and designers collaborate to
build the fluid user interfaces that are becoming common in portable
consumer devices, such as mobile phones, media players, set-top boxes
@@ -41,72 +43,74 @@ and netbooks. Qt Quick consists of the QtDeclarative C++ module, QML, and
the integration of both of these into the Qt Creator IDE. Using the QtDeclarative
C++ module, you can load and interact with QML files from your Qt application.
-QML provides mechanisms to declaratively build an object tree using
-\l {QML Elements}{QML elements}. QML improves the integration between
-\l {http://www.ecma-international.org/publications/standards/Ecma-262.htm}{JavaScript}
-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.
+QML is an extension to \l{About JavaScript}{JavaScript}, that provides
+a mechanism to declaratively build an object tree of
+\l{QML Elements}{QML elements}. QML improves the integration between
+JavaScript 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}{QML elements} are a sophisticated set of
+The \l{QML Elements}{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
+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.
+complete Internet-enabled applications like a photo browser for the
+popular \l{http://www.flickr.com}{Flickr} photo-sharing site.
-Qt Quick 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 completely new applications. QML is fully \l
-{Extending QML in C++}{extensible from C++} through the QtDeclarative Module.
+Qt Quick 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 completely new applications. QML is fully
+\l{Extending QML in C++}{extensible from C++} through the QtDeclarative
+Module.
\section1 Getting Started
\list
-\o \l {Introduction to the QML language}
-\o \l {QML Tutorial}{Tutorial: 'Hello World'}
-\o \l {QML Advanced Tutorial}{Tutorial: 'Same Game'}
-\o \l {QML Examples and Demos}
-\o \l {QML for Qt programmers}
+\o \l{Introduction to the QML language}
+\o \l{QML Tutorial}{Tutorial: 'Hello World'}
+\o \l{QML Advanced Tutorial}{Tutorial: 'Same Game'}
+\o \l{QML Examples and Demos}
+\o \l{QML for Qt Programmers}
+\o \l{Getting Started Programming with QML}
+\o \l{Beginning Qt Quick}
\endlist
\section1 Core QML Features
\list
-\o \l {QML Documents}
-\o \l {Property Binding}
-\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 {qdeclarativefocus.html}{Keyboard Focus}
-\o \l {qdeclarativemodules.html}{Modules}
-\o \l {Extending types from QML}
-\o \l {qdeclarativedynamicobjects.html}{Dynamic Object Creation}
+\o \l{QML Documents}
+\o \l{Property Binding}
+\o \l{Network Transparency}
+\o \l{QML Scope}
+\o \l{Integrating JavaScript}
+\o \l{Data Models}
+\o \l{Anchor-based Layout in QML}
+\o \l{QML States}
+\o \l{QML Animation}
+\o \l{Keyboard Focus in QML}
+\o \l{QML Modules}
+\o \l{Extending types from QML}
+\o \l{Dynamic Object Management in QML}
\endlist
\section1 Using QML with C++
\list
-\o \l {qmlruntime.html}{The Qt Declarative Runtime}
-\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++}
+\o \l{Qt Declarative UI Runtime}
+\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
\list
-\o \l {QML Elements}
-\o \l {QML Global Object}
-\o \l {QML Internationalization}
-\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}
+\o \l{QML Elements}
+\o \l{QML Global Object}
+\o \l{QML Internationalization}
+\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 997f601d71..e735bce0fc 100644
--- a/doc/src/declarative/dynamicobjects.qdoc
+++ b/doc/src/declarative/dynamicobjects.qdoc
@@ -27,7 +27,7 @@
/*!
\page qdeclarativedynamicobjects.html
-\title Dynamic Object Management
+\title Dynamic Object Management in QML
QML provides a number of ways to dynamically create and manage QML objects.
The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index c008404a9a..94abe10081 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -26,113 +26,151 @@
****************************************************************************/
/*!
-\page qdeclarativeelements.html
-\target elements
-\title QML Elements
-
-The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module.
-
-\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 {QML:QtObject} {QtObject} \o Basic element containing only the objectName property
-\row \o \l {QML:Qt} {Qt} \o The QML global Qt object provides useful enums and functions from Qt.
-\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
+ \page qdeclarativeelements.html
+ \target elements
+ \title QML Elements
+ This is a dictionary of all the QML elements available in the \l
+ {QtDeclarative} {Qt Declarative} module.
+
+ To see the QML elements listed by
+ functional area, \l{Groups Of Related QML Elements} {look here}.
+
+ \generatelist qmlclasses
+
+*/
+
+
+/*!
+ \group qml-groups
+ \title Groups Of Related QML Elements
+
+ \brief If you know what kind of QML element you want (Basic Visual,
+ Interaction, Animation, etc), look here.
+
+ This is a list of functional groups of QML elements.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-visual-elements
+ \title Basic QML Visual Elements
+ \ingroup qml-groups
+
+ \brief Elements for constructing basic visual items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-interaction-elements
+ \title Basic QML Interaction Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling basic interactions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-state-elements
+ \title QML State Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling state changes.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-event-elements
+ \title QML Event Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling events.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-animation-transition
+ \title QML Animation and Transition Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling animations and transitions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-working-with-data
+ \title Working With Data in QML
+ \ingroup qml-groups
+
+ \brief Elements for working with data.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-view-elements
+ \title QML View Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling views.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-positioning-elements
+ \title QML Positioning Elements
+ \ingroup qml-groups
+
+ \brief Elements for positioning items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-utility-elements
+ \title QML Utility Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling misc operations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-transform-elements
+ \title QML Transform Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling transformations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-particle-elements
+ \title QML Particle Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling particle effects.
+
+ \generatelist{related}
*/
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 3acfbdf769..5c4d5e7a78 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -434,6 +434,23 @@ NOTIFY signal in C++.
See also \l {Extending types from QML}.
+\section1 Methods
+
+Slots and methods marked Q_INVOKABLE may be called as functions in QML.
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/example.qml 0
+
+In this example an invitation is added via an \c {invite()} invokable method of
+the BirthdayParty element. This function is available in QML by marking the \c {invite()}
+method with Q_INVOKABLE in the BirthdayParty class:
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h 0
+
+\l {Extending QML - Methods Example} shows the complete code used to
+implement the invite() method.
+
+The \c {invite()} method is similarly available if it is declared as a slot.
+
\section1 Property Value Sources
\snippet examples/declarative/cppextensions/referenceexamples/valuesource/example.qml 0
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index fbab001002..63d682556d 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -28,14 +28,11 @@
/*!
-
-\page qml-intro.html
+\page qml-intro.html
\title Beginning Qt Quick
-
\section1 Overview
-
QML is a high level, scripted language. Its commands, more correctly \e elements,
leverage the power and efficiency of the Qt libraries to make easy to use
commands that perform intuitive functions. Draw a rectangle, display an image at
@@ -50,7 +47,7 @@ Javascript is easier to learn than C++ and can be embedded into the QML
files or imported from a separate file.
\bold{In QML the types of various 'objects' are referred to as \l {QML
-Elements}{ elements}}.
+Elements}{elements}}.
An element usually has various \e properties that help define the element. For
example, if we created an element called Circle then the radius of the circle
@@ -59,14 +56,9 @@ would be a property.
\section1 A First Look
-The basic syntax of an \l {QML Elements}{element} is
+The basic syntax of an \l{QML Elements}{element} is
- \code
- SomeElement {
- id: myObject
- ... some other things here ...
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax
Here we are defining a new object. We specify its 'type' first as SomeElement.
Then within matching braces { ... } we specify the various parts of our
@@ -90,61 +82,38 @@ want a rectangle that is 500 pixels by 400 pixels in the x and y directions
We can implement this \l Rectangle with these properties this way
- \code
- import Qt 4.7
-
- // This is a comment. And below myRectangle is defined.
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/rectangle.qml document
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
+myexample.qml, and on the command line run the following command:
- \code
- qmlviewer myexample.qml
- \endcode
+\code
+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
-
+\code
+QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml
+\endcode
It will create a very boring rectangle in its own window.
-
\section1 Hello World!
We can now add some color and text to make a Hello World QML program.
-\l Rectangle has the property \l {Rectangle::color}{color} to produce a
+\l Rectangle has the property \l{Rectangle::color}{color} to produce a
background color.
Text is handled by a different element called \l Text. We need to create a
-\l Text object inside the \l Rectangle and set its \l {Text::text}{text}
-property to "Hello World!". So to set the text to 'Hello world' and the
+\l Text object inside the \l Rectangle and set its \l{Text::}{text}
+property to "Hello World!". So to set the text to "Hello world" and the
background colour to light gray,
- \code
- import Qt 4.7
-
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
- Text { text: "Hello World!" }
-
- color: "lightgray"
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world1.qml document
\section1 Hello World Again
@@ -158,12 +127,7 @@ position belongs to the \l Text element so we set the position inside its
definition. Note that we separate different QML statements on the same line
with a semi-colon, or we could have simply put each statement on a new line
- \code
- Text {
- text: "<h2>Hello World</h2>"; color: "darkgreen"
- x: 100; y:100
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world2.qml updated text
Not only did we reposition the text, but the text was altered by adding
HTML tags to change the font size. The text color was also changed from the
@@ -174,13 +138,7 @@ We could also have used a hexadecimal string for the RGB (red-green-blue, as
#rrggbb) values of the color similar to the method used in HTML. For
example, mostly blue with a green tint,
- \code
- Text {
- text: "<h1>Hello world again</h1>"
- color: "#002288"
- x: 100; y: 100
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world3.qml updated text
All of these changes occurred within the \l Text object which is the scope
of these property changes.
@@ -198,11 +156,7 @@ source of the image, the path to the file, is a URL. Therefore the file can
be local: \e {mydir/myimage1.png}. Or it can be remote:
\e {"http://www.example.com/images/myimage1.png"}.
- \code
- Image {
- source: "images/qt-logo.png"
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world4.qml added an image
This displays the image, as we would expect, at the top left of the window.
The position of the default x = 0, y = 0 coordinate. The example here uses
@@ -213,44 +167,12 @@ Let us reposition the image and enlarge it. Place it at the same 'x' offset
as the "Hello world again" text, but put it another 50 pixels below the
text, also make it 150 by 150 pixels in size,
- \code
- Image {
- source: "images/qt-logo.png"
- x: 100; y: 150
- width: 150; height: 150
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml positioning the image
Adding the Hello World example, with the text and the image example we can
write a simple piece of QML that starts to look a bit better.
- \code
- import Qt 4.7
-
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
- // A light gray background
- color: "lightgray"
-
- // Position and color some text
- Text {
- text: "<h1>Hello world again</h1>"
- color: "darkgreen"
- x: 100; y: 100
- }
-
- // Using the opportunity to resize the image.
- Image {
- source: "images/qt-logo.png"
- x: 100; y: 150
- width: 150; height: 150
- }
-
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml document
The result is still quite simple
@@ -281,22 +203,7 @@ If we want to position an image at the bottom of the rectangle it is
inside. I have to specify that the bottom of the image is also at the
bottom of the rectangle
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/anchors1.qml document
This places the logo at the bottom left of the window.
@@ -315,25 +222,7 @@ the bottomMargin property is used. So the new actions for the script are
Encoded into QML the script becomes
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
- }
- }
- \endcode
-
+\snippet doc/src/snippets/declarative/qml-intro/anchors2.qml document
Run this and resize the window. You will see that now the position of the
image adjusts during the resize.
@@ -344,14 +233,7 @@ You can also add another object say a block of descriptive text and place
it above or below the image or to the side. This code places some text just
above the image
- \code
- Text {
- text: "<h2>The Qt Logo</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/anchors3.qml adding some text
\image qml-intro-anchors3.png
@@ -359,17 +241,15 @@ above the image
referencing these properties from another object we use the property
directly, instead of saying:
- \code
- myRectangle.anchors.top // Wrong
- \endcode
+\qml
+myRectangle.anchors.top // Wrong
+\endqml
we use
- \code
- myRectangle.top // Correct
- \endcode
-
-
+\qml
+myRectangle.top // Correct
+\endqml
\section1 Transformations
@@ -391,9 +271,9 @@ Rotation of text was also suggested. It could also be useful to scale the
text. We can do both. The \l {Item::transform}{transform} property is a
\e list of \l Transform elements, so using the list syntax
- \code
- myList: [ listElement1, listElement2, ... } ]
- \endcode
+\qml
+myList: [ listElement1, listElement2, ... } ]
+\endqml
we can produce a list of transformations.
@@ -402,46 +282,7 @@ vertically by a factor of 1.5 and by 1.2 horizontally.
Using the example above as the basis for this we have,
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
-
- transform: Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -90
- }
-
- }
-
- Text {
- text: "<h2>The Qt Logo -- taking it easy</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
-
- transform: [
- Scale { xScale: 1.5; yScale: 1.2 } ,
-
- Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -45
- }
- ]
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/transformations1.qml document
The code block in \c image1 starting with \c transform specifies that the
\l {Item::transform}{transform} property will be a Rotation through -90
@@ -479,30 +320,7 @@ from \l Item. The rotation property is a real number that specifies the
angle in a clockwise direction for the rotation of the object. Here is the
code for our animated rotating image.
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 200; y: 100
- width: 100; height: 100
-
- // Animate a rotation
- transformOrigin: Item.Center
- NumberAnimation on rotation {
- from: 0; to: 360
- duration: 2000
- loops: Animation.Infinite
- }
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/number-animation1.qml document
The \c {transformOrigin: Item.Center} is redundant since this is the default
axis of rotation anyway. But if you change \c Center to \c BottomRight you
@@ -515,32 +333,7 @@ combination. For example, if the task had been to animate the rotation
about the y-axis passing through the center of the image then the following
code would do it.
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 200; y: 100
- width: 100; height: 100
-
- // Animate a rotation
- transform: Rotation {
- origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0
- NumberAnimation on angle {
- from: 0; to: 360;
- duration: 3000;
- loops: Animation.Infinite
- }
- }
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/number-animation2.qml document
Here there is a rectangle 600 by 400 pixels. Placed within that rectangle
is an image 100 by 100 pixels. It is rotated about the center of the image
@@ -569,31 +362,7 @@ will be animating the position and the size of the image.
First create two images
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
- }
-
- Image {
- id: image2
- source: "images/qt-logo.png"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/sequential-animation1.qml document
We will add to 'image1' a SequentialAnimation from x = 20 to the target of
x = 450. The 'from' values will be used because we will be repeating the
@@ -606,14 +375,7 @@ between the x values and over a given duration. After the NumberAnimation
there will be a PauseAnimation that will pause the animation for 500
milliseconds (half a second) simply for the visual effect.
- \code
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation { from: 20; to: 450; easing.type: "InOutQuad";
-duration: 2000 }
- PauseAnimation { duration: 500 }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/sequential-animation2.qml adding a sequential animation
A similar block of code is written for the animation of the 'y' value of
the position.
@@ -628,54 +390,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and
image1 in the background. When image1 passes image2 it will pass behind it.
The completed code looks like
- \code
- Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
- Image {
- id: image2
- source: "images/qt-logo.png"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
-
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 450
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
- }
-
- SequentialAnimation on y {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 250
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
- }
-
- SequentialAnimation on scale {
- loops: Animation.Infinite
- NumberAnimation { from: 1; to: 0.5; duration: 1000 }
- NumberAnimation { from: 0.5; to: 1; duration: 1000 }
- PauseAnimation { duration: 500 }
- }
- }
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/sequential-animation3.qml document
The \c {easing.type} has many options, expressed as a string. It specifies the
kind of equation that describes the acceleration of the property value, not
@@ -724,9 +439,6 @@ delivers some of the best examples that illustrate these new elements.
\endtable
-
-
-
\section1 Using States
A state is a defined set of values in the configuration of an object and
@@ -756,60 +468,7 @@ will be the default state. We will just go to 'night' by clicking and
holding the left mouse button down, releasing the mouse button will reverse
the process
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRectangle
- width: 600
- height: 400
- color: "black"
-
- Rectangle {
- id: sky
- width: 600
- height: 200
- y: 0
- color: "lightblue"
- }
-
- Rectangle {
- id: ground
- width: 600; height: 200
- y: 200
- color: "green"
- }
-
- MouseArea {
- id: mousearea
- anchors.fill: mainRectangle
- }
-
- states: [ State {
- name: "night"
- when: mousearea.pressed == true
- PropertyChanges { target: sky; color: "darkblue" }
- PropertyChanges { target: ground; color: "black" }
- },
- State {
- name: "daylight"
- when: mousearea.pressed == false
- PropertyChanges { target: sky; color: "lightblue" }
- PropertyChanges { target: ground; color: "green" }
- }
- ]
-
- transitions: [ Transition {
- from: "daylight"; to: "night"
- ColorAnimation { duration: 1000 }
- },
- Transition {
- from: "night"; to: "daylight"
- ColorAnimation { duration: 500 }
- }
- ]
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/states1.qml document
Several new things appear in this sample. Firstly, we use a \l MouseArea
element to detect mouse clicks in the \e mainRectangle. Secondly, we use
@@ -887,15 +546,15 @@ needle_shadow have the same default \e x and \e y values but the rotation origin
for the needle is slightly different so that a shadow will be evident as the
needle moves.
-\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow
+\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow
And the needle
-\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle
+\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle
The final image is the overlay which simply has a position defined.
-\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay
+\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay
\e {dialcontrol.qml} in the \e {examples/declarative/ui-components/dialcontrol} directory is the
main file of the example. It defines the visual environment that the Dial
@@ -903,17 +562,14 @@ will fit into. Because the \e Dial component and the images live in the \e
content sub-directory we will have to import this into \e dialcontrol.qml. So the
start of the file looks like
- \code
- import Qt 4.7
- import "content"
- \endcode
+\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml imports
The visual space is bound by a 300 by 300 pixel \l Rectangle which is given
a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle.
Inside the rectangle called 'container' is another rectangle with the
interesting name 'slider'.
-\snippet ../../examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0
+\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0
The Dial component, named 'dial, is \e anchored to the center of the main
rectangle. The \c value attribute of 'dial' is set to a value based on the
@@ -922,15 +578,7 @@ rectangle. The \c value attribute of 'dial' is set to a value based on the
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
- angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
- Behavior on angle {
- SpringAnimation {
- spring: 1.4
- damping: .15
- }
- }
- \endcode
+\snippet examples/declarative/ui-components/dialcontrol/Dial.qml needle angle
This is part of the \c needleRotation that rotates the needle and causes the
rotation of its shadow. \l SpringAnimation is an element that modifies the value
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index b4f4c83c93..f163a66a54 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -59,6 +59,16 @@
Equivalent to Q_DECLARE_METATYPE(TYPE) and Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
*/
+/*!
+ \macro QML_DECLARE_TYPEINFO(Type,Flags)
+ \relates QDeclarativeEngine
+
+ Declares additional properties of a type.
+
+ Current the only supported type info is \c QML_HAS_ATTACHED_PROPERTIES which
+ declares that the \c Type supports \l {Attached Properties}.
+*/
+
/*!
\fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc
index 68d56bf1c3..c0639dbd18 100644
--- a/doc/src/declarative/qtprogrammers.qdoc
+++ b/doc/src/declarative/qtprogrammers.qdoc
@@ -26,10 +26,9 @@
****************************************************************************/
/*!
-
\page qtprogrammers.html
\target qtprogrammers
-\title QML for Qt programmers
+\title QML for Qt Programmers
\section1 Overview
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 00771ed121..f2908bd300 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1442,10 +1442,8 @@
\endlist
\note If you want a 3rd party library to be included in your
- application bundle, then you must add an excplicit lib entry for
- that library to your application's .pro file. Otherwise, the
- \c macdeployqt tool will not copy the 3rd party .dylib into the
- bundle.
+ application bundle, then you must copy the library into the
+ bundle manually, after the bundle is created.
\c macdeployqt supports the following options:
\list
diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc
index b24127c6f2..50622cd3ac 100644
--- a/doc/src/development/qtestlib.qdoc
+++ b/doc/src/development/qtestlib.qdoc
@@ -31,6 +31,8 @@
\brief An overview of Qt's unit testing framework.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
\keyword qtestlib
The QTestLib framework, provided by Nokia, is a tool for unit
diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc
index f4d6b0d41f..7c643c2d38 100644
--- a/doc/src/examples/diagramscene.qdoc
+++ b/doc/src/examples/diagramscene.qdoc
@@ -265,7 +265,8 @@
\snippet examples/graphicsview/diagramscene/mainwindow.cpp 3
- This slot deletes the selected item, if any, from the scene. If
+ This slot deletes the selected item, if any, from the scene. It
+ deletes the arrows first in order to avoid to delete them twice. If
the item to be deleted is a \c DiagramItem, we also need to delete
arrows connected to it; we don't want arrows in the scene that
aren't connected to items in both ends.
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index 0d191c9fbb..b140562457 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -137,6 +137,7 @@
\o \l {declarative/cppextensions/referenceexamples/grouped}{Grouped Properties}
\o \l {declarative/cppextensions/referenceexamples/attached}{Attached Properties}
\o \l {declarative/cppextensions/referenceexamples/signal}{Signal Support}
+ \o \l {declarative/cppextensions/referenceexamples/methods}{Methods Support}
\o \l {declarative/cppextensions/referenceexamples/valuesource}{Property Value Source}
\o \l {declarative/cppextensions/referenceexamples/binding}{Binding}
\endlist
diff --git a/doc/src/examples/qml-extending.qdoc b/doc/src/examples/qml-extending.qdoc
index b419fe42f5..21ec3bb034 100644
--- a/doc/src/examples/qml-extending.qdoc
+++ b/doc/src/examples/qml-extending.qdoc
@@ -253,6 +253,20 @@ This example builds on:
*/
/*!
+\example declarative/cppextensions/referenceexamples/methods
+\title Extending QML - Methods Example
+
+This example builds on:
+\list
+\o \l {Extending QML - Default Property Example}
+\o \l {Extending QML - Inheritance and Coercion Example}
+\o \l {Extending QML - Object and List Property Types Example}
+\o \l {Extending QML - Adding Types Example}
+\endlist
+
+*/
+
+/*!
\example declarative/cppextensions/referenceexamples/valuesource
\title Extending QML - Property Value Source Example
diff --git a/doc/src/examples/qml-minehunt.qdoc b/doc/src/examples/qml-minehunt.qdoc
index be82302283..e1ff22f49b 100644
--- a/doc/src/examples/qml-minehunt.qdoc
+++ b/doc/src/examples/qml-minehunt.qdoc
@@ -30,7 +30,7 @@
\example demos/declarative/minehunt
This demo shows how to create a simple Minehunt game, using QML for the
- UI and a C++ plugin for the game logic.
+ UI and C++ for the game logic.
\image qml-minehunt-demo.png
*/
diff --git a/doc/src/examples/simpletreemodel.qdoc b/doc/src/examples/simpletreemodel.qdoc
index 88aa27ae0e..7d1f8fe5fa 100644
--- a/doc/src/examples/simpletreemodel.qdoc
+++ b/doc/src/examples/simpletreemodel.qdoc
@@ -41,10 +41,9 @@
of the data to simplify and standardize the way it is accessed.
Simple models represent data as a table of items, and allow views
to access this data via an
- \l{Model/View Programming#model-indexes} {index-based}
- system. More generally, models can be used to represent data in
- the form of a tree structure by allowing each item to act as a
- parent to a table of child items.
+ \l{Model/View Programming#Models}{index-based} system. More generally,
+ models can be used to represent data in the form of a tree structure
+ by allowing each item to act as a parent to a table of child items.
Before attempting to implement a tree model, it is worth considering whether
the data is supplied by an external source, or whether it is going to be
diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc
index e901124c45..61620f58c6 100644
--- a/doc/src/external-resources.qdoc
+++ b/doc/src/external-resources.qdoc
@@ -428,3 +428,18 @@
\externalpage http://developer.symbian.org/wiki/index.php/Deploying_a_Qt_Application
\title Deploying a Qt Application article
*/
+
+/*!
+ \externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm
+ \title ECMAScript Language Specification
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript
+ \title JavaScript
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript/About_JavaScript
+ \title About JavaScript
+*/
diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc
index 4134cfec40..cbc15589b3 100644
--- a/doc/src/frameworks-technologies/accessible.qdoc
+++ b/doc/src/frameworks-technologies/accessible.qdoc
@@ -36,6 +36,7 @@
\brief How to make your applications accessible to those with disabilities.
\ingroup technology-apis
+ \ingroup qt-basic-concepts
\ingroup best-practices
\tableofcontents
diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc
index 797326e38c..cf5fe73cd6 100644
--- a/doc/src/frameworks-technologies/containers.qdoc
+++ b/doc/src/frameworks-technologies/containers.qdoc
@@ -46,6 +46,7 @@
\title Container Classes
\ingroup technology-apis
\ingroup groups
+ \ingroup qt-basic-concepts
\keyword container class
\keyword container classes
diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc
index 71478230d0..20bb750edd 100644
--- a/doc/src/frameworks-technologies/graphicsview.qdoc
+++ b/doc/src/frameworks-technologies/graphicsview.qdoc
@@ -34,6 +34,8 @@
\page graphicsview.html
\title Graphics View Framework
\ingroup qt-graphics
+ \ingroup qt-basic-concepts
+
\brief An overview of the Graphics View framework for interactive 2D
graphics.
diff --git a/doc/src/frameworks-technologies/ipc.qdoc b/doc/src/frameworks-technologies/ipc.qdoc
index 26a8cecc71..775243a672 100644
--- a/doc/src/frameworks-technologies/ipc.qdoc
+++ b/doc/src/frameworks-technologies/ipc.qdoc
@@ -31,6 +31,7 @@
\brief Inter-Process communication in Qt applications.
\ingroup technology-apis
+ \ingroup qt-basic-concepts
\ingroup qt-network
Qt provides several ways to implement Inter-Process Communication
diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc
index 7167f97598..7a1fb403e1 100644
--- a/doc/src/frameworks-technologies/model-view-programming.qdoc
+++ b/doc/src/frameworks-technologies/model-view-programming.qdoc
@@ -32,6 +32,7 @@
/*!
\page model-view-programming.html
+ \ingroup qt-basic-concepts
\title Model/View Programming
\brief A guide to Qt's extensible model/view architecture.
diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc
index a66bae041b..5103bdc4a3 100644
--- a/doc/src/frameworks-technologies/plugins-howto.qdoc
+++ b/doc/src/frameworks-technologies/plugins-howto.qdoc
@@ -47,6 +47,8 @@
functionality provided by Qt.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
\keyword QT_DEBUG_PLUGINS
\keyword QT_NO_PLUGIN_CHECK
diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc
index 42a57ec723..a9ee0b2c5c 100644
--- a/doc/src/frameworks-technologies/richtext.qdoc
+++ b/doc/src/frameworks-technologies/richtext.qdoc
@@ -36,7 +36,8 @@
\brief An overview of Qt's rich text processing, editing and display features.
\ingroup frameworks-technologies
-
+ \ingroup qt-basic-concepts
+
\nextpage Rich Text Document Structure
The Scribe framework provides a set of classes for reading and manipulating
diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc
index 4003988168..f52fc92d9c 100644
--- a/doc/src/getting-started/demos.qdoc
+++ b/doc/src/getting-started/demos.qdoc
@@ -46,7 +46,7 @@
\o \inlineimage qtdemo-small.png
\o If you run the \l{Examples and Demos Launcher}, you'll see many of Qt's
widgets in action.
-
+
The \l{Qt Widget Gallery} also provides overviews of selected Qt
widgets in each of the styles used on various supported platforms.
\endtable
@@ -134,15 +134,23 @@
\section1 QtWebKit
\list
- \o \l{Web Browser} demonstrates how Qt's \l{WebKit in Qt}{WebKit module}
- can be used to implement a small Web browser.
+ \o \l{Web Browser} demonstrates how Qt's \l{QtWebKit} module can be used to
+ implement a small Web browser.
+ \endlist
+
+ \section1 Multimedia
+
+ \list
+ \o \l{demos/spectrum}{Spectrum Analyser} shows how the \l{QtMultimedia}
+ module can be used to manipulate audio as it is played.
\endlist
\section1 Phonon
\list
- \o \l{demos/qmediaplayer}{Media Player} demonstrates how the \l{Phonon Module} can be
- used to implement a basic media player application.
+ \o \l{demos/qmediaplayer}{Media Player} demonstrates how the
+ \l{Phonon Module}{Phonon module} can be used to implement a basic media player
+ application.
\endlist
\note The Phonon demos are currently not available for the MinGW platform.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index a533f1bda1..e8c85e6139 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -255,6 +255,7 @@
\o \l{graphicsview/flowlayout}{Flow Layout}
\o \l{graphicsview/simpleanchorlayout}{Simple Anchor Layout}
\o \l{graphicsview/weatheranchorlayout}{Weather Anchor Layout}
+ \o \l{graphicsview/basicgraphicslayouts}{Basic Graphics Layouts}
\endlist
Some examples demonstrate the use of graphics effects with canvas items.
@@ -344,7 +345,7 @@
\page examples-draganddrop.html
\ingroup all-examples
\title Drag and Drop Examples
- \brief How to access your platform's native darg and drop functionality
+ \brief How to access your platform's native drag and drop functionality.
\image draganddrop-examples.png
@@ -471,6 +472,7 @@
\o \l{network/googlesuggest}{Google Suggest}
\o \l{network/bearercloud}{Bearer Cloud}\raisedaster
\o \l{network/bearermonitor}{Bearer Monitor}
+ \o \l{network/securesocketclient}{Secure Socket Client}
\endlist
Examples marked with an asterisk (*) are fully documented.
@@ -609,6 +611,7 @@
\o \l{sql/querymodel}{Query Model}
\o \l{sql/relationaltablemodel}{Relational Table Model}
\o \l{sql/tablemodel}{Table Model}
+ \o \l{sql/masterdetail}{Master Detail}
\o \l{sql/sqlwidgetmapper}{SQL Widget Mapper}\raisedaster
\endlist
@@ -633,6 +636,7 @@
\o \l{xml/streambookmarks}{QXmlStream Bookmarks}\raisedaster
\o \l{xml/rsslisting}{RSS-Listing}
\o \l{xml/xmlstreamlint}{XML Stream Lint Example}\raisedaster
+ \o \l{xml/htmlinfo}{XML HTML Info}
\endlist
The XQuery/XPath and XML Schema engines in the QtXmlPatterns modules
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
index 6c857766b5..a19d281f4b 100644
--- a/doc/src/getting-started/gettingstartedqml.qdoc
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -26,1026 +26,1023 @@
****************************************************************************/
/*!
- \page qml-textEditor.html
-
- \title Getting Started programming with QML
- \ingroup gettingStarted
-
- Welcome to the world of QML - the declarative UI language. In this Getting
- Started guide, we create a simple text editor application using QML.
- After reading this guide, you should be ready to start developing your own
- applications using QML and Qt C++.
-
- \example tutorials/gettingStarted/gsQml
-
- \section1 QML to Build User Interfaces
-
- Here we are building is a simple text editor that con load, save,
- and perform some text manipulation. This guide consists of two parts. The
- first part involves designing the application layout and behaviors using
- declarative language in QML. For the second part, file loading and saving is
- implemented using Qt C++.
- Using \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++
- functions as properties that QML elements can use. By utilizing QML and Qt C++,
- we can efficiently decouple the interface logic from the application logic.
-
- \image qml-texteditor5_editmenu.png
-
- To run the QML example code, we merely provide the included \l{QML Viewer}{qmlviewer}
- tool with the QML file as the argument. The C++ portion of this tutorial assumes
- that the reader possesses basic knowledge of Qt's compilation procedures.
-
- \omit
- Tutorial chapters:
- \list 1
- \o \l {Defining a Button and a Menu}{Defining a Button and a Menu}
- \o \l {Implementing a Menu Bar}{Implementing a Menu Bar}
- \o \l {Building a Text Editor}{Building a Text Editor}
- \o \l {Decorating the Text Editor}{Decorating the Text Editor}
- \o \l {Extending QML using Qt C++}{Extending QML using Qt C++}
- \endlist
- \endomit
-
- \section1 Defining a Button and a Menu
-
- \section2 Basic Component - a Button
-
- We start our text editor by building a button. Functionally, a button has a mouse
- sensitive area and a label. Buttons perform actions when a user presses the button.
-
- In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The
- \c Rectangle element has properties to control the element's appearance and location.
-
- \code
- import Qt 4.7
- Rectangle {
- id: simplebutton
- color: "grey"
- width: 150; height: 75
-
- Text{
- id: buttonLabel
- anchors.centerIn: parent
- text: "button label"
- }
- }
- \endcode
-
- First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements
- we will later use. This line must exist for every QML file. Notice that the version
- of Qt modules is included in the import statement.
-
- This simple rectangle has a unique identifier, \c simplebutton, which is bound to the
- id property. The \c Rectangle element's properties are bound to values by listing the
- property, followed by a colon, then the value. In the code sample, the color \c grey
- is bound to the the Rectangle's \c color property. Similarly, we bind the \c width
- and \c height of the Rectangle.
-
- The \l {Text}{Text} element is a non-editable text field. We name this \c Text element
- \c buttonLabel. To set the string content of the Text field, we bind a value to the
- \c text property. The label is contained within the Rectangle and in order to center
- it in the middle, we assign the \c anchors of the Text element to its parent, which
- is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout
- assignments simpler.
-
- We save this code as \c SimpleButton.qml. Running qmlviewer with the file as the
- argument will display the grey rectangle with a text label.
-
- \image qml-texteditor1_simplebutton.png
-
- To implement the button click functionality, we can use QML's event handling. QML's event
- handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals
- are emitted and the connected slot is called.
-
- \code
- Rectangle{
- id:simplebutton
- ...
-
- MouseArea{
- id: buttonMouseArea
-
- anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors
- //onClicked handles valid mouse button clicks
- onClicked: console.log(buttonLabel.text + " clicked" )
- }
- }
- \endcode
-
- We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe
- the interactive area where mouse movements are detected. For our button, we anchor the
- whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is
- one way of accessing a specific property called \c fill inside a group of properties
- called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where
- items can anchor to another item, creating robust layouts.
-
- The \c MouseArea has many signal handlers that are called during mouse movements within
- the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called
- whenever the acceptable mouse button is clicked, the left click being the default. We
- can bind actions to the onClicked handler. In our example, \c console.log() outputs text
- whenever the mouse area is clicked. The function \c console.log() is a useful tool for
- debugging purposes and for outputting text.
-
- The code in \c SimpleButton.qml is sufficient to display a button on the screen and
- output text whenever it is clicked with a mouse.
-
- \code
- Rectangle {
- id:Button
- ...
-
- property color buttonColor: "lightblue"
- property color onHoverColor: "gold"
- property color borderColor: "white"
-
- signal buttonClick()
- onButtonClick: {
- console.log(buttonLabel.text + " clicked" )
- }
-
- MouseArea{
- onClicked: buttonClick()
- hoverEnabled: true
- onEntered: parent.border.color = onHoverColor
- onExited: parent.border.color = borderColor
- }
-
- //determines the color of the button by using the conditional operator
- color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
- }
- \endcode
-
- A fully functioning button is in \c Button.qml. The code snippets in this article
- have some code omitted, denoted by ellipses because they were either introduced
- earlier in the previous sections or irrelevant to the current code discussion.
-
- Custom properties are declared using the \c {property type name} syntax. In the
- code, the property \c buttonColor, of type \c color, is declared and bound to
- the value \c{"lightblue"}. The \c buttonColor is later used in a conditional
- operation to determine the buttons's fill color. Note that property value
- assignment is possible using the \c= equals sign, in addition to value binding
- using the \c : colon character. Custom properties allow internal items to be
- accessible outside of the Rectangle's scope. There are basic
- \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as
- a type called \c variant.
-
- By binding the \c onEntered and \c onExited signal handlers to colors, the
- button's border will turn yellow when the mouse hovers above the button and
- reverts the color when the mouse exits the mouse area.
-
- A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal
- keyword in front of the signal name. All signals have their handlers automatically
- created, their names starting with \c on. As a result, the \c onButtonClick is
- \c buttonClick's handler. The \c onButtonClick is then assigned an action to
- perform. In our button example, the \c onClicked mouse handler will simply call
- \c onButtonClick, which displays a text. The \c onButtonClick enables outside
- objects to access the \c {Button}'s mouse area easily. For example, items may
- have more than one \c MouseArea declarations and a \c buttonClick signal can
- make the distinction between the several \c MouseArea signal handlers better.
-
- We now have the basic knowledge to implement items in QML that can handle
- basic mouse movements. We created a \c Text label inside a \c Rectangle,
- customized its properties, and implemented behaviors that respond to mouse
- movements. This idea of creating elements within elements is repeated
- throughout the text editor application.
-
- This button is not useful unless used as a component to perform an action.
- In the next section, we will soon create a menu containing several of these
- buttons.
-
- \image qml-texteditor1_button.png
-
- \section2 Creating a Menu Page
-
- Up to this stage, we covered how to create elements and assign behaviors inside
- a single QML file. In this section, we will cover how to import QML elements and how
- to reuse some of the created components to build other components.
-
- Menus display the contents of a list, each item having the ability to perform an action.
- In QML, we can create a menu in several ways. First, we will create a menu containing
- buttons which will eventually perform different actions. The menu code is in
- \c FileMenu.qml.
-
- \code
- import Qt 4.7 \\import the main Qt QML module
- import folderName \\import the contents of the folder
- import Button.qml \\import a QML file
- import NewButton.qml as ButtonModule \\import a QML file and give it a name
- import script.js as Script \\import a Javascript file and name it as Script
- \endcode
-
- To use the \c Button element in \c FileMenu.qml, we need to import \c Button.qml.
- The syntax shown above, shows how to use the \c import keyword. However, the
- \c {import Button.qml} is not necessary; qmlviewer will import all the contents
- of the current directory. We can directly create a \c Button element by declaring
- \c Button{}, similar to a \c Rectangle{} declaration.
-
- \code
- In FileMenu.qml:
-
- Row{
- anchors.centerIn: parent
- spacing: parent.width/6
-
- Button{
- id: loadButton
- buttonColor: "lightgrey"
- label: "Load"
- }
- Button{
- buttonColor: "grey"
- id: saveButton
- label: "Save"
- }
- Button{
- id: exitButton
- label: "Exit"
- buttonColor: "darkgrey"
-
- onButtonClick: Qt.quit()
- }
- }
- \endcode
-
- In \c FileMenu.qml, we declare three \c Button elements. They are declared
- inside a \l {Row}{Row} element, a positioner that will position its children
- along a vertical row. The \c Button declaration resides in Button.qml,
- which is the same as the \c Button.qml we used in the previous section.
- New property bindings can be declared within the newly created buttons,
- effectively overwriting the properties set in \c Button.qml. The button
- called \c exitButton will quit and close the window when it is clicked.
- Note that the signal handler \c onButtonClick in \c Button.qml will be
- called in addition to the \c onButtonClick handler in \c exitButton.
-
- \image qml-texteditor1_filemenu.png
-
- The \c Row declaration is declared in a \c Rectangle, creating a rectangle
- container for the row of buttons. This additional rectangle creates an indirect
- way of organizing the row of buttons inside a menu.
-
- The declaration of the edit menu is very similar at this stage. The menu has
- buttons that have the labels: \c Copy, \c Paste, and \c {Select All}.
-
- \image qml-texteditor1_editmenu.png
-
- Armed with our knowledge of importing and customizing previously made
- components, we may now combine these menu pages to create a menu bar,
- consisting of buttons to select the menu, and look at how we may structure
- data using QML.
-
- \section1 Implementing a Menu Bar
-
- Our text editor application will need a way to display menus using a menu bar.
- The menu bar will switch the different menus and the user can choose which menu
- to display. Menu switching implies that the menus need more structure than
- merely displaying them in a row. QML uses models and views to structure data
- and display the structured data.
-
- \section2 Using Data Models and Views
-
- QML has different \l {Data Models}{data views} that display
- \l {Data Models}{data models}. Our menu bar will display the menus in a list,
- with a header that displays a row of menu names. The list of menus are declared
- inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel}
- element contains items that already have views such as \c Rectangle elements
- and imported UI elements. Other model types such as the \l {ListModel}{\c ListModel}
- element need a delegate to display their data.
-
- We declare two visual items in the \c menuListModel, the \c FileMenu and the
- \c EditMenu. We customize the two menus and display them using a
- \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations
- and a simple edit menu is defined in \c EditMenu.qml.
-
- \code
- VisualItemModel{
- id: menuListModel
- FileMenu{
- width: menuListView.width
- height: menuBar.height
- color: fileColor
- }
- EditMenu{
- color: editColor
- width: menuListView.width
- height: menuBar.height
- }
- }
- \endcode
-
- The \l {ListView}{ListView} element will display a model according to a delegate.
- The delegate may declare the model items to display in a \c Row element or display
- the items in a grid. Our \c menuListModel already has visible items, therefore,
- we do not need to declare a delegate.
-
- \code
- ListView{
- id: menuListView
-
- //Anchors are set to react to window anchors
- anchors.fill:parent
- anchors.bottom: parent.bottom
- width:parent.width
- height: parent.height
-
- //the model contains the data
- model: menuListModel
-
- //control the movement of the menu switching
- snapMode: ListView.SnapOneItem
- orientation: ListView.Horizontal
- boundsBehavior: Flickable.StopAtBounds
- flickDeceleration: 5000
- highlightFollowsCurrentItem: true
- highlightMoveDuration:240
- highlightRangeMode: ListView.StrictlyEnforceRange
- }
- \endcode
-
- Additionally, \c ListView inherits from \l {Flickable}{\c Flickable}, making
- the list respond to mouse drags and other gestures. The last portion of the
- code above sets \c Flickable properties to create the desired flicking movement
- to our view. In particular,the property \c highlightMoveDuration changes the
- duration of the flick transition. A higher \c highlightMoveDuration value
- results in slower menu switching.
-
- The \c ListView maintains the model items through an \c index and each visual
- item in the model is accessible through the \c index, in the order of the
- declaration. Changing the \c currentIndex effectively changes the highlighted
- item in the \c ListView. The header of our menu bar exemplify this effect.
- There are two buttons in a row, both changing the current menu when clicked.
- The \c fileButton changes the current menu to the file menu when clicked,
- the \c index being \c 0 because \c FileMenu is declared first in the
- \c menuListModel. Similarly, the \c editButton will change the current
- menu to the \c EditMenu when clicked.
-
- The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed
- at the front of the menu bar. Items with higher \c z values are displayed in front
- of items with lower \c z values. The default \c z value is \c 0.
-
- \code
- Rectangle{
- id: labelList
- ...
- z: 1
- Row{
- anchors.centerIn: parent
- spacing:40
- Button{
- label: "File"
- id: fileButton
- ...
- onButtonClick: menuListView.currentIndex = 0
- }
- Button{
- id: editButton
- label: "Edit"
- ...
- onButtonClick: menuListView.currentIndex = 1
- }
- }
- }
- \endcode
-
- The menu bar we just created can be flicked to access the menus or by clicking
- on the menu names at the top. Switching menu screens feel intuitive and responsive.
-
- \image qml-texteditor2_menubar.png
-
- \section1 Building a Text Editor
-
- \section2 Declaring a TextArea
-
- Our text editor is not a text editor if it didn't contain an editable text area.
- QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line
- editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text}
- element, which doesn't allow the user to directly edit the text.
-
- \code
- TextEdit{
- id: textEditor
- anchors.fill:parent
- width:parent.width; height:parent.height
- color:"midnightblue"
- focus: true
-
- wrapMode: TextEdit.Wrap
-
- onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle)
- }
- \endcode
-
- The editor has its font color property set and set to wrap the text. The
- \c TextEdit area is inside a flickable area that will scroll the text if the
- text cursor is outside the visible area. The function \c ensureVisible() will
- check if the cursor rectangle is outside the visible boundaries and move the
- text area accordingly. QML uses Javascript syntax for its scripts, and as previously
- mentioned, Javascript files can be imported and used within a QML file.
-
- \code
- function ensureVisible(r){
- if (contentX >= r.x)
- contentX = r.x;
- else if (contentX+width <= r.x+r.width)
- contentX = r.x+r.width-width;
- if (contentY >= r.y)
- contentY = r.y;
- else if (contentY+height <= r.y+r.height)
- contentY = r.y+r.height-height;
- }
- \endcode
-
- \section1 Combining Components for the Text Editor
-
- We are now ready to create the layout of our text editor using QML. The text
- editor has two components, the menu bar we created and the text area. QML allows
- us to reuse components, therefore making our code simpler, by importing components
- and customizing when necessary. Our text editor splits the window into two;
- one-third of the screen is dedicated to the menu bar and two-thirds of the screen
- displays the text area. The menu bar is displayed in front of any other elements.
-
- \code
- Rectangle{
-
- id: screen
- width: 1000; height: 1000
-
- //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar
- property int partition: height/3
-
- MenuBar{
- id:menuBar
- height: partition
- width:parent.width
- z: 1
- }
-
- TextArea{
- id:textArea
- anchors.bottom:parent.bottom
- y: partition
- color: "white"
- height: partition*2
- width:parent.width
- }
- }
- \endcode
-
- By importing reusable components, our \c TextEditor code looks much simpler.
- We can then customize the main application, without worrying about properties
- that already have defined behaviors. Using this approach, application layouts
- and UI components can be created easily.
-
- \image qml-texteditor3_texteditor.png
-
- \section1 Decorating the Text Editor
- \section2 Implementing a Drawer Interface
-
- Our text editor looks simple and we need to decorate it. Using QML, we can declare
- transitions and animate our text editor. Our menu bar is occupying one-third of the
- screen and it would be nice to have it only appear when we want it.
-
- We can add a drawer interface, that will contract or expand the menu bar when clicked.
- In our implementation, we have a thin rectangle that responds to mouse clicks. The
- \c drawer, as well as the application, has two sates: the "drawer is open" state and
- the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small
- height. There is a nested \l {Image}{Image} element declaring that an arrow icon will
- be centered inside the drawer. The drawer assigns a state to the whole application,
- with the identifier \c screen, whenever a user clicks the mouse area.
-
- \code
- Rectangle{
- id:drawer
- height:15
-
- Image{
- id: arrowIcon
- source: "images/arrow.png"
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- MouseArea{
- id: drawerMouseArea
- anchors.fill:parent
- onClicked:{
- if (screen.state == "DRAWER_CLOSED"){
- screen.state = "DRAWER_OPEN"
- }
- else if (screen.state == "DRAWER_OPEN"){
- screen.state = "DRAWER_CLOSED"
- }
- }
- ...
- }
- }
- \endcode
-
- A state is simply a collection of configurations and it is declared in a
- \l{State}{State} element. A list of states can be listed and bound to the
- \c states property. In our application, the two states are called
- \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in
- \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state,
- there are four items that will receive property changes. The first target,
- \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea
- will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea,
- the \c drawer, and the drawer's icon will undergo property changes to meet the
- current state.
-
- \code
-
- states:[
- State{
- name: "DRAWER_OPEN"
- PropertyChanges { target: menuBar; y:0}
- PropertyChanges { target: textArea; y: partition + drawer.height}
- PropertyChanges { target: drawer; y: partition}
- PropertyChanges { target: arrowIcon; rotation: 180}
- },
- State{
- name: "DRAWER_CLOSED"
- PropertyChanges { target: menuBar; y:-partition}
- PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height}
- PropertyChanges { target: drawer; y: 0}
- PropertyChanges { target: arrowIcon; rotation: 0}
- }
-
- ]
-
- \endcode
-
- State changes are abrupt and needs smoother transitions. Transitions between states
- are defined using the \l {Transition}{Transition} element, which can then bind to
- the item's \c transitions property. Our text editor has a state transition whenever
- the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the
- transition needs a \c from and a \c to state but for our transitions, we can use
- the wild card \c * symbol to denote that the transition applies to all state changes.
-
- During transitions, we can assign animations to the property changes. Our
- \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate
- this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare
- that the targets' properties will animate for a certain duration of time and using
- a certain easing curve. An easing curve controls the animation rates and
- interpolation behavior during state transitions. The easing curve we chose is
- \l{PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near
- the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation}
- article.
-
- \code
- transitions: [
- Transition{
- to: "*"
- NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint }
- NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
- NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
- }
- ]
- \endcode
-
- Another way of animating property changes is by declaring a \l {Behavior}{Behavior}
- element. A transition only works during state changes and \c Behavior can set an
- animation for a general property change. In the text editor, the arrow has a
- \c NumberAnimation animating its \c rotation property whenever the property changes.
-
- \code
- In TextEditor.qml:
-
- Behavior{
- NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }
- }
- \endcode
-
- Going back to our components with knowledge of states and animations, we can improve
- the appearances of the components. In \c Button.qml, we can add \c color and \c scale
- property changes when the button is clicked. Color types are animated using
- \l {ColorAnimation}{ColorAnimation} and numbers are animated using
- \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below
- is helpful when targeting a single property.
-
- \code
- In Button.qml:
- ...
-
- color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
- Behavior on color { ColorAnimation{ duration: 55} }
-
- scale: buttonMouseArea.pressed ? 1.1 : 1.00
- Behavior on scale { NumberAnimation{ duration: 55} }
- \endcode
-
- Additionally, we can enhance the appearances of our QML components by adding color
- effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient}
- element will override the \c color property of the element. You may declare a color
- in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is
- positioned using a scale, between \c 0.0 and \c 1.0.
-
- \code
- In MenuBar.qml
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#8C8F8C" }
- GradientStop { position: 0.17; color: "#6A6D6A" }
- GradientStop { position: 0.98;color: "#3F3F3F" }
- GradientStop { position: 1.0; color: "#0e1B20" }
- }
- \endcode
-
- This gradient is used by the menu bar to display a gradient simulating depth.
- The first color starts at \c 0.0 and the last color is at \c 1.0.
-
-
- \section2 Where to Go from Here
-
- We are finished building the user interface of a very simple text editor.
- Going forward, the user interface is complete, and we can implement the
- application logic using regular Qt and C++. QML works nicely as a prototyping
- tool, separating the application logic away from the UI design.
-
- \image qml-texteditor4_texteditor.png
-
- \section1 Extending QML using Qt C++
-
- Now that we have our text editor layout, we may now implement the text editor
- functionalities in C++. Using QML with C++ enables us to create our application
- logic using Qt. We can create a QML context in a C++ application using the
- \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML
- elements using a Graphics Scene. Alternatively, we can export our C++ code into
- a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application,
- we shall implement the load and save functions in C++ and export it as a plugin.
- This way, we only need to load the QML file directly instead of running an executable.
-
- \section2 Exposing C++ Classes to QML
-
- We will be implementing file loading and saving using Qt and C++. C++ classes
- and functions can be used in QML by registering them. The class also needs to be
- compiled as a Qt plugin and the QML file will need to know where the plugin is located.
-
- For our application, we need to create the following items:
- \list 1
- \o \c Directory class that will handle directory related operations
- \o \c File class which is a QObject, simulating the list of files in a directory
- \o plugin class that will register the class to the QML context
- \o Qt project file that will compile the plugin
- \o A \c qmldir file telling the qmlviewer tool where to find the plugin
- \endlist
-
- \section2 Building a Qt Plugin
-
- To build a plugin, we need to set the following in a Qt project file. First,
- the necessary sources, headers, and Qt modules need to be added into our
- project file. All the C++ code and project files are in the \c filedialog
- directory.
-
- \code
- In cppPlugins.pro:
-
- TEMPLATE = lib
- CONFIG += qt plugin
- QT += declarative
-
- DESTDIR += ../plugins
- OBJECTS_DIR = tmp
- MOC_DIR = tmp
-
- TARGET = FileDialog
-
- HEADERS += directory.h \
- file.h \
- dialogPlugin.h
-
- SOURCES += directory.cpp \
- file.cpp \
- dialogPlugin.cpp
- \endcode
-
- In particular, we compile Qt with the \c declarative module and configure it as a
- \c plugin, needing a \c lib template. We shall put the compiled plugin into the
- parent's \c plugins directory.
-
-
- \section2 Registering a Class into QML
-
- \code
- In dialogPlugin.h:
-
- #include <QtDeclarative/QDeclarativeExtensionPlugin>
-
- class DialogPlugin : public QDeclarativeExtensionPlugin
- {
- Q_OBJECT
-
- public:
- void registerTypes(const char *uri);
-
- };
-
- \endcode
-
- Our plugin class, \c DialogPlugin is a subclass of \l
- {QDeclarativeExtensionPlugin}{QDeclarativeExtensionPlugin}. We
- need to implement the inherited function, \l
- {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes}. The
- \c dialogPlugin.cpp file looks like this:
-
- \code
- DialogPlugin.cpp:
-
- #include "dialogPlugin.h"
- #include "directory.h"
- #include "file.h"
- #include <QtDeclarative/qdeclarative.h>
-
- void DialogPlugin::registerTypes(const char *uri){
-
- qmlRegisterType<Directory>(uri, 1, 0, "Directory");
- qmlRegisterType<File>(uri, 1, 0,"File");
- }
-
- Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin);
- \endcode
-
- The \l {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes}
- function registers our File and Directory classes into QML. This function
- needs the class name for its template, a major version number, a minor version
- number, and a name for our classes.
-
- We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2}
- macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT}
- macro at the top of our class. As well, we need to run \c qmake on the project
- file to generate the necessary meta-object code.
-
-
- \section2 Creating QML Properties in a C++ class
-
- We can create QML elements and properties using C++ and
- \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement
- properties using slots and signals, making Qt aware of these properties.
- These properties can then be used in QML.
-
- For the text editor, we need to be able to load and save files. Typically,
- these features are contained in a file dialog. Fortunately, we can use
- \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to
- implement directory reading and input/output streams.
-
- \code
- class Directory : public QObject{
-
- Q_OBJECT
-
- Q_PROPERTY(int filesCount READ filesCount CONSTANT)
- Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
- Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged)
- Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
-
- ...
- \endcode
-
- The \c Directory class uses Qt's Meta-Object System to register properties it
- needs to accomplish file handling. The \c Directory class is exported as a plugin
- and is useable in QML as the \c Directory element. Each of the listed properties
- using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property.
-
- The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and
- write functions into Qt's Meta-Object System. For example, the \c filename
- property, of type \l {QString}{QString}, is readable using the \c filename()
- function and writable using the function \c setFilename(). Additionally, there
- is a signal associated to the filename property called \c filenameChanged(),
- which is emitted whenever the property changes. The read and write functions
- are declared as \c public in the header file.
-
- Similarly, we have the other properties declared according to their uses. The
- \c filesCount property indicates the number of files in a directory. The filename
- property is set to the currently selected file's name and the loaded/saved file
- content is stored in \c fileContent property.
-
- \code
- Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
- \endcode
-
- The \c files list property is a list of all the filtered files in a directory.
- The \c Directory class is implemented to filter out invalid text files; only
- files with a \c .txt extension are valid. Further, \l {QList}{QLists} can be
- used in QML files by declaring them as a \c QDeclarativeListProperty in C++.
- The templated object needs to inherit from a \l {QObject}{QObject}, therefore,
- the \c File class must also inherit from \c QObject. In the \c Directory class,
- the list of \c File objects is stored in a \c QList called \c m_fileList.
-
- \code
- class File : public QObject{
-
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-
- ...
- };
- \endcode
-
- The properties can then be used in QML as part of the \c Directory element's
- properties. Note that we do not have to create an identifier \c id property
- in our C++ code.
-
- \code
- Directory{
- id: directory
-
- filesCount
- filename
- fileContent
- files
-
- files[0].name
- }
-
- \endcode
-
- Because QML uses Javascript's syntax and structure, we can iterate through
- the list of files and retrieve its properties. To retrieve the first file's
- name property, we can call \c { files[0].name }.
-
- Regular C++ functions are also accessible from QML. The file loading and saving
- functions are implemented in C++ and declared using the
- \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions
- as a \c slot and the functions will be accessible from QML.
-
- \code
- In Directory.h:
-
- Q_INVOKABLE void saveFile();
- Q_INVOKABLE void loadFile();
- \endcode
-
- The \c Directory class also has to notify other objects whenever the directory
- contents change. This feature is performed using a \c signal. As previously
- mentioned, QML signals have a corresponding handler with their names prepended
- with \c on. The signal is called \c directoryChanged and it is emitted whenever
- there is a directory refresh. The refresh simply reloads the directory contents
- and updates the list of valid files in the directory. QML items can then be
- notified by attaching an action to the \c onDirectoryChanged signal handler.
-
- The \c list properties need to be explored further. This is because list
- properties use callbacks to access and modify the list contents. The list
- property is of type \c QDeclarativeListProperty<File>. Whenever the list
- is accessed, the accessor function needs to return a
- \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a
- \c QObject derivative. Further, to create the
- \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor
- and modifiers need to be passed to the consructor as function pointers. The list,
- a \c QList in our case, also needs to be a list of \c File pointers.
-
- The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty}
- constructor and the \c Directory implementation:
- \code
- QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 )
- QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
- \endcode
-
- The constructor passes pointers to functions that will append the list, count
- the list, retrieve the item using an index, and empty the list. Only the append
- function is mandatory. Note that the function pointers must match the definition
- of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction},
- \l {QDeclarativeListProperty::CountFunction}{CountFunction},
- \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or
- \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}.
-
- \code
- void appendFiles(QDeclarativeListProperty<File> * property, File * file)
- File* fileAt(QDeclarativeListProperty<File> * property, int index)
- int filesSize(QDeclarativeListProperty<File> * property)
- void clearFilesPtr(QDeclarativeListProperty<File> *property)
- \endcode
-
- To simplify our file dialog, the \c Directory class filters out invalid text
- files, which are files that do not have a \c .txt extension. If a file name
- doesn't have the \c .txt extension, then it won't be seen in our file dialog.
- Also, the implementation makes sure that saved files have a \c .txt extension in
- the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file
- and to output the file contents to a file.
-
- With our \c Directory element, we can retrieve the files as a list, know how many
- text files is in the application directory, get the file's name and content as a
- string, and be notified whenever there are changes in the directory contents.
-
- To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run
- \c make to build and transfer the plugin to the \c plugins directory.
-
-
- \section2 Importing a Plugin in QML
-
- The qmlviewer tool imports files that are in the same directory as the
- application. We can also create a \c qmldir file containing the locations of
- QML files we wish to import. The \c qmldir file can also store locations of
- plugins and other resources.
-
- \code
- In qmldir:
-
- Button ./Button.qml
- FileDialog ./FileDialog.qml
- TextArea ./TextArea.qml
- TextEditor ./TextEditor.qml
- EditMenu ./EditMenu.qml
-
- plugin FileDialog plugins
- \endcode
-
- The plugin we just created is called \c FileDialog, as indicated by the
- \c TARGET field in the project file. The compiled plugin is in the \c plugins directory.
-
-
- \section2 Integrating a File Dialog into the File Menu
-
- Our \c FileMenu needs to display the \c FileDialog element, containing a list of
- the text files in a directory thus allowing the user to select the file by
- clicking on the list. We also need to assign the save, load, and new buttons
- to their respective actions. The FileMenu contains an editable text input to
- allow the user to type a file name using the keyboard.
-
- The \c Directory element is used in the \c FileMenu.qml file and it notifies the
- \c FileDialog element that the directory refreshed its contents. This notification
- is performed in the signal handler, \c onDirectoryChanged.
-
- \code
- In FileMenu.qml:
-
- Directory{
- id:directory
- filename: textInput.text
- onDirectoryChanged: fileDialog.notifyRefresh()
- }
- \endcode
-
- Keeping with the simplicity of our application, the file dialog will always be
- visible and will not display invalid text files, which do not have a \c .txt
- extension to their filenames.
-
- \code
- In FileDialog.qml:
-
- signal notifyRefresh()
- onNotifyRefresh: dirView.model = directory.files
- \endcode
-
- The \c FileDialog element will display the contents of a directory by reading its
- list property called \c files. The files are used as the model of a
- \l {GridView}{GridView} element, which displays data items in a grid according
- to a delegate. The delegate handles the appearance of the model and our file
- dialog will simply create a grid with text centered in the middle. Clicking on
- the file name will result in the appearance of a rectangle to highlight the file
- name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted,
- reloading the files in the directory.
-
- \code
- In FileMenu.qml:
-
- Button{
- id: newButton
- label: "New"
- onButtonClick:{
- textArea.textContent = ""
- }
- }
- Button{
- id: loadButton
- label: "Load"
- onButtonClick:{
- directory.filename = textInput.text
- directory.loadFile()
- textArea.textContent = directory.fileContent
- }
- }
- Button{
- id: saveButton
- label: "Save"
- onButtonClick:{
- directory.fileContent = textArea.textContent
- directory.filename = textInput.text
- directory.saveFile()
- }
- }
- Button{
- id: exitButton
- label: "Exit"
- onButtonClick:{
- Qt.quit()
- }
- }
- \endcode
-
- Our \c FileMenu can now connect to their respective actions. The \c saveButton
- will transfer the text from the \c TextEdit onto the directory's \c fileContent
- property, then copy its file name from the editable text input. Finally, the button
- calls the \c saveFile() function, saving the file. The \c sloadButton has a similar
- execution. Also, the \c New action will empty the contents of the \c TextEdit.
-
- Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy,
- paste, and select all the text in the text editor.
-
- \image qml-texteditor5_filemenu.png
-
- \section1 Text Editor Completion
-
- \image qml-texteditor5_newfile.png
-
- The application can function as a simple text editor, able to accept text
- and save the text into a file. The text editor can also load from a file and
- perform text manipulation.
-
-
-*/ \ No newline at end of file
+ \page gettingstartedqml.html
+ \title Getting Started Programming with QML
+ \ingroup gettingStarted
+
+ Welcome to the world of QML, the declarative UI language. In this Getting
+ Started guide, we will create a simple text editor application using QML.
+ After reading this guide, you should be ready to develop your own applications
+ using QML and Qt C++.
+
+ \section1 QML to Build User Interfaces
+
+ The application we are building is a simple text editor that will load, save,
+ and perform some text manipulation. This guide will consist of two parts. The
+ first part will involve designing the application layout and behaviors using
+ declarative language in QML. For the second part, file loading and saving will
+ be implemented using Qt C++. Using
+ \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ functions
+ as properties that QML elements can use. Utilizing QML and Qt C++, we can
+ efficiently decouple the interface logic from the application logic.
+
+ \image qml-texteditor5_editmenu.png
+
+ To run the QML example code, merely provide the included \l{QML Viewer}{qmlviewer}
+ tool with the QML file as the argument. The C++ portion of this tutorial assumes
+ that the reader possesses basic knowledge of Qt's compilation procedures.
+
+ Tutorial chapters:
+ \list 1
+ \o \l {Defining a Button and a Menu}{Defining a Button and a Menu}
+ \o \l {Implementing a Menu Bar}{Implementing a Menu Bar}
+ \o \l {Building a Text Editor}{Building a Text Editor}
+ \o \l {Decorating the Text Editor}{Decorating the Text Editor}
+ \o \l {Extending QML using Qt C++}{Extending QML using Qt C++}
+ \endlist
+
+ \section1 Defining a Button and a Menu
+
+ \section2 Basic Component - a Button
+
+ We start our text editor by building a button. Functionally, a button has a mouse
+ sensitive area and a label. Buttons perform actions when a user presses the button.
+
+ In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The
+ \c Rectangle element has properties to control the element's appearance and location.
+
+ \code
+ import Qt 4.7
+ Rectangle {
+ id: simplebutton
+ color: "grey"
+ width: 150; height: 75
+
+ Text{
+ id: buttonLabel
+ anchors.centerIn: parent
+ text: "button label"
+ }
+ }
+ \endcode
+
+ First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements
+ we will later use. This line must exist for every QML file. Notice that the version
+ of Qt modules is included in the import statement.
+
+ This simple rectangle has a unique identifier, \c simplebutton, which is bound to the
+ id property. The \c Rectangle element's properties are bound to values by listing the
+ property, followed by a colon, then the value. In the code sample, the color \c grey
+ is bound to the the Rectangle's \c color property. Similarly, we bind the \c width
+ and \c height of the Rectangle.
+
+ The \l {Text}{Text} element is a non-editable text field. We name this \c Text element
+ \c buttonLabel. To set the string content of the Text field, we bind a value to the
+ \c text property. The label is contained within the Rectangle and in order to center
+ it in the middle, we assign the \c anchors of the Text element to its parent, which
+ is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout
+ assignments simpler.
+
+ We shall save this code as \c SimpleButton.qml. Running qmlviewer with the file as the
+ argument will display the grey rectangle with a text label.
+
+ \image qml-texteditor1_simplebutton.png
+
+ To implement the button click functionality, we can use QML's event handling. QML's event
+ handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals
+ are emitted and the connected slot is called.
+
+ \code
+ Rectangle{
+ id:simplebutton
+ ...
+
+ MouseArea{
+ id: buttonMouseArea
+
+ anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors
+ //onClicked handles valid mouse button clicks
+ onClicked: console.log(buttonLabel.text + " clicked" )
+ }
+ }
+ \endcode
+
+ We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe
+ the interactive area where mouse movements are detected. For our button, we anchor the
+ whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is
+ one way of accessing a specific property called \c fill inside a group of properties
+ called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where
+ items can anchor to another item, creating robust layouts.
+
+ The \c MouseArea has many signal handlers that are called during mouse movements within
+ the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called
+ whenever the acceptable mouse button is clicked, the left click being the default. We
+ can bind actions to the onClicked handler. In our example, \c console.log() outputs text
+ whenever the mouse area is clicked. The function \c console.log() is a useful tool for
+ debugging purposes and for outputting text.
+
+ The code in \c SimpleButton.qml is sufficient to display a button on the screen and
+ output text whenever it is clicked with a mouse.
+
+ \code
+ Rectangle {
+ id:Button
+ ...
+
+ property color buttonColor: "lightblue"
+ property color onHoverColor: "gold"
+ property color borderColor: "white"
+
+ signal buttonClick()
+ onButtonClick: {
+ console.log(buttonLabel.text + " clicked" )
+ }
+
+ MouseArea{
+ onClicked: buttonClick()
+ hoverEnabled: true
+ onEntered: parent.border.color = onHoverColor
+ onExited: parent.border.color = borderColor
+ }
+
+ //determines the color of the button by using the conditional operator
+ color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
+ }
+ \endcode
+
+ A fully functioning button is in \c Button.qml. The code snippets in this article
+ have some code omitted, denoted by ellipses because they were either introduced
+ earlier in the previous sections or irrelevant to the current code discussion.
+
+ Custom properties are declared using the \c {property type name} syntax. In the
+ code, the property \c buttonColor, of type \c color, is declared and bound to
+ the value \c{"lightblue"}. The \c buttonColor is later used in a conditional
+ operation to determine the buttons's fill color. Note that property value
+ assignment is possible using the \c= equals sign, in addition to value binding
+ using the \c : colon character. Custom properties allow internal items to be
+ accessible outside of the Rectangle's scope. There are basic
+ \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as
+ a type called \c variant.
+
+ By binding the \c onEntered and \c onExited signal handlers to colors, the
+ button's border will turn yellow when the mouse hovers above the button and
+ reverts the color when the mouse exits the mouse area.
+
+ A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal
+ keyword in front of the signal name. All signals have their handlers automatically
+ created, their names starting with \c on. As a result, the \c onButtonClick is
+ \c buttonClick's handler. The \c onButtonClick is then assigned an action to
+ perform. In our button example, the \c onClicked mouse handler will simply call
+ \c onButtonClick, which displays a text. The \c onButtonClick enables outside
+ objects to access the \c {Button}'s mouse area easily. For example, items may
+ have more than one \c MouseArea declarations and a \c buttonClick signal can
+ make the distinction between the several \c MouseArea signal handlers better.
+
+ We now have the basic knowledge to implement items in QML that can handle
+ basic mouse movements. We created a \c Text label inside a \c Rectangle,
+ customized its properties, and implemented behaviors that respond to mouse
+ movements. This idea of creating elements within elements is repeated
+ throughout the text editor application.
+
+ This button is not useful unless used as a component to perform an action.
+ In the next section, we will soon create a menu containing several of these
+ buttons.
+
+ \image qml-texteditor1_button.png
+
+ \section2 Creating a Menu Page
+
+ Up to this stage, we covered how to create elements and assign behaviors inside
+ a single QML file. In this section, we will cover how to import QML elements and how
+ to reuse some of the created components to build other components.
+
+ Menus display the contents of a list, each item having the ability to perform an action.
+ In QML, we can create a menu in several ways. First, we will create a menu containing
+ buttons which will eventually perform different actions. The menu code is in
+ \c FileMenu.qml.
+
+ \code
+ import Qt 4.7 \\import the main Qt QML module
+ import "folderName" \\import the contents of the folder
+ import "script.js" as Script \\import a Javascript file and name it as Script
+ \endcode
+
+ The syntax shown above shows how to use the \c import keyword. This is required to
+ use JavaScript files, or QML files that are not within the same directory. Since
+ \c Button.qml is in the same directory as \c FileMenu.qml, we do not need to import
+ the \c Button.qml file to use it. We can directly create a \c Button element by declaring
+ \c Button{}, similar to a \c Rectangle{} declaration.
+
+ \code
+ In FileMenu.qml:
+
+ Row{
+ anchors.centerIn: parent
+ spacing: parent.width/6
+
+ Button{
+ id: loadButton
+ buttonColor: "lightgrey"
+ label: "Load"
+ }
+ Button{
+ buttonColor: "grey"
+ id: saveButton
+ label: "Save"
+ }
+ Button{
+ id: exitButton
+ label: "Exit"
+ buttonColor: "darkgrey"
+
+ onButtonClick: Qt.quit()
+ }
+ }
+ \endcode
+
+ In \c FileMenu.qml, we declare three \c Button elements. They are declared
+ inside a \l {Row}{Row} element, a positioner that will position its children
+ along a vertical row. The \c Button declaration resides in Button.qml,
+ which is the same as the \c Button.qml we used in the previous section.
+ New property bindings can be declared within the newly created buttons,
+ effectively overwriting the properties set in \c Button.qml. The button
+ called \c exitButton will quit and close the window when it is clicked.
+ Note that the signal handler \c onButtonClick in \c Button.qml will be
+ called in addition to the \c onButtonClick handler in \c exitButton.
+
+ \image qml-texteditor1_filemenu.png
+
+ The \c Row declaration is declared in a \c Rectangle, creating a rectangle
+ container for the row of buttons. This additional rectangle creates an indirect
+ way of organizing the row of buttons inside a menu.
+
+ The declaration of the edit menu is very similar at this stage. The menu has
+ buttons that have the labels: \c Copy, \c Paste, and \c {Select All}.
+
+ \image qml-texteditor1_editmenu.png
+
+ Armed with our knowledge of importing and customizing previously made
+ components, we may now combine these menu pages to create a menu bar,
+ consisting of buttons to select the menu, and look at how we may structure
+ data using QML.
+
+ \section1 Implementing a Menu Bar
+
+ Our text editor application will need a way to display menus using a menu bar.
+ The menu bar will switch the different menus and the user can choose which menu
+ to display. Menu switching implies that the menus need more structure than
+ merely displaying them in a row. QML uses models and views to structure data
+ and display the structured data.
+
+ \section2 Using Data Models and Views
+
+ QML has different \l {Data Models}{data views} that display
+ \l {Data Models}{data models}. Our menu bar will display the menus in a list,
+ with a header that displays a row of menu names. The list of menus are declared
+ inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel}
+ element contains items that already have views such as \c Rectangle elements
+ and imported UI elements. Other model types such as the \l{ListModel}{\c ListModel}
+ element need a delegate to display their data.
+
+ We declare two visual items in the \c menuListModel, the \c FileMenu and the
+ \c EditMenu. We customize the two menus and display them using a
+ \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations
+ and a simple edit menu is defined in \c EditMenu.qml.
+
+ \code
+ VisualItemModel{
+ id: menuListModel
+ FileMenu{
+ width: menuListView.width
+ height: menuBar.height
+ color: fileColor
+ }
+ EditMenu{
+ color: editColor
+ width: menuListView.width
+ height: menuBar.height
+ }
+ }
+ \endcode
+
+ The \l {ListView}{ListView} element will display a model according to a delegate.
+ The delegate may declare the model items to display in a \c Row element or display
+ the items in a grid. Our \c menuListModel already has visible items, therefore,
+ we do not need to declare a delegate.
+
+ \code
+ ListView{
+ id: menuListView
+
+ //Anchors are set to react to window anchors
+ anchors.fill:parent
+ anchors.bottom: parent.bottom
+ width:parent.width
+ height: parent.height
+
+ //the model contains the data
+ model: menuListModel
+
+ //control the movement of the menu switching
+ snapMode: ListView.SnapOneItem
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ flickDeceleration: 5000
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration:240
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ }
+ \endcode
+
+ Additionally, \c ListView inherits from \l{Flickable}{\c Flickable}, making
+ the list respond to mouse drags and other gestures. The last portion of the
+ code above sets \c Flickable properties to create the desired flicking movement
+ to our view. In particular,the property \c highlightMoveDuration changes the
+ duration of the flick transition. A higher \c highlightMoveDuration value
+ results in slower menu switching.
+
+ The \c ListView maintains the model items through an \c index and each visual
+ item in the model is accessible through the \c index, in the order of the
+ declaration. Changing the \c currentIndex effectively changes the highlighted
+ item in the \c ListView. The header of our menu bar exemplify this effect.
+ There are two buttons in a row, both changing the current menu when clicked.
+ The \c fileButton changes the current menu to the file menu when clicked,
+ the \c index being \c 0 because \c FileMenu is declared first in the
+ \c menuListModel. Similarly, the \c editButton will change the current
+ menu to the \c EditMenu when clicked.
+
+ The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed
+ at the front of the menu bar. Items with higher \c z values are displayed in front
+ of items with lower \c z values. The default \c z value is \c 0.
+
+ \code
+ Rectangle{
+ id: labelList
+ ...
+ z: 1
+ Row{
+ anchors.centerIn: parent
+ spacing:40
+ Button{
+ label: "File"
+ id: fileButton
+ ...
+ onButtonClick: menuListView.currentIndex = 0
+ }
+ Button{
+ id: editButton
+ label: "Edit"
+ ...
+ onButtonClick: menuListView.currentIndex = 1
+ }
+ }
+ }
+ \endcode
+
+ The menu bar we just created can be flicked to access the menus or by clicking
+ on the menu names at the top. Switching menu screens feel intuitive and responsive.
+
+ \image qml-texteditor2_menubar.png
+
+ */
+
+ /*!
+ \page qml-textEditor3.html
+ \title Building a Text Editor
+
+ \section1 Declaring a TextArea
+
+ Our text editor is not a text editor if it didn't contain an editable text area.
+ QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line
+ editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text}
+ element, which doesn't allow the user to directly edit the text.
+
+ \code
+ TextEdit{
+ id: textEditor
+ anchors.fill:parent
+ width:parent.width; height:parent.height
+ color:"midnightblue"
+ focus: true
+
+ wrapMode: TextEdit.Wrap
+
+ onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle)
+ }
+ \endcode
+
+ The editor has its font color property set and set to wrap the text. The
+ \c TextEdit area is inside a flickable area that will scroll the text if the
+ text cursor is outside the visible area. The function \c ensureVisible() will
+ check if the cursor rectangle is outside the visible boundaries and move the
+ text area accordingly. QML uses Javascript syntax for its scripts, and as previously
+ mentioned, Javascript files can be imported and used within a QML file.
+
+ \code
+ function ensureVisible(r){
+ if (contentX >= r.x)
+ contentX = r.x;
+ else if (contentX+width <= r.x+r.width)
+ contentX = r.x+r.width-width;
+ if (contentY >= r.y)
+ contentY = r.y;
+ else if (contentY+height <= r.y+r.height)
+ contentY = r.y+r.height-height;
+ }
+ \endcode
+
+ \section1 Combining Components for the Text Editor
+
+ We are now ready to create the layout of our text editor using QML. The text
+ editor has two components, the menu bar we created and the text area. QML allows
+ us to reuse components, therefore making our code simpler, by importing components
+ and customizing when necessary. Our text editor splits the window into two;
+ one-third of the screen is dedicated to the menu bar and two-thirds of the screen
+ displays the text area. The menu bar is displayed in front of any other elements.
+
+ \code
+ Rectangle{
+
+ id: screen
+ width: 1000; height: 1000
+
+ //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar
+ property int partition: height/3
+
+ MenuBar{
+ id:menuBar
+ height: partition
+ width:parent.width
+ z: 1
+ }
+
+ TextArea{
+ id:textArea
+ anchors.bottom:parent.bottom
+ y: partition
+ color: "white"
+ height: partition*2
+ width:parent.width
+ }
+ }
+ \endcode
+
+ By importing reusable components, our \c TextEditor code looks much simpler.
+ We can then customize the main application, without worrying about properties
+ that already have defined behaviors. Using this approach, application layouts
+ and UI components can be created easily.
+
+ \image qml-texteditor3_texteditor.png
+
+ */
+
+ /*!
+ \page qml-textEditor4
+ \title Decorating the Text Editor
+ \section1 Implementing a Drawer Interface
+
+ Our text editor looks simple and we need to decorate it. Using QML, we can declare
+ transitions and animate our text editor. Our menu bar is occupying one-third of the
+ screen and it would be nice to have it only appear when we want it.
+
+ We can add a drawer interface, that will contract or expand the menu bar when clicked.
+ In our implementation, we have a thin rectangle that responds to mouse clicks. The
+ \c drawer, as well as the application, has two sates: the "drawer is open" state and
+ the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small
+ height. There is a nested \l {Image}{Image} element declaring that an arrow icon will
+ be centered inside the drawer. The drawer assigns a state to the whole application,
+ with the identifier \c screen, whenever a user clicks the mouse area.
+
+ \code
+ Rectangle{
+ id:drawer
+ height:15
+
+ Image{
+ id: arrowIcon
+ source: "images/arrow.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ MouseArea{
+ id: drawerMouseArea
+ anchors.fill:parent
+ onClicked:{
+ if (screen.state == "DRAWER_CLOSED"){
+ screen.state = "DRAWER_OPEN"
+ }
+ else if (screen.state == "DRAWER_OPEN"){
+ screen.state = "DRAWER_CLOSED"
+ }
+ }
+ ...
+ }
+ }
+ \endcode
+
+ A state is simply a collection of configurations and it is declared in a
+ \l{State}{State} element. A list of states can be listed and bound to the
+ \c states property. In our application, the two states are called
+ \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in
+ \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state,
+ there are four items that will receive property changes. The first target,
+ \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea
+ will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea,
+ the \c drawer, and the drawer's icon will undergo property changes to meet the
+ current state.
+
+ \code
+
+ states:[
+ State{
+ name: "DRAWER_OPEN"
+ PropertyChanges { target: menuBar; y:0}
+ PropertyChanges { target: textArea; y: partition + drawer.height}
+ PropertyChanges { target: drawer; y: partition}
+ PropertyChanges { target: arrowIcon; rotation: 180}
+ },
+ State{
+ name: "DRAWER_CLOSED"
+ PropertyChanges { target: menuBar; y:-partition}
+ PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height}
+ PropertyChanges { target: drawer; y: 0}
+ PropertyChanges { target: arrowIcon; rotation: 0}
+ }
+
+ ]
+
+ \endcode
+
+ State changes are abrupt and needs smoother transitions. Transitions between states
+ are defined using the \l {Transition}{Transition} element, which can then bind to
+ the item's \c transitions property. Our text editor has a state transition whenever
+ the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the
+ transition needs a \c from and a \c to state but for our transitions, we can use
+ the wild card \c * symbol to denote that the transition applies to all state changes.
+
+ During transitions, we can assign animations to the property changes. Our
+ \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate
+ this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare
+ that the targets' properties will animate for a certain duration of time and using
+ a certain easing curve. An easing curve controls the animation rates and
+ interpolation behavior during state transitions. The easing curve we chose is
+ \l{PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near
+ the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation}
+ article.
+
+ \code
+ transitions: [
+ Transition{
+ to: "*"
+ NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint }
+ NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
+ NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
+ }
+ ]
+ \endcode
+
+ Another way of animating property changes is by declaring a \l {Behavior}{Behavior}
+ element. A transition only works during state changes and \c Behavior can set an
+ animation for a general property change. In the text editor, the arrow has a
+ \c NumberAnimation animating its \c rotation property whenever the property changes.
+
+ \code
+ In TextEditor.qml:
+
+ Behavior{
+ NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }
+ }
+ \endcode
+
+ Going back to our components with knowledge of states and animations, we can improve
+ the appearances of the components. In \c Button.qml, we can add \c color and \c scale
+ property changes when the button is clicked. Color types are animated using
+ \l {ColorAnimation}{ColorAnimation} and numbers are animated using
+ \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below
+ is helpful when targeting a single property.
+
+ \code
+ In Button.qml:
+ ...
+
+ color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
+ Behavior on color { ColorAnimation{ duration: 55} }
+
+ scale: buttonMouseArea.pressed ? 1.1 : 1.00
+ Behavior on scale { NumberAnimation{ duration: 55} }
+ \endcode
+
+ Additionally, we can enhance the appearances of our QML components by adding color
+ effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient}
+ element will override the \c color property of the element. You may declare a color
+ in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is
+ positioned using a scale, between \c 0.0 and \c 1.0.
+
+ \code
+ In MenuBar.qml
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#8C8F8C" }
+ GradientStop { position: 0.17; color: "#6A6D6A" }
+ GradientStop { position: 0.98;color: "#3F3F3F" }
+ GradientStop { position: 1.0; color: "#0e1B20" }
+ }
+ \endcode
+
+ This gradient is used by the menu bar to display a gradient simulating depth.
+ The first color starts at \c 0.0 and the last color is at \c 1.0.
+
+
+ \section2 Where to Go from Here
+
+ We are finished building the user interface of a very simple text editor.
+ Going forward, the user interface is complete, and we can implement the
+ application logic using regular Qt and C++. QML works nicely as a prototyping
+ tool, separating the application logic away from the UI design.
+
+ \image qml-texteditor4_texteditor.png
+
+ \section1 Extending QML using Qt C++
+
+ Now that we have our text editor layout, we may now implement the text editor
+ functionalities in C++. Using QML with C++ enables us to create our application
+ logic using Qt. We can create a QML context in a C++ application using the
+ \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML
+ elements using a Graphics Scene. Alternatively, we can export our C++ code into
+ a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application,
+ we shall implement the load and save functions in C++ and export it as a plugin.
+ This way, we only need to load the QML file directly instead of running an executable.
+
+ \section2 Exposing C++ Classes to QML
+
+ We will be implementing file loading and saving using Qt and C++. C++ classes
+ and functions can be used in QML by registering them. The class also needs to be
+ compiled as a Qt plugin and the QML file will need to know where the plugin is located.
+
+ For our application, we need to create the following items:
+ \list 1
+ \o \c Directory class that will handle directory related operations
+ \o \c File class which is a QObject, simulating the list of files in a directory
+ \o plugin class that will register the class to the QML context
+ \o Qt project file that will compile the plugin
+ \o A \c qmldir file telling the qmlviewer tool where to find the plugin
+ \endlist
+
+ \section2 Building a Qt Plugin
+
+ To build a plugin, we need to set the following in a Qt project file. First,
+ the necessary sources, headers, and Qt modules need to be added into our
+ project file. All the C++ code and project files are in the \c filedialog
+ directory.
+
+ \code
+ In cppPlugins.pro:
+
+ TEMPLATE = lib
+ CONFIG += qt plugin
+ QT += declarative
+
+ DESTDIR += ../plugins
+ OBJECTS_DIR = tmp
+ MOC_DIR = tmp
+
+ TARGET = FileDialog
+
+ HEADERS += directory.h \
+ file.h \
+ dialogPlugin.h
+
+ SOURCES += directory.cpp \
+ file.cpp \
+ dialogPlugin.cpp
+ \endcode
+
+ In particular, we compile Qt with the \c declarative module and configure it as a
+ \c plugin, needing a \c lib template. We shall put the compiled plugin into the
+ parent's \c plugins directory.
+
+
+ \section2 Registering a Class into QML
+
+ \code
+ In dialogPlugin.h:
+
+ #include <QtDeclarative/QDeclarativeExtensionPlugin>
+
+ class DialogPlugin : public QDeclarativeExtensionPlugin
+ {
+ Q_OBJECT
+
+ public:
+ void registerTypes(const char *uri);
+
+ };
+
+ \endcode
+
+ Our plugin class, \c DialogPlugin is a subclass of \l{QDeclarativeExtensionPlugin}.
+ We need to implement the inherited function, \l {QDeclarativeExtensionPlugin::}{registerTypes()}.
+ The \c dialogPlugin.cpp file looks like this:
+
+ \code
+ DialogPlugin.cpp:
+
+ #include "dialogPlugin.h"
+ #include "directory.h"
+ #include "file.h"
+ #include <QtDeclarative/qdeclarative.h>
+
+ void DialogPlugin::registerTypes(const char *uri){
+
+ qmlRegisterType<Directory>(uri, 1, 0, "Directory");
+ qmlRegisterType<File>(uri, 1, 0,"File");
+ }
+
+ Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin);
+ \endcode
+
+ The \l{QDeclarativeExtensionPlugin::}{registerTypes()} function registers
+ our File and Directory classes into QML. This function needs the class name
+ for its template, a major version number, a minor version number, and a name
+ for our classes.
+
+ We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2}
+ macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT}
+ macro at the top of our class. As well, we need to run \c qmake on the project
+ file to generate the necessary meta-object code.
+
+
+ \section2 Creating QML Properties in a C++ class
+
+ We can create QML elements and properties using C++ and
+ \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement
+ properties using slots and signals, making Qt aware of these properties.
+ These properties can then be used in QML.
+
+ For the text editor, we need to be able to load and save files. Typically,
+ these features are contained in a file dialog. Fortunately, we can use
+ \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to
+ implement directory reading and input/output streams.
+
+ \code
+ class Directory : public QObject{
+
+ Q_OBJECT
+
+ Q_PROPERTY(int filesCount READ filesCount CONSTANT)
+ Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
+ Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged)
+ Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
+
+ ...
+ \endcode
+
+ The \c Directory class uses Qt's Meta-Object System to register properties it
+ needs to accomplish file handling. The \c Directory class is exported as a plugin
+ and is useable in QML as the \c Directory element. Each of the listed properties
+ using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property.
+
+ The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and
+ write functions into Qt's Meta-Object System. For example, the \c filename
+ property, of type \l {QString}{QString}, is readable using the \c filename()
+ function and writable using the function \c setFilename(). Additionally, there
+ is a signal associated to the filename property called \c filenameChanged(),
+ which is emitted whenever the property changes. The read and write functions
+ are declared as \c public in the header file.
+
+ Similarly, we have the other properties declared according to their uses. The
+ \c filesCount property indicates the number of files in a directory. The filename
+ property is set to the currently selected file's name and the loaded/saved file
+ content is stored in \c fileContent property.
+
+ \code
+ Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
+ \endcode
+
+ The \c files list property is a list of all the filtered files in a directory.
+ The \c Directory class is implemented to filter out invalid text files; only
+ files with a \c .txt extension are valid. Further, \l {QLists}{QLists} can be
+ used in QML files by declaring them as a \c QDeclarativeListProperty in C++.
+ The templated object needs to inherit from a \l {QObject}{QObject}, therefore,
+ the \c File class must also inherit from \c QObject. In the \c Directory class,
+ the list of \c File objects is stored in a \c QList called \c m_fileList.
+
+ \code
+ class File : public QObject{
+
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+
+ ...
+ };
+ \endcode
+
+ The properties can then be used in QML as part of the \c Directory element's
+ properties. Note that we do not have to create an identifier \c id property
+ in our C++ code.
+
+ \code
+ Directory{
+ id: directory
+
+ filesCount
+ filename
+ fileContent
+ files
+
+ files[0].name
+ }
+
+ \endcode
+
+ Because QML uses Javascript's syntax and structure, we can iterate through
+ the list of files and retrieve its properties. To retrieve the first file's
+ name property, we can call \c { files[0].name }.
+
+ Regular C++ functions are also accessible from QML. The file loading and saving
+ functions are implemented in C++ and declared using the
+ \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions
+ as a \c slot and the functions will be accessible from QML.
+
+ \code
+ In Directory.h:
+
+ Q_INVOKABLE void saveFile();
+ Q_INVOKABLE void loadFile();
+ \endcode
+
+ The \c Directory class also has to notify other objects whenever the directory
+ contents change. This feature is performed using a \c signal. As previously
+ mentioned, QML signals have a corresponding handler with their names prepended
+ with \c on. The signal is called \c directoryChanged and it is emitted whenever
+ there is a directory refresh. The refresh simply reloads the directory contents
+ and updates the list of valid files in the directory. QML items can then be
+ notified by attaching an action to the \c onDirectoryChanged signal handler.
+
+ The \c list properties need to be explored further. This is because list
+ properties use callbacks to access and modify the list contents. The list
+ property is of type \c QDeclarativeListProperty<File>. Whenever the list
+ is accessed, the accessor function needs to return a
+ \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a
+ \c QObject derivative. Further, to create the
+ \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor
+ and modifiers need to be passed to the consructor as function pointers. The list,
+ a \c QList in our case, also needs to be a list of \c File pointers.
+
+ The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty}
+ constructor and the \c Directory implementation:
+ \code
+ QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 )
+ QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
+ \endcode
+
+ The constructor passes pointers to functions that will append the list, count
+ the list, retrieve the item using an index, and empty the list. Only the append
+ function is mandatory. Note that the function pointers must match the definition
+ of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction},
+ \l {QDeclarativeListProperty::CountFunction}{CountFunction},
+ \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or
+ \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}.
+
+ \code
+ void appendFiles(QDeclarativeListProperty<File> * property, File * file)
+ File* fileAt(QDeclarativeListProperty<File> * property, int index)
+ int filesSize(QDeclarativeListProperty<File> * property)
+ void clearFilesPtr(QDeclarativeListProperty<File> *property)
+ \endcode
+
+ To simplify our file dialog, the \c Directory class filters out invalid text
+ files, which are files that do not have a \c .txt extension. If a file name
+ doesn't have the \c .txt extension, then it won't be seen in our file dialog.
+ Also, the implementation makes sure that saved files have a \c .txt extension in
+ the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file
+ and to output the file contents to a file.
+
+ With our \c Directory element, we can retrieve the files as a list, know how many
+ text files is in the application directory, get the file's name and content as a
+ string, and be notified whenever there are changes in the directory contents.
+
+ To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run
+ \c make to build and transfer the plugin to the \c plugins directory.
+
+
+ \section2 Importing a Plugin in QML
+
+ The qmlviewer tool imports files that are in the same directory as the
+ application. We can also create a \c qmldir file containing the locations of
+ QML files we wish to import. The \c qmldir file can also store locations of
+ plugins and other resources.
+
+ \code
+ In qmldir:
+
+ Button ./Button.qml
+ FileDialog ./FileDialog.qml
+ TextArea ./TextArea.qml
+ TextEditor ./TextEditor.qml
+ EditMenu ./EditMenu.qml
+
+ plugin FileDialog plugins
+ \endcode
+
+ The plugin we just created is called \c FileDialog, as indicated by the
+ \c TARGET field in the project file. The compiled plugin is in the \c plugins directory.
+
+
+ \section2 Integrating a File Dialog into the File Menu
+
+ Our \c FileMenu needs to display the \c FileDialog element, containing a list of
+ the text files in a directory thus allowing the user to select the file by
+ clicking on the list. We also need to assign the save, load, and new buttons
+ to their respective actions. The FileMenu contains an editable text input to
+ allow the user to type a file name using the keyboard.
+
+ The \c Directory element is used in the \c FileMenu.qml file and it notifies the
+ \c FileDialog element that the directory refreshed its contents. This notification
+ is performed in the signal handler, \c onDirectoryChanged.
+
+ \code
+ In FileMenu.qml:
+
+ Directory{
+ id:directory
+ filename: textInput.text
+ onDirectoryChanged: fileDialog.notifyRefresh()
+ }
+ \endcode
+
+ Keeping with the simplicity of our application, the file dialog will always be
+ visible and will not display invalid text files, which do not have a \c .txt
+ extension to their filenames.
+
+ \code
+ In FileDialog.qml:
+
+ signal notifyRefresh()
+ onNotifyRefresh: dirView.model = directory.files
+ \endcode
+
+ The \c FileDialog element will display the contents of a directory by reading its
+ list property called \c files. The files are used as the model of a
+ \l {GridView}{GridView} element, which displays data items in a grid according
+ to a delegate. The delegate handles the appearance of the model and our file
+ dialog will simply create a grid with text centered in the middle. Clicking on
+ the file name will result in the appearance of a rectangle to highlight the file
+ name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted,
+ reloading the files in the directory.
+
+ \code
+ In FileMenu.qml:
+
+ Button{
+ id: newButton
+ label: "New"
+ onButtonClick:{
+ textArea.textContent = ""
+ }
+ }
+ Button{
+ id: loadButton
+ label: "Load"
+ onButtonClick:{
+ directory.filename = textInput.text
+ directory.loadFile()
+ textArea.textContent = directory.fileContent
+ }
+ }
+ Button{
+ id: saveButton
+ label: "Save"
+ onButtonClick:{
+ directory.fileContent = textArea.textContent
+ directory.filename = textInput.text
+ directory.saveFile()
+ }
+ }
+ Button{
+ id: exitButton
+ label: "Exit"
+ onButtonClick:{
+ Qt.quit()
+ }
+ }
+ \endcode
+
+ Our \c FileMenu can now connect to their respective actions. The \c saveButton
+ will transfer the text from the \c TextEdit onto the directory's \c fileContent
+ property, then copy its file name from the editable text input. Finally, the button
+ calls the \c saveFile() function, saving the file. The \c sloadButton has a similar
+ execution. Also, the \c New action will empty the contents of the \c TextEdit.
+
+ Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy,
+ paste, and select all the text in the text editor.
+
+ \image qml-texteditor5_filemenu.png
+
+ \section1 Text Editor Completion
+
+ \image qml-texteditor5_newfile.png
+
+ The application can function as a simple text editor, able to accept text
+ and save the text into a file. The text editor can also load from a file and
+ perform text manipulation.
+*/
diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc
index 1b3770fdd8..25d0ccd22f 100644
--- a/doc/src/getting-started/gettingstartedqt.qdoc
+++ b/doc/src/getting-started/gettingstartedqt.qdoc
@@ -28,8 +28,8 @@
/*!
\page gettingstartedqt.html
- \title Getting Started programming with Qt
- \ingroup gettingStarted
+ \title Getting Started Programming with Qt
+ \ingroup gettingStarted
Welcome to the world of Qt--the cross-platform GUI toolkit. In
this getting started guide, we teach basic Qt knowledge by
@@ -85,7 +85,7 @@
other widgets), it is possible to show a single widget in its own
window. Widgets are not visible by default; the function
\l{QWidget::}{show()} makes the widget visible.
-
+
Line 11 makes the QApplication enter its event loop. When a Qt
application is running, events are generated and sent to the
widgets of the application. Examples of events are mouse presses
diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc
index b81d2f2345..1384d48628 100644
--- a/doc/src/getting-started/installation.qdoc
+++ b/doc/src/getting-started/installation.qdoc
@@ -1204,9 +1204,9 @@ applications using Qt for Symbian can start right away.
Qt for the Symbian platform requires the following software installed on your development PC:
\list
- \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher}
+ \o \l{http://www.forum.nokia.com/Library/Tools_and_downloads/Other/Carbide.c++/}{Carbide.c++ v2.3.0 or higher recommended}.
\list
- \o \bold{Note:} It may be necessary to update the Carbide compiler.
+ \o \bold{Note:} It may be necessary to update the Carbide compiler depending on Carbide version.
See \l{http://pepper.troll.no/s60prereleases/patches/}{here} for instructions how to check your
compiler version and how to patch it, if needed.
\endlist
@@ -1216,18 +1216,18 @@ applications using Qt for Symbian can start right away.
but that version is no longer available from ActiveState. However, Qt for Symbian has been successfully
compiled using both 5.8.x and 5.10.x versions.
\endlist
- \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/S60SDK/}{S60 Platform SDK 3rd Edition FP1 or higher}
+ \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html}{S60 Platform SDK 3rd Edition FP1 or higher}
\list
\o \bold{Note:} Users of \bold{S60 Platform SDK 3rd Edition FP1} also need special update. The update can be found
\l{http://pepper.troll.no/s60prereleases/patches/}{here}.
\endlist
- \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}.
+ \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html}{Open C/C++ v1.7.5 or higher}.
Install this to all Symbian SDKs you plan to use Qt with.
\o Building Qt tools from scratch requires \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler.
\list
\o \bold{Note:} This is not required if you are using pre-built binary package.
\endlist
- \o Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} version 2.2 (build 686 or later),
+ \o Building Qt libraries requires \l{http://www.arm.com/products/tools/software-development-tools.php}{RVCT} version 2.2 (build 686 or later),
which is not available free of charge. Usage of later versions of RVCT, including the 3.x and 4.x series, is not supported
in this release.
\endlist
diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc
index cabd8f7ce5..dc7a34a5e7 100644
--- a/doc/src/howtos/openvg.qdoc
+++ b/doc/src/howtos/openvg.qdoc
@@ -30,6 +30,8 @@
\title OpenVG Rendering in Qt
\since 4.6
\ingroup best-practices
+ \ingroup technology-apis
+
\brief Efficient rendering on embedded devices with OpenVG
diff --git a/doc/src/images/qml-image-example.png b/doc/src/images/qml-image-example.png
index c1951c0dae..8d9846f8f5 100644
--- a/doc/src/images/qml-image-example.png
+++ b/doc/src/images/qml-image-example.png
Binary files differ
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index d0f0903761..e45892fabc 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -52,35 +52,33 @@
</div>
<div class="indexbox api">
<div class="heading">
- Qt API Overviews</div>
+ Qt API</div>
<div class="indexboxcont indexboxbar ">
<div class="sectionlist tricol">
<ul>
- <li><a href="classes.html">Class index</a></li>
- <li><a href="functions.html">Function index</a></li>
- <li><a href="modules.html">Modules</a></li>
- <li><a href="namespaces.html">Namespaces</a></li>
+ <li><a href="classes.html">All Classes</a></li>
+ <li><a href="functions.html">All Functions</a></li>
+ <li><a href="modules.html">All Modules</a></li>
+ <li><a href="namespaces.html">All Namespaces</a></li>
<li><a href="qtglobal.html">Global Declarations</a></li>
+ <li><a href="licensing.html">Licenses and Credits</a></li>
</ul>
</div>
<div class="sectionlist tricol">
<ul>
- <li><a href="qt-basic-concepts.html">Basic Qt Architecture</a></li>
- <li><a href="qt-gui-concepts.html">UI Components</a></li>
- <li><a href="developing-with-qt.html">Cross-platform &amp; Platform-specific Development</a></li>
- <li><a href="technology-apis.html">Qt &amp; standard technologies </a></li>
- <li><a href="best-practices.html">Qt How-to's &amp; best practices</a></li>
- </ul>
+ <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
+ <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
+ <li><a href="developing-with-qt.html">Cross-platform and Platform-specific</a></li>
+ <li><a href="technology-apis.html">Qt and Key Technologies</a></li>
+ <li><a href="best-practices.html">Best Practices Guides</a></li>
+ </ul>
</div>
<div class="sectionlist">
<ul>
<li><a href="qtquick.html">Qt Quick</a></li>
<li><a href="qdeclarativeintroduction.html">Introduction to QML</a></li>
<li><a href="qdeclarativeelements.html">QML Elements</a></li>
- <li><a href="qt-gui-concepts.html">UI components</a></li>
- <li><a href="model-view-programming.html">Model/View Programming</a></li>
- <li><a href="qt-network.html">Network Programming</a></li>
- <li><a href="qt-graphics.html">Graphics and Printing</a></li>
+ <li><a href="qdeclarativeexamples.html">QML Examples and Demos</a></li>
</ul>
</div>
</div>
@@ -102,13 +100,12 @@
<li><a href="assistant-manual.html">Qt Assistant</a></li>
<li><a href="qmake-manual.html">Qt qmake</a></li>
<li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a></li>
- <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> &amp; <a href="http://qt.nokia.com/products/appdev">add-ins</a></li>
+ <li><a href="http://qt.nokia.com/developer/eclipse-integration">Eclipse Integration</a></li>
+ <li><a href="http://qt.nokia.com/products/appdev">Add-On Products and Services</a></li>
<li><a href="qvfb.html">Virtual Framebuffer</a></li>
</ul>
</div>
</div>
</div>
\endraw
-
-
*/
diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc
index 5d9c819ad5..8b6e337148 100644
--- a/doc/src/internationalization/i18n.qdoc
+++ b/doc/src/internationalization/i18n.qdoc
@@ -39,6 +39,8 @@
\brief Information about Qt's support for internationalization and multiple languages.
\nextpage Writing Source Code for Translation
+ \ingroup qt-basic-concepts
+
\keyword internationalization
\keyword i18n
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 891249047f..d3c33d995d 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -152,6 +152,7 @@
\module QtOpenGL
\title QtOpenGL Module
\ingroup modules
+ \ingroup technology-apis
\brief The QtOpenGL module offers classes that make it easy to
use OpenGL in Qt applications.
@@ -202,6 +203,7 @@
\title QtOpenVG Module
\since 4.6
\ingroup modules
+ \ingroup technology-apis
\brief The QtOpenVG module is a plugin that provides support for
OpenVG painting.
@@ -352,6 +354,8 @@
\title QtSvg Module
\since 4.1
\ingroup modules
+ \ingroup technology-apis
+ \ingroup best-practices
\brief The QtSvg module provides classes for displaying and creating SVG files.
@@ -400,6 +404,7 @@
\module QtXml
\title QtXml Module
\ingroup modules
+ \ingroup technology-apis
\brief The QtXml module provides a stream reader and writer for
XML documents, and C++ implementations of SAX and DOM.
@@ -424,6 +429,7 @@
\title QtXmlPatterns Module
\since 4.4
\ingroup modules
+ \ingroup technology-apis
\brief The QtXmlPatterns module provides support for XPath,
XQuery, XSLT and XML Schema validation.
diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc
index dca332ea29..3a8e3b4351 100644
--- a/doc/src/objectmodel/properties.qdoc
+++ b/doc/src/objectmodel/properties.qdoc
@@ -79,10 +79,9 @@
mean \e {reset to the context specific cursor}. The \c RESET
function must return void and take no parameters.
- \o A \c NOTIFY signal is optional. If defined, the signal will be
- emitted whenever the value of the property changes. The signal must
- take one parameter, which must be of the same type as the property; the
- parameter will take the new value of the property.
+ \o A \c NOTIFY signal is optional. If defined, it should specify one
+ existing signal in that class that is emitted whenever the value
+ of the property changes.
\o The \c DESIGNABLE attribute indicates whether the property
should be visible in the property editor of GUI design tool (e.g.,
diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc
index 1c35a63ac8..2dd44f69bb 100644
--- a/doc/src/overviews.qdoc
+++ b/doc/src/overviews.qdoc
@@ -35,21 +35,21 @@
/*!
\group qt-basic-concepts
- \title Basic Qt Architecture
+ \title Programming with Qt
\brief The basic architecture of the Qt cross-platform application and UI framework.
Qt is a cross-platform application and UI framework for writing
web-enabled applications for desktop, mobile, and embedded
- operating systems. These pages explain basic architectural
- concepts of Qt:
-
+ operating systems. This page contains links to articles and overviews
+ explaining key components and techniuqes used in Qt development.
+
\generatelist {related}
*/
/*!
\group qt-gui-concepts
- \title Qt Desktop UI Components
+ \title UI Design with Qt
\brief The Qt components for constructing native look & feel desktop UI's.
@@ -62,6 +62,7 @@
/*!
\group qt-graphics
+ \ingroup qt-basic-concepts
\title Qt Graphics and Printing
\brief The Qt components for doing graphics.
@@ -71,6 +72,7 @@
/*!
\group qt-network
+ \ingroup qt-basic-concepts
\title Network programming with Qt
\brief The these pages are about Qt's support for network programming.
@@ -80,7 +82,7 @@
/*!
\group technology-apis
- \title Qt API's for other technologies
+ \title Qt and Key Technologies
These pages document Qt's API's for some widely-used standards and
technologies.
@@ -91,6 +93,7 @@
/*!
\group qt-activex
\title ActiveX in Qt
+ \ingroup qt-basic-concepts
\ingroup technology-apis
\ingroup platform-specific
@@ -108,6 +111,8 @@
\brief Qt API's for using SQL.
\ingroup technology-apis
\ingroup best-practices
+ \ingroup qt-basic-concepts
+
These pages document Qt's API's for using SQL database systems
in Qt applications.
@@ -117,7 +122,7 @@
/*!
\group best-practices
- \title How-To's and Best Practices
+ \title Best Practices Guides
\brief How-To Guides and Best Practices
@@ -128,3 +133,16 @@
\generatelist{related}
*/
+/*!
+
+ \group licensing
+ \title Qt Licenses and Credits
+
+ \brief About the licenses used for Qt, and some credits to our contributors.
+
+ This page contains information on the different licenses Qt is shipped with,
+ and credits to some of our many contributers.
+
+ \generatelist {related}
+
+*/
diff --git a/doc/src/painting-and-printing/paintsystem.qdoc b/doc/src/painting-and-printing/paintsystem.qdoc
index 4c6fd915d1..deb9c8b38b 100644
--- a/doc/src/painting-and-printing/paintsystem.qdoc
+++ b/doc/src/painting-and-printing/paintsystem.qdoc
@@ -50,6 +50,8 @@
\brief A system for painting on the screen or on print devices using the same API
\ingroup qt-graphics
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
Qt's paint system enables painting on screen and print devices
using the same API, and is primarily based on the QPainter,
diff --git a/doc/src/platforms/x11overlays.qdoc b/doc/src/platforms/x11overlays.qdoc
index 1a03ea69f8..949a500dad 100644
--- a/doc/src/platforms/x11overlays.qdoc
+++ b/doc/src/platforms/x11overlays.qdoc
@@ -28,6 +28,7 @@
/*!
\page x11overlays.html
\title How to Use X11 Overlays with Qt
+ \ingroup best-practices
X11 overlays are a powerful mechanism for drawing
annotations etc., on top of an image without destroying it, thus saving
diff --git a/doc/src/porting/qt4-mainwindow.qdoc b/doc/src/porting/qt4-mainwindow.qdoc
index 7d2a400ae4..b160d63916 100644
--- a/doc/src/porting/qt4-mainwindow.qdoc
+++ b/doc/src/porting/qt4-mainwindow.qdoc
@@ -28,7 +28,12 @@
/*!
\page qt4-mainwindow.html
\title The Qt 4 Main Window Classes
+ \ingroup qt-basic-concepts
+
+ \brief Overview of the Main Window concept and Classes
+
+
\contentspage {What's New in Qt 4}{Home}
\previouspage The Scribe Classes
\nextpage The New Qt Designer
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 88ef2a891c..a88b32612b 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -455,10 +455,10 @@
\image quick_screens.png
- Qt 4.7 introduces Quick, the Qt UI Creation Kit. that enables the creation
- of dynamic user interfaces, easier and more effective than possible
- with existing UI technologies. This UI Creation Kit consist of three
- technologies:
+ Qt 4.7 introduces \l{Qt Quick}, the Qt UI Creation Kit. that enables
+ the creation of dynamic user interfaces, easier and more effective
+ than possible with existing UI technologies. This UI Creation Kit
+ consists of three technologies:
\list
\i QML is a declarative language oriented on JavaScript that utilizes
diff --git a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
index 8f74461218..cea6553be6 100644
--- a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
+++ b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
@@ -73,16 +73,14 @@ QFuture<QString> future = QtConcurrent::run(someFunction, bytearray);
QString result = future.result();
//! [3]
-
//! [4]
-// call 'QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const' in a separate thread
-QString string = ...;
-QFuture<QStringList> future = QtConcurrent::run(string, &QString::split, QString(", "), QString::KeepEmptyParts, Qt::CaseSensitive);
+// call 'QList<QByteArray> QByteArray::split(char sep) const' in a separate thread
+QByteArray bytearray = "hello world;
+QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split), ',');
...
-QStringList result = future.result();
+QList<QByteArray> result = future.result();
//! [4]
-
//! [5]
// call 'void QImage::invertPixels(InvertMode mode)' in a separate thread
QImage image = ...;
diff --git a/doc/src/snippets/declarative/loader/KeyReader.qml b/doc/src/snippets/declarative/loader/KeyReader.qml
new file mode 100644
index 0000000000..4423ac68f5
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/KeyReader.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ Item {
+ focus: true
+ Keys.onPressed: {
+ console.log("Loaded item captured:", event.text);
+ event.accepted = true;
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/MyItem.qml b/doc/src/snippets/declarative/loader/MyItem.qml
new file mode 100644
index 0000000000..cc69661c04
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/MyItem.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ id: myItem
+ signal message(string msg)
+
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myItem.message("clicked!")
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/connections.qml b/doc/src/snippets/declarative/loader/connections.qml
new file mode 100644
index 0000000000..babac4ea38
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/connections.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ width: 100; height: 100
+
+ Loader {
+ id: myLoader
+ source: "MyItem.qml"
+ }
+
+ Connections {
+ target: myLoader.item
+ onMessage: console.log(msg)
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/focus.qml b/doc/src/snippets/declarative/loader/focus.qml
new file mode 100644
index 0000000000..464d98613e
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/focus.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 200; height: 200
+
+ Loader {
+ id: loader
+ focus: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: loader.source = "KeyReader.qml"
+ }
+
+ Keys.onPressed: {
+ console.log("Captured:", event.text);
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/loader/simple.qml b/doc/src/snippets/declarative/loader/simple.qml
new file mode 100644
index 0000000000..e0dc6b337e
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/simple.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ width: 200; height: 200
+
+ Loader { id: pageLoader }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageLoader.source = "Page1.qml"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml
new file mode 100644
index 0000000000..1a154691d9
--- /dev/null
+++ b/doc/src/snippets/declarative/propertyaction.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import Qt 4.7
+
+Row {
+
+//![transition]
+Item {
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect
+ width: 200; height: 100
+ color: "red"
+
+ states: State {
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
+ }
+
+ transitions: Transition {
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.state = "rotated"
+ }
+ }
+}
+//![transition]
+
+Item {
+ width: 300; height: 300
+
+ Image { id: img; source: "pics/qt.png" }
+
+//![standalone]
+SequentialAnimation {
+ PropertyAction { target: img; property: "smooth"; value: "true" }
+ NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
+ PropertyAction { target: img; property: "smooth"; value: "false" }
+}
+//![standalone]
+}
+
+}
+
diff --git a/doc/src/snippets/declarative/propertychanges.qml b/doc/src/snippets/declarative/propertychanges.qml
new file mode 100644
index 0000000000..9f119bf5c3
--- /dev/null
+++ b/doc/src/snippets/declarative/propertychanges.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![import]
+import Qt 4.7
+//![import]
+
+Column {
+
+//![0]
+Item {
+ id: container
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "resized"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "blue"; height: container.height }
+ }
+ }
+}
+//![0]
+
+//![reset]
+Rectangle {
+ width: 300; height: 200
+
+ Text {
+ id: myText
+ width: 50
+ wrapMode: Text.WordWrap
+ text: "a text string that is longer than 50 pixels"
+
+ states: State {
+ name: "widerText"
+ PropertyChanges { target: myText; width: undefined }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myText.state = "widerText"
+ }
+}
+//![reset]
+}
diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml
new file mode 100644
index 0000000000..09ef3b2ee1
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: myWin
+ width: 500
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ width: 150; height: 150
+ anchors.bottom: myWin.bottom
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml
new file mode 100644
index 0000000000..ef0ec1fa27
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: myWin
+ width: 500
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ width: 150; height: 150
+ anchors.bottom: myWin.bottom
+ anchors.horizontalCenter: myWin.horizontalCenter
+ anchors.bottomMargin: 10
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml
new file mode 100644
index 0000000000..008ad1a972
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: myWin
+ width: 500
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ width: 150; height: 150
+ anchors.bottom: myWin.bottom
+ anchors.horizontalCenter: myWin.horizontalCenter
+ anchors.bottomMargin: 10
+ }
+
+//! [adding some text]
+ Text {
+ text: "<h2>The Qt Logo</h2>"
+ anchors.bottom: image1.top
+ anchors.horizontalCenter: myWin.horizontalCenter
+ anchors.bottomMargin: 15
+ }
+//! [adding some text]
+}
diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml
new file mode 100644
index 0000000000..686a927ea5
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Note: this file is not intended to be run.
+
+//! [basic syntax]
+SomeElement {
+ id: myObject
+ ... some other things here ...
+}
+//! [basic syntax]
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/qml-intro/hello-world1.qml
new file mode 100644
index 0000000000..9b91049998
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+
+ Text { text: "Hello World!" }
+
+ color: "lightgray"
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml
new file mode 100644
index 0000000000..ddc10174da
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+
+//! [updated text]
+ Text {
+ text: "<h2>Hello World</h2>"; color: "darkgreen"
+ x: 100; y:100
+ }
+//! [updated text]
+
+ color: "lightgray"
+}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml
new file mode 100644
index 0000000000..f1102c2665
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+
+//! [updated text]
+ Text {
+ text: "<h1>Hello world again</h1>"
+ color: "#002288"
+ x: 100; y: 100
+ }
+//! [updated text]
+
+ color: "lightgray"
+}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml
new file mode 100644
index 0000000000..c18fe154f7
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+
+ Text {
+ text: "<h1>Hello world again</h1>"
+ color: "#002288"
+ x: 100; y: 100
+ }
+
+//! [added an image]
+ Image {
+ source: "images/qt-logo.png"
+ }
+//! [added an image]
+
+ color: "lightgray"
+}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml
new file mode 100644
index 0000000000..bde8dc3460
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+
+ Text {
+ text: "<h1>Hello world again</h1>"
+ color: "#002288"
+ x: 100; y: 100
+ }
+
+//! [positioning the image]
+ Image {
+ source: "images/qt-logo.png"
+ x: 100; y: 150
+ width: 150; height: 150
+ }
+//! [positioning the image]
+
+ color: "lightgray"
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml
new file mode 100644
index 0000000000..8d8d7478ba
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: mainRec
+ width: 600
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ x: 200; y: 100
+ width: 100; height: 100
+
+ // Animate a rotation
+ transformOrigin: Item.Center
+ NumberAnimation on rotation {
+ from: 0; to: 360
+ duration: 2000
+ loops: Animation.Infinite
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml
new file mode 100644
index 0000000000..d556c211da
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: mainRec
+ width: 600
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ x: 200; y: 100
+ width: 100; height: 100
+
+ // Animate a rotation
+ transform: Rotation {
+ origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0
+ NumberAnimation on angle {
+ from: 0; to: 360;
+ duration: 3000;
+ loops: Animation.Infinite
+ }
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml
new file mode 100644
index 0000000000..007881316f
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+// This is a comment. And below myRectangle is defined.
+Rectangle {
+ id: myRectangle
+ width: 500
+ height: 400
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml
new file mode 100644
index 0000000000..e68de2053d
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: mainRec
+ width: 600
+ height: 400
+ z: 0
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ x: 20; y: 20 ; z: 1
+ width: 100; height: 100
+ }
+
+ Image {
+ id: image2
+ source: "images/qt-logo.png"
+ width: 100; height: 100
+ x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
+ z: 2
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml
new file mode 100644
index 0000000000..31835a1eb2
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: mainRec
+ width: 600
+ height: 400
+ z: 0
+
+//! [adding a sequential animation]
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ width: 100; height: 100
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: 20; to: 450; easing.type: "InOutQuad";
+ duration: 2000
+ }
+ PauseAnimation { duration: 500 }
+ }
+ }
+//! [adding a sequential animation]
+
+ Image {
+ id: image2
+ source: "images/qt-logo.png"
+ width: 100; height: 100
+ x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
+ z: 2
+ }
+}
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
new file mode 100644
index 0000000000..f83a966a78
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+Rectangle {
+ id: mainRec
+ width: 600
+ height: 400
+ z: 0
+
+ Image {
+ id: image2
+ source: "images/qt-logo.png"
+ width: 100; height: 100
+ x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
+ z: 2
+ }
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ x: 20; y: 20 ; z: 1
+ width: 100; height: 100
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: 20; to: 450
+ easing.type: "InOutQuad"; duration: 2000
+ }
+ PauseAnimation { duration: 500 }
+ }
+
+ SequentialAnimation on y {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: 20; to: 250
+ easing.type: "InOutQuad"; duration: 2000
+ }
+ PauseAnimation { duration: 500 }
+ }
+
+ SequentialAnimation on scale {
+ loops: Animation.Infinite
+ NumberAnimation { from: 1; to: 0.5; duration: 1000 }
+ NumberAnimation { from: 0.5; to: 1; duration: 1000 }
+ PauseAnimation { duration: 500 }
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml
new file mode 100644
index 0000000000..9619eb7ed5
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/states1.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: mainRectangle
+ width: 600
+ height: 400
+ color: "black"
+
+ Rectangle {
+ id: sky
+ width: 600
+ height: 200
+ y: 0
+ color: "lightblue"
+ }
+
+ Rectangle {
+ id: ground
+ width: 600; height: 200
+ y: 200
+ color: "green"
+ }
+
+ MouseArea {
+ id: mousearea
+ anchors.fill: mainRectangle
+ }
+
+ states: [ State {
+ name: "night"
+ when: mousearea.pressed == true
+ PropertyChanges { target: sky; color: "darkblue" }
+ PropertyChanges { target: ground; color: "black" }
+ },
+ State {
+ name: "daylight"
+ when: mousearea.pressed == false
+ PropertyChanges { target: sky; color: "lightblue" }
+ PropertyChanges { target: ground; color: "green" }
+ }
+ ]
+
+ transitions: [ Transition {
+ from: "daylight"; to: "night"
+ ColorAnimation { duration: 1000 }
+ },
+ Transition {
+ from: "night"; to: "daylight"
+ ColorAnimation { duration: 500 }
+ }
+ ]
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml
new file mode 100644
index 0000000000..af39e6923a
--- /dev/null
+++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import Qt 4.7
+
+Rectangle {
+ id: myWin
+ width: 500
+ height: 400
+
+ Image {
+ id: image1
+ source: "images/qt-logo.png"
+ width: 150; height: 150
+ anchors.bottom: myWin.bottom
+ anchors.horizontalCenter: myWin.horizontalCenter
+ anchors.bottomMargin: 10
+
+ transform: Rotation {
+ origin.x: 75; origin.y: 75
+ axis{ x: 0; y: 0; z:1 } angle: -90
+ }
+
+ }
+
+ Text {
+ text: "<h2>The Qt Logo -- taking it easy</h2>"
+ anchors.bottom: image1.top
+ anchors.horizontalCenter: myWin.horizontalCenter
+ anchors.bottomMargin: 15
+
+ transform: [
+ Scale { xScale: 1.5; yScale: 1.2 } ,
+
+ Rotation {
+ origin.x: 75; origin.y: 75
+ axis{ x: 0; y: 0; z:1 } angle: -45
+ }
+ ]
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/declarative/rotationanimation.qml b/doc/src/snippets/declarative/rotationanimation.qml
index c81395a459..b56cb3f373 100644
--- a/doc/src/snippets/declarative/rotationanimation.qml
+++ b/doc/src/snippets/declarative/rotationanimation.qml
@@ -52,7 +52,8 @@ Item {
smooth: true
states: State {
- name: "rotated"; PropertyChanges { target: rect; rotation: 180 }
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180 }
}
transitions: Transition {
diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css
index e4ad135908..de5b0a09f9 100644
--- a/doc/src/template/style/narrow.css
+++ b/doc/src/template/style/narrow.css
@@ -54,7 +54,7 @@
.narrow .header .qtref a
{
- color: #363534;
+ color: #00732F;
}
.narrow .header .qtref span
@@ -103,7 +103,7 @@
}
.narrow .header #shortCut ul li a
{
- color: #44a51c;
+ color: #00732F;
}
.narrow .wrapper .hd
@@ -203,6 +203,9 @@
*border: 1px solid #fff;
*height: 17px;
_height: 18px;
+ /* to be fixed */
+ display: none;
+ /* to be fixed */
}
.narrow .indexbox .indexIcon {
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 6a32e536a0..9afff03f25 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -388,9 +388,9 @@
.shortCut-topleft-inactive
{
padding-left: 3px;
+ padding-right: 3px;
background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
height: 20px;
- width: 47px;
}
.shortCut-topleft-inactive span
{
@@ -1283,43 +1283,6 @@
-/* start of offline spec*/
- .offline .wrapper .hd
- {
- background: url(../images/page.png) no-repeat 0 -15px;
- }
- .offline .wrapper .bd
- {
- background: url(../images/bg_l_blank.png) repeat-y 0 0;
- }
- .offline .wrapper .ft
- {
- background: url(../images/page.png) no-repeat 0 -90px;
- }
- .offline .sidebar,
- .offline .feedback,
- .offline .t_button,
- .offline #narrowsearch,
- .offline #narrowmenu
- {
- display: none;
- }
- .offline .wrap
- {
- margin: 0 5px 0 5px;
- }
- .offline .wrap .breadcrumb
- {
- }
-
- .offline .wrap .content
- {
- padding-top: 15px;
- }
-
-
-/* end of offline spec*/
-
/* start of creator spec*/
.creator
{
@@ -1339,9 +1302,9 @@
.creator #feedbackBox,
.creator #feedback,
.creator #blurpage,
- .creator .indexbox .indexIcon span,
+ /*.creator .indexbox .indexIcon span,*/
.creator .wrapper .hd,
- .creator .indexbox .indexIcon,
+/* .creator .indexbox .indexIcon,*/
.creator .header #nav-logo,
.creator #offlinemenu,
.creator #offlinesearch,
@@ -1558,6 +1521,10 @@
.creator .toc {
margin:10px 20px 10px 10px;
}
+
+ .creator #narrowsearch, .creator #narrowmenu{
+ display:none;
+ }
/* end of creator spec*/
}
diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc
index d2687ea3c3..32dddd7b02 100644
--- a/doc/src/widgets-and-layouts/layout.qdoc
+++ b/doc/src/widgets-and-layouts/layout.qdoc
@@ -33,6 +33,7 @@
/*!
\page layout.html
\title Layout Management
+ \ingroup qt-basic-concepts
\ingroup qt-gui-concepts
\brief A tour of the standard layout managers and an introduction to custom
layouts.
diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
index 5c7257099b..cc36fa2306 100644
--- a/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -31,6 +31,7 @@
\brief How to use style sheets to customize the appearance of widgets.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
\previouspage {Styles and Style Aware Widgets}{Styles}
\contentspage Widgets and Layouts
diff --git a/doc/src/xml-processing/xquery-introduction.qdoc b/doc/src/xml-processing/xquery-introduction.qdoc
index b79c205132..b5356f77e3 100644
--- a/doc/src/xml-processing/xquery-introduction.qdoc
+++ b/doc/src/xml-processing/xquery-introduction.qdoc
@@ -29,6 +29,7 @@
\page xquery-introduction.html
\title A Short Path to XQuery
+\pagekeywords XPath XQuery
\startpage XQuery
\target XQuery-introduction
diff --git a/doc/src/zh_CN/bughowto.qdoc b/doc/src/zh_CN/bughowto.qdoc
new file mode 100644
index 0000000000..05c84033a6
--- /dev/null
+++ b/doc/src/zh_CN/bughowto.qdoc
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 bughowto.html
+ \title 如何报告 Bug
+ \brief 关于报告 Qt 中 bug 方法的信息。
+
+ 如果您认为您已经发现了 Qt 的一个 bug,我们非常高兴听到这个消息,因为在此之后我们可以修复它。
+
+ 在报告 bug 之前,请检查 Qt 网站中的 \l{FAQs}{FAQ}、\l{Platform Notes}{平台备注}和 \l{Qt Bug Tracker}{Qt Bug 跟踪器}确认这个问题是否已知。
+
+ 如果您还没有 \l{Qt Bug Tracker}{Qt Bug 跟踪器}的帐号,您要做的第一件事情就是注册一个。一旦您完成了这一步,您就可以提交并且跟踪您的 bug 报告,而且在您提交之后,公众就可以看到它们。
+
+ 请在您的 bug 报告中包含以下信息:
+
+ \list 1
+ \o 您的编译器的名称和版本号
+ \o 您的操作系统的名称和版本号
+ \o 您所使用的 Qt 的版本号,以及它在被编译的时候所使用的配置选项
+ \o 关于如何重复这个问题的可靠并且清晰的描述
+ \endlist
+
+ 如果可能,请提供一个使用 QtTest 模块编写的测试程序,因为这样做可以加快我们重现您的这个问题的进程,并且可以让开发人员更有效率的确认这个问题。
+
+ 另外,如果您的问题只是在运行时可见,请尽量创建一个可以运行并且显示这个问题的小测试程序。通常,您可以在众多 Qt 实例中选择一个进行少量修改就可以实现这一目的。
+
+ 如果您已经实现了一个 bug 修复并且希望直接贡献这个修复,那么您需要通过\l{Public Qt Repository}{公共 Qt 代码仓库}来实现。
+*/