summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-08-04 14:16:35 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-08-04 14:16:35 (GMT)
commit84fdd4be15a8fa2ea921a112a05b185ffd59cc04 (patch)
treedd4539a6f6eeccb05d02bce338b7f755504dcff6 /doc
parent245a68a0aad0473fcf56cd75e78b951480d39e2b (diff)
parentae1c9def5cb22d88cf10b2a23d06bc38da12725b (diff)
downloadQt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.zip
Qt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.tar.gz
Qt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/animation.qdoc4
-rw-r--r--doc/src/declarative/dynamicobjects.qdoc119
-rw-r--r--doc/src/declarative/examples.qdoc6
-rw-r--r--doc/src/declarative/extending-tutorial.qdoc32
-rw-r--r--doc/src/declarative/focus.qdoc10
-rw-r--r--doc/src/declarative/javascriptblocks.qdoc25
-rw-r--r--doc/src/declarative/modules.qdoc293
-rw-r--r--doc/src/declarative/pics/anatomy-component.pngbin16117 -> 4902 bytes
-rw-r--r--doc/src/declarative/qdeclarativedocument.qdoc62
-rw-r--r--doc/src/declarative/qdeclarativei18n.qdoc2
-rw-r--r--doc/src/declarative/qdeclarativeintro.qdoc9
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc16
-rw-r--r--doc/src/declarative/qdeclarativestates.qdoc183
-rw-r--r--doc/src/declarative/qmlviewer.qdoc8
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc16
-rw-r--r--doc/src/declarative/tutorial.qdoc2
-rw-r--r--doc/src/development/debug.qdoc2
-rw-r--r--doc/src/development/developing-with-qt.qdoc61
-rw-r--r--doc/src/development/qmake-manual.qdoc7
-rw-r--r--doc/src/examples/fingerpaint.qdoc6
-rw-r--r--doc/src/examples/pinchzoom.qdoc6
-rw-r--r--doc/src/examples/qml-examples.qdoc111
-rw-r--r--doc/src/examples/touch-dials.qdoc (renamed from doc/src/examples/multitouch-dials.qdoc)8
-rw-r--r--doc/src/examples/touch-knobs.qdoc (renamed from doc/src/examples/multitouch-knobs.qdoc)10
-rw-r--r--doc/src/files-and-resources/resources.qdoc2
-rw-r--r--doc/src/frameworks-technologies/eventsandfilters.qdoc2
-rw-r--r--doc/src/getting-started/examples.qdoc16
-rw-r--r--doc/src/getting-started/gettingstarted.qdoc37
-rw-r--r--doc/src/getting-started/gettingstartedqml.qdoc1050
-rw-r--r--doc/src/getting-started/gettingstartedqt.qdoc517
-rw-r--r--doc/src/getting-started/installation.qdoc7
-rw-r--r--doc/src/getting-started/tutorials.qdoc12
-rw-r--r--doc/src/images/addressbook-tutorial-part1-labeled-layout.pngbin20739 -> 19114 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part1-labeled-screenshot.pngbin26594 -> 23223 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part1-screenshot.pngbin7180 -> 9872 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part2-add-contact.pngbin10255 -> 12936 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part2-add-successful.pngbin8089 -> 10825 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part2-labeled-layout.pngbin31947 -> 27103 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part3-labeled-layout.pngbin39500 -> 27467 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part3-screenshot.pngbin10460 -> 14041 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part4-remove.pngbin13860 -> 22248 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part5-finddialog.pngbin6982 -> 10046 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part5-notfound.pngbin8177 -> 10789 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part5-screenshot.pngbin12557 -> 15849 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part6-load.pngbin40623 -> 24797 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part6-save.pngbin40406 -> 24747 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part6-screenshot.pngbin13598 -> 16819 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-part7-screenshot.pngbin14822 -> 18369 bytes
-rw-r--r--doc/src/images/addressbook-tutorial-screenshot.pngbin11916 -> 15275 bytes
-rw-r--r--doc/src/images/addressbook-tutorial.pngbin11481 -> 6200 bytes
-rw-r--r--doc/src/images/gs1.pngbin0 -> 7860 bytes
-rw-r--r--doc/src/images/gs2.pngbin0 -> 8630 bytes
-rw-r--r--doc/src/images/gs3.pngbin0 -> 9781 bytes
-rw-r--r--doc/src/images/gs4.pngbin0 -> 7494 bytes
-rw-r--r--doc/src/images/gs5.pngbin0 -> 23537 bytes
-rw-r--r--doc/src/images/qml-pathview-example.pngbin0 -> 22077 bytes
-rw-r--r--doc/src/images/touch-dials-example.png (renamed from doc/src/images/multitouch-dials-example.png)bin17676 -> 17676 bytes
-rw-r--r--doc/src/images/touch-examples.png (renamed from doc/src/images/multitouch-examples.png)bin6691 -> 6691 bytes
-rw-r--r--doc/src/images/touch-fingerpaint-example.png (renamed from doc/src/images/multitouch-fingerpaint-example.png)bin17026 -> 17026 bytes
-rw-r--r--doc/src/images/touch-knobs-example.png (renamed from doc/src/images/multitouch-knobs-example.png)bin1290 -> 1290 bytes
-rw-r--r--doc/src/images/touch-pinchzoom-example.png (renamed from doc/src/images/multitouch-pinchzoom-example.png)bin48154 -> 48154 bytes
-rw-r--r--doc/src/index.qdoc15
-rw-r--r--doc/src/internationalization/linguist-manual.qdoc4
-rw-r--r--doc/src/network-programming/bearermanagement.qdoc2
-rw-r--r--doc/src/platforms/emb-directfb-EmbLinux.qdoc4
-rw-r--r--doc/src/platforms/mac-differences.qdoc3
-rw-r--r--doc/src/platforms/platform-notes.qdocinc0
-rw-r--r--doc/src/porting/porting4.qdoc14
-rw-r--r--doc/src/qt-webpages.qdoc8
-rw-r--r--doc/src/qt4-intro.qdoc8
-rw-r--r--doc/src/snippets/code/doc_src_containers.qdoc8
-rw-r--r--doc/src/snippets/code/doc_src_installation.qdoc4
-rw-r--r--doc/src/snippets/code/doc_src_qalgorithms.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_qset.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_qt4-tulip.qdoc2
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp2
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qapplication.cpp4
-rw-r--r--doc/src/snippets/code/src_network_kernel_qhostinfo.cpp2
-rw-r--r--doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp2
-rw-r--r--doc/src/snippets/declarative/anchoranimation.qml65
-rw-r--r--doc/src/snippets/declarative/behavior.qml59
-rw-r--r--doc/src/snippets/declarative/coloranimation.qml52
-rw-r--r--doc/src/snippets/declarative/comments.qml3
-rw-r--r--doc/src/snippets/declarative/component.qml60
-rw-r--r--doc/src/snippets/declarative/componentCreation.js63
-rw-r--r--doc/src/snippets/declarative/createComponent-simple.qml57
-rw-r--r--doc/src/snippets/declarative/createComponent.qml4
-rw-r--r--doc/src/snippets/declarative/createQmlObject.qml7
-rw-r--r--doc/src/snippets/declarative/dynamicObjects-destroy.qml55
-rw-r--r--doc/src/snippets/declarative/mouseareadragfilter.qml72
-rw-r--r--doc/src/snippets/declarative/numberanimation.qml52
-rw-r--r--doc/src/snippets/declarative/parallelanimation.qml57
-rw-r--r--doc/src/snippets/declarative/parentanimation.qml74
-rw-r--r--doc/src/snippets/declarative/parentchange.qml5
-rw-r--r--doc/src/snippets/declarative/pathview/pathattributes.qml12
-rw-r--r--doc/src/snippets/declarative/propertyanimation.qml101
-rw-r--r--doc/src/snippets/declarative/qmldocuments.qml66
-rw-r--r--doc/src/snippets/declarative/qtobject.qml55
-rw-r--r--doc/src/snippets/declarative/rotationanimation.qml66
-rw-r--r--doc/src/snippets/declarative/sequentialanimation.qml57
-rw-r--r--doc/src/snippets/declarative/smoothedanimation.qml69
-rw-r--r--doc/src/snippets/declarative/springanimation.qml (renamed from doc/src/snippets/declarative/dynamicObjects.qml)36
-rw-r--r--doc/src/snippets/declarative/state-when.qml55
-rw-r--r--doc/src/snippets/declarative/state.qml21
-rw-r--r--doc/src/snippets/declarative/states.qml38
-rw-r--r--doc/src/snippets/declarative/transition-from-to.qml62
-rw-r--r--doc/src/snippets/declarative/transition-reversible.qml65
-rw-r--r--doc/src/snippets/declarative/transition.qml59
-rw-r--r--doc/src/snippets/droparea.cpp2
-rw-r--r--doc/src/snippets/picture/picture.cpp4
-rw-r--r--doc/src/snippets/qfontdatabase/main.cpp4
-rw-r--r--doc/src/snippets/qlistview-dnd/model.cpp4
-rw-r--r--doc/src/snippets/qstringlist/main.cpp2
-rw-r--r--doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp2
-rw-r--r--doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp4
-rw-r--r--doc/src/template/style/OfflineStyle.css251
-rw-r--r--doc/src/template/style/narrow.css21
-rwxr-xr-xdoc/src/template/style/style.css13
-rw-r--r--doc/src/template/style/superfish_skin.css83
-rw-r--r--doc/src/widgets-and-layouts/layout.qdoc2
120 files changed, 3781 insertions, 785 deletions
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index c5333df..401cf16 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -67,7 +67,9 @@ A property animation can also be specified as a resource that is manipulated fro
\snippet doc/src/snippets/declarative/animation.qml property-anim-3
As can be seen, when an animation is used like this (as opposed to as a value source) you will need
-to explicitly set the \c target and \c property to animate.
+to explicitly set the \c target and \c property to animate. This also the only case where
+an animation needs to be started explictly by either setting the \c running property to
+true or calling the \c start() method.
Animations can be joined into a group using SequentialAnimation and ParallelAnimation.
diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc
index a5e53a9..997f601 100644
--- a/doc/src/declarative/dynamicobjects.qdoc
+++ b/doc/src/declarative/dynamicobjects.qdoc
@@ -39,31 +39,35 @@ QML also supports the dynamic creation of objects from within JavaScript
code. This is useful if the existing QML elements do not fit the needs of your
application, and there are no C++ components involved.
-See the {declarative/toys/dynamicscene}{Dynamic Scene example} for a demonstration
+See the \l {declarative/toys/dynamicscene}{Dynamic Scene example} for a demonstration
of the concepts discussed on this page.
\section1 Creating Objects Dynamically
There are two ways to create objects dynamically from JavaScript. You can either call
-\l {QML:Qt::createComponent()}{Qt.createComponent()} to create
-a component which instantiates items, or use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+\l {QML:Qt::createComponent()}{Qt.createComponent()} to dynamically create
+a \l Component object, or use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
to create an item from a string of QML.
-Creating a component is better if you have a predefined
-item, and you want to create dynamic instances of that item; creating an item from
-a string of QML is useful when the item QML itself is generated at runtime.
+Creating a component is better if you have an existing component defined in a \c .qml
+file, and you want to dynamically create instances of that component. Otherwise,
+creating an item from a string of QML is useful when the item QML itself is generated
+at runtime.
-If you have a component specified in a QML file, you can dynamically load it with
-the \l {QML:Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}.
-This function takes the URL of the QML file as its only argument and returns
-a component object which can be used to create and load that QML file.
-Once you have a component you can use its \l {Component::createObject()}{createObject()} method to create an instance of
+\section2 Creating a Component dynamically
+
+To dynamically load a component defined in a QML file, call the
+\l {QML:Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}.
+This function takes the URL of the QML file as its only argument and creates
+a \l Component object from this URL.
+
+Once you have a \l Component, you can call its \l {Component::createObject()}{createObject()} method to create an instance of
the component. This function takes exactly one argument, which is the parent for the new item. Since graphical items will
not appear on the scene without a parent, it is recommended that you set the parent this way. However, if you wish to set
-the parent later you can safely pass null to this function.
+the parent later you can safely pass \c null to this function.
-Here is an example. Here is a \c Sprite.qml, which defines a simple QML component:
+Here is an example. First there is \c Sprite.qml, which defines a simple QML component:
\snippet doc/src/snippets/declarative/Sprite.qml 0
@@ -72,35 +76,48 @@ that will create \c Sprite objects:
\snippet doc/src/snippets/declarative/createComponent.qml 0
-Here is \c componentCreation.js. Remember that QML files that might be loaded
-over the network cannot be expected to be ready immediately:
+Here is \c componentCreation.js. Notice it checks whether the component \l{Component::status}{status} is
+\c Component.Ready before calling \l {Component::createObject()}{createObject()}
+in case the QML file is loaded over a network and thus is not ready immediately.
-\snippet doc/src/snippets/declarative/componentCreation.js 0
+\snippet doc/src/snippets/declarative/componentCreation.js vars
+\codeline
+\snippet doc/src/snippets/declarative/componentCreation.js func
+\snippet doc/src/snippets/declarative/componentCreation.js remote
+\snippet doc/src/snippets/declarative/componentCreation.js func-end
\codeline
-\snippet doc/src/snippets/declarative/componentCreation.js 1
+\snippet doc/src/snippets/declarative/componentCreation.js finishCreation
-If you are certain the files will be local, you could simplify to:
+If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation()
+function and call \l {Component::createObject()}{createObject()} immediately:
-\snippet doc/src/snippets/declarative/componentCreation.js 2
+\snippet doc/src/snippets/declarative/componentCreation.js func
+\snippet doc/src/snippets/declarative/componentCreation.js local
+\snippet doc/src/snippets/declarative/componentCreation.js func-end
-Notice that once a \c Sprite object is created, its parent is set to \c appWindow (defined
-in \c main.qml). After creating an item, you must set its parent to an item within the scene.
-Otherwise your dynamically created item will not appear in the scene.
+Notice in both instances, \l {Component::createObject()}{createObject()} is called with
+\c appWindow passed as an argument so that the created object will become a child of the
+\c appWindow item in \c main.qml. Otherwise, the new item will not appear in the scene.
When using files with relative paths, the path should
be relative to the file where \l {QML:Qt::createComponent()}{Qt.createComponent()} is executed.
-If the QML component does not exist until runtime, you can create a QML item from
+
+\section2 Creating an object from a string of QML
+
+If the QML is not defined until runtime, you can create a QML item from
a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example:
\snippet doc/src/snippets/declarative/createQmlObject.qml 0
The first argument is the string of QML to create. Just like in a new file, you will need to
-import any types you wish to use. For importing files with relative paths, the path should
-be relative to the file where the item in the second argument is defined. Remember to set the parent after
-creating the item. The second argument is another item in the scene, and the new item is created
-in the same QML Context as this item. The third argument is the file path associated with this
-item, which is used for error reporting.
+import any types you wish to use. The second argument is the parent item for the new item;
+this should be an existing item in the scene. The third argument is the file path to associate
+with the new item; this is used for error reporting.
+
+If the string of QML imports files using relative paths, the path should be relative
+to the file in which the parent item (the second argument to the method) is defined.
+
\section1 Maintaining Dynamically Created Objects
@@ -114,9 +131,9 @@ The actual creation context depends on how an item is created:
\o If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the creation context
is the QDeclarativeContext in which this method is called
\o If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
- if called, it is the context of the item used as the second argument to this method
+ if called, the creation context is the context of the parent item passed to this method
\o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()}
- is called on that item, it is the context in which the \c Component is defined
+ is called on that item, the creation context is the context in which the \c Component is defined
\endlist
Also, note that while dynamically created objects may be used the same as other objects, they
@@ -131,17 +148,47 @@ lots of dynamically created items, however, you may receive a worthwhile
performance benefit if unused items are deleted.
Note that you should never manually delete items that were dynamically created
-by QML elements (such as \l Loader). Also, you should generally avoid deleting
+by QML elements (such as \l Loader and \l Repeater). Also, you should avoid deleting
items that you did not dynamically create yourself.
Items can be deleted using the \c destroy() method. This method has an optional
argument (which defaults to 0) that specifies the approximate delay in milliseconds
-before the object is to be destroyed. This allows you to wait until the completion of
-an animation or transition. An example:
+before the object is to be destroyed.
+
+Here is an example. The \c application.qml creates five instances of the \c SelfDestroyingRect.qml
+component. Each instance runs a NumberAnimation, and when the animation has finished, calls
+\c destroy() on its root item to destroy itself:
+
+\table
+\row
+\o \c application.qml
+\o \c SelfDestroyingRect.qml
-\snippet doc/src/snippets/declarative/dynamicObjects.qml 0
+\row
+\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0
+\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0
+
+\endtable
+
+Alternatively, the \c application.qml could have destroyed the created object
+by calling \c object.destroy().
+
+Notice that if a \c SelfDestroyingRect instance was created statically like this:
+
+\qml
+Item {
+ SelfDestroyingRect { ... }
+}
+\endqml
+
+This would result in an error, since items can only be dynamically
+destroyed if they were dynamically created.
+
+Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+can similarly be destroyed using \c destroy():
+
+\snippet doc/src/snippets/declarative/createQmlObject.qml 0
+\snippet doc/src/snippets/declarative/createQmlObject.qml destroy
-Here, \c Rectangle objects are destroyed one second after they are created, which is long
-enough for the \c NumberAnimation to be played before the object is destroyed.
*/
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index 8a24228..9929cfe 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -175,6 +175,7 @@ The examples can be found in Qt's \c examples/declarative directory.
\list
\o \l{declarative/modelviews/gridview}{GridView}
\o \l{declarative/modelviews/listview}{ListView}
+\o \l{declarative/modelviews/pathview}{PathView}
\o \l{declarative/modelviews/package}{Package}
\o \l{declarative/modelviews/parallax}{Parallax}
\o \l{declarative/modelviews/visualitemmodel}{VisualItemModel}
@@ -202,6 +203,11 @@ The examples can be found in Qt's \c examples/declarative directory.
\o \l{declarative/threading/workerscript}{WorkerScript}
\endlist
+\section2 Screen orientation
+\list
+\o \l{declarative/screenorientation}{Example}
+\endlist
+
\section2 SQL Local Storage
\list
\o \l{declarative/sqllocalstorage}{Example}
diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc
index cc93e86..d128d0f 100644
--- a/doc/src/declarative/extending-tutorial.qdoc
+++ b/doc/src/declarative/extending-tutorial.qdoc
@@ -260,20 +260,34 @@ custom QML types may see unexpected behavior if bindings are not implemented.
\example declarative/tutorials/extending/chapter4-customPropertyTypes
The \c PieChart type currently has a string-type property and a color-type property.
-It could have many other types of properties. For example, we could add an
-integer-type property to store an identifier for each pie chart:
+It could have many other types of properties. For example, it could have an
+enum-type property to store a display mode for each chart:
\code
+ // C++
class PieChart : public QDeclarativeItem
{
+ Q_ENUMS(DisplayMode)
+ Q_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode)
...
- Q_PROPERTY(int id READ id WRITE setId)
+
public:
- ...
- int id() const;
- void setId(int id);
+ enum DisplayMode {
+ MultiLevel,
+ Exploded,
+ ThreeDimensional
+ };
+
+ void setDisplayMode(DisplayMode mode);
+ DisplayMode displayMode() const;
...
};
+
+ // QML
+ PieChart {
+ ...
+ displayMode: PieChart.Exploded
+ }
\endcode
We can also use various other property types. QML has built-in support for the following
@@ -407,7 +421,7 @@ To create a plugin library, we need:
\list
\o A plugin class that registers our QML types
\o A project file that describes the plugin
-\o A "qmldir" file that tells the QML engine to load the plugin
+\o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin
\endlist
First, we create a plugin class named \c ChartsPlugin. It subclasses QDeclarativeExtensionPlugin
@@ -427,8 +441,8 @@ and specifies with DESTDIR that library files should be built into a "lib" subdi
\quotefile declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
-Finally, we add a \c qmldir file that is automatically parsed by the QML engine.
-Here, we specify that a plugin named "chapter6-plugin" (the name
+Finally, we add a \l{Writing a qmldir file}{qmldir} file that is automatically parsed by the QML engine.
+In this file, we specify that a plugin named "chapter6-plugin" (the name
of the example project) can be found in the "lib" subdirectory:
\quotefile declarative/tutorials/extending/chapter6-plugins/qmldir
diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc
index 0dd5eb3..56ea165 100644
--- a/doc/src/declarative/focus.qdoc
+++ b/doc/src/declarative/focus.qdoc
@@ -73,12 +73,12 @@ See also the \l {Keys}{Keys attached property} and \l {KeyNavigation}{KeyNavigat
\section1 Querying the Active Focus Item
Whether or not an \l Item has \e {active focus} can be queried through the
-property \c {Item::focus}. For example, here we have a \l Text
+property \c {Item::activeFocus}. For example, here we have a \l Text
element whose text is determined by whether or not it has \e {active focus}.
\code
Text {
- text: focus ? "I have active focus!" : "I do not have active focus"
+ text: activeFocus ? "I have active focus!" : "I do not have active focus"
}
\endcode
@@ -174,7 +174,7 @@ Rectangle {
The right hand side of the example shows the expanded code - the equivalent QML
without the use of the component \c {MyWidget}. From this, the problem is
evident - there are no less than three elements that have the \c {Item::focus}
-property set to true. Ultimately only one element can have focus, and the
+property set to true. Ultimately only one element can have keyboard focus, and the
system has to decide which on. In this case the first appearance of the
\c {Item::focus} property being set to true on line 4 is selected, and the value
of \c {Item::focus} in the other two instances is reverted back to false. This
@@ -233,7 +233,7 @@ and the others are unset, just like when there are no \e {focus scopes}.
\o When a \e {focus scope} receives \e {active focus}, the contained element with
\c {Item::focus} set (if any) also gets \e {active focus}. If this element is
also a \l FocusScope, the proxying behaviour continues. Both the
-\e {focus scope} and the sub-focused item will have \c {Item::focus} set.
+\e {focus scope} and the sub-focused item will have \c {Item::activeFocus} set.
\endlist
So far the example has the second component statically selected. It is trivial
@@ -266,7 +266,7 @@ When a QML item explicitly relinquishes focus (by setting its
does not automatically select another element to receive focus. That is, it
is possible for there to be no currently \e {active focus}.
-See the {declarative/keyinteraction/focus}{Keyboard Focus example} for a
+See the \l{declarative/keyinteraction/focus}{Keyboard Focus example} for a
demonstration of moving keyboard focus between multiple areas using FocusScope
elements.
diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc
index c41e38e..18da3d2 100644
--- a/doc/src/declarative/javascriptblocks.qdoc
+++ b/doc/src/declarative/javascriptblocks.qdoc
@@ -236,6 +236,31 @@ This restriction exists as the QML environment is not yet fully established.
To run code after the environment setup has completed, refer to
\l {Running JavaScript at Startup}.
+\o The value of \c this is currently undefined in QML
+
+The value of \c this is undefined in QML. To refer to any element, provide
+an \c id. For example:
+
+\qml
+Item {
+ width: 200; height: 100
+ function mouseAreaClicked(area) {
+ console.log("Clicked in area at: " + area.x + ", " + area.y);
+ }
+ // This will not work because this is undefined
+ MouseArea {
+ height: 50; width: 200
+ onClicked: mouseAreaClicked(this)
+ }
+ // This will pass area2 to the function
+ MouseArea {
+ id: area2
+ y: 50; height: 50; width: 200
+ onClicked: mouseAreaClicked(area2)
+ }
+}
+\endqml
+
\endlist
*/
diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
index 938222a..9e51a40 100644
--- a/doc/src/declarative/modules.qdoc
+++ b/doc/src/declarative/modules.qdoc
@@ -30,152 +30,277 @@
\title Modules
\section1 QML Modules
-A \bold {QML module} is a collection of QML types. They allow you to organize your QML content
-into independent units. Modules have an optional versioning mechanism that allows for independent
+
+A module is a set of QML content files that can be imported as a unit into a QML
+application. Modules can be used to organize QML content into independent units,
+and they can use a versioning mechanism that allows for independent
upgradability of the modules.
-There are two types of modules:
-location modules (defined by a URL),
-and
-installed modules (defined by a URI).
+While QML component files within the same directory are automatically accessible
+within the global namespace, components defined elsewhere must be imported
+explicitly using the \c import statement to import them as modules. For
+example, an \c import statement is required to use:
+
+\list
+\o A component defined in another QML file that is not in the same directory
+\o A component defined in a QML file located on a remote server
+\o A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} library (unless the plugin is installed in the same directory)
+\o A JavaScript file (note this must be imported using \l {#namespaces}{named imports})
+\endlist
+
+An \c import statement includes the module name, and possibly a version number.
+This can be seen in the snippet commonly found at the top of QML files:
+
+\qml
+ import Qt 4.7
+\endqml
+
+This imports version 4.7 of the "Qt" module into the global namespace. (The QML
+library itself must be imported to use any of the \l {QML Elements}, as they
+are not included in the global namespace by default.)
+
+The \c Qt module is an \e installed module; it is found in the
+\l{The QML import path}{import path}. There are two types of QML modules:
+location modules (defined by a URL) and installed modules (defined by a URI).
+
+
+\section1 Location Modules
+
+Location modules can reside on the local filesystem or a network resource,
+and are referred to by a quoted location URL that specifies the filesystem
+or network URL. They allow any directory with QML content to be imported
+as a module, whether the directory is on the local filesystem or a remote
+server.
+
+For example, a QML project may have a separate directory for a set of
+custom UI components. These components can be accessed by importing the
+directory using a relative or absolute path, like this:
+
+\table
+\row
+\o Directory structure
+\o Contents of application.qml
+
+\row
+\o
+\code
+MyQMLProject
+ |- MyComponents
+ |- Slider.qml
+ |- CheckBox.qml
+ |- Main
+ |- application.qml
+\endcode
+
+\o
+\code
+import "../MyComponents"
+
+Slider { ... }
+CheckBox { ... }
+\endcode
+
+\endtable
-Location modules types are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins}
-in a directory refered to directly by
-the location URL, either on the local filesystem, or as a network resource. The URL that locates them
-can be relative, in which case they actual URL is resolved by the QML file containing the import.
-When importing a location module, a quoted URL is used:
+Similarly, if the directory resided on a network source, it could
+be imported like this:
\code
-import "https://qml.nokia.com/qml/example" 1.0
-import "https://qml.nokia.com/qml/example" as NokiaExample
-import "mymodule" 1.0
-import "mymodule"
+ import "https://qml.nokia.com/qml/qmlcomponents"
+ import "https://qml.nokia.com/qml/qmlcomponents" 1.0
\endcode
-Installed modules can \e only be on the local file system or in application C++ code. Again they
-are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins} in a directory,
-but the directory is indirectly referred to by the URI. The mapping to actual content is either
-by application C++ code registering a C++ type to a module URI (see \l{Extending QML in C++}),
-or in the referenced subdirectory of a path on the import path (see below).
-When importing a location module, an un-quoted URI is used:
+Remote location modules must have a \l{Writing a qmldir file}{qmldir file} in the
+same directory to specify which QML files should be made available. See the
+\l {#qmldirexample}{example} below. The qmldir file is optional for modules on
+the local filesystem.
+
+
+
+\section1 Installed modules
+
+
+Installed modules are modules that are installed on the
+local filesystem within the QML import path, or modules defined in C++
+application code. When importing an installed module, an un-quoted URI is
+used, with a mandatory version number:
\code
-import com.nokia.qml.mymodule 1.0
-import com.nokia.qml.mymodule as MyModule
+ import Qt 4.7
+ import com.nokia.qml.mymodule 1.0
\endcode
+Installed modules that are installed into the import path or created
+as a \l{QDeclarativeExtensionPlugin}{QML C++ plugin} must define a
+\l{Writing a qmldir file}{qmldir file}.
+
+
+\section2 The QML import path
-For either type of module, a \c qmldir file in the module directory defines the content of the module. This file is
-optional for location modules, but only for local filesystem content or a single remote content with a namespace.
-The second exception is explained in more detail in the section below on Namespaces.
+The QML engine will search the import path for a requested installed module.
+The default import path includes:
-\section2 The Import Path
+\list
+\o The directory of the current file
+\o The location specified by QLibraryInfo::ImportsPath
+\o Paths specified by the \c QML_IMPORT_PATH environment variable
+\endlist
-Installed modules are searched for on the import path.
-The \c -I option to the \l {QML Viewer} adds paths to the import path.
+The import path can be queried using QDeclarativeEngine::importPathList() and modified using QDeclarativeEngine::addImportPath().
-From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to
-using \l QDeclarativeEngine::addImportPath().
+When running the \l {QML Viewer}, use the \c -I option to add paths to the import path.
-\section2 The \c qmldir File
-Installed QML modules and remote content without a namespace require a file \c qmldir which
-specifies the mapping from all type names to versioned QML files. It is a list of lines of the form:
+\section2 Creating installed modules in C++
+
+C++ applications can dynamically define installed modules using
+qmlRegisterType().
+
+For \l{QDeclarativeExtensionPlugin}{QML C++ plugins}, the
+module URI is automatically passed to QDeclarativeExtensionPlugin::registerTypes().
+The QDeclarativeExtensionPlugin documentation shows how to use this URI
+to call qmlRegisterType() to enable the plugin library to be built as
+an installed module. Once the plugin is built and installed, the module is importable
+in QML, like this:
+
+\code
+import com.nokia.TimeExample 1.0
+\endcode
+
+A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} also requires a
+\l{Writing a qmldir file}{qmldir file} to make it available to the
+QML engine.
+
+
+
+\target namespaces
+\section1 Namespaces: Using Named Imports
+
+By default, when a module is imported, its contents are imported into the global namespace. You may choose to import the module into another namespace, either to allow identically-named types to be referenced, or purely for readability.
+
+To import a module into a specific namespace, use the \e as keyword:
+
+\qml
+ import Qt 4.7 as QtLibrary
+ import "../MyComponents" as MyComponents
+ import com.nokia.qml.mymodule 1.0 as MyModule
+\endqml
+
+Types from these modules can then only be used when qualified by the namespace:
+
+\qml
+ QtLibrary.Rectangle { ... }
+
+ MyComponents.Slider { ... }
+
+ MyModule.SomeComponent { ... }
+\endqml
+
+Multiple modules can be imported into the same namespace in the same way that multiple modules can be imported into the global namespace:
+
+\qml
+ import Qt 4.7 as Nokia
+ import Ovi 1.0 as Nokia
+\endqml
+
+\section2 JavaScript files
+
+JavaScript files must always be imported with a named import:
+
+\qml
+ import "somescript.js" as MyScript
+
+ Item {
+ //...
+ Component.onCompleted: MyScript.doSomething()
+ }
+\endqml
+
+
+
+\section1 Writing a qmldir file
+
+A \c qmldir file is a metadata file for a module that maps all type names in
+the module to versioned QML files. It is required for installed modules, and
+location modules that are loaded from a network source.
+
+It is defined by a plain text file named "qmldir" that contains one or more lines of the form:
\code
# <Comment>
<TypeName> [<InitialVersion>] <File>
-internal <Name> <File>
+internal <TypeName> <File>
plugin <Name> [<Path>]
\endcode
-# <Comment> lines are ignored, and can be used for comments.
+\bold {# <Commment>} lines are used for comments. They are ignored by the QML engine.
-<TypeName> <InitialVersion> <File> lines are used to add QML files as types.
-<TypeName> is the type being made available; the optional <InitialVersion> is a version
-number like \c 4.0; <File> is the (relative)
-file name of the QML file defining the type.
+\bold {<TypeName> [<InitialVersion>] <File>} lines are used to add QML files as types.
+<TypeName> is the type being made available, the optional <InitialVersion> is a version
+number, and <File> is the (relative) file name of the QML file defining the type.
Installed files do not need to import the module of which they are a part, as they can refer
to the other QML files in the module as relative (local) files, but
if the module is imported from a remote location, those files must nevertheless be listed in
the \c qmldir file. Types which you do not wish to export to users of your module
-may be marked with the \c internal keyword: \c internal <TypeName> <File>.
+may be marked with the \c internal keyword: \bold {internal <TypeName> <File>}.
The same type can be provided by different files in different versions, in which
case later versions (eg. 1.2) must precede earlier versions (eg. 1.0),
since the \e first name-version match is used and a request for a version of a type
can be fulfilled by one defined in an earlier version of the module. If a user attempts
to import a version earlier than the earliest provided or later than the latest provided,
-an error results, but if the user imports a version within the range of versions provided,
-even if no type is specific to that version, no error results.
+the import produces a runtime error, but if the user imports a version within the range of versions provided,
+even if no type is specific to that version, no error will occur.
A single module, in all versions, may only be provided in a single directory (and a single \c qmldir file).
If multiple are provided, only the first in the search path will be used (regardless of whether other versions
are provided by directories later in the search path).
-Installed and remote files without a namespace \e must be referred to by version information described above,
-local files \e may have it.
-
The versioning system ensures that a given QML file will work regardless of the version
of installed software, since a versioned import \e only imports types for that version,
leaving other identifiers available, even if the actual installed version might otherwise
provide those identifiers.
-\c plugin <Name> [<Path>] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins}
-to the module.
-
-<Name> is the name of the library. It is usually not the same as the file name
-of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce
-a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows.
-By default the engine searches for the plugin library in the directory containing the \c qmldir
-file. The \c -P option to the \l {QML Viewer} adds paths to the
-plugin search path.
-From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to
-using \l QDeclarativeEngine::addPluginPath().
+\bold {plugin <Name> [<Path>]} lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} to the module. <Name> is the name of the library. It is usually not the same as the file name
+of the plugin binary, which is platform dependent; e.g. the library \c MyAppTypes would produce
+\c libMyAppTypes.so on Linux and \c MyAppTypes.dll on Windows.
<Path> is an optional argument specifying either an absolute path to the directory containing the
plugin file, or a relative path from the directory containing the \c qmldir file to the directory
-containing the plugin file.
-
+containing the plugin file. By default the engine searches for the plugin library in the directory that contains the \c qmldir
+file. The plugin search path can be queried with QDeclarativeEngine::pluginPathList() and modified using QDeclarativeEngine::addPluginPath(). When running the \l {QML Viewer}, use the \c -P option to add paths to the plugin search path.
-\section2 Namespaces - Named Imports
-When importing content it by default imports types into the global namespace.
-You may choose to import the module into another namespace, either to allow identically-named
-types to be referenced, or purely for readability.
+\target qmldirexample
+\section2 Example
-To import a module into a namespace:
+If the components in the \c MyComponents directory from the
+\l{Location Modules}{earlier example} were to be made available as a network resource,
+the directory would need to contain a \c qmldir file similar to this:
\code
-import Qt 4.7 as TheQtLibrary
+ComponentA 1.0 ComponentA.qml
+ComponentB 1.0 ComponentB.qml
\endcode
-Types from the Qt 4.7 module may then be used, but only by qualifying them with the namespace:
+The \c MyComponents directory could then be imported as a module using:
\code
-TheQtLibrary.Rectangle { ... }
-\endcode
-
-Multiple modules can be imported into the same namespace in the same way that multiple
-modules can be imported into the global namespace:
+import "http://the-server-name.com/MyComponents"
-\code
-import Qt 4.7 as Nokia
-import Ovi 1.0 as Nokia
+Slider { ... }
+CheckBox { ... }
\endcode
-While import statements are needed to make any types available in QML, the directory of the
-current file is implicitly loaded. This is the exact same as if you had added 'import "."' to
-the start of every QML file. The effect of this is that you can automatically use types defined in C++ plugins
-or QML files if they reside in the same directory. This is the last location searched for types - so if you
-happen to have a "Text.qml" file, or "text.qml" on case-insensitive file systems, it will not override
-the one from Qt if you import Qt.
-
-*/
+with an optional "1.0" version specification. Notice the import fails if
+a later version is used, as the \c qmldir file specifies that these elements
+are only available in the 1.0 version.
-/*
-Original requirement is QT-558.
+For examples of \c qmldir files for plugins, see the
+\l {declarative/cppextensions/plugins}{Plugins} example and
+\l {Tutorial: Writing QML extensions with C++}.
*/
+/
diff --git a/doc/src/declarative/pics/anatomy-component.png b/doc/src/declarative/pics/anatomy-component.png
index 70ed983..6125b00 100644
--- a/doc/src/declarative/pics/anatomy-component.png
+++ b/doc/src/declarative/pics/anatomy-component.png
Binary files differ
diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc
index a2ed205..068297a 100644
--- a/doc/src/declarative/qdeclarativedocument.qdoc
+++ b/doc/src/declarative/qdeclarativedocument.qdoc
@@ -73,51 +73,61 @@ document - such as \c Rectangle and \c ListView - including those made within an
import statements. QML does not import any modules by default, so at least one \c import
statement must be present or no elements will be available!
+Each \c id value in a QML document must be unique within that document. They
+do not need to be unique across different documents as id values are
+resolved according to the document scope.
+
+
+\section1 Documents as Component Definitions
+
A QML document defines a single, top-level \l {QDeclarativeComponent}{QML component}. A QML component
is a template that is interpreted by the QML runtime to create an object with some predefined
behaviour. As it is a template, a single QML component can be "run" multiple times to
produce several objects, each of which are said to be \e instances of the component.
Once created, instances are not dependent on the component that created them, so they can
-operate on independent data. Here is an example of a simple "Button" component that is
-instantiated four times, each with a different value for its \c text property.
+operate on independent data. Here is an example of a simple "Button" component (defined
+in a \c Button.qml file) that is instantiated four times by \c application.qml.
+Each instance is created with a different value for its \c text property:
-\raw HTML
-<table><tr><td>
-\endraw
-\code
+\table
+\row
+\o Button.qml
+\o application.qml
+
+\row
+\o \snippet doc/src/snippets/declarative/qmldocuments.qml 0
+\o
+\qml
import Qt 4.7
-BorderImage {
- property alias text: textElement.text
- width: 100; height: 30; source: "images/toolbutton.sci"
-
- Text {
- id: textElement
- anchors.centerIn: parent
- font.pointSize: 20
- style: Text.Raised
- color: "white"
- }
+Column {
+ spacing: 10
+
+ Button { text: "Apple" }
+ Button { text: "Orange" }
+ Button { text: "Pear" }
+ Button { text: "Grape" }
}
-\endcode
-\raw HTML
-</td> <td>
-\endraw
+\endqml
+
\image anatomy-component.png
-\raw HTML
-</td> </tr> </table>
-\endraw
+
+\endtable
Any snippet of QML code can become a component, just by placing it in the file "<Name>.qml"
-where <Name> is the new element name, and begins with an uppercase letter. Note that
+where <Name> is the new element name, and begins with an \bold uppercase letter. Note that
the case of all characters in the <Name> are significant on some filesystems, notably
UNIX filesystems. It is recommended that the case of the filename matches the case of
the component name in QML exactly, regardless of the platform the QML will be deployed to.
-These QML files automatically become available as new QML element types
+These QML component files automatically become available as new QML element types
to other QML components and applications in the same directory.
+
+
+\section1 Inline Components
+
In addition to the top-level component that all QML documents define, and any reusable
components placed in separate files, documents may also
include \e inline components. Inline components are declared using the
diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc
index b6e6c6e..70a3587 100644
--- a/doc/src/declarative/qdeclarativei18n.qdoc
+++ b/doc/src/declarative/qdeclarativei18n.qdoc
@@ -80,5 +80,5 @@ qmlviewer -translation hello.qm hello.qml
\endcode
-You can see a complete example and source code in the {declarative/i18n}{QML Internationalization example}.
+You can see a complete example and source code in the \l{declarative/i18n}{QML Internationalization example}.
*/
diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc
index 3f1b184..fa42f59 100644
--- a/doc/src/declarative/qdeclarativeintro.qdoc
+++ b/doc/src/declarative/qdeclarativeintro.qdoc
@@ -87,6 +87,10 @@ Rectangle { width: 100; height: 100 }
When multiple property/value pairs are specified on a single line, they
must be separated by a semicolon.
+The \c import statement imports the \c Qt \l{QML Modules}{module}, which contains all of the
+standard \l {QML Elements}. Without this import statement, the \l Rectangle
+and \l Image elements would not be available.
+
\section1 Expressions
In addition to assigning values to properties, you can also assign
@@ -129,7 +133,7 @@ Commenting in QML is similar to JavaScript.
\o Multiline comments start with /* and finish with *\/
\endlist
-\quotefile doc/src/snippets/declarative/comments.qml
+\snippet doc/src/snippets/declarative/comments.qml 0
Comments are ignored by the engine. They are useful for explaining what you
are doing; for referring back to at a later date, or for others reading
@@ -181,7 +185,8 @@ Item {
\section3 The \c id property
-Each object can be given a special unique property called an \e id. Assigning an id enables the object
+Each object can be given a special unique property called an \e id. No other object within the
+same \l{QML Documents}{QML document} can have the same \c id value. Assigning an id enables the object
to be referred to by other objects and scripts.
The first Rectangle element below has an \e id, "myRect". The second Rectange element defines its
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index a2f4d3a..173002a 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -208,7 +208,10 @@ Models can be defined in C++ and then made available to QML. This is useful
for exposing existing C++ data models or otherwise complex datasets to QML.
A C++ model class can be defined as a QStringList, a QList<QObject*> or a
-QAbstractItemModel.
+QAbstractItemModel. The first two are useful for exposing simpler datasets,
+while QAbstractItemModel provides a more flexible solution for more complex
+models.
+
\section2 QStringList
@@ -268,7 +271,10 @@ the model by calling QDeclarativeContext::setContextProperty() again.
\section2 QAbstractItemModel
-A model can be defined by subclassing QAbstractItemModel.
+A model can be defined by subclassing QAbstractItemModel. This is the
+best approach if you have a more complex model that cannot be supported
+by the other approaches. A QAbstractItemModel can also automatically
+notify a QML view when the model data has changed.
The roles of a QAbstractItemModel subclass can be exposed to QML by calling
QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
@@ -305,6 +311,12 @@ roles:
\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0
+QML views are automatically updated when the model changes. Remember the model
+must follow the standard rules for model changes and notify the view when
+the model has changed by using QAbstractItemModel::dataChanged(),
+QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for
+more information.
+
The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory.
QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML
diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc
index 6461925..0b91756 100644
--- a/doc/src/declarative/qdeclarativestates.qdoc
+++ b/doc/src/declarative/qdeclarativestates.qdoc
@@ -32,57 +32,174 @@
\section1 Overview
-QML states typically describe user interface configurations, including:
+User interfaces are designed to present different interface configurations in
+different scenarios, or to modify their appearances in response to user
+interaction. Often, there are a set of changes that are made concurrently, such
+that the interface could be seen to be internally changing from one \e state to
+another.
+
+This applies generally to interface elements regardless of their complexity.
+A photo viewer may initially present images in a grid, and when an image is
+clicked, change to a "detailed" state where the individual image is expanded
+and the interface is changed to present new options for image editing. On the
+other end of the scale, when a simple button is pressed, it may change to a
+"pressed" state in which its color and position is modified to give a pressed
+appearance.
+
+In QML, any object can change between different \e states to apply sets of
+changes that modify the properties of relevant items. Each \e state could
+present a different configuration that could, for example:
+
\list
-\o What UI elements are present
-\o The properties of those elements (including how they behave)
-\o What actions are available
+\o Show some UI elements and hide others
+\o Present different available actions to the user
+\o Start, stop or pause animations
+\o Execute some script required in the new state
+\o Change a property value for a particular item
+\o Show a different view or "screen"
\endlist
-A state can also be thought of as a set of batched changes from a default configuration.
+Changes between states can be animated using \l {Transitions}{transitions}, as
+discussed further below.
-Examples of states in modern UI:
-\list
-\o An Address Book application with a 'View Contact' state and an 'Edit Contact' State. In the first state the contact information presented is read-only (using labels), and in the second it is editable (using editors).
-\o A button with a pressed and unpressed state. When pressed the text moves slightly down and to the right, and the button has a slightly darker appearance.
-\endlist
+All \l {Item}-based objects have a \e {default state}, and can specify additional
+states by adding new \l State objects to the item's \l {Item::}{states}
+property. Each state has a \e name that is unique for all states within that
+item; the default state's name is an empty string. To change the current state
+of an item, set the \l {Item::}{state} property to the name of the state.
+
+Non-Item objects can use states through the StateGroup element.
-\section1 States in QML
-In QML:
+\section1 Creating states
+
+To create a state, add a \l State object to the item's \l {Item::}{states} property,
+which holds a list of states for that item.
+
+Following is an example. Here, the \l Rectangle is initially placed in the
+default (0, 0) position. It has defined an additional state named "moved", in
+which a PropertyChanges object repositions the rectangle to (50, 50). Clicking
+within the MouseArea changes the state to the "moved" state, thus moving the \l
+Rectangle.
+
+\snippet doc/src/snippets/declarative/states.qml 0
+
+A \l State item defines all the changes to be made in the new state. You
+could specify additional properties to be changed, or create additional
+PropertyChanges for other objects. (Note that a \l State can modify the
+properties of other objects, not just the object that owns the state.)
+
+For example:
+
+\qml
+State {
+ name: "moved"
+ PropertyChanges { target: myRect; x: 50; y: 50; color: "blue" }
+ PropertyChanges { target: someOtherItem; width: 1000 }
+}
+\endqml
+
+A \l State is not limited to performing modifications on property values. It
+can also:
+
\list
-\o Any object can use states.
-\o There is a default state. The default state can be explicitly set.
-\o A state can affect the properties of other objects, not just the object owning the state (and not just that object's children).
+\o Run some script using StateChangeScript
+\o Override an existing signal handler for an object using PropertyChanges
+\o Re-parent an \l Item using ParentChanges
+\o Modify anchor values using AnchorChanges
\endlist
-To define a state for an item, add a \l State element to the \l{Item::states}{states} property. To
-change the current state of an \l Item, set the \l{Item::state}{state} property to the name
-of the required state.
+The \l {declarative/animation/states}{States and Transitions example}
+demonstrates how to declare a basic set of states and apply animated
+transitions between them.
-Here is an example of using states. In the default state \c myRect is positioned at 0,0. In the 'moved' state it is positioned at 50,50. Clicking within the mouse area changes the state from the default state to the 'moved' state, thus moving the rectangle.
-\snippet doc/src/snippets/declarative/states.qml 0
-\snippet doc/src/snippets/declarative/states.qml 1
+\section1 The default state
-State changes can be animated using \l{state-transitions}{Transitions}.
+Of course, the \l Rectangle in the example above could have simply been moved
+by setting its position to (50, 50) in the mouse area's \c onClicked handler.
+However, aside from enabling batched property changes, the use of states allows
+an item to revert to its \e {default state}, which contains all of the items'
+initial property values before they were modified in a state change.
-For example, adding this code to the above \c Item element animates the transition to the "moved" state:
+The default state is specified by an empty string. If the MouseArea in the
+above example was changed to this:
-\snippet doc/src/snippets/declarative/states.qml transitions
+\qml
+MouseArea {
+ anchors.fill: parent
+ onClicked: myRect.state == 'moved' ? myRect.state = "" : myRect.state = 'moved';
+}
+\endqml
-See \l{state-transitions}{Transitions} for more information.
+This would toggle the \l Rectangle's state between the \e moved and \e default
+states when clicked. The properties can be reverted to their initial
+values without requiring the definition of another \l State that defines these
+value changes.
-Other things you can do in a state change:
-\list
-\o Override signal handlers with PropertyChanges
-\o Change an item's visual parent with ParentChange
-\o Change an item's anchors with AnchorChanges
-\o Run some script with StateChangeScript
-\endlist
+\section1 The "when" property
+
+The \l {State::}{when} property is useful for specifying when a state should be
+applied. This can be set to an expression that evaluates to \c true when an
+item should change to a particular state.
+
+If the above example was changed to this:
+
+\qml
+Rectangle {
+ ...
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "moved"; when: mouseArea.pressed
+ ...
+ }
+\endqml
+
+The \l Rectangle would automatically change to the \e moved state when the
+mouse is pressed, and revert to the default state when it is released. This is
+simpler (and a better, more declarative method) than creating \c onPressed
+and \c onReleased handlers in the MouseArea to set the current state.
+
+
+\section1 Animating state changes
+
+
+State changes can be easily animated through \l {Transitions}{transitions}. A
+\l Transition defines the animations that should be applied when an item
+changes from one state to another.
+
+If the above example was modified to include the following \l Transition, the
+movement of the \l Rectangle would be animated:
+
+\qml
+Rectangle {
+ ...
+
+ MouseArea { ... }
+
+ states: [
+ ...
+ ]
+
+ transitions: [
+ Transition {
+ NumberAnimation { properties: "x,y"; duration: 500 }
+ }
+ ]
+ }
+\endqml
+
+This \l Transition defines that if any \c x or \c y properties have changed
+during a state change within this item, their values should be animated over 500
+millliseconds.
-The {declarative/animation/states}{States and Transitions example} demonstrates how to declare a basic set of states and then apply animated transitions between them.
+See the \l Transitions documentation for more information.
*/
diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc
index 5efc0ce..41c4c80 100644
--- a/doc/src/declarative/qmlviewer.qdoc
+++ b/doc/src/declarative/qmlviewer.qdoc
@@ -197,10 +197,10 @@ Rectangle {
\o \c runtime.orientation
\o This property indicates the current orientation of the QML Viewer. On the
-N900 platform, this property automatically updates to reflect the device's
-actual orientation; on other platforms, this indicates the orientation currently
-selected in the QML Viewer's \e {Settings -> Properties} menu. The
-\c orientation value can be one of the following:
+N900 platform and most S60 5.0-based or newer Symbian devices, this property
+automatically updates to reflect the device's actual orientation; on other platforms,
+this indicates the orientation currently selected in the QML Viewer's
+\e {Settings -> Properties} menu. The \c orientation value can be one of the following:
\list
\o \c Orientation.Portrait
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index fb50286..413eb59 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -70,13 +70,23 @@
Returns the QML type id.
- Example: Register the C++ class \c MinehuntGame as the QML type
- named \c Game for version 0.1 in the import library \c MinehuntCore:
+ For example, this registers a C++ class \c MySliderItem as a QML type
+ named \c Slider for version 1.0 of a \l{QML Modules}{module} called
+ "com.mycompany.qmlcomponents":
\code
- qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game");
+ qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider");
\endcode
+ Once this is registered, the type can be used in QML by importing the
+ specified module name and version number:
+
+ \qml
+ imoprt com.mycompany.qmlcomponents 1.0
+
+ Slider { ... }
+ \endqml
+
Note that it's perfectly reasonable for a library to register types to older versions
than the actual version of the library. Indeed, it is normal for the new library to allow
QML written to previous versions to continue to work, even if more advanced versions of
diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc
index 7a97eb1..f913d44 100644
--- a/doc/src/declarative/tutorial.qdoc
+++ b/doc/src/declarative/tutorial.qdoc
@@ -222,5 +222,5 @@ This is equivalent to writing the two transitions separately.
The \l ParallelAnimation element makes sure that the two types of animations (number and color) start at the same time.
We could also run them one after the other by using \l SequentialAnimation instead.
-For more details on states and transitions, see \l {QML States} and the {declarative/animation/states}{states and transitions example}.
+For more details on states and transitions, see \l {QML States} and the \l{declarative/animation/states}{states and transitions example}.
*/
diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc
index 36970ee..9e881d1 100644
--- a/doc/src/development/debug.qdoc
+++ b/doc/src/development/debug.qdoc
@@ -49,7 +49,7 @@
The basic stuff you need to know about debug libraries and
frameworks is found at developer.apple.com in:
\l{http://developer.apple.com/technotes/tn2004/tn2124.html#SECDEBUGLIB}
- {Apple Technicle Note TN2124} Qt follows that.
+ {Apple Technical Note TN2124}.
When you build Qt, frameworks are built by default, and inside the
framework you will find both a release and a debug version (e.g.,
diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc
index ffc5a8e..f9b38b8 100644
--- a/doc/src/development/developing-with-qt.qdoc
+++ b/doc/src/development/developing-with-qt.qdoc
@@ -27,12 +27,22 @@
/*!
\page developing-with-qt.html
- \title Cross Platform Development with Qt
+
+ \title Cross-platform & Platform-specific Development
+ Qt allows you to write advanced applications and UIs once, and deploy them
+ across desktop and embedded operating systems without rewriting the source
+ code. The top section of this page provides an overview of the tools and
+ techniques used in Qt application development. Still, you might want to add
+ platform-specific features to your code. The bottom section of the page
+ links to documents that describe platform-specific features provided by Qt,
+ and discuss issues related to particular platforms and environments.
+
+ \section1 Cross-platform Development with Qt
Qt is provided with a set of build tools to help developers automate
the process of building and installing Qt applications.
- \table 100%
+ \table
\header \o Development \o Cross-Platform Issues \o Specific Tools
\row
\o
@@ -57,4 +67,49 @@
\o \l {Resource Compiler (rcc)}
\endlist
\endtable
-*/
+
+ \section1 Platform-specific Development with Qt
+
+ These documents describe platform-specific features provided by Qt, and
+ discuss issues related to particular platforms and environments.
+
+ \table
+ \row
+ \o
+ \list
+ \o \l {Calling Qt Functions From Unix Signal Handlers}
+ \o \l {Compiler Notes}
+ \o \l {Developing Qt Applications for Mac OS X}
+ \o \l {Known Issues}
+ \o \l {Platform Notes}
+ \o \l {Platform Notes - Symbian}
+ \o \l {Qt For ActiveX}
+ \o \l {Qt for Embedded Linux Classes}
+ \o \l {Qt for Embedded Platforms}
+ \o \l {Qt for Mac OS X - Specific Issues}
+ \o \l {Qt is Mac OS X Native}
+ \o \l {Supported Platforms}
+ \o \l {The qtmain Library}
+ \o \l {Window System Specific Notes}
+ \endlist
+ \o
+ \list
+ \o Workaround to make it work.
+ \o Information about the C++ compilers and tools used to build Qt.
+ \o Information for developing Qt applications for Mac OS X
+ \o A summary of known issues in this Qt version at the time of release.
+ \o Information about the platforms on which Qt can be used.
+ \o Information about the state of support for the Symbian platform.
+ \o Qt API's for using ActiveX controls, servers, and COM.
+ \o Classes that are specific to Qt for Embedded Linux.
+ \o Documents related to Qt for Embedded Platforms.
+ \o A description of issues with Qt that are specific to Mac OS X.
+ \o An explanation of Qt's native features on Mac OS X.
+ \o The platforms supported by Nokia for Qt.
+ \o Describes the use and license of the qtmain helper library.
+ \o Collections of notes about Qt implementations on different window systems.
+ \endlist
+ \endtable
+
+
+*/ \ No newline at end of file
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc
index 0fdeff8..baa30fc 100644
--- a/doc/src/development/qmake-manual.qdoc
+++ b/doc/src/development/qmake-manual.qdoc
@@ -3015,6 +3015,13 @@ For example:
\snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150
+ \target SYMBIAN_VERSION
+ \section1 SYMBIAN_VERSION
+
+ \e {This is only used on the Symbian platform.}
+
+ Contains the version number of the underlying Symbian SDK; e.g. "9.2" or "Symbian3".
+
\target TARGET
\section1 TARGET
diff --git a/doc/src/examples/fingerpaint.qdoc b/doc/src/examples/fingerpaint.qdoc
index f438082..4b62570 100644
--- a/doc/src/examples/fingerpaint.qdoc
+++ b/doc/src/examples/fingerpaint.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \example multitouch/fingerpaint
+ \example touch/fingerpaint
\title Finger Paint Example
- The Finger Paint example shows the use of multi-touch with a custom widget
+ The Finger Paint example shows the use of touch with a custom widget
to create a simple painting application.
- \image multitouch-fingerpaint-example.png
+ \image touch-fingerpaint-example.png
*/
diff --git a/doc/src/examples/pinchzoom.qdoc b/doc/src/examples/pinchzoom.qdoc
index e091230..198cbb3 100644
--- a/doc/src/examples/pinchzoom.qdoc
+++ b/doc/src/examples/pinchzoom.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \example multitouch/pinchzoom
+ \example touch/pinchzoom
\title Pinch Zoom Example
- The Pinch Zoom example shows how to use low-level multi-touch information
+ The Pinch Zoom example shows how to use low-level touch information
to recognize a gesture.
- \image multitouch-pinchzoom-example.png
+ \image touch-pinchzoom-example.png
*/
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index ce53677..8d3aa25 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \title Animation: Basics
+ \title Animation: Basics Example
\example declarative/animation/basics
This example shows how to create and combine \l{QML Animation}{animations} in QML.
@@ -47,7 +47,7 @@
*/
/*!
- \title Animation: Behaviors
+ \title Animation: Behavior Examples
\example declarative/animation/behaviors
This example shows how to use QML behaviors.
@@ -56,7 +56,7 @@
*/
/*!
- \title Animation: Easing
+ \title Animation: Easing Example
\example declarative/animation/easing
This example shows the different easing modes available for \l{QML Animation}{animations}.
@@ -65,7 +65,7 @@
*/
/*!
- \title Animation: States
+ \title Animation: States Example
\example declarative/animation/states
These examples show how to use \l{States}{states} and \l{Transitions}{transitions}.
@@ -89,7 +89,7 @@
*/
/*!
- \title Image Elements: Border Image
+ \title Image Elements: Border Image Example
\example declarative/imageelements/borderimage
These examples show how to use the BorderImage element.
@@ -110,7 +110,7 @@
*/
/*!
- \title Image Elements: Image
+ \title Image Elements: Image Example
\example declarative/imageelements/image
This example shows how to use the \l Image element and its \l{Image::fillMode}{fillModes}.
@@ -147,7 +147,7 @@
*/
/*!
- \title C++ Extensions: Plugins
+ \title C++ Extensions: Plugins Example
\example declarative/cppextensions/plugins
This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin.
@@ -156,7 +156,7 @@
*/
/*!
- \title LayoutItem
+ \title LayoutItem Example
\example declarative/cppextensions/qgraphicslayouts/layoutitem
This example show how to use the LayoutItem element to integrate QML items into an existing
@@ -165,7 +165,7 @@
\image qml-layoutitem-example.png
*/
/*!
- \title QGraphicsGridLayout
+ \title QGraphicsGridLayout Example
\example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout
This example shows how to use QGraphicsGridLayout to lay out QML items. This is
@@ -175,7 +175,7 @@
\image qml-qgraphicsgridlayout-example.png
*/
/*!
- \title QGraphicsLinearLayout
+ \title QGraphicsLinearLayout Example
\example declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout
This example shows how to use QGraphicsLinearLayout to lay out QML items. This is
@@ -185,8 +185,8 @@
\image qml-qgraphicslinearlayout-example.png
*/
/*!
+ \title C++ Extensions: QGraphicsLayouts examples
\page declarative-cppextensions-qgraphicslayouts.html
- \title C++ Extensions: QGraphicsLayouts
These examples show how to integrate \l{Graphics View Framework}{Graphics View}
layout components with QML:
@@ -202,7 +202,7 @@
*/
/*!
- \title C++ Extensions: QWidgets
+ \title C++ Extensions: QWidgets Example
\example declarative/cppextensions/qwidgets
This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget.
@@ -211,7 +211,7 @@
*/
/*!
- \title C++ Extensions: Image Provider
+ \title C++ Extensions: Image Provider Example
\example declarative/cppextensions/imageprovider
This examples shows how to use QDeclarativeImageProvider to serve images
@@ -221,7 +221,7 @@
*/
/*!
- \title C++ Extensions: Network access manager factory
+ \title C++ Extensions: Network Access Manager Factory Example
\example declarative/cppextensions/networkaccessmanagerfactory
This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager
@@ -229,7 +229,7 @@
*/
/*!
- \title Internationlization
+ \title Internationlization Example
\example declarative/i18n
This example shows how to enable text translation in QML.
@@ -238,7 +238,7 @@
*/
/*!
- \title Positioners
+ \title Positioners Example
\example declarative/positioners
This example shows how to use positioner elements such as \l Row, \l Column,
@@ -248,7 +248,7 @@
*/
/*!
- \title Key Interaction: Focus
+ \title Key Interaction: Focus Example
\example declarative/keyinteraction/focus
This example shows how to handle keyboard input and focus in QML.
@@ -257,7 +257,7 @@
*/
/*!
- \title Models and Views: AbstractItemModel
+ \title Models and Views: AbstractItemModel Example
\example declarative/modelviews/abstractitemmodel
This example shows how to use a QAbstractItemModel subclass as a model in QML.
@@ -266,7 +266,7 @@
*/
/*!
- \title Models and Views: GridView
+ \title Models and Views: GridView Example
\example declarative/modelviews/gridview
This example shows how to use the GridView element.
@@ -275,7 +275,7 @@
*/
/*!
- \title Models and Views: ListView
+ \title Models and Views: ListView Example
\example declarative/modelviews/listview
These examples show how to use the ListView element.
@@ -317,7 +317,16 @@
*/
/*!
- \title Models and Views: Object ListModel
+ \title Models and Views: PathView Example
+ \example declarative/modelviews/pathview
+
+ This example shows how to use the PathView element.
+
+ \image qml-pathview-example.png
+*/
+
+/*!
+ \title Models and Views: Object ListModel Example
\example declarative/modelviews/objectlistmodel
This example shows how to use a QList<QObject*> as a model in QML.
@@ -326,7 +335,7 @@
*/
/*!
- \title Models and Views: Package
+ \title Models and Views: Package Example
\example declarative/modelviews/package
This example shows how to use the \l Package element.
@@ -335,7 +344,7 @@
*/
/*!
- \title Models and Views: Parallax
+ \title Models and Views: Parallax Example
\example declarative/modelviews/parallax
This example shows how to combine and switch between views.
@@ -344,7 +353,7 @@
*/
/*!
- \title Models and Views: String ListModel
+ \title Models and Views: String ListModel Example
\example declarative/modelviews/stringlistmodel
This example shows how to use a QStringList as a model in QML.
@@ -353,7 +362,7 @@
*/
/*!
- \title Models and Views: VisualItemModel
+ \title Models and Views: VisualItemModel Example
\example declarative/modelviews/visualitemmodel
This example shows how to use the VisualItemModel element.
@@ -362,7 +371,7 @@
*/
/*!
- \title Models and Views: WebView
+ \title Models and Views: WebView Example
\example declarative/modelviews/webview
These examples shows how to use the WebView element.
@@ -403,15 +412,23 @@
\endtable
*/
+
+/*!
+ \title Screen orientation
+ \example declarative/screenorientation
+
+ This example shows how to implement screen orientation support for your application.
+*/
+
/*!
- \title SQL Local Storage
+ \title SQL Local Storage Example
\example declarative/sqllocalstorage
This example shows how to use the SQL Local Storage API in QML.
*/
/*!
- \title Text: Fonts
+ \title Text: Fonts Example
\example declarative/text/fonts
These examples show how to discover available fonts from QML and manipulate
@@ -447,7 +464,7 @@
*/
/*!
- \title Text: Text Selection
+ \title Text: Text Selection Example
\example declarative/text/textselection
This example shows how text selection, copy and paste operations
@@ -457,7 +474,7 @@
*/
/*!
- \title Threading: Threaded ListModel
+ \title Threading: Threaded ListModel Example
\example declarative/threading/threadedlistmodel
This example shows how to use a ListModel from multiple threads using
@@ -465,14 +482,14 @@
*/
/*!
- \title Threading: WorkerScript
+ \title Threading: WorkerScript Example
\example declarative/threading/workerscript
This example shows how to use the WorkerScript element for threading in QML.
*/
/*!
- \title Toys: Clocks
+ \title Toys: Clocks Example
\example declarative/toys/clocks
This example displays a set of clocks with different times for different cities.
@@ -483,7 +500,7 @@
*/
/*!
- \title Toys: Corkboards
+ \title Toys: Corkboards Example
\example declarative/toys/corkboards
This example presents a flickable set of interactive corkboards. It is created
@@ -494,7 +511,7 @@
*/
/*!
- \title Toys: Dynamic Scene
+ \title Toys: Dynamic Scene Example
\example declarative/toys/dynamicscene
This example presents an interactive drag-and-drop scene. It demonstrates
@@ -505,7 +522,7 @@
*/
/*!
- \title Toys: Tic-Tac-Toe
+ \title Toys: Tic-Tac-Toe Example
\example declarative/toys/tic-tac-toe
This example presents a simple implementation of Tic Tac Toe.
@@ -514,7 +531,7 @@
*/
/*!
- \title Toys: TV Tennis
+ \title Toys: TV Tennis Example
\example declarative/toys/tvtennis
This example shows how to use animation components such as \l SpringAnimation,
@@ -524,14 +541,14 @@
*/
/*!
- \title Touch Interaction: Gestures
+ \title Touch Interaction: Gestures Example
\example declarative/touchinteraction/gestures
This example shows how to use the GestureArea element.
*/
/*!
- \title Touch Interaction: MouseArea
+ \title Touch Interaction: MouseArea Example
\example declarative/touchinteraction/mousearea
This example shows how to use the MouseArea element to access information
@@ -541,7 +558,7 @@
*/
/*!
- \title UI Components: Dial
+ \title UI Components: Dial Control Example
\example declarative/ui-components/dialcontrol
This example shows how to create a dial-type control. It combines
@@ -553,7 +570,7 @@
/*!
- \title UI Components: Flipable
+ \title UI Components: Flipable Example
\example declarative/ui-components/flipable
This example shows how to use the \l Flipable element.
@@ -562,7 +579,7 @@
*/
/*!
- \title UI Components: Progress Bars
+ \title UI Components: Progress Bars Example
\example declarative/ui-components/progressbar
This example shows how to create a progress bar.
@@ -571,7 +588,7 @@
*/
/*!
- \title UI Components: Scroll Bar
+ \title UI Components: Scroll Bar Example
\example declarative/ui-components/scrollbar
This example shows how to create scroll bars for a \l Flickable element
@@ -582,7 +599,7 @@
*/
/*!
- \title UI Components: Search Box
+ \title UI Components: Search Box Example
\example declarative/ui-components/searchbox
This example shows how to combine TextInput, FocusScope and BorderImage
@@ -592,7 +609,7 @@
*/
/*!
- \title UI Components: Slide Switch
+ \title UI Components: Slide Switch Example
\example declarative/ui-components/slideswitch
This example shows how to create a slide switch control.
@@ -601,7 +618,7 @@
*/
/*!
- \title UI Components: Spinner
+ \title UI Components: Spinner Example
\example declarative/ui-components/spinner
This example shows how to create a spinner-type component using the PathView element.
@@ -610,7 +627,7 @@
*/
/*!
- \title UI Components: Tab Widget
+ \title UI Components: Tab Widget Example
\example declarative/ui-components/tabwidget
This example shows how to create a tab widget. It also demonstrates how
@@ -621,7 +638,7 @@
*/
/*!
- \title XML: XMLHttpRequest
+ \title XML: XMLHttpRequest Example
\example declarative/xml/xmlhttprequest
This example shows how to use the \l XmlHttpRequest API in QML.
diff --git a/doc/src/examples/multitouch-dials.qdoc b/doc/src/examples/touch-dials.qdoc
index 632c4f6..552d752 100644
--- a/doc/src/examples/multitouch-dials.qdoc
+++ b/doc/src/examples/touch-dials.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \example multitouch/dials
- \title Multi-Touch Dials Example
+ \example touch/dials
+ \title Touch Dials Example
- The Multi-Touch Dials example shows how to apply multi-touch to a set of
+ The Touch Dials example shows how to apply touch to a set of
standard Qt widgets.
- \image multitouch-dials-example.png
+ \image touch-dials-example.png
*/
diff --git a/doc/src/examples/multitouch-knobs.qdoc b/doc/src/examples/touch-knobs.qdoc
index 14ee597..deb4c28 100644
--- a/doc/src/examples/multitouch-knobs.qdoc
+++ b/doc/src/examples/touch-knobs.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \example multitouch/knobs
- \title Multi-Touch Knobs Example
+ \example touch/knobs
+ \title Touch Knobs Example
- The Multi-Touch Knobs example shows how to create custom controls that
- accept multi-touch input.
+ The Touch Knobs example shows how to create custom controls that
+ accept touch input.
- \image multitouch-knobs-example.png
+ \image touch-knobs-example.png
*/
diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc
index b0b0e3c..3177af8 100644
--- a/doc/src/files-and-resources/resources.qdoc
+++ b/doc/src/files-and-resources/resources.qdoc
@@ -54,7 +54,7 @@
The resource system is based on tight cooperation between \l qmake,
\l rcc (Qt's resource compiler), and QFile. It obsoletes Qt 3's
\c qembed tool and the
- \l{http://qt.nokia.com/doc/qq/qq05-iconography.html#imagestorage}{image
+ \l{http://doc.qt.nokia.com/qq/qq05-iconography.html}{image
collection} mechanism.
\section1 Resource Collection Files (\c{.qrc})
diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc
index e792161..fb14a3b 100644
--- a/doc/src/frameworks-technologies/eventsandfilters.qdoc
+++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc
@@ -100,7 +100,7 @@
event delivery mechanisms are flexible. The documentation for
QCoreApplication::notify() concisely tells the whole story; the
\e{Qt Quarterly} article
- \l{http://qt.nokia.com/doc/qq/qq11-events.html}{Another Look at Events}
+ \l{http://doc.qt.nokia.com/qq/qq11-events.html}{Another Look at Events}
rehashes it less concisely. Here we will explain enough for 95%
of applications.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index a32d120..b2895ba 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -837,19 +837,19 @@
*/
/*!
- \page examples-multitouch.html
+ \page examples-touch.html
\ingroup all-examples
- \title Multi-Touch Examples
- \brief Using Qt's multi-touch input capability
+ \title Touch Input Examples
+ \brief Using Qt's touch input capability
- Support for multi-touch input makes it possible for developers to create
+ Support for touch input makes it possible for developers to create
extensible and intuitive user interfaces.
\list
- \o \l{multitouch/dials}{Multi-Touch Dials}
- \o \l{multitouch/fingerpaint}{Finger Paint}
- \o \l{multitouch/knobs}{Multi-Touch Knobs}
- \o \l{multitouch/pinchzoom}{Pinch Zoom}
+ \o \l{touch/dials}{Touch Dials}
+ \o \l{touch/fingerpaint}{Finger Paint}
+ \o \l{touch/knobs}{Touch Knobs}
+ \o \l{touch/pinchzoom}{Pinch Zoom}
\endlist
*/
diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc
new file mode 100644
index 0000000..145982b
--- /dev/null
+++ b/doc/src/getting-started/gettingstarted.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \title Getting Started Guides
+
+ \group gettingStarted
+
+ Following is a list.
+ \generatelist{related}
+
+*/
+
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
new file mode 100644
index 0000000..2bfb71c
--- /dev/null
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -0,0 +1,1050 @@
+/****************************************************************************
+**
+** 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 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 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 “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
+
+ */
+
+ /*!
+ \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}{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 {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.
+
+
+*/ \ No newline at end of file
diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc
new file mode 100644
index 0000000..1b3770f
--- /dev/null
+++ b/doc/src/getting-started/gettingstartedqt.qdoc
@@ -0,0 +1,517 @@
+/****************************************************************************
+**
+** 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 gettingstartedqt.html
+
+ \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
+ implementing a simple Notepad application. After reading this
+ guide, you should be ready to delve into our overviews and API
+ documentation, and find the information you need for the
+ application you are developing.
+
+ \section1 Hello Notepad
+
+ In this first example, we simply create and show a text edit in a
+ window frame on the desktop. This represents the simplest possible
+ Qt program that has a GUI.
+
+ \image gs1.png
+
+ Here is the code:
+
+ \code
+ 1 #include <QApplication>
+ 2 #include <QTextEdit>
+ 3
+ 4 int main(int argv, char **args)
+ 5 {
+ 6 QApplication app(argv, args);
+ 7
+ 8 QTextEdit textEdit;
+ 9 textEdit.show();
+10
+11 return app.exec();
+12 }
+ \endcode
+
+ Let us go through the code line by line. In the first two lines, we
+ include the header files for QApplication and QTextEdit, which are
+ the two classes that we need for this example. All Qt classes have
+ a header file named after them.
+
+ Line 6 creates a QApplication object. This object manages
+ application-wide resources and is necessary to run any Qt program
+ that has a GUI. It needs \c argv and \c args because Qt accepts a
+ few command line arguments.
+
+ Line 8 creates a QTextEdit object. A text edit is a visual element
+ in the GUI. In Qt, we call such elements widgets. Examples of
+ other widgets are scroll bars, labels, and radio buttons. A widget
+ can also be a container for other widgets; a dialog or a main
+ application window, for example.
+
+ Line 9 shows the text edit on the screen in its own window frame.
+ Since widgets also function as containers (for instance a
+ QMainWindow, which has toolbars, menus, a status bar, and a few
+ 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
+ and key strokes. When you type text in the text edit widget, it
+ receives key pressed events and responds by drawing the text
+ typed.
+
+ To run the application, open a command prompt, and enter the
+ directory in which you have the \c .cpp file of the program. The
+ following shell commands build the program.
+
+ \code
+ qmake -project
+ qmake
+ make
+ \endcode
+
+ This will leave an executable in the \c part1 directory (note that
+ on Windows, you may have to use \c nmake instead of \c make. Also,
+ the executable will be placed in part1/debug or part1/release). \c
+ qmake is Qt's build tool, which takes a configuration file. \c
+ qmake generates this for us when given the \c{-project} argument.
+ Given the configuration file (suffixed .pro), \c qmake produces a
+ \c make file that will build the program for you. We will look
+ into writing our own \c .pro files later.
+
+ \section2 Learn More
+
+ \table
+ \header
+ \o About
+ \o Here
+ \row
+ \o Widgets and Window Geometry
+ \o \l{Window and Dialog Widgets}
+ \row
+ \o Events and event handling
+ \o \l{The Event System}
+ \endtable
+
+ \section1 Adding a Quit Button
+
+ In a real application, you will normally need more than one
+ widget. We will now introduce a QPushButton beneath the text edit.
+ The button will exit the Notepad application when pushed (i.e.,
+ clicked on with the mouse).
+
+ \image gs2.png
+
+ Let us take a look at the code.
+
+ \code
+ 1 #include <QtGui>
+ 2
+ 3 int main(int argv, char **args)
+ 4 {
+ 5 QApplication app(argv, args);
+ 6
+ 7 QTextEdit textEdit;
+ 8 QPushButton quitButton("Quit");
+ 9
+10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
+11
+12 QVBoxLayout layout;
+13 layout.addWidget(&textEdit);
+14 layout.addWidget(&quitButton);
+15
+16 QWidget window;
+17 window.setLayout(&layout);
+18
+19 window.show();
+20
+21 return app.exec();
+22 }
+ \endcode
+
+ Line 1 includes QtGui, which contains all of Qt's GUI classes.
+
+ Line 10 uses Qt's Signals and Slots mechanism to make the
+ application exit when the \gui {Quit button} is pushed. A slot is
+ a function that can be invoked at runtime using its name (as a
+ literal string). A signal is a function that when called will
+ invoke slots registered with it; we call that to connect the slot
+ to the signal and to emit the signal.
+
+ \l{QApplication::}{quit()} is a slot of QApplication that exits
+ the application. \l{QPushButton::}{clicked()} is a signal that
+ QPushButton emits when it is pushed. The static
+ QObject::connect() function takes care of connecting the slot to
+ the signal. SIGNAL() and SLOT() are two macros that take the
+ function signatures of the signal and slot to connect. We also
+ need to give pointers to the objects that should send and receive
+ the signal.
+
+ Line 12 creates a QVBoxLayout. As mentioned, widgets can contain
+ other widgets. It is possible to set the bounds (the location and
+ size) of child widgets directly, but it is usually easier to use a
+ layout. A layout manages the bounds of a widget's children.
+ QVBoxLayout, for instance, places the children in a vertical row.
+
+ Line 13 and 14 adds the text edit and button to the layout. In
+ line 17, we set the layout on a widget.
+
+ \section2 Learn More
+
+ \table
+ \header
+ \o About
+ \o Here
+ \row
+ \o Signals and slots
+ \o \l{Signals & Slots}
+ \row
+ \o Layouts
+ \o \l{Layout Management},
+ \l{Widgets and Layouts},
+ \l{Layout Examples}
+ \row
+ \o The widgets that come with Qt
+ \o \l{Qt Widget Gallery},
+ \l{Widget Examples}
+ \endtable
+
+ \section1 Subclassing QWidget
+
+ When the user wants to quit an application, you might want to
+ pop-up a dialog that asks whether he/she really wants to quit. In
+ this example, we subclass QWidget, and add a slot that we connect
+ to the \gui {Quit button}.
+
+ \image gs3.png
+
+ Let us look at the code:
+
+ \code
+ 5 class Notepad : public QWidget
+ 6 {
+ 7 Q_OBJECT
+ 8
+ 9 public:
+10 Notepad();
+11
+12 private slots:
+13 void quit();
+14
+15 private:
+16 QTextEdit *textEdit;
+17 QPushButton *quitButton;
+18 };
+ \endcode
+
+ The \c Q_OBJECT macro must be first in the class definition, and
+ declares our class as a \c QObject (Naturally, it must also
+ inherit from QObject). A \l{QObject} adds several abilities to a
+ normal C++ class. Notably, the class name and slot names can be
+ queried at run-time. It is also possible to query a slot's
+ parameter types and invoke it.
+
+ Line 13 declares the slot \c quit(). This is easy using the \c
+ slots macro. The \c quit() slot can now be connected to signals
+ with a matching signature (any signal that takes no parameters).
+
+ Instead of setting up the GUI and connecting the slot in the \c
+ main() function, we now use \c{Notepad}'s constructor.
+
+ \code
+ Notepad::Notepad()
+ {
+ textEdit = new QTextEdit;
+ quitButton = new QPushButton(tr("Quit"));
+
+ connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(textEdit);
+ layout->addWidget(quitButton);
+
+ setLayout(layout);
+
+ setWindowTitle(tr("Notepad"));
+ }
+ \endcode
+
+ As you saw in the class definition, we use pointers to our \l
+ {QObject}s (\c textEdit and \c quitButton). As a rule, you should
+ always allocate \l{QObject}s on the heap and never copy them.
+
+ We now use the function \l{QObject::}{tr()} around our user
+ visible strings. This function is necessary when you want to
+ provide your application in more than one language (e.g. English
+ and Chinese). We will not go into details here, but you can follow
+ the \c {Qt Linguist} link from the learn more table.
+
+ \section2 Learn More
+
+ \table
+ \header
+ \o About
+ \o Here
+ \row
+ \o tr() and internationalization
+ \o \l{Qt Linguist Manual},
+ \l{Writing Source Code for Translation},
+ \l{Hello tr() Example},
+ \l{Internationalization with Qt}
+ \row
+ \o QObjects and the Qt Object model (This is essential to understand Qt)
+ \o \l{Object Model}
+ \row
+ \o qmake and the Qt build system
+ \o \l{qmake Manual}
+ \endtable
+
+ \section2 Creating a .pro file
+
+ For this example, we write our own \c .pro file instead of
+ using \c qmake's \c -project option.
+
+ \code
+ HEADERS = notepad.h
+ SOURCES = notepad.cpp \
+ main.cpp
+ \endcode
+
+ The following shell commands build the example.
+
+ \code
+ qmake
+ make
+ \endcode
+
+ \section1 Using a QMainWindow
+
+ Many applications will benefit from using a QMainWindow, which has
+ its own layout to which you can add a menu bar, dock widgets, tool
+ bars, and a status bar. QMainWindow has a center area that can be
+ occupied by any kind of widget. In our case, we will place our
+ text edit there.
+
+ \image gs4.png
+
+ Let us look at the new \c Notepad class definition.
+
+ \code
+ #include <QtGui>
+
+ class Notepad : public QMainWindow
+ {
+ Q_OBJECT
+
+ public:
+ Notepad();
+
+ private slots:
+ void open();
+ void save();
+ void quit();
+
+ private:
+ QTextEdit *textEdit;
+
+ QAction *openAction;
+ QAction *saveAction;
+ QAction *exitAction;
+
+ QMenu *fileMenu;
+ };
+ \endcode
+
+ We include two more slots that can save and open a document. We
+ will implement these in the next section.
+
+ Often, in a main window, the same slot should be invoked by
+ several widgets. Examples are menu items and buttons on a tool
+ bar. To make this easier, Qt provides QAction, which can be given
+ to several widgets, and be connected to a slot. For instance, both
+ QMenu and QToolBar can create menu items and tool buttons from the
+ same \l{QAction}s. We will see how this works shortly.
+
+ As before, we use the \c {Notepad}s constructor to set up the
+ GUI.
+
+ \code
+ Notepad::Notepad()
+ {
+ saveAction = new QAction(tr("&Open"), this);
+ saveAction = new QAction(tr("&Save"), this);
+ exitAction = new QAction(tr("E&xit"), this);
+
+ connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
+ connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
+ connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(openAction);
+ fileMenu->addAction(saveAction);
+ fileMenu->addSeparator();
+ fileMenu->addAction(exitAction);
+
+ textEdit = new QTextEdit;
+ setCentralWidget(textEdit);
+
+ setWindowTitle(tr("Notepad"));
+ }
+ \endcode
+
+ \l{QAction}s are created with the text that should appear on the
+ widgets that we add them to (in our case, menu items). If we also
+ wanted to add them to a tool bar, we could have given
+ \l{QIcon}{icons} to the actions.
+
+ When a menu item is clicked now, the item will trigger the action,
+ and the respective slot will be invoked.
+
+ \section2 Learn More
+
+ \table
+ \header
+ \o About
+ \o Here
+ \row
+ \o Main windows and main window classes
+ \o \l{Application Main Window},
+ \l{Main Window Examples}
+ \row
+ \o MDI applications
+ \o QMdiArea,
+ \l{MDI Example}
+ \endtable
+
+ \section1 Saving and Loading
+
+ In this example, we will implement the functionality of the \c
+ open() and \c save() slots that we added in the previous example.
+
+ \image gs5.png
+
+ We will start with the \c open() slot:
+
+ \code
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
+ tr("Text Files (*.txt);;C++ Files (*.cpp *.h)"));
+
+ if (fileName != "") {
+ QFile file(fileName);
+ if (!file.open(QIODevice::ReadOnly)) {
+ QMessageBox::critical(this, tr("Error"),
+ tr("Could not open file"));
+ return;
+ }
+ QString contents = file.readAll().constData();
+ textEdit->setPlainText(contents);
+ file.close();
+ }
+ \endcode
+
+ The first step is asking the user for the name of the file to
+ open. Qt comes with QFileDialog, which is a dialog from which the
+ user can select a file. The image above shows the dialog on
+ Kubuntu. The static \l{QFileDialog::}{getOpenFileName()} function
+ displays a modal file dialog, and does not return until the user
+ has selected a file. It returns the file path of the file
+ selected, or an empty string if the user canceled the dialog.
+
+ If we have a file name, we try to open the file with
+ \l{QIODevice::}{open()}, which returns true if the file could be
+ opened. We will not go into error handling here, but you can follow
+ the links from the learn more section. If the file could not be
+ opened, we use QMessageBox to display a dialog with an error
+ message (see the QMessageBox class description for further
+ details).
+
+ Actually reading in the data is trivial using the
+ \l{QIODevice::}{readAll()} function, which returns all data in the
+ file in a QByteArray. The \l{QByteArray::}{constData()} returns all
+ data in the array as a const char*, which QString has a
+ constructor for. The contents can then be displayed in the text
+ edit. We then \l{QIODevice::}{close()} the file to return the file
+ descriptor back to the operating system.
+
+ Now, let us move on to the the \c save() slot.
+
+ \code
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "",
+ tr("Text Files (*.txt);;C++ Files (*.cpp *.h)"));
+
+ if (fileName != "") {
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly)) {
+ // error message
+ } else {
+ QTextStream stream(&file);
+ stream << textEdit->toPlainText();
+ stream.flush();
+ file.close();
+ }
+ }
+ \endcode
+
+ When we write the contents of the text edit to the file, we use
+ the QTextStream class, which wraps the QFile object. The text
+ stream can write QStrings directly to the file; QFile only accepts
+ raw data (char*) with the \l{QIODevice::}{write()} functions of
+ QIODevice.
+
+ \section2 Learn More
+
+ \table
+ \header
+ \o About
+ \o Here
+ \row
+ \o Files and I/O devices
+ \o QFile, QIODevice
+ \endtable
+
+ \omit
+ \section1 Moving On
+
+ This may not be true for the first release.
+ The Qt documentation comes with three getting started guides. You
+ have come to the end of the first, which concerns itself with
+ basic Qt concepts. We also have guides covering intermediate and
+ advanced topics. They are found here: You may also have noticed that the learn more sections in
+ this guide frequently linked to them.
+ Basic Qt Architecture
+ \endomit
+*/
+
diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc
index 90723ec..629d8b7 100644
--- a/doc/src/getting-started/installation.qdoc
+++ b/doc/src/getting-started/installation.qdoc
@@ -30,10 +30,13 @@
\title Installation
\brief Installing Qt on supported platforms.
-The installation procedure is different on each Qt platform.
-Please follow the instructions for your platform from the following list.
+The installation procedure is different on each Qt platform. This page provides
+information on how to install Qt, as well as software and hardware requirements
+for using Qt on each of the supported platforms. Please follow the instructions
+for your platform from the following list.
\generatelist{related}
+
*/
/*! \page install-x11.html
diff --git a/doc/src/getting-started/tutorials.qdoc b/doc/src/getting-started/tutorials.qdoc
index 0a83170..46a5808 100644
--- a/doc/src/getting-started/tutorials.qdoc
+++ b/doc/src/getting-started/tutorials.qdoc
@@ -84,6 +84,18 @@
\o
\row
+ \o{2,1} \l{QML Tutorial}{\bold QML Tutorial}
+ \o{2,1} \l{QML Advanced Tutorial}{\bold SameGame}
+ \row
+ \o{2,1}
+ This tutorial provides a very basic introduction to QML.
+ \o \image qml-samegame-demo-small.png Samegame
+ \o
+ This tutorial walks through creating a complete application with QML,
+ in this case a simple game. It is recommended that you complete the basic QML
+ tutorial first.
+
+ \row
\o{2,1} \l{QTestLib Tutorial}{\bold QTestLib}
\o{2,1} \l{qmake Tutorial}{\bold qmake}
\row
diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png
index ef514c8..b19cb36 100644
--- a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png
+++ b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png
index 4381079..f9b91ee 100644
--- a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part1-screenshot.png b/doc/src/images/addressbook-tutorial-part1-screenshot.png
index cf15627..454b095 100644
--- a/doc/src/images/addressbook-tutorial-part1-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part1-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part2-add-contact.png b/doc/src/images/addressbook-tutorial-part2-add-contact.png
index 330858d..6f2b947 100644
--- a/doc/src/images/addressbook-tutorial-part2-add-contact.png
+++ b/doc/src/images/addressbook-tutorial-part2-add-contact.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part2-add-successful.png b/doc/src/images/addressbook-tutorial-part2-add-successful.png
index 3b108fb..99a2154 100644
--- a/doc/src/images/addressbook-tutorial-part2-add-successful.png
+++ b/doc/src/images/addressbook-tutorial-part2-add-successful.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png
index 73f6dfb..1e000c8 100644
--- a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png
+++ b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png
index 662fa7f..1981ba8 100644
--- a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png
+++ b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part3-screenshot.png b/doc/src/images/addressbook-tutorial-part3-screenshot.png
index 97d1357..75159b4 100644
--- a/doc/src/images/addressbook-tutorial-part3-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part3-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part4-remove.png b/doc/src/images/addressbook-tutorial-part4-remove.png
index 42b0f92..8eb259e 100644
--- a/doc/src/images/addressbook-tutorial-part4-remove.png
+++ b/doc/src/images/addressbook-tutorial-part4-remove.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part5-finddialog.png b/doc/src/images/addressbook-tutorial-part5-finddialog.png
index 18e5451..743d92e 100644
--- a/doc/src/images/addressbook-tutorial-part5-finddialog.png
+++ b/doc/src/images/addressbook-tutorial-part5-finddialog.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part5-notfound.png b/doc/src/images/addressbook-tutorial-part5-notfound.png
index be7172e..2d35766 100644
--- a/doc/src/images/addressbook-tutorial-part5-notfound.png
+++ b/doc/src/images/addressbook-tutorial-part5-notfound.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part5-screenshot.png b/doc/src/images/addressbook-tutorial-part5-screenshot.png
index ea4a66c..3abe277 100644
--- a/doc/src/images/addressbook-tutorial-part5-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part5-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part6-load.png b/doc/src/images/addressbook-tutorial-part6-load.png
index 95fdcaf..a027a1d 100644
--- a/doc/src/images/addressbook-tutorial-part6-load.png
+++ b/doc/src/images/addressbook-tutorial-part6-load.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part6-save.png b/doc/src/images/addressbook-tutorial-part6-save.png
index c0deb70..757feeb 100644
--- a/doc/src/images/addressbook-tutorial-part6-save.png
+++ b/doc/src/images/addressbook-tutorial-part6-save.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part6-screenshot.png b/doc/src/images/addressbook-tutorial-part6-screenshot.png
index f77bf03..7bb2f74 100644
--- a/doc/src/images/addressbook-tutorial-part6-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part6-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-part7-screenshot.png b/doc/src/images/addressbook-tutorial-part7-screenshot.png
index d6b0a50..3e7b3ca 100644
--- a/doc/src/images/addressbook-tutorial-part7-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-part7-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial-screenshot.png b/doc/src/images/addressbook-tutorial-screenshot.png
index d6727dc..3fba6e8 100644
--- a/doc/src/images/addressbook-tutorial-screenshot.png
+++ b/doc/src/images/addressbook-tutorial-screenshot.png
Binary files differ
diff --git a/doc/src/images/addressbook-tutorial.png b/doc/src/images/addressbook-tutorial.png
index 495edda..f80b42d 100644
--- a/doc/src/images/addressbook-tutorial.png
+++ b/doc/src/images/addressbook-tutorial.png
Binary files differ
diff --git a/doc/src/images/gs1.png b/doc/src/images/gs1.png
new file mode 100644
index 0000000..875dd39
--- /dev/null
+++ b/doc/src/images/gs1.png
Binary files differ
diff --git a/doc/src/images/gs2.png b/doc/src/images/gs2.png
new file mode 100644
index 0000000..aaba3b2
--- /dev/null
+++ b/doc/src/images/gs2.png
Binary files differ
diff --git a/doc/src/images/gs3.png b/doc/src/images/gs3.png
new file mode 100644
index 0000000..5e474e3
--- /dev/null
+++ b/doc/src/images/gs3.png
Binary files differ
diff --git a/doc/src/images/gs4.png b/doc/src/images/gs4.png
new file mode 100644
index 0000000..7a8237e
--- /dev/null
+++ b/doc/src/images/gs4.png
Binary files differ
diff --git a/doc/src/images/gs5.png b/doc/src/images/gs5.png
new file mode 100644
index 0000000..b3cab60
--- /dev/null
+++ b/doc/src/images/gs5.png
Binary files differ
diff --git a/doc/src/images/qml-pathview-example.png b/doc/src/images/qml-pathview-example.png
new file mode 100644
index 0000000..c874c5c
--- /dev/null
+++ b/doc/src/images/qml-pathview-example.png
Binary files differ
diff --git a/doc/src/images/multitouch-dials-example.png b/doc/src/images/touch-dials-example.png
index 60e1776..60e1776 100644
--- a/doc/src/images/multitouch-dials-example.png
+++ b/doc/src/images/touch-dials-example.png
Binary files differ
diff --git a/doc/src/images/multitouch-examples.png b/doc/src/images/touch-examples.png
index b053cf3..b053cf3 100644
--- a/doc/src/images/multitouch-examples.png
+++ b/doc/src/images/touch-examples.png
Binary files differ
diff --git a/doc/src/images/multitouch-fingerpaint-example.png b/doc/src/images/touch-fingerpaint-example.png
index c741b65..c741b65 100644
--- a/doc/src/images/multitouch-fingerpaint-example.png
+++ b/doc/src/images/touch-fingerpaint-example.png
Binary files differ
diff --git a/doc/src/images/multitouch-knobs-example.png b/doc/src/images/touch-knobs-example.png
index 1cbd90d..1cbd90d 100644
--- a/doc/src/images/multitouch-knobs-example.png
+++ b/doc/src/images/touch-knobs-example.png
Binary files differ
diff --git a/doc/src/images/multitouch-pinchzoom-example.png b/doc/src/images/touch-pinchzoom-example.png
index 1079fb2..1079fb2 100644
--- a/doc/src/images/multitouch-pinchzoom-example.png
+++ b/doc/src/images/touch-pinchzoom-example.png
Binary files differ
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index b5e73ed..7efd1e6 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -40,8 +40,8 @@
</div>
<div class="section sectionlist">
<ul>
- <li><a href="">Getting started</a></li>
- <li><a href="installation.html">Installation &amp; first steps</a></li>
+ <li><a href="gettingstarted.html">Getting started</a></li>
+ <li><a href="installation.html">Installation</a></li>
<li><a href="how-to-learn-qt.html">How to learn Qt</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="all-examples.html">Examples</a></li>
@@ -65,8 +65,8 @@
</div>
<div class="sectionlist tricol">
<ul>
- <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
- <li><a href="qt-basic-concepts.html">Qt Architecture</a></li>
+ <!-- <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> -->
+ <li><a href="qt-basic-concepts.html">Basic Qt Architecture</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>
@@ -78,7 +78,7 @@
<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="declarativeui.html">Qt & GUI design</a></li>
+ <!-- <li><a href="declarativeui.html">Qt & GUI design</a></li> -->
</ul>
</div>
</div>
@@ -94,11 +94,12 @@
</div>
<div class="section sectionlist">
<ul>
- <li><a href="http://doc.qt.nokia.com/qtcreator-1.3/index.html">Qt Creator</a></li>
+ <li><a href="http://doc.qt.nokia.com/qtcreator-2.0/index.html">Qt Creator</a> (online document)</li>
<li><a href="designer-manual.html">Qt Designer</a></li>
<li><a href="linguist-manual.html">Qt Linguist</a></li>
<li><a href="assistant-manual.html">Qt Assistant</a></li>
- <li><a href="http://doc.qt.nokia.com/">Integration and add-ins</a></li>
+ <li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a> (online document)</li>
+ <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> (online document) and <a href="http://qt.nokia.com/products/appdev">add-ins</a> (online document)</li>
<li><a href="qvfb.html">Virtual Framebuffer</a></li>
</ul>
</div>
diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc
index c8d8e9d..fa992af 100644
--- a/doc/src/internationalization/linguist-manual.qdoc
+++ b/doc/src/internationalization/linguist-manual.qdoc
@@ -1414,8 +1414,8 @@
\c -pluralonly command line option, which allows the creation of
TS files containing only entries with plural forms.
- See the \l{http://qt.nokia.com/doc/qq/}{Qt Quarterly} Article
- \l{http://qt.nokia.com/doc/qq/qq19-plurals.html}{Plural Forms in Translations}
+ See the \l{http://doc.qt.nokia.com/qq/}{Qt Quarterly} Article
+ \l{http://doc.qt.nokia.com/qq/qq19-plurals.html}{Plural Forms in Translations}
for further details on this issue.
\section2 Coping With C++ Namespaces
diff --git a/doc/src/network-programming/bearermanagement.qdoc b/doc/src/network-programming/bearermanagement.qdoc
index 67c13f2..bc016df 100644
--- a/doc/src/network-programming/bearermanagement.qdoc
+++ b/doc/src/network-programming/bearermanagement.qdoc
@@ -191,7 +191,7 @@ closed via \l{QNetworkSession::close()}, respectively. If the session
is \l{QNetworkSession::Disconnected}{disconnected} at the time of the
\l{QNetworkSession::open()}{open()} call the underlying interface is started;
otherwise only the reference counter against the global session is
-incremeted. The opposite behavior can be observed when using
+incremented. The opposite behavior can be observed when using
\l{QNetworkSession::close()}{close()}.
In some use cases it may be necessary to turn the interface off despite of
diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc
index b4f44bf..955258e 100644
--- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc
+++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc
@@ -147,8 +147,8 @@ your qmake.conf.
#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
\endcode
-As demonstrated above, you need to Qt which drawing operations you want to
-warn/disable. Since there are varying implementations of DirectFB from
+As demonstrated above, you need to tell Qt which drawing operations you want
+to warn/disable. Since there are varying implementations of DirectFB from
manufacturer to manufacture, different operations will be optimized. This
require you to define the operations you want to warn about or disable.
These are listed above in the DIRECTFB_DRAWINGOPERATIONS variable.
diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc
index 766c619..2501656 100644
--- a/doc/src/platforms/mac-differences.qdoc
+++ b/doc/src/platforms/mac-differences.qdoc
@@ -175,6 +175,9 @@
\l{http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/index.html}
{Apple's Developer Website}.
+ Note: QCoreApplication::applicationDirPath() can be used to determine
+ the path of the binary within the bundle.
+
\section2 Translating the Application Menu and Native Dialogs
The items in the Application Menu will be merged correctly for
diff --git a/doc/src/platforms/platform-notes.qdocinc b/doc/src/platforms/platform-notes.qdocinc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/doc/src/platforms/platform-notes.qdocinc
diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc
index f355e7b..0bbf35f 100644
--- a/doc/src/porting/porting4.qdoc
+++ b/doc/src/porting/porting4.qdoc
@@ -472,7 +472,7 @@
\section1 Explicit Sharing
Qt 4 is the first version of Qt that contains no \link
- http://qt.nokia.com/doc/3.3/shclass.html explicitly shared
+ http://doc.qt.nokia.com/3.3/shclass.html explicitly shared
\endlink classes. All classes that were explicitly shared in Qt 3
are \e implicitly shared in Qt 4:
@@ -1079,7 +1079,7 @@
ensuring that the string is '\\0'-terminated. Another important
issue was that conversions between \c QCString and QByteArray often
gave confusing results. (See the
- \l{http://qt.nokia.com/doc/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung!
+ \l{http://doc.qt.nokia.com/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung!
Binary and Character Data} article in \e{Qt Quarterly} for an
overview of the pitfalls.)
@@ -2440,13 +2440,13 @@
that provides the old semantics. See the Q3Painter documentation
for details and for the reasons why we had to make this change.
- The \l{http://qt.nokia.com/doc/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode}
+ The \l{http://doc.qt.nokia.com/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode}
enum has been removed in Qt 4. All clipping
operations are now defined using logical coordinates and are subject
to transformation operations.
The
- \l{http://qt.nokia.com/doc/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP}
+ \l{http://doc.qt.nokia.com/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP}
enum has been replaced with QPainter::CompositionMode.
\section1 QPicture
@@ -3258,7 +3258,7 @@
\list \o If you use Q3SocketDevice in a thread to perform blocking
network I/O (a technique encouraged by the \e{Qt Quarterly}
- article \l{http://qt.nokia.com/doc/qq/qq09-networkthread.html}
+ article \l{http://doc.qt.nokia.com/qq/qq09-networkthread.html}
{Unblocking Networking}), you can now use QTcpSocket, QFtp, or
QNetworkAccessManager, which can be used from non-GUI threads.
@@ -4052,7 +4052,7 @@
Sample code on how to do obtain similar behavior from Qt 4, previously
handled by some of the above functions can be found in the
- \l{http://qt.nokia.com/doc/qwidget-qt3.html}{Qt 3 Support Members for QWidget}
+ \l{http://doc.qt.nokia.com/qwidget-qt3.html}{Qt 3 Support Members for QWidget}
page.
A widget now receives change events in its QWidget::changeEvent()
@@ -4150,7 +4150,7 @@
clearWFlags() has no direct replacement. You can use
QWidget::setAttribute() instead. For example,
\c{setAttribute(..., false)} to clear an attribute. More information
- is available \l{http://qt.nokia.com/doc/qwidget.html#setAttribute}{here}.
+ is available \l{http://doc.qt.nokia.com/qwidget.html#setAttribute}{here}.
testWFlags() was renamed to \l{QWidget::testAttribute()}{testAttribute()}.
diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc
index 89d564f..0c61285 100644
--- a/doc/src/qt-webpages.qdoc
+++ b/doc/src/qt-webpages.qdoc
@@ -141,7 +141,7 @@
*/
/*!
- \externalpage http://qt.nokia.com/doc/supported-platforms.html
+ \externalpage http://doc.qt.nokia.com/supported-platforms.html
\title Platform Support Policy
*/
@@ -151,7 +151,7 @@
*/
/*!
- \externalpage http://qt.nokia.com/doc/supported-platforms.html
+ \externalpage http://doc.qt.nokia.com/supported-platforms.html
\title Qt 4 Platforms Overview
*/
@@ -161,7 +161,7 @@
*/
/*!
- \externalpage http://qt.nokia.com/doc/qq/
+ \externalpage http://doc.qt.nokia.com/qq/
\title Qt Quarterly
*/
@@ -181,7 +181,7 @@
*/
/*!
- \externalpage http://qt.nokia.com/doc/qtcanvas
+ \externalpage http://doc.qt.nokia.com/qtcanvas
\title QtCanvas
*/
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 052e1c9..8867fd9 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -597,9 +597,9 @@
See \l{The State Machine Framework} documentation for more information.
- \section1 Multi-Touch and Gestures
+ \section1 Touch and Gestures
- Support for multi-touch input enables users to interact with many
+ Support for touch input enables users to interact with many
parts of a user interface at the same time, and provides the basis
for gestures. Additional infrastructure for gesture recognition
allows a sequence of touch inputs to be combined to create gestures
@@ -613,12 +613,12 @@
\list
\o Allows users to interact with applications in more natural ways.
\o Simplifies finger-based interaction with UI components.
- \o Combines support for common basic gestures and multi-touch gestures
+ \o Combines support for common basic gestures and touch gestures
in a single general framework.
\o Enables extensibility by design.
\endlist
- See the QTouchEvent class documentation for more information on multi-touch
+ See the QTouchEvent class documentation for more information on touch
input and QGestureEvent for gestures.
\section1 DOM access API
diff --git a/doc/src/snippets/code/doc_src_containers.qdoc b/doc/src/snippets/code/doc_src_containers.qdoc
index 5cf2aab..1f86f60 100644
--- a/doc/src/snippets/code/doc_src_containers.qdoc
+++ b/doc/src/snippets/code/doc_src_containers.qdoc
@@ -216,7 +216,7 @@ while (i.hasNext())
//! [17]
QLinkedList<QString> list;
...
-foreach (QString str, list)
+foreach (const QString &str, list)
qDebug() << str;
//! [17]
@@ -224,7 +224,7 @@ foreach (QString str, list)
//! [18]
QLinkedList<QString> list;
...
-foreach (QString str, list) {
+foreach (const QString &str, list) {
if (str.isEmpty())
break;
qDebug() << str;
@@ -235,7 +235,7 @@ foreach (QString str, list) {
//! [19]
QMap<QString, int> map;
...
-foreach (QString str, map.keys())
+foreach (const QString &str, map.keys())
qDebug() << str << ":" << map.value(str);
//! [19]
@@ -243,7 +243,7 @@ foreach (QString str, map.keys())
//! [20]
QMultiMap<QString, int> map;
...
-foreach (QString str, map.uniqueKeys()) {
+foreach (const QString &str, map.uniqueKeys()) {
foreach (int i, map.values(str))
qDebug() << str << ":" << i;
}
diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc
index c46159c..0593567 100644
--- a/doc/src/snippets/code/doc_src_installation.qdoc
+++ b/doc/src/snippets/code/doc_src_installation.qdoc
@@ -250,12 +250,12 @@ export PATH
//! [38]
cd /home/user/qt/%VERSION%
-./configure -platform linux-g++ -xplatform symbian/linux-armcc -arch symbian
+./configure -platform linux-g++ -xplatform symbian/linux-armcc
//! [38]
//! [39]
cd /home/user/qt/%VERSION%
-./configure -platform linux-g++ -xplatform symbian/linux-gcce -arch symbian -no-webkit
+./configure -platform linux-g++ -xplatform symbian/linux-gcce -no-webkit
//! [39]
//! [40]
diff --git a/doc/src/snippets/code/doc_src_qalgorithms.qdoc b/doc/src/snippets/code/doc_src_qalgorithms.qdoc
index 78634a2..f5a73c6 100644
--- a/doc/src/snippets/code/doc_src_qalgorithms.qdoc
+++ b/doc/src/snippets/code/doc_src_qalgorithms.qdoc
@@ -217,7 +217,7 @@ QStringList list;
list << "AlPha" << "beTA" << "gamma" << "DELTA";
QMap<QString, QString> map;
-foreach (QString str, list)
+foreach (const QString &str, list)
map.insert(str.toLower(), str);
list = map.values();
diff --git a/doc/src/snippets/code/doc_src_qset.qdoc b/doc/src/snippets/code/doc_src_qset.qdoc
index ac48edb..c6e1933 100644
--- a/doc/src/snippets/code/doc_src_qset.qdoc
+++ b/doc/src/snippets/code/doc_src_qset.qdoc
@@ -80,7 +80,7 @@ while (i != set.constEnd()) {
//! [6]
QSet<QString> set;
...
-foreach (QString value, set)
+foreach (const QString &value, set)
qDebug() << value;
//! [6]
diff --git a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc b/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
index 3d88a0d..f29d3ba 100644
--- a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
@@ -47,7 +47,7 @@ foreach (variable, container)
//! [1]
QList<QString> list;
...
-foreach (QString str, list)
+foreach (const QString &str, list)
cout << str.ascii() << endl;
//! [1]
diff --git a/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp b/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
index 2e64505..fb62347 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp
@@ -51,7 +51,7 @@ connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()));
//! [2]
-foreach (QString path, app.libraryPaths())
+foreach (const QString &path, app.libraryPaths())
do_something(path);
//! [2]
diff --git a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp b/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
index c93a25c..766b249 100644
--- a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/doc/src/snippets/code/src_gui_kernel_qapplication.cpp
@@ -158,13 +158,13 @@ appname -session id
//! [10]
-foreach (QString command, mySession.restartCommand())
+foreach (const QString &command, mySession.restartCommand())
do_something(command);
//! [10]
//! [11]
-foreach (QString command, mySession.discardCommand())
+foreach (const QString &command, mySession.discardCommand())
do_something(command);
//! [11]
diff --git a/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp b/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
index 3871289..99deb20 100644
--- a/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
+++ b/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
@@ -68,7 +68,7 @@ void MyWidget::lookedUp(const QHostInfo &host)
return;
}
- foreach (QHostAddress address, host.addresses())
+ foreach (const QHostAddress &address, host.addresses())
qDebug() << "Found address:" << address.toString();
}
//! [3]
diff --git a/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp b/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
index 5c9421f..937dbb9 100644
--- a/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
+++ b/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
@@ -39,7 +39,7 @@
****************************************************************************/
//! [0]
-foreach (QSslCertificate cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,
+foreach (const QSslCertificate &cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,
QRegExp::Wildcard)) {
qDebug() << cert.issuerInfo(QSslCertificate::Organization);
}
diff --git a/doc/src/snippets/declarative/anchoranimation.qml b/doc/src/snippets/declarative/anchoranimation.qml
new file mode 100644
index 0000000..6c7aaf6
--- /dev/null
+++ b/doc/src/snippets/declarative/anchoranimation.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$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ id: container
+ width: 200; height: 200
+
+ Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "red"
+ }
+
+ states: State {
+ name: "reanchored"
+ AnchorChanges { target: myRect; anchors.right: container.right }
+ }
+
+ transitions: Transition {
+ // smoothly reanchor myRect and move into new position
+ AnchorAnimation { duration: 1000 }
+ }
+
+ Component.onCompleted: container.state = "reanchored"
+}
+//![0]
diff --git a/doc/src/snippets/declarative/behavior.qml b/doc/src/snippets/declarative/behavior.qml
new file mode 100644
index 0000000..420dfc4
--- /dev/null
+++ b/doc/src/snippets/declarative/behavior.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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: rect
+ width: 100; height: 100
+ color: "red"
+
+ Behavior on width {
+ NumberAnimation { duration: 1000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.width = 50
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/coloranimation.qml b/doc/src/snippets/declarative/coloranimation.qml
new file mode 100644
index 0000000..4e35f22
--- /dev/null
+++ b/doc/src/snippets/declarative/coloranimation.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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: 100; height: 100
+ color: "red"
+
+ ColorAnimation on color { to: "yellow"; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/comments.qml b/doc/src/snippets/declarative/comments.qml
index f4bedb8..9be0ce5 100644
--- a/doc/src/snippets/declarative/comments.qml
+++ b/doc/src/snippets/declarative/comments.qml
@@ -38,8 +38,10 @@
**
****************************************************************************/
+//![0]
import Qt 4.7
+//![0]
Text {
text: "Hello world!" //a basic greeting
/*
@@ -49,3 +51,4 @@ Text {
font.family: "Helvetica"
font.pointSize: 24
}
+//![0]
diff --git a/doc/src/snippets/declarative/component.qml b/doc/src/snippets/declarative/component.qml
new file mode 100644
index 0000000..09c4aa2
--- /dev/null
+++ b/doc/src/snippets/declarative/component.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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
+
+ Component {
+ id: redSquare
+
+ Rectangle {
+ color: "red"
+ width: 10
+ height: 10
+ }
+ }
+
+ Loader { sourceComponent: redSquare }
+ Loader { sourceComponent: redSquare; x: 20 }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
index 25bc10c..c29a1f9 100644
--- a/doc/src/snippets/declarative/componentCreation.js
+++ b/doc/src/snippets/declarative/componentCreation.js
@@ -1,7 +1,39 @@
-//![0]
+//![vars]
var component;
var sprite;
+//![vars]
+//![func]
+function createSpriteObjects() {
+//![func]
+
+//![remote]
+ component = Qt.createComponent("Sprite.qml");
+ if (component.status == Component.Ready)
+ finishCreation();
+ else
+ component.statusChanged.connect(finishCreation);
+//![remote]
+
+//![local]
+ component = Qt.createComponent("Sprite.qml");
+ sprite = component.createObject(appWindow);
+
+ if (sprite == null) {
+ // Error Handling
+ console.log("Error creating object");
+ } else {
+ sprite.x = 100;
+ sprite.y = 100;
+ // ...
+ }
+//![local]
+
+//![func-end]
+}
+//![func-end]
+
+//![finishCreation]
function finishCreation() {
if (component.status == Component.Ready) {
sprite = component.createObject(appWindow);
@@ -17,31 +49,4 @@ function finishCreation() {
console.log("Error loading component:", component.errorString());
}
}
-//![0]
-
-function createSpriteObjects() {
-
-//![1]
-component = Qt.createComponent("Sprite.qml");
-if (component.status == Component.Ready)
- finishCreation();
-else
- component.statusChanged.connect(finishCreation);
-//![1]
-
-//![2]
-component = Qt.createComponent("Sprite.qml");
-sprite = component.createObject(appWindow);
-
-if (sprite == null) {
- // Error Handling
- console.log("Error loading component:", component.errorString());
-} else {
- sprite.x = 100;
- sprite.y = 100;
- // ...
-}
-//![2]
-
-}
-
+//![finishCreation]
diff --git a/doc/src/snippets/declarative/createComponent-simple.qml b/doc/src/snippets/declarative/createComponent-simple.qml
new file mode 100644
index 0000000..9669580
--- /dev/null
+++ b/doc/src/snippets/declarative/createComponent-simple.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$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ id: container
+ width: 300; height: 300
+
+ function loadButton() {
+ var component = Qt.createComponent("Button.qml");
+ if (component.status == Component.Ready) {
+ var button = component.createObject(container);
+ button.color = "red";
+ }
+ }
+
+ Component.onCompleted: loadButton()
+}
+//![0]
diff --git a/doc/src/snippets/declarative/createComponent.qml b/doc/src/snippets/declarative/createComponent.qml
index 8bfed07..0f9fad5 100644
--- a/doc/src/snippets/declarative/createComponent.qml
+++ b/doc/src/snippets/declarative/createComponent.qml
@@ -40,12 +40,12 @@
//![0]
import Qt 4.7
-import "componentCreation.js" as MyModule
+import "componentCreation.js" as MyScript
Rectangle {
id: appWindow
width: 300; height: 300
- Component.onCompleted: MyModule.createSpriteObjects();
+ Component.onCompleted: MyScript.createSpriteObjects();
}
//![0]
diff --git a/doc/src/snippets/declarative/createQmlObject.qml b/doc/src/snippets/declarative/createQmlObject.qml
index 380f6f1..a5f15f4 100644
--- a/doc/src/snippets/declarative/createQmlObject.qml
+++ b/doc/src/snippets/declarative/createQmlObject.qml
@@ -42,16 +42,19 @@ import Qt 4.7
Rectangle {
id: parentItem
- property QtObject newObject
width: 100
height: 100
function createIt() {
//![0]
-newObject = Qt.createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}',
+var newObject = Qt.createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}',
parentItem, "dynamicSnippet1");
//![0]
+
+//![destroy]
+newObject.destroy(1000);
+//![destroy]
}
Component.onCompleted: createIt()
diff --git a/doc/src/snippets/declarative/dynamicObjects-destroy.qml b/doc/src/snippets/declarative/dynamicObjects-destroy.qml
new file mode 100644
index 0000000..2c0c2fb
--- /dev/null
+++ b/doc/src/snippets/declarative/dynamicObjects-destroy.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: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$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ id: container
+ width: 500; height: 100
+
+ Component.onCompleted: {
+ var component = Qt.createComponent("SelfDestroyingRect.qml");
+ for (var i=0; i<5; i++) {
+ var object = component.createObject(container);
+ object.x = (object.width + 10) * i;
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/mouseareadragfilter.qml b/doc/src/snippets/declarative/mouseareadragfilter.qml
new file mode 100644
index 0000000..52ed10c
--- /dev/null
+++ b/doc/src/snippets/declarative/mouseareadragfilter.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [dragfilter]
+import Qt 4.7
+
+Rectangle {
+ width: 480
+ height: 320
+ Rectangle {
+ x: 30; y: 30
+ width: 300; height: 240
+ color: "lightsteelblue"
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent;
+ drag.axis: "XAxis"
+ drag.minimumX: 30
+ drag.maximumX: 150
+ drag.filterChildren: true
+
+ Rectangle {
+ color: "yellow"
+ x: 50; y : 50
+ width: 100; height: 100
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("Clicked")
+ }
+ }
+ }
+ }
+}
+//! [dragfilter]
diff --git a/doc/src/snippets/declarative/numberanimation.qml b/doc/src/snippets/declarative/numberanimation.qml
new file mode 100644
index 0000000..57d23b1
--- /dev/null
+++ b/doc/src/snippets/declarative/numberanimation.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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: 100; height: 100
+ color: "red"
+
+ NumberAnimation on x { to: 50; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/parallelanimation.qml b/doc/src/snippets/declarative/parallelanimation.qml
new file mode 100644
index 0000000..d823b4f
--- /dev/null
+++ b/doc/src/snippets/declarative/parallelanimation.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
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ ParallelAnimation {
+ running: true
+ NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/parentanimation.qml b/doc/src/snippets/declarative/parentanimation.qml
new file mode 100644
index 0000000..7f11a43
--- /dev/null
+++ b/doc/src/snippets/declarative/parentanimation.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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: 100
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: "red"
+ }
+
+ Rectangle {
+ id: blueRect
+ x: redRect.width
+ width: 50; height: 50
+ color: "blue"
+
+ states: State {
+ name: "reparented"
+ ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
+ }
+
+ transitions: Transition {
+ ParentAnimation {
+ NumberAnimation { properties: "x,y"; duration: 1000 }
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/parentchange.qml b/doc/src/snippets/declarative/parentchange.qml
index 7f5718a..ea50832 100644
--- a/doc/src/snippets/declarative/parentchange.qml
+++ b/doc/src/snippets/declarative/parentchange.qml
@@ -41,9 +41,8 @@
//![0]
import Qt 4.7
-Rectangle {
- width: 200
- height: 100
+Item {
+ width: 200; height: 100
Rectangle {
id: redRect
diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml
index 8d424a8..4daee63 100644
--- a/doc/src/snippets/declarative/pathview/pathattributes.qml
+++ b/doc/src/snippets/declarative/pathview/pathattributes.qml
@@ -49,8 +49,8 @@ Rectangle {
id: delegate
Item {
width: 80; height: 80
- scale: PathView.scale
- opacity: PathView.opacity
+ scale: PathView.iconScale
+ opacity: PathView.iconOpacity
Column {
Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
Text { text: name; font.pointSize: 16}
@@ -66,11 +66,11 @@ Rectangle {
delegate: delegate
path: Path {
startX: 120; startY: 100
- PathAttribute { name: "scale"; value: 1.0 }
- PathAttribute { name: "opacity"; value: 1.0 }
+ PathAttribute { name: "iconScale"; value: 1.0 }
+ PathAttribute { name: "iconOpacity"; value: 1.0 }
PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
- PathAttribute { name: "scale"; value: 0.3 }
- PathAttribute { name: "opacity"; value: 0.5 }
+ PathAttribute { name: "iconScale"; value: 0.3 }
+ PathAttribute { name: "iconOpacity"; value: 0.5 }
PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
}
}
diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml
new file mode 100644
index 0000000..059cde5
--- /dev/null
+++ b/doc/src/snippets/declarative/propertyanimation.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** 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]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "moved"
+ PropertyChanges { target: rect; x: 50 }
+ }
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![transition]
+
+//![behavior]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ Behavior on x { PropertyAnimation {} }
+
+ MouseArea { anchors.fill: parent; onClicked: parent.x = 50 }
+}
+//![behavior]
+
+//![propertyvaluesource]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ PropertyAnimation { to: 50 }
+ PropertyAnimation { to: 0 }
+ }
+}
+//![propertyvaluesource]
+
+//![standalone]
+Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: "red"
+
+ // this is a standalone animation, it's not running by default
+ PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
+
+ MouseArea { anchors.fill: parent; onClicked: animation.running = true }
+}
+//![standalone]
+
+
+}
diff --git a/doc/src/snippets/declarative/qmldocuments.qml b/doc/src/snippets/declarative/qmldocuments.qml
new file mode 100644
index 0000000..c19a658
--- /dev/null
+++ b/doc/src/snippets/declarative/qmldocuments.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: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 {
+ property alias text: textItem.text
+
+ width: 100; height: 30
+ border.width: 1
+ radius: 5
+ smooth: true
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkGray" }
+ GradientStop { position: 0.5; color: "black" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+
+ Text {
+ id: textItem
+ anchors.centerIn: parent
+ font.pointSize: 20
+ color: "white"
+ }
+
+}
+//![0]
diff --git a/doc/src/snippets/declarative/qtobject.qml b/doc/src/snippets/declarative/qtobject.qml
new file mode 100644
index 0000000..970fa16
--- /dev/null
+++ b/doc/src/snippets/declarative/qtobject.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
+
+Item {
+ QtObject {
+ id: attributes
+ property string name
+ property int size
+ property variant attributes
+ }
+
+ Text { text: attributes.name }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/rotationanimation.qml b/doc/src/snippets/declarative/rotationanimation.qml
new file mode 100644
index 0000000..c81395a
--- /dev/null
+++ b/doc/src/snippets/declarative/rotationanimation.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: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: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 150; height: 100; anchors.centerIn: parent
+ color: "red"
+ smooth: true
+
+ states: State {
+ name: "rotated"; PropertyChanges { target: rect; rotation: 180 }
+ }
+
+ transitions: Transition {
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: rect.state = "rotated" }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/sequentialanimation.qml b/doc/src/snippets/declarative/sequentialanimation.qml
new file mode 100644
index 0000000..a15f7f3
--- /dev/null
+++ b/doc/src/snippets/declarative/sequentialanimation.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
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ SequentialAnimation {
+ running: true
+ NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/smoothedanimation.qml b/doc/src/snippets/declarative/smoothedanimation.qml
new file mode 100644
index 0000000..20c90b5
--- /dev/null
+++ b/doc/src/snippets/declarative/smoothedanimation.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 800; height: 600
+ color: "blue"
+
+ Rectangle {
+ width: 60; height: 60
+ x: rect1.x - 5; y: rect1.y - 5
+ color: "green"
+
+ Behavior on x { SmoothedAnimation { velocity: 200 } }
+ Behavior on y { SmoothedAnimation { velocity: 200 } }
+ }
+
+ Rectangle {
+ id: rect1
+ width: 50; height: 50
+ color: "red"
+ }
+
+ focus: true
+ Keys.onRightPressed: rect1.x = rect1.x + 100
+ Keys.onLeftPressed: rect1.x = rect1.x - 100
+ Keys.onUpPressed: rect1.y = rect1.y - 100
+ Keys.onDownPressed: rect1.y = rect1.y + 100
+}
+//![0]
diff --git a/doc/src/snippets/declarative/dynamicObjects.qml b/doc/src/snippets/declarative/springanimation.qml
index 3698499..8e810e1 100644
--- a/doc/src/snippets/declarative/dynamicObjects.qml
+++ b/doc/src/snippets/declarative/springanimation.qml
@@ -38,32 +38,28 @@
**
****************************************************************************/
-import Qt 4.7
-
//![0]
-Rectangle {
- id: rootItem
- width: 300
- height: 300
+import Qt 4.7
- Component {
- id: rectComponent
+Item {
+ width: 300; height: 300
- Rectangle {
- id: rect
- width: 40; height: 40;
- color: "red"
+ Rectangle {
+ id: rect
+ width: 50; height: 50
+ color: "red"
- NumberAnimation on opacity { from: 1; to: 0; duration: 1000 }
+ Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
+ }
- Component.onCompleted: rect.destroy(1000);
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ rect.x = mouse.x - rect.width/2
+ rect.y = mouse.y - rect.height/2
}
}
-
- function createRectangle() {
- var object = rectComponent.createObject(rootItem);
- }
-
- Component.onCompleted: createRectangle()
}
//![0]
+
diff --git a/doc/src/snippets/declarative/state-when.qml b/doc/src/snippets/declarative/state-when.qml
new file mode 100644
index 0000000..6d3bb75
--- /dev/null
+++ b/doc/src/snippets/declarative/state-when.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$
+**
+****************************************************************************/
+import Qt 4.7
+//![0]
+Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "hidden"; when: mouseArea.pressed
+ PropertyChanges { target: myRect; opacity: 0 }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml
index a99c2e2..ce2653b 100644
--- a/doc/src/snippets/declarative/state.qml
+++ b/doc/src/snippets/declarative/state.qml
@@ -46,24 +46,17 @@ Rectangle {
width: 100; height: 100
color: "black"
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: myRect.state == 'clicked' ? myRect.state = "" : myRect.state = 'clicked';
+ }
+
states: [
State {
name: "clicked"
- PropertyChanges {
- target: myRect
- color: "red"
- }
+ PropertyChanges { target: myRect; color: "red" }
}
]
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (myRect.state == "") // i.e. the default state
- myRect.state = "clicked";
- else
- myRect.state = "";
- }
- }
}
//![0]
diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml
index c3b1796..127e3a7 100644
--- a/doc/src/snippets/declarative/states.qml
+++ b/doc/src/snippets/declarative/states.qml
@@ -40,42 +40,22 @@
****************************************************************************/
//![0]
import Qt 4.7
-
-Item {
- id: myItem
+
+Rectangle {
+ id: myRect
width: 200; height: 200
+ color: "red"
- Rectangle {
- id: myRect
- width: 100; height: 100
- color: "red"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myRect.state = 'moved'
}
states: [
State {
name: "moved"
- PropertyChanges {
- target: myRect
- x: 50
- y: 50
- }
+ PropertyChanges { target: myRect; x: 50; y: 50 }
}
]
-
- MouseArea {
- anchors.fill: parent
- onClicked: myItem.state = 'moved'
- }
-//![0]
-
-//![transitions]
-transitions: [
- Transition {
- NumberAnimation { properties: "x,y"; duration: 500 }
- }
-]
-//![transitions]
-
-//![1]
}
-//![1]
+//![0]
diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml
new file mode 100644
index 0000000..615de17
--- /dev/null
+++ b/doc/src/snippets/declarative/transition-from-to.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$
+**
+****************************************************************************/
+import Qt 4.7
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow" }
+ }
+
+ transitions: Transition {
+ ColorAnimation { duration: 1000 }
+ }
+}
+//![0]
+
+
diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml
new file mode 100644
index 0000000..8a7b69a
--- /dev/null
+++ b/doc/src/snippets/declarative/transition-reversible.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: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
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"
+ when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow"; x: 50 }
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ PropertyAnimation { property: "x"; duration: 1000 }
+ ColorAnimation { duration: 1000 }
+ }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml
new file mode 100644
index 0000000..b884750
--- /dev/null
+++ b/doc/src/snippets/declarative/transition.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "moved"
+ PropertyChanges { target: rect; x: 50; y: 50 }
+ }
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/droparea.cpp b/doc/src/snippets/droparea.cpp
index bbcf82d..bb49dd7 100644
--- a/doc/src/snippets/droparea.cpp
+++ b/doc/src/snippets/droparea.cpp
@@ -130,7 +130,7 @@ QPixmap DropArea::extractPixmap(const QByteArray &data, const QString &format)
QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
QPixmap pixmap;
- foreach (QByteArray imageFormat, imageFormats) {
+ foreach (const QByteArray &imageFormat, imageFormats) {
if (format.mid(6) == QString(imageFormat)) {
pixmap.loadFromData(data, imageFormat);
break;
diff --git a/doc/src/snippets/picture/picture.cpp b/doc/src/snippets/picture/picture.cpp
index 0c5712a..5283978 100644
--- a/doc/src/snippets/picture/picture.cpp
+++ b/doc/src/snippets/picture/picture.cpp
@@ -76,7 +76,7 @@ int main()
// FORMATS
//! [2]
QStringList list = QPicture::inputFormatList();
- foreach (QString string, list)
+ foreach (const QString &string, list)
myProcessing(string);
//! [2]
}
@@ -85,7 +85,7 @@ int main()
// OUTPUT
//! [3]
QStringList list = QPicture::outputFormatList();
- foreach (QString string, list)
+ foreach (const QString &string, list)
myProcessing(string);
//! [3]
}
diff --git a/doc/src/snippets/qfontdatabase/main.cpp b/doc/src/snippets/qfontdatabase/main.cpp
index 7f939de..1b8ff42 100644
--- a/doc/src/snippets/qfontdatabase/main.cpp
+++ b/doc/src/snippets/qfontdatabase/main.cpp
@@ -50,11 +50,11 @@ int main(int argc, char **argv)
fontTree.setColumnCount(2);
fontTree.setHeaderLabels(QStringList() << "Font" << "Smooth Sizes");
- foreach (QString family, database.families()) {
+ foreach (const QString &family, database.families()) {
QTreeWidgetItem *familyItem = new QTreeWidgetItem(&fontTree);
familyItem->setText(0, family);
- foreach (QString style, database.styles(family)) {
+ foreach (const QString &style, database.styles(family)) {
QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem);
styleItem->setText(0, style);
diff --git a/doc/src/snippets/qlistview-dnd/model.cpp b/doc/src/snippets/qlistview-dnd/model.cpp
index d310c03..bca71ee 100644
--- a/doc/src/snippets/qlistview-dnd/model.cpp
+++ b/doc/src/snippets/qlistview-dnd/model.cpp
@@ -109,7 +109,7 @@ bool DragDropListModel::dropMimeData(const QMimeData *data,
//! [6]
insertRows(beginRow, rows, QModelIndex());
- foreach (QString text, newItems) {
+ foreach (const QString &text, newItems) {
QModelIndex idx = index(beginRow, 0, QModelIndex());
setData(idx, text);
beginRow++;
@@ -139,7 +139,7 @@ QMimeData *DragDropListModel::mimeData(const QModelIndexList &indexes) const
QDataStream stream(&encodedData, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
+ foreach (const QModelIndex &index, indexes) {
if (index.isValid()) {
QString text = data(index, Qt::DisplayRole).toString();
stream << text;
diff --git a/doc/src/snippets/qstringlist/main.cpp b/doc/src/snippets/qstringlist/main.cpp
index 76785f1..9ada319 100644
--- a/doc/src/snippets/qstringlist/main.cpp
+++ b/doc/src/snippets/qstringlist/main.cpp
@@ -118,7 +118,7 @@ Widget::Widget(QWidget *parent)
result.clear();
//! [12]
- foreach (QString str, list) {
+ foreach (const QString &str, list) {
if (str.contains("Bill"))
result += str;
}
diff --git a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
index 2d01240..620a716 100644
--- a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
+++ b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
@@ -123,7 +123,7 @@ QMimeData *DragDropModel::mimeData(const QModelIndexList &indexes) const
QDataStream stream(&encodedData, QIODevice::WriteOnly);
- foreach (QModelIndex index, indexes) {
+ foreach (const QModelIndex &index, indexes) {
if (index.isValid()) {
QString text = data(index, Qt::DisplayRole).toString();
stream << index.internalId() << index.row() << index.column() << text;
diff --git a/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp b/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
index 6a49be8..35d2fa7 100644
--- a/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
+++ b/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
@@ -72,9 +72,9 @@ int main(int argc, char *argv[])
<< (QStringList() << "David Bradley" << "42")
<< (QStringList() << "Knut Walters" << "25")
<< (QStringList() << "Andrea Jones" << "34");
- foreach (QStringList row, rows) {
+ foreach (const QStringList &row, rows) {
QList<QStandardItem *> items;
- foreach (QString text, row)
+ foreach (const QString &text, row)
items.append(new QStandardItem(text));
model.appendRow(items);
}
diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css
deleted file mode 100644
index 9f5d28b..0000000
--- a/doc/src/template/style/OfflineStyle.css
+++ /dev/null
@@ -1,251 +0,0 @@
-@media screen
-{
-
- .wrapper
- {
- top:50px;
- background: none;
-
- }
- .wrapper .bd
- {
- background: none;
- position: relative;
- }
-
-
-
-
- body.offline
- {
- background-image: none;
- background-color: #FFFFFF;
-
- }
-
- .offline .footer {
- margin: 0;
- }
- .offline .header
- {
- width: 100%;
- margin: 0;
- height: auto;
- background-color: #ffffff;
- padding: 10px 0 5px 0;
- overflow: visible;
- border-bottom: solid #E5E5E5 1px;
- z-index:1;
- position:fixed;
- }
-
- .offline .header .content
- {
- }
- .offline .header .qtref
- {
- color: #00732F;
- position: static;
- float: left;
- margin-left: 5px;
- font: bold 18px/1 Arial;
- }
-
- .offline .header .qtref:visited
- {
- color: #00732F;
- }
- .offline .header .qtref:hover
- {
- color: #00732F;
- text-decoration:none;
- }
- .offline .header .qtref span
- {
- background-image: none;
- text-indent: 0;
- text-decoration:none;
- }
-
- .offline .wrap
- {
- margin: 0 5px 0 5px;
- }
-
- .offline .wrap .toolbar
- {
- display:block;
- padding-top:5px;
- }
-
- .offline .wrap .breadcrumb ul li {
- font-weight: normal;
- }
-
- .offline .wrap .breadcrumb ul li a {
- /*color: #44a51c;*/
- }
-
- .offline .wrap .breadcrumb ul li.last a {
- /*color: #363534;*/
- }
-
-
-
- .narrow .indexboxcont .section {
- width: 64%;
- padding-left: 0;
- }
-
- .narrow .indexboxcont .sectionlist {
- width: 32.5%;
- }
-
- .header .icon,
- .sidebar,
- .feedback,
- .t_button,
- .feedback,
- #feedbackBox,
- #feedback,
- #blurpage,
- .indexbox .indexIcon span,
- .wrapper .hd,
- .offline .indexbox .indexIcon,
- .offline .header #nav-logo,
- #offlinemenu,
- #offlinesearch,
- .offline .header #nav-topright,
- .offline .header #shortCut ,
- .offline .wrapper .hd,
- .offline .wrapper .ft,
- .offline .sidebar,
- .offline .wrap .feedback
- {
- display:none;
- }
-
- /* end offline mode */
-#narrowmenu {
- display: none;
- float: right;
- margin: 15px 40px 0 0;
- font-size: 11px;
- }
-
- .narrow #narrowmenu {
- display: block;
- }
-
- #narrowsearch{
- display:none;
- }
-
- #narrowmenu ul
- {
- border-bottom:solid 1px #E5E5E5;
- border-left:solid 1px #E5E5E5;
- border-right:solid 1px #E5E5E5;
- }
-
- #narrowmenu a {
- line-height: 1.1;
- background: url(../images/arrow_down.png) no-repeat 100% 50%;
- white-space: nowrap;
- padding: 0 16px 0 5px;
- }
-
- #narrowmenu li {
- margin-left: 20px;
- }
-
- #narrowmenu li li {
- margin: 0 0 5px 0;
- }
-
- #narrowmenu li li a {
- padding: 0;
- background-image: none;
- }
-
- #narrowmenu li,
- #narrowmenu li ul {
- background-color: #fff;
- }
-
- #narrowmenu li ul {
- width: auto;
- padding: 5px;
- margin-top:-15px;
- }
-
- .sf-menu li:hover ul, .sf-menu li.sfHover ul {
- top: 1.2em;
- }
-.sf-menu, .sf-menu * {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-.sf-menu {
- line-height: 1.0;
-}
-.sf-menu ul {
- position: absolute;
- top: -999em;
- width: 10em; /* left offset of submenus need to match (see below) */
-}
-.sf-menu ul li {
- width: 100%;
-}
-.sf-menu li:hover {
- visibility: inherit; /* fixes IE7 'sticky bug' */
-}
-.sf-menu li {
- float: left;
- position: relative;
-}
-.sf-menu a {
- display: block;
- position: relative;
-}
-.sf-menu li:hover ul,
-.sf-menu li.sfHover ul {
- left: 0;
- top: 2.5em; /* match top ul list item height */
- z-index: 99;
-}
-ul.sf-menu li:hover li ul,
-ul.sf-menu li.sfHover li ul {
- top: -999em;
-}
-ul.sf-menu li li:hover ul,
-ul.sf-menu li li.sfHover ul {
- left: 10em; /* match ul width */
- top: 0;
-}
-ul.sf-menu li li:hover li ul,
-ul.sf-menu li li.sfHover li ul {
- top: -999em;
-}
-ul.sf-menu li li li:hover ul,
-ul.sf-menu li li li.sfHover ul {
- left: 10em; /* match ul width */
- top: 0;
-}
- .wrap .content ol li {
- background:none;
- font:400 10pt/1 Verdana;
- margin-bottom:10px;
- margin-left:12px;
- }
- .wrap .content ol li {
- list-style-type:decimal;
-
- }
-
-
-
-}
-/* end of screen media */
-
diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css
index 05159aa..e4ad135 100644
--- a/doc/src/template/style/narrow.css
+++ b/doc/src/template/style/narrow.css
@@ -15,7 +15,12 @@
}
.narrow .footer {
- margin: 0;
+ margin: 0px;
+ }
+
+ .creator .header, .creator .header .content, .creator .footer, .creator .wrapper {
+ margin: 0px;
+ min-width: 300px;
}
.narrow .header
{
@@ -126,6 +131,11 @@
margin: 0 5px 0 5px;
}
+ .creator .wrap
+ {
+ margin: 0px;
+ background:#FFFFFF;
+ }
.narrow .wrap .toolbar
{
border-bottom: none;
@@ -135,7 +145,14 @@
{
padding-top: 15px;
}
-
+ .creator .wrap .content
+ {
+ padding-top: 10px;
+ }
+ .creator .wrap .content .guide
+ {
+ padding-top: 15px;
+ }
.narrow .wrap .feedback
{
display: none;
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 9f80921..9b37693 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -1345,7 +1345,7 @@
font: normal 13px/1.2 Verdana;
color: #363534;
- background-color: #FFFFFF;
+ background-color: #FAFAFA;
}
@@ -1406,7 +1406,9 @@
border-bottom:1px solid #E5E5E5;
- width:100%,
+ /*width:100%;*/
+ margin-left:-5px;
+ margin-right:-5px;
}
.creator .wrap .breadcrumb ul li a
{
@@ -1550,18 +1552,17 @@
@media print
{
- input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft
+ input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
{
display: none;
background: none;
}
.content
{
- position: absolute;
- top: 0px;
- left: 0px;
background: none;
display: block;
+ width: 100%; margin: 0; float: none;
+
}
}
/* end of print media */
diff --git a/doc/src/template/style/superfish_skin.css b/doc/src/template/style/superfish_skin.css
deleted file mode 100644
index 8d84827..0000000
--- a/doc/src/template/style/superfish_skin.css
+++ /dev/null
@@ -1,83 +0,0 @@
-
-/*** DEMO SKIN ***/
-.sf-menu {
- float: left;
- margin-bottom: 1em;
-}
-.sf-menu a {
- border-left: 1px solid #fff;
- border-top: 1px solid #CFDEFF;
- padding: .75em 1em;
- text-decoration:none;
-}
-.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
- color: #13a;
-}
-.sf-menu li {
- background: #BDD2FF;
-}
-.sf-menu li li {
- background: #AABDE6;
-}
-.sf-menu li li li {
- background: #9AAEDB;
-}
-.sf-menu li:hover, .sf-menu li.sfHover,
-.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
- background: #CFDEFF;
- outline: 0;
-}
-
-/*** arrows **/
-.sf-menu a.sf-with-ul {
- padding-right: 2.25em;
- min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
-}
-.sf-sub-indicator {
- position: absolute;
- display: block;
- right: .75em;
- top: 1.05em; /* IE6 only */
- width: 10px;
- height: 10px;
- text-indent: -999em;
- overflow: hidden;
- background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
-}
-a > .sf-sub-indicator { /* give all except IE6 the correct values */
- top: .8em;
- background-position: 0 -100px; /* use translucent arrow for modern browsers*/
-}
-/* apply hovers to modern browsers */
-a:focus > .sf-sub-indicator,
-a:hover > .sf-sub-indicator,
-a:active > .sf-sub-indicator,
-li:hover > a > .sf-sub-indicator,
-li.sfHover > a > .sf-sub-indicator {
- background-position: -10px -100px; /* arrow hovers for modern browsers*/
-}
-
-/* point right for anchors in subs */
-.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
-.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
-/* apply hovers to modern browsers */
-.sf-menu ul a:focus > .sf-sub-indicator,
-.sf-menu ul a:hover > .sf-sub-indicator,
-.sf-menu ul a:active > .sf-sub-indicator,
-.sf-menu ul li:hover > a > .sf-sub-indicator,
-.sf-menu ul li.sfHover > a > .sf-sub-indicator {
- background-position: -10px 0; /* arrow hovers for modern browsers*/
-}
-
-/*** shadows for all but IE6 ***/
-.sf-shadow ul {
- background: url('../images/shadow.png') no-repeat bottom right;
- padding: 0 8px 9px 0;
- -moz-border-radius-bottomleft: 17px;
- -moz-border-radius-topright: 17px;
- -webkit-border-top-right-radius: 17px;
- -webkit-border-bottom-left-radius: 17px;
-}
-.sf-shadow ul.sf-shadow-off {
- background: transparent;
-}
diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc
index aa4a933..798a7a1 100644
--- a/doc/src/widgets-and-layouts/layout.qdoc
+++ b/doc/src/widgets-and-layouts/layout.qdoc
@@ -242,7 +242,7 @@
For further guidance when implementing these functions, see the
\e{Qt Quarterly} article
- \l{http://qt.nokia.com/doc/qq/qq04-height-for-width.html}
+ \l{http://doc.qt.nokia.com/qq/qq04-height-for-width.html}
{Trading Height for Width}.