From 9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 20 Dec 2010 17:29:06 +0100 Subject: Re-organized the Qt Quick page. Changed titles and links. Task-number: QTBUG-16071 --- doc/src/declarative/anchor-layout.qdoc | 4 +- doc/src/declarative/animation.qdoc | 4 +- doc/src/declarative/basicelements.qdoc | 37 ++ doc/src/declarative/basictypes.qdoc | 4 +- doc/src/declarative/declarativeui.qdoc | 40 +- doc/src/declarative/dynamicobjects.qdoc | 4 +- doc/src/declarative/extending-tutorial.qdoc | 48 +- doc/src/declarative/extending.qdoc | 472 +------------------ doc/src/declarative/focus.qdoc | 5 +- doc/src/declarative/graphicaleffects.qdoc | 36 ++ doc/src/declarative/integrating.qdoc | 8 +- doc/src/declarative/mouseevents.qdoc | 52 +++ doc/src/declarative/network.qdoc | 3 + doc/src/declarative/propertybinding.qdoc | 177 +++++++- doc/src/declarative/qdeclarativei18n.qdoc | 3 + doc/src/declarative/qdeclarativemodels.qdoc | 88 +--- doc/src/declarative/qdeclarativestates.qdoc | 2 + doc/src/declarative/qmlevents.qdoc | 37 ++ doc/src/declarative/qmlreusablecomponents.qdoc | 497 +++++++++++++++++++++ doc/src/declarative/qmlruntime.qdoc | 42 +- doc/src/declarative/qmlsyntax.qdoc | 7 +- doc/src/declarative/qmltexthandling.qdoc | 55 +++ doc/src/declarative/qmlviewer.qdoc | 60 +-- doc/src/declarative/qmlviews.qdoc | 111 +++++ doc/src/declarative/qmlwebkit.qdoc | 47 ++ doc/src/declarative/qtbinding.qdoc | 17 +- doc/src/declarative/qtprogrammers.qdoc | 3 +- doc/src/examples/qml-examples.qdoc | 28 +- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- doc/src/overviews.qdoc | 29 +- doc/src/qt-webpages.qdoc | 16 + .../ui-components/tabwidget/TabWidget.qml | 2 +- .../graphicsitems/qdeclarativeflipable.cpp | 14 +- src/declarative/qml/qdeclarativecomponent.cpp | 52 +-- src/declarative/qml/qdeclarativecontext.cpp | 46 +- src/declarative/util/qdeclarativeanimation.cpp | 170 +++---- src/declarative/util/qdeclarativebehavior.cpp | 6 +- .../util/qdeclarativesmoothedanimation.cpp | 12 +- .../util/qdeclarativespringanimation.cpp | 20 +- src/declarative/util/qdeclarativetransition.cpp | 24 +- src/declarative/util/qdeclarativeview.cpp | 12 +- 41 files changed, 1428 insertions(+), 868 deletions(-) create mode 100644 doc/src/declarative/basicelements.qdoc create mode 100644 doc/src/declarative/graphicaleffects.qdoc create mode 100644 doc/src/declarative/mouseevents.qdoc create mode 100644 doc/src/declarative/qmlevents.qdoc create mode 100644 doc/src/declarative/qmlreusablecomponents.qdoc create mode 100644 doc/src/declarative/qmltexthandling.qdoc create mode 100644 doc/src/declarative/qmlviews.qdoc create mode 100644 doc/src/declarative/qmlwebkit.qdoc diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 4953b22..11acbad 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -29,8 +29,8 @@ \page qml-anchor-layout.html \target anchor-layout \contentspage QML Features -\previouspage Using QML Positioner and Repeater Items -\nextpage Using QML Positioner and Repeater Items +\previouspage {Using QML Positioner and Repeater Items}{Component Layouts} +\nextpage {QML Mouse Events}{Mouse Events} \title Anchor-based Layout in QML \section1 Overview diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 708f412..099f02d 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -29,7 +29,9 @@ \page qdeclarativeanimation.html \ingroup qml-features \contentspage QML Features -\title QML Animation +\previouspage {QML States}{States} +\nextpage {QML Data Models}{Structuring Data with Models} +\title QML Animation and Transitions In QML, animations are created by applying animation objects to object property diff --git a/doc/src/declarative/basicelements.qdoc b/doc/src/declarative/basicelements.qdoc new file mode 100644 index 0000000..d0c16b6 --- /dev/null +++ b/doc/src/declarative/basicelements.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$ +** 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 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 qmlbasicelements.html + \ingroup qml-features + \contentspage QML Features + \previouspage {QML Basic Types}{Data Types} + \nextpage {Using QML Positioner and Repeater Items}{Component Layouts} + + \title QML Basic Elements + +*/ diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 0277ccb..59772c5 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -29,13 +29,15 @@ \page qdeclarativebasictypes.html \ingroup qml-features \contentspage QML Features + \previouspage {Property Binding} + \nextpage {QML Basic Elements}{Basic Elements} \title QML Basic Types QML has a set of primitive types, as listed below, that are used throughout the \l {QML Elements}. Some of these types can also be used for defining - \c property values in QML. See \l{Writing QML Components: Properties, Methods and Signals} for the + \c property values in QML. See \l{Importing Reusable Components} for the list of types that can be used for \c property values. \annotatedlist qmlbasictypes diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 771a421..473cbdd 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -77,42 +77,41 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \list \o \l{QML Syntax} \o \l{Property Binding} +\o \l{QML Basic Types}{Data Types} +\o \l{QML Basic Elements}{Basic Elements} \o \l{Using QML Positioner and Repeater Items}{Component Layouts} -\o \l{Anchor-based Layout in QML}{Anchor Layout} -\o \l{Writing QML Components: Properties, Methods and Signals}{Reusable Components} -\o \l{Text Handling} -\o \l{Keyboard Focus in QML}{Keyboard Focus} +\o \l{Anchor-based Layout in QML}{Layouts using Anchors} \o \l{Mouse Events} -\o \l{QML States} {States} -\o \l{QML Animation}{Animation and Transitions} -\o \l{QML Basic Types}{QML Basic Data Types} +\o \l{QML Text Handling and Validators}{Text Handling and Validators} +\o \l{Keyboard Focus in QML}{Keyboard Focus} +\o \l{Importing Reusable Components} +\o \l{QML States}{States} +\o \l{QML Animation and Transitions}{Animation and Transitions} \o \l{QML Data Models}{Structuring Data with Models} -\o \l{Presenting Data with QML}{Presenting Data with Views} -\o \l{Affine Transformations} +\o \l{Presenting Data with Views} +\o \l{Extending QML Functionalities using C++} +\o \l{Using QML Bindings in C++ Applications} +\o \l{Integrating QML Code with Existing Qt UI Code} +\o \l{QML Signal and Handler Event System}{Signal and Handler Event System} \o \l{Dynamic Object Management in QML}{Dynamic Object Management} -\o \l{Network Transparency}{Resource Loading} -\o \l{Extending QML in C++}{Extending QML Functionalities using C++} -\o \l{Using QML in C++ Applications} -\o \l{Integrating QML with existing Qt UI code}{Integrating QML Code with Existing Qt UI Code} -\o \l{Signals and Slots Event System} +\o \l{Network Transparency}{Loading Resources in QML} \o \l{QML Internationalization}{Internationalization} -\o \l{Graphical Effects} +\o \l{QML Graphical Effects}{Graphical Effects} \endlist \section1 QML Add-Ons \list -\o \l{Qt WebKit} -\o \l{Mobility QML bindings} +\o \l{QtWebKit QML Module} +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins} \endlist \section1 Qt Quick Tools \list \o \l{Debugging QML} +\o \l{Developing Qt Quick Applications with Creator}{Developing with Qt Creator} \o \l{QML Viewer} -\o \l{QML Performance} -\o \l{Developing Qt Quick Applications}{Developing with Qt Creator} \endlist \section1 Reference @@ -160,6 +159,9 @@ examples for porting} \list \o \l{QML Best Practices: Data Types}{Using Data Types in QML} \o \l{QML Best Practices: Coding Conventions}{Coding Tips} +\o \l{QML Performance}{Performance Tips} +\omit \o \l{Geir's screen size document} +\endomit \endlist */ diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 1e43166..e5077ba 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -29,13 +29,15 @@ \page qdeclarativedynamicobjects.html \ingroup qml-features \contentspage {QML Features} +\previouspage {QML Signal and Handler Event System}{Signal and Handler Event System} +\nextpage {Network Transparency}{Loading Resources in QML} \title Dynamic Object Management in QML QML provides a number of ways to dynamically create and manage QML objects. The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements all support dynamic object management. Objects can also be created and managed from C++, and this is the preferred method for hybrid QML/C++ applications -(see \l{Using QML in C++ Applications}). +(see \l{Using QML Bindings in C++ Applications}). 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 diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index c998c5c..25be0f9 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -33,7 +33,7 @@ The Qt Declarative module provides a set of APIs for extending QML through C++ extensions. You can write extensions to add your own QML types, extend existing Qt types, or call C/C++ functions that are not accessible from ordinary QML code. -This tutorial shows how to write a QML extension using C++ that includes +This tutorial shows how to write a QML extension using C++ that includes core QML features, including properties, signals and bindings. It also shows how extensions can be deployed through plugins. @@ -67,18 +67,18 @@ like network programming that are not accessible through built-in QML features. In this tutorial, we will show how to use the C++ classes in the Qt Declarative module to extend QML. The end result will be a simple Pie Chart display implemented by -several custom QML types connected together through QML features like bindings and +several custom QML types connected together through QML features like bindings and signals, and made available to the QML runtime through a plugin. To begin with, let's create a new QML type called "PieChart" that has two properties: a name and a color. We will make it available in a \l {Modules}{module} called "Charts", with -a module version of 1.0. +a module version of 1.0. We want this \c PieChart type to be usable from QML like this: \code import Charts 1.0 - + PieChart { width: 100; height: 100 name: "A simple pie chart" @@ -99,16 +99,16 @@ Here is our \c PieChart class, defined in \c piechart.h: \snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0 -The class inherits from QDeclarativeItem because we want to override +The class inherits from QDeclarativeItem because we want to override QDeclarativeItem::paint() in order to draw. If the class just represented some data type and was not an item that actually needed to be displayed, it could simply inherit -from QObject. Or, if we want to extend the functionality of an existing QObject-based +from QObject. Or, if we want to extend the functionality of an existing QObject-based class, it could inherit from that class instead. The \c PieChart class defines the two properties, \c name and \c color, with the Q_PROPERTY macro, -and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp -simply sets and returns the \c m_name and \c m_color values as appropriate, and -implements \c paint() to draw a simple pie chart. It also turns off the +and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp +simply sets and returns the \c m_name and \c m_color values as appropriate, and +implements \c paint() to draw a simple pie chart. It also turns off the QGraphicsItem::ItemHasNoContents flag to enable painting: \snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 0 @@ -150,19 +150,19 @@ Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-b At the moment, the \c app.qml is run from within a C++ application. This may seem odd if you're used to running QML files with the \l {QML Viewer}. -Later on, we'll show how to create a plugin so that you can run \c app.qml using the +Later on, we'll show how to create a plugin so that you can run \c app.qml using the \l {QML Viewer} instead. */ /*! -\title Chapter 2: Connecting to C++ Methods and Signals +\title Chapter 2: Connecting to C++ Methods and Signals \example declarative/tutorials/extending/chapter2-methods Suppose we want \c PieChart to have a "clearChart()" method that erases the -chart and then emits a "chartCleared" signal. Our \c app.qml would be able +chart and then emits a "chartCleared" signal. Our \c app.qml would be able to call \c clearChart() and receive \c chartCleared() signals like this: \snippet declarative/tutorials/extending/chapter2-methods/app.qml 0 @@ -210,7 +210,7 @@ Property bindings is a powerful feature of QML that allows values of different elements to be synchronized automatically. It uses signals to notify and update other elements' values when property values are changed. -Let's enable property bindings for the \c color property. That means +Let's enable property bindings for the \c color property. That means if we have code like this: \snippet declarative/tutorials/extending/chapter3-bindings/app.qml 0 @@ -224,7 +224,7 @@ updates to the same value. When the window is clicked, the \c onClicked handler in the MouseArea changes the color of \c chartA, thereby changing both charts to the color blue. -It's easy to enable property binding for the \c color property. +It's easy to enable property binding for the \c color property. We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal is emitted whenever the value changes. @@ -244,7 +244,7 @@ It's important for \c setColor() to check that the color value has actually chan before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and also prevents loops when other elements respond to the value change. -The use of bindings is essential to QML. You should always add NOTIFY +The use of bindings is essential to QML. You should always add NOTIFY signals for properties if they are able to be implemented, so that your properties can be used in bindings. Properties that cannot be bound cannot be automatically updated and cannot be used as flexibly in QML. Also, since @@ -299,7 +299,7 @@ listed in the \l{Adding Properties} documentation, which includes the following: If we want to create a property whose type is not supported by QML by default, we need to register the type with QML. -For example, let's replace the use of the \c property with a type called +For example, let's replace the use of the \c property with a type called "PieSlice" that has a \c color property. Instead of assigning a color, we assign an \c PieSlice value which itself contains a \c color: @@ -358,10 +358,10 @@ have a \c slices property that accepts a list of \c PieSlice items: \image extending-tutorial-chapter5.png To do this, we replace the \c pieSlice property in \c PieChart with a \c slices property, -declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the +declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the creation of list properties in QML extensions. We replace the \c pieSlice() -function with a \c slices() function that returns a list of slices, and add -an internal \c append_slice() function (discussed below). We also use a QList to +function with a \c slices() function that returns a list of slices, and add +an internal \c append_slice() function (discussed below). We also use a QList to store the internal list of slices as \c m_slices: \snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 0 @@ -409,7 +409,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 project file that describes the plugin \o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin \endlist @@ -468,8 +468,9 @@ In this tutorial, we've shown the basic steps for creating a QML extension: \endlist -The \l {Extending QML in C++} reference documentation shows other useful features that can be added to -QML extensions. For example, we could use \l{Default Property}{default properties} to allow +The \l {Extending QML Functionalities using C++} reference documentation shows +other useful features that can be added to QML extensions. For example, we +could use \l{Default Property}{default properties} to allow slices to be added without using the \c slices property: \code @@ -489,7 +490,8 @@ Or randomly add and remove slices from time to time using \l{Property Value Sour \endcode -See the \l{Extending QML in C++}{reference documentation} for more information. +See the \l{Extending QML Functionalities using C++} reference documentation +for more information. */ diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 51b52b0..d3f1521 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -29,7 +29,9 @@ \page qml-extending.html \ingroup qml-features \contentspage QML Features -\title Extending QML in C++ +\previouspage {Presenting Data with Views} +\nextpage {Using QML Bindings in C++ Applications} +\title Extending QML Functionalities using C++ The QML syntax declaratively describes how to construct an in-memory object tree. In Qt, QML is mainly used to describe a visual scene graph, but it is @@ -431,7 +433,7 @@ onChanged, regardless of the name used for the NOTIFY signal in C++. We recommend using Changed() for the NOTIFY signal in C++. -See also \l {Writing QML Components: Properties, Methods and Signals} +See also \l {Importing Reusable Components} \section1 Methods @@ -637,469 +639,3 @@ public: */ -/*! -\page qml-extending-types.html -\ingroup qml-features -\title Writing QML Components: Properties, Methods and Signals - -One of the key concepts in QML is the ability to define your own QML components that suit -the purposes of your application. The standard \l {QML Elements} provide the essential components -for creating a QML application; beyond these, you can write your own custom components that can -be created and reused, without the use of C++. - -Components are the building blocks of a QML project. When writing a QML application, whether -large or small, it is best to separate QML code into smaller components that perform specific -sets of operations, instead of creating mammoth QML files with large, combined functionality -that is more difficult to manage and may contain duplicated code. - - -\section1 Defining New Components - -A component is a reusable type with a well-defined interface, built entirely in QML. -Any snippet of QML code can become a component, by placing the code in a file ".qml" where - is the new component name, beginning with an uppercase letter. These QML files automatically -become available as new QML element types to other QML components and applications in the same directory. - -For example, one of the simplest and most common components you can build in QML is a -button-type component. Below, we implement this component as a \l Rectangle with a clickable -\l MouseArea, in a file named \c Button.qml: - -\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 - -Now this component can be reused by another file within the same directory. Since the file is -named \c Button.qml, the component is referred to as \c Button: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 -\o \image qml-extending-types.png -\endtable - -The root object in \c Button.qml defines the attributes that are available to users of the -\c Button component. In this case, the root object is a \l Rectangle, so any properties, methods -and signals of \l Rectangle are made available, allowing \c application.qml to -customize the \c width, \c height, \c radius and \c color properties of \c Button objects. - - -If \c Button.qml was not in the same directory, \c application.qml would need to load it as a -\l {Modules}{module} from a specific filesystem path or \l{QDeclarativeExtensionPlugin}{plugin}. -Also, note the letter case of the component file name is significant on some (notably UNIX) -filesystems. It is recommended the file name case matches the case of the QML component name -exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the -QML component will be deployed. - -To write a useful component, it is generally necessary to provide it with custom attributes that store and -communicate specific data. This is achieved by adding the following attributes to your components: - -\list -\o \bold Properties that can be accessed externally to modify an object (for example, \l Item has - \l {Item::}{width} and \l {Item::}{height} properties) and used in \l {Property Binding} -\o \bold Methods of JavaScript code can be invoked internally or externally (for example, - \l Animation has a \l {Animation::}{start()} method) -\o \bold Signals to notify other objects when an event has occurred (for example, MouseArea has a - \c clicked signal) -\endlist - -The following sections show how these attributes can be added to QML components. - - -\section1 Adding Properties - -A property is a value of a QML component that can be read and modified by other objects. For -example, a \l Rectangle component has \l {Item::}{width}, \l {Item::}{height} and \l -{Rectangle::}{color} properties. Significantly, properties be used with \l {Property Binding}, where -a property value is automatically updated using the value of another property. - -The syntax for defining a new property is: - -\code -[default] property [: defaultValue] -\endcode - -A \c property declaration can appear anywhere within a QML component definition, but it is customary -to place it at the top. A component cannot declare more than one property with the same name. (It is -possible to have a property name that is the same as an existing property in a type, but this is not -recommended as the existing property becomes hidden and inaccessible.) - -Below is an example. The \c ImageViewer component has defined a \c string type property named -\c currentImage, and its initial value is "default-image.png". This property is used to set the image -displayed in the child \l Image object. Another file, \c application.qml, can create -an \c ImageViewer object and read or modify the \c currentImage value: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/application.qml 0 -\endtable - -It is optional for a property to have a default value. The default value is a convenient shortcut, and is -behaviorally identical to doing it in two steps, like this: - -\qml -// Use default value -property int myProperty: 10 - -// Longer, but behaviorally identical -property int myProperty -myProperty: 10 -\endqml - - -\section2 Supported property types - -All QML properties are typed. The examples above show properties with \c int and \c string types; -notice that the type of the property must be declared. The type is used to determine the property -behavior, and how the property is defined in C++. - -A number of property types are supported by default. These are listed in the table below, -with their default values and the corresponding C++ type: - -\table -\header \o QML Type Name \o Default value \o C++ Type Name -\row \o int \o 0 \o int -\row \o bool \o \c false \o bool -\row \o double \o 0.0 \o double -\row \o real \o 0.0 \o double -\row \o string \o "" (empty string) \o QString -\row \o url \o "" (empty url) \o QUrl -\row \o color \o #000000 (black) \o QColor -\row \o date \o \c undefined \o QDateTime -\row \o variant \o \c undefined \o QVariant -\endtable - -QML object types can also be used as property types. This includes -\l {Defining new QML elements}{custom QML types} implemented in C++. Such properties are -defined like this: - -\qml -property Item itemProperty -property QtObject objectProperty -property MyCustomType customProperty -\endqml - -Such object-type properties default to an \c undefined value. - -\l{list}{List properties} are created with the \c list syntax, and default to an empty -list: - -\qml -property list listOfItems -\endqml - -Note that list properties cannot be modified like ordinary JavaScript -arrays. See the \l {list}{list type documentation} for details. - -For details about accessing and manipulating QML properties from C++, see \l {Using QML with C++}. - - -\section2 Property change signals - -Adding a \c property to an item automatically adds a \e {value changed} -signal handler to the item. To connect to this signal, use a \l {Signal Handlers}{signal handler} -named with the \c onChanged syntax, using upper case for the first letter of the -property name. - -For example, the following \c onMyNumberChanged signal handler is automatically called whenever the -\c myNumber property changes: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/property-signals.qml 0 - - -\section2 Default properties - -The optional \c default attribute for a property marks it as the \e {default property} -for a type. This allows other items to specify the default property's value -as child elements. For example, the \l Item element's default property is its -\l{Item::children}{children} property. This allows the children of an \l Item -to be set like this: - -\qml -Item { - Rectangle {} - Rectangle {} -} -\endqml - -If the \l{Item::children}{children} property was not the default property for -\l Item, its value would have to be set like this instead: - -\qml -Item { - children: [ - Rectangle {} - Rectangle {} - ] -} -\endqml - -See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a -demonstration of using default properties. - -Specifying a default property overrides any existing default property (for -example, any default property inherited from a parent item). Using the -\c default attribute twice in the same type block is an error. - - -\section2 Property aliases - -Property aliases are a more advanced form of property declaration. Unlike a -property definition, which allocates a new, unique storage space for the -property, a property alias connects the newly declared property (called the -aliasing property) as a direct reference to an existing property (the aliased property). Read -operations on the aliasing property act as read operations on the aliased -property, and write operations on the aliasing property as write operations on -the aliased property. - -A property alias declaration looks a lot like an ordinary property definition: -\code - [default] property alias : -\endcode - -As the aliasing property has the same type as the aliased property, an explicit -type is omitted, and the special "alias" keyword is used. Instead of a default -value, a property alias includes a compulsory alias reference. The alias -reference is used to locate the aliased property. While similar to a property -binding, the alias reference syntax is highly restricted. - -An alias reference takes one of the following forms: -\code - . - -\endcode - -where must refer to an object id within the same component as the type -declaring the alias, and, optionally, refers to a property on that object. - -For example, below is a \c Button.qml component with a \c buttonText aliased property which is -connected to the child Text object's \c text property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias.qml 0 - -The following code would create a \c Button with a defined text string for the -child \l Text object: - -\qml -Button { buttonText: "This is a button" } -\endqml - -Here, modifying \c buttonText directly modifies the \c textItem.text value; it does not -change some other value that then updates \c textItem.text. - -In this case, the use of aliased properties is essential. If \c buttonText was not an alias, -changing its value would not actually change the displayed text at all, as -\l {Property Binding}{property bindings} are not bi-directional: the \c buttonText value would -change when \c textItem.text changes, but not the other way around. - -Aliased properties are also useful for allowing external objects to directly modify and -access child objects in a component. For example, here is a modified version of the \c ImageViewer -component shown \l {Adding Properties}{earlier} on this page. The \c currentImage property has -been changed to an alias to the child \l Image object: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/application.qml 0 -\endtable - -Instead of being limited to setting the \l Image source, \c application.qml can now directly -access and modify the child \l Image object and its properties. - -Obviously, exposing child objects in this manner should be done with care, as it allows external -objects to modify them freely. However, this use of aliased properties can be quite useful in -particular situations, such as for the \l {declarative/ui-components/tabwidget}{TabWidget} -example, where new tab items are actually parented to a child object that displays the current tab. - - -\section3 Considerations for property aliases - -Aliases are only activated once the component specifying them is completed. The -most obvious consequence of this is that the component itself cannot generally -use the aliased property directly during creation. For example, this will not work: - -\code - // Does NOT work - property alias buttonText: textItem.text - buttonText: "Some text" // buttonText is not yet defined when this value is set -\endcode - -A second, much less significant, consequence of the delayed activation of -aliases is that an alias reference cannot refer to another aliasing property -declared within the same component. This will not work: - -\code - // Does NOT work - id: root - property alias buttonText: textItem.text - property alias buttonText2: root.buttonText -\endcode - -At the time the component is created, the \c buttonText value has not yet been assigned, -so \c root.buttonText would refer to an undefined value. (From outside the component, -however, aliasing properties appear as regular Qt properties and consequently can be -used in alias references.) - -It is possible for an aliased property to have the same name as an existing property. For example, -the following component has a \c color alias property, named the same as the built-in -\l {Rectangle::color} property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias-override.qml 0 - -Any objects that use this component and refer to its \c color property will be -referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, -however, the rectangle can correctly set this property to "red" and refer to the actual defined -property rather than the alias. - - -\section1 Adding Methods - -A QML component can define methods of JavaScript code. These methods can be invoked -either internally or by other objects. - -The syntax for defining a method is: - -\code -function ([[, ...]]) { } -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two methods or signals with the -same name in the same type block is an error. However, a new method may reuse -the name of an existing method on the type. (This should be done with caution, -as the existing method may be hidden and become inaccessible.) - -Unlike \l{Adding Signals}{signals}, method parameter types do not have to be declared as they -default to the \c variant type. The body of the method is written in JavaScript and may access -the parameters by name. - -Here is an example of a component with a \c say() method that accepts a single \c text argument: - -\snippet doc/src/snippets/declarative/qml-extending-types/methods/app.qml 0 - -A method can be connected to a signal so that it is automatically invoked whenever the signal -is emitted. See \l {Connecting signals to methods and other signals} below. - -Also see \l {Integrating JavaScript} for more information on using JavaScript with QML. - - -\section1 Adding Signals - -Signals provide a way to notify other objects when an event has occurred. For example, the MouseArea -\c clicked signal notifies other objects that the mouse has been clicked within the area. - -The syntax for defining a new signal is: - -\code -signal [([ [, ...]])] -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two signals or methods with the -same name in the same type block is an error. However, a new signal may reuse -the name of an existing signal on the type. (This should be done with caution, -as the existing signal may be hidden and become inaccessible.) - -Here are three examples of signal declarations: - -\code -Item { - signal clicked - signal hovered() - signal performAction(string action, variant actionArgument) -} -\endcode - -If the signal has no parameters, the "()" brackets are optional. If parameters are used, the -parameter types must be declared, as for the \c string and \c variant arguments for the \c -performAction signal above; the allowed parameter types are the same as those listed in the \l -{Adding Properties} section on this page. - -Adding a signal to an item automatically adds a \l {Signal Handlers}{signal handler} as well. -The signal hander is named \c on, with the first letter of the signal being upper -cased. The above example item would now have the following signal handlers: - -\list -\o onClicked -\o onHovered -\o onPerformAction -\endlist - -To emit a signal, simply invoke it in the same way as a method. Below left, when the \l MouseArea is -clicked, it emits the parent \c buttonClicked signal by invoking \c rect.buttonClicked(). The -signal is received by \c application.qml through an \c onButtonClicked signal handler: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/basic.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/no-parameters.qml 0 -\endtable - -If the signal has parameters, they are accessible by parameter name in the signal handler. -In the example below, \c buttonClicked is emitted with \c xPos and \c yPos parameters instead: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/Button.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/parameters.qml 0 -\endtable - - -\section2 Connecting signals to methods and other signals - -Signal objects have a \c connect() method that can be used to a connect a signal to a method or -another signal. When a signal is connected to a method, the method is automatically invoked -whenever the signal is emitted. (In Qt terminology, the method is a \e slot that is connected -to the \e signal; all methods defined in QML are created as Qt slots.) This enables a signal -to be received by a method instead of a \l {Signal Handlers}{signal handler}. - -For example, the \c application.qml above could be rewritten as: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectslots.qml 0 - -The \c myMethod() method will be called whenever the \c buttonClicked signal is received. - -In many cases it is sufficient to receive signals through signal handlers rather than using -the \c connect() function; the above example does not provide any improvements over using a -simple \c onButtonClicked handler. However, if you are \l{Dynamic Object Management in QML}{creating objects dynamically}, -or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find the -\c connect() method useful. For example, the component below creates three \c Button -objects dynamically, and connects the \c buttonClicked signal of each object to the -\c myMethod() function: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectdynamic.qml 0 - -In the same way, you could connect a signal to methods defined in a dynamically -created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. - -There is also a corresponding \c disconnect() method for removing connected signals. The following -code removes the connection created in \c application.qml above: - -\qml -// application.qml -Item { - ... - - function removeSignal() { - button.clicked.disconnect(item.myMethod) - } -} -\endqml - - -\section3 Forwarding signals - -The \c connect() method can also connect a signal to other signals. This has the effect -of "forwarding" a signal: it is automatically emitted whenever the relevant signal is emitted. For -example, the MouseArea \c onClicked handler in \c Button.qml above could have been replaced with -a call to \c connect(): - -\qml -MouseArea { - anchors.fill: parent - Component.onCompleted: clicked.connect(item.buttonClicked) -} -\endqml - -Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will -automatically be emitted as well. - -*/ diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index 3da60f1..be1000e 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -30,11 +30,14 @@ \page qdeclarativefocus.html \ingroup qml-features \contentspage QML Features +\previouspage {QML Text Handling and Validators}{Text Handling and Validators} +\nextpage {Importing Reusable Components} + \title Keyboard Focus in QML When a key is pressed or released, a key event is generated and delivered to the focused QML \l Item. To facilitate the construction of reusable components -and to address some of the cases unique to fluid user interfaces, the QML items add a +and to address some of the cases unique to fluid user interfaces, the QML items add aged \e scope based extension to Qt's traditional keyboard focus model. \tableofcontents diff --git a/doc/src/declarative/graphicaleffects.qdoc b/doc/src/declarative/graphicaleffects.qdoc new file mode 100644 index 0000000..b5ef601 --- /dev/null +++ b/doc/src/declarative/graphicaleffects.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlgraphicaleffects.html +\ingroup qml-features +\contentspage QML Features +\previouspage {QML Internationalization}{Internationalization} +\nextpage {QML Features} +\title QML Graphical Effects + +*/ diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 23235d7..caba2cd 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -28,7 +28,10 @@ /*! \page qml-integration.html \ingroup qml-features -\title Integrating QML with existing Qt UI code +\previouspage {Using QML Bindings in C++ Applications} +\nextpage {QML Signal and Handler Event System} +\contentspage QML Features +\title Integrating QML Code with Existing Qt UI Code There are a number of ways to integrate QML into QWidget-based UI applications, depending on the characteristics of your existing UI code. @@ -102,6 +105,7 @@ which shows how to expose Qt's graphics layout classes to QML in order to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. To expose your existing QGraphicsWidget classes to QML, use \l {qmlRegisterType()}. -See \l{Extending QML in C++} for further information on using C++ types in QML. +See \l{Extending QML Functionalities using C++} for further information on +how to use C++ types in QML. */ diff --git a/doc/src/declarative/mouseevents.qdoc b/doc/src/declarative/mouseevents.qdoc new file mode 100644 index 0000000..f6512a7 --- /dev/null +++ b/doc/src/declarative/mouseevents.qdoc @@ -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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 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 mouseevents.html +\title QML Mouse Events +\ingroup QML Features +\previouspage {Anchor-based Layout in QML}{Layouts using Anchors} +\nextpage {QML Text Handling and Validators}{Text Handling and Validators} +\contentspage QML Features + +\tableofcontents + +\section1 Introduction + +\section1 Mouse Events + +\list +\o \l{MouseArea} Element +\o \l{MouseEvent} Object +\endlist + +\section1 Mouse Event Handling +go over the slots and signals feature (without the C++) + +To learn more about QML's event system, please read the \l {QML Signal and Handler Event System} document. + +*/ diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index 4354f9d..3348eb8 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -28,6 +28,9 @@ /*! \page qdeclarativenetwork.html \ingroup qml-features +\previouspage {Dynamic Object Management in QML}{Dynamic Object Management} +\nextpage {QML Internationalization}{Internationalization} +\contentspage QML Features \title Network Transparency QML supports network transparency by using URLs (rather than file names) for all diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 92cf874..6f7c40a 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -29,12 +29,179 @@ \page propertybinding.html \ingroup qml-features \contentspage QML Features -\previouspage QML Features -\nextpage Using QML Positioner and Repeater Items +\previouspage QML Syntax +\nextpage {QML Basic Types}{Data Types} \title Property Binding +\section1 Properties -\section1 Introduction +QML property rules coincide with many of JavaScript's property rules. +Properties begin with a lowercase letter (with the exception of +\l{Attached Properties}). \l {JavaScript Reserved Words}{JavaScript reserved words} +are not valid property names. + +\section1 Property types + +QML supports properties of many types (see \l{QML Basic Types}). The basic types +include int, real, bool, string, color, and lists. + +\code +Item { + x: 10.5 // a 'real' property + ... + state: "details" // a 'string' property + focus: true // a 'bool' property +} +\endcode + +QML properties are \i type-safe. That is, properties only allow you to assign +a value that matches the property type. For example, the \c x property of item is a real, and if you try to assign +a string to it you will get an error. + +\badcode +Item { + property real value: "hello" // illegal! +} +\endcode + +\section1 The \c id Property + +Each object can be given a special unique property called an \c id. No other object within the +same QML component (see \l{QML Documents}) 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 \c id, "myRect". The second Rectangle element defines its +own width by referring to \tt myRect.width, which means it will have the same \tt width +value as the first Rectangle element. + +\code +Item { + Rectangle { + id: myRect + width: 100 + height: 100 + } + Rectangle { + width: myRect.width + height: 200 + } +} +\endcode + +Note that an \c id must begin with a lower-case letter or an underscore. The \c id cannot contain characters other than letters, numbers, underscores, and \l {JavaScript Reserved Words}{JavaScript reserved words}. + + +\section1 List properties + +List properties look like this: + +\code +Item { + children: [ + Image {}, + Text {} + ] +} +\endcode + +The list is enclosed in square brackets, with a comma separating the +list elements. In cases where you are only assigning a single item to a +list, you can omit the square brackets: + +\code +Image { + children: Rectangle {} +} +\endcode + +Items in the list can be accessed by the \c index. See the \l{list}{list type} documentation +for more details about list properties and their available operations. + + +\section1 Default Properties + +Each object type can specify one of its list or object properties as its default property. +If a property has been declared as the default property, the property tag can be omitted. + +For example this code: +\code +State { + changes: [ + PropertyChanges {}, + PropertyChanges {} + ] +} +\endcode + +can be simplified to: + +\code +State { + PropertyChanges {} + PropertyChanges {} +} +\endcode + +because \c changes is the default property of the \c State type. + +\section1 Grouped Properties +\target dot properties + +In some cases properties form a logical group and use a 'dot' or grouped notation +to show this. + +Grouped properties can be written like this: +\qml +Text { + font.pixelSize: 12 + font.bold: true +} +\endqml + +or like this: +\qml +Text { + font { pixelSize: 12; bold: true } +} +\endqml + +In the element documentation grouped properties are shown using the 'dot' notation. + +\section1 Attached Properties +\target attached-properties + +Some objects attach properties to another object. Attached Properties +are of the form \c {Type.property} where \c Type is the type of the +element that attaches \c property. + +For example: +\code +Component { + id: myDelegate + Text { + text: "Hello" + color: ListView.isCurrentItem ? "red" : "blue" + } +} +ListView { + delegate: myDelegate +} +\endcode + +The \l ListView element attaches the \c ListView.isCurrentItem property +to each delegate it creates. + +Another example of attached properties is the \l Keys element which +attaches properties for handling key presses to +any visual Item, for example: + +\code +Item { + focus: true + Keys.onSelectPressed: console.log("Selected") +} +\endcode +\section1 Property Binding Property binding is a declarative way of specifying the value of a property. Binding allows a property's value to be expressed as an JavaScript expression that defines the value relative to other property values or data accessible in the application. The property value is @@ -103,7 +270,7 @@ Rectangle { \section1 Effects of Property Assignment in JavaScript -Assigning a property value from JavaScript does \i not create a property binding. +Assigning a property value from JavaScript does \e not create a property binding. For example: \code @@ -153,7 +320,5 @@ Binding { value: slider.value } \endqml - - */ diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index fac1e55..cd4ccf0 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -28,6 +28,9 @@ /*! \page qdeclarativei18n.html \ingroup qml-features +\contentspage QML Features +\previouspage {Network Transparency}{Loading Resources in QML} +\nextpage {QML Graphical Effects}{Graphical Effects} \title QML Internationalization \section1 Overview diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 0be29e1..e1a425f 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -29,6 +29,8 @@ \page qdeclarativemodels.html \ingroup qml-features \contentspage QML Features +\previouspage {QML Animation and Transitions}{Animation and Transitions} +\nextpage {Presenting Data with Views} \target qmlmodels \title QML Data Models @@ -70,7 +72,8 @@ QML provides several types of data models among the built-in set of QML elements. In addition, models can be created with C++ and then made available to QML components. -The views used to access data models are described in \l{Presenting Data with QML}. +The views used to access data models are described in the +\l{Presenting Data with Views} overview. The use of positioner items to arrange items from a model is covered in \l{Using QML Positioner and Repeater Items}. @@ -465,86 +468,3 @@ a function in the model, e.g.: updated, and that \e{value} holds the new value. */ - -/*! -\page qml-presenting-data.html -\ingroup qml-features -\contentspage QML Features -\title Presenting Data with QML - -\section1 Introduction - -Qt Quick contains a set of standard items that can be used to present data in a -number of different ways. For simple user interfaces, -\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used -in combination with -\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} -to obtain pieces of data and arrange them in a user interface. However, when -large quantities of data are involved, it is often better to use models with -the standard views since these contain many built-in display and navigation -features. - -\section1 Views - -Views are scrolling containers for collections of items. They are feature-rich, -supporting many of the use cases found in typical applications, and can be -customized to meet requirements on style and behavior. - -A set of standard views are provided in the basic set of Qt Quick -graphical elements: - -\list -\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list -\o \l{#GridView}{GridView} arranges items in a grid within the available space -\o \l{#PathView}{PathView} arranges items on a path -\endlist - -Unlike these items, \l WebView is not a fully-featured view item, and needs -to be combined with a \l Flickable item to create a view that performs like -a Web browser. - -\section2 ListView - -\l ListView shows a classic list of items with horizontal or vertical placing -of items. - -\div{float-right} -\inlineimage qml-listview-snippet.png -\enddiv - -The following example shows a minimal ListView displaying a sequence of -numbers (using an \l{QML Data Models#An Integer}{integer as a model}). -A simple delegate is used to define an items for each piece of data in the -model. - -\clearfloat -\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document - - - -\section2 GridView - -\l GridView displays items in a grid like an file manager's icon view. - -\section2 PathView - -\l PathView displays items on a path, where the selection remains in -the same place and the items move around it. - -\section1 Decorating Views - -\section2 Headers and Footers - -\section2 Sections - -\section2 Navigation - -In traditional user interfaces, views can be scrolled using standard -controls, such as scroll bars and arrow buttons. In some situations, it -is also possible to drag the view directly by pressing and holding a -mouse button while moving the cursor. In touch-based user interfaces, -this dragging action is often complemented with a flicking action, where -scrolling continues after the user has stopped touching the view. - -\section1 Further Reading -*/ diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index f378ce6..3266bae 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -29,6 +29,8 @@ \page qdeclarativestates.html \ingroup qml-features \contentspage QML Features +\previouspage {Importing Reusable Components} +\nextpage {QML Animation and Transitions}{Animation and Transitions} \target qmlstates \title QML States diff --git a/doc/src/declarative/qmlevents.qdoc b/doc/src/declarative/qmlevents.qdoc new file mode 100644 index 0000000..3c1c8df --- /dev/null +++ b/doc/src/declarative/qmlevents.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$ +** 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 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 qmlevents.html + \ingroup qml-features + \contentspage QML Features + \previouspage {Integrating QML Code with Existing Qt UI Code} + \nextpage {Dynamic Object Management in QML}{Dynamic Object Management} + + \title QML Signal and Handler Event System + +*/ diff --git a/doc/src/declarative/qmlreusablecomponents.qdoc b/doc/src/declarative/qmlreusablecomponents.qdoc new file mode 100644 index 0000000..78865a1 --- /dev/null +++ b/doc/src/declarative/qmlreusablecomponents.qdoc @@ -0,0 +1,497 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlreusablecomponents.html +\ingroup qml-features +\previouspage {Keyboard Focus in QML}{Keyboard Focus} +\nextpage {QML States}{States} +\contentspage QML Features + +\title Importing Reusable Components + +One of the key concepts in QML is the ability to define your own QML components that suit +the purposes of your application. The standard \l {QML Elements} provide the essential components +for creating a QML application; beyond these, you can write your own custom components that can +be created and reused, without the use of C++. + +Components are the building blocks of a QML project. When writing a QML application, whether +large or small, it is best to separate QML code into smaller components that perform specific +sets of operations, instead of creating mammoth QML files with large, combined functionality +that is more difficult to manage and may contain duplicated code. + + +\section1 Defining New Components + +A component is a reusable type with a well-defined interface, built entirely in QML. +Any snippet of QML code can become a component, by placing the code in a file ".qml" where + is the new component name, beginning with an uppercase letter. These QML files automatically +become available as new QML element types to other QML components and applications in the same directory. + +For example, one of the simplest and most common components you can build in QML is a +button-type component. Below, we implement this component as a \l Rectangle with a clickable +\l MouseArea, in a file named \c Button.qml: + +\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 + +Now this component can be reused by another file within the same directory. Since the file is +named \c Button.qml, the component is referred to as \c Button: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 +\o \image qml-extending-types.png +\endtable + +The root object in \c Button.qml defines the attributes that are available to users of the +\c Button component. In this case, the root object is a \l Rectangle, so any properties, methods +and signals of \l Rectangle are made available, allowing \c application.qml to +customize the \c width, \c height, \c radius and \c color properties of \c Button objects. + + +If \c Button.qml was not in the same directory, \c application.qml would need to load it as a +\l {Modules}{module} from a specific filesystem path or \l{QDeclarativeExtensionPlugin}{plugin}. +Also, note the letter case of the component file name is significant on some (notably UNIX) +filesystems. It is recommended the file name case matches the case of the QML component name +exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the +QML component will be deployed. + +To write a useful component, it is generally necessary to provide it with custom attributes that store and +communicate specific data. This is achieved by adding the following attributes to your components: + +\list +\o \bold Properties that can be accessed externally to modify an object (for example, \l Item has + \l {Item::}{width} and \l {Item::}{height} properties) and used in \l {Property Binding} +\o \bold Methods of JavaScript code can be invoked internally or externally (for example, + \l Animation has a \l {Animation::}{start()} method) +\o \bold Signals to notify other objects when an event has occurred (for example, MouseArea has a + \c clicked signal) +\endlist + +The following sections show how these attributes can be added to QML components. + + +\section1 Adding Properties + +A property is a value of a QML component that can be read and modified by other objects. For +example, a \l Rectangle component has \l {Item::}{width}, \l {Item::}{height} and \l +{Rectangle::}{color} properties. Significantly, properties be used with \l {Property Binding}, where +a property value is automatically updated using the value of another property. + +The syntax for defining a new property is: + +\code +[default] property [: defaultValue] +\endcode + +A \c property declaration can appear anywhere within a QML component definition, but it is customary +to place it at the top. A component cannot declare more than one property with the same name. (It is +possible to have a property name that is the same as an existing property in a type, but this is not +recommended as the existing property becomes hidden and inaccessible.) + +Below is an example. The \c ImageViewer component has defined a \c string type property named +\c currentImage, and its initial value is "default-image.png". This property is used to set the image +displayed in the child \l Image object. Another file, \c application.qml, can create +an \c ImageViewer object and read or modify the \c currentImage value: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/ImageViewer.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/application.qml 0 +\endtable + +It is optional for a property to have a default value. The default value is a convenient shortcut, and is +behaviorally identical to doing it in two steps, like this: + +\qml +// Use default value +property int myProperty: 10 + +// Longer, but behaviorally identical +property int myProperty +myProperty: 10 +\endqml + + +\section2 Supported property types + +All QML properties are typed. The examples above show properties with \c int and \c string types; +notice that the type of the property must be declared. The type is used to determine the property +behavior, and how the property is defined in C++. + +A number of property types are supported by default. These are listed in the table below, +with their default values and the corresponding C++ type: + +\table +\header \o QML Type Name \o Default value \o C++ Type Name +\row \o int \o 0 \o int +\row \o bool \o \c false \o bool +\row \o double \o 0.0 \o double +\row \o real \o 0.0 \o double +\row \o string \o "" (empty string) \o QString +\row \o url \o "" (empty url) \o QUrl +\row \o color \o #000000 (black) \o QColor +\row \o date \o \c undefined \o QDateTime +\row \o variant \o \c undefined \o QVariant +\endtable + +QML object types can also be used as property types. This includes +\l {Defining new QML elements}{custom QML types} implemented in C++. Such properties are +defined like this: + +\qml +property Item itemProperty +property QtObject objectProperty +property MyCustomType customProperty +\endqml + +Such object-type properties default to an \c undefined value. + +\l{list}{List properties} are created with the \c list syntax, and default to an empty +list: + +\qml +property list listOfItems +\endqml + +Note that list properties cannot be modified like ordinary JavaScript +arrays. See the \l {list}{list type documentation} for details. + +For details about accessing and manipulating QML properties from C++, see \l {Using QML Bindings in C++ Applications}. + + +\section2 Property change signals + +Adding a \c property to an item automatically adds a \e {value changed} +signal handler to the item. To connect to this signal, use a \l {Signal Handlers}{signal handler} +named with the \c onChanged syntax, using upper case for the first letter of the +property name. + +For example, the following \c onMyNumberChanged signal handler is automatically called whenever the +\c myNumber property changes: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/property-signals.qml 0 + + +\section2 Default properties + +The optional \c default attribute for a property marks it as the \e {default property} +for a type. This allows other items to specify the default property's value +as child elements. For example, the \l Item element's default property is its +\l{Item::children}{children} property. This allows the children of an \l Item +to be set like this: + +\qml +Item { + Rectangle {} + Rectangle {} +} +\endqml + +If the \l{Item::children}{children} property was not the default property for +\l Item, its value would have to be set like this instead: + +\qml +Item { + children: [ + Rectangle {} + Rectangle {} + ] +} +\endqml + +See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a +demonstration of using default properties. + +Specifying a default property overrides any existing default property (for +example, any default property inherited from a parent item). Using the +\c default attribute twice in the same type block is an error. + + +\section2 Property aliases + +Property aliases are a more advanced form of property declaration. Unlike a +property definition, which allocates a new, unique storage space for the +property, a property alias connects the newly declared property (called the +aliasing property) as a direct reference to an existing property (the aliased property). Read +operations on the aliasing property act as read operations on the aliased +property, and write operations on the aliasing property as write operations on +the aliased property. + +A property alias declaration looks a lot like an ordinary property definition: +\code + [default] property alias : +\endcode + +As the aliasing property has the same type as the aliased property, an explicit +type is omitted, and the special "alias" keyword is used. Instead of a default +value, a property alias includes a compulsory alias reference. The alias +reference is used to locate the aliased property. While similar to a property +binding, the alias reference syntax is highly restricted. + +An alias reference takes one of the following forms: +\code + . + +\endcode + +where must refer to an object id within the same component as the type +declaring the alias, and, optionally, refers to a property on that object. + +For example, below is a \c Button.qml component with a \c buttonText aliased property which is +connected to the child Text object's \c text property: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias.qml 0 + +The following code would create a \c Button with a defined text string for the +child \l Text object: + +\qml +Button { buttonText: "This is a button" } +\endqml + +Here, modifying \c buttonText directly modifies the \c textItem.text value; it does not +change some other value that then updates \c textItem.text. + +In this case, the use of aliased properties is essential. If \c buttonText was not an alias, +changing its value would not actually change the displayed text at all, as +\l {Property Binding}{property bindings} are not bi-directional: the \c buttonText value would +change when \c textItem.text changes, but not the other way around. + +Aliased properties are also useful for allowing external objects to directly modify and +access child objects in a component. For example, here is a modified version of the \c ImageViewer +component shown \l {Adding Properties}{earlier} on this page. The \c currentImage property has +been changed to an alias to the child \l Image object: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/ImageViewer.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/application.qml 0 +\endtable + +Instead of being limited to setting the \l Image source, \c application.qml can now directly +access and modify the child \l Image object and its properties. + +Obviously, exposing child objects in this manner should be done with care, as it allows external +objects to modify them freely. However, this use of aliased properties can be quite useful in +particular situations, such as for the \l {declarative/ui-components/tabwidget}{TabWidget} +example, where new tab items are actually parented to a child object that displays the current tab. + + +\section3 Considerations for property aliases + +Aliases are only activated once the component specifying them is completed. The +most obvious consequence of this is that the component itself cannot generally +use the aliased property directly during creation. For example, this will not work: + +\code + // Does NOT work + property alias buttonText: textItem.text + buttonText: "Some text" // buttonText is not yet defined when this value is set +\endcode + +A second, much less significant, consequence of the delayed activation of +aliases is that an alias reference cannot refer to another aliasing property +declared within the same component. This will not work: + +\code + // Does NOT work + id: root + property alias buttonText: textItem.text + property alias buttonText2: root.buttonText +\endcode + +At the time the component is created, the \c buttonText value has not yet been assigned, +so \c root.buttonText would refer to an undefined value. (From outside the component, +however, aliasing properties appear as regular Qt properties and consequently can be +used in alias references.) + +It is possible for an aliased property to have the same name as an existing property. For example, +the following component has a \c color alias property, named the same as the built-in +\l {Rectangle::color} property: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias-override.qml 0 + +Any objects that use this component and refer to its \c color property will be +referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, +however, the rectangle can correctly set this property to "red" and refer to the actual defined +property rather than the alias. + + +\section1 Adding Methods + +A QML component can define methods of JavaScript code. These methods can be invoked +either internally or by other objects. + +The syntax for defining a method is: + +\code +function ([[, ...]]) { } +\endcode + +This declaration may appear anywhere within a type body, but it is customary to +include it at the top. Attempting to declare two methods or signals with the +same name in the same type block is an error. However, a new method may reuse +the name of an existing method on the type. (This should be done with caution, +as the existing method may be hidden and become inaccessible.) + +Unlike \l{Adding Signals}{signals}, method parameter types do not have to be declared as they +default to the \c variant type. The body of the method is written in JavaScript and may access +the parameters by name. + +Here is an example of a component with a \c say() method that accepts a single \c text argument: + +\snippet doc/src/snippets/declarative/qml-extending-types/methods/app.qml 0 + +A method can be connected to a signal so that it is automatically invoked whenever the signal +is emitted. See \l {Connecting signals to methods and other signals} below. + +Also see \l {Integrating JavaScript} for more information on using JavaScript with QML. + + +\section1 Adding Signals + +Signals provide a way to notify other objects when an event has occurred. For example, the MouseArea +\c clicked signal notifies other objects that the mouse has been clicked within the area. + +The syntax for defining a new signal is: + +\code +signal [([ [, ...]])] +\endcode + +This declaration may appear anywhere within a type body, but it is customary to +include it at the top. Attempting to declare two signals or methods with the +same name in the same type block is an error. However, a new signal may reuse +the name of an existing signal on the type. (This should be done with caution, +as the existing signal may be hidden and become inaccessible.) + +Here are three examples of signal declarations: + +\code +Item { + signal clicked + signal hovered() + signal performAction(string action, variant actionArgument) +} +\endcode + +If the signal has no parameters, the "()" brackets are optional. If parameters are used, the +parameter types must be declared, as for the \c string and \c variant arguments for the \c +performAction signal above; the allowed parameter types are the same as those listed in the \l +{Adding Properties} section on this page. + +Adding a signal to an item automatically adds a \l {Signal Handlers}{signal handler} as well. +The signal hander is named \c on, with the first letter of the signal being upper +cased. The above example item would now have the following signal handlers: + +\list +\o onClicked +\o onHovered +\o onPerformAction +\endlist + +To emit a signal, simply invoke it in the same way as a method. Below left, when the \l MouseArea is +clicked, it emits the parent \c buttonClicked signal by invoking \c rect.buttonClicked(). The +signal is received by \c application.qml through an \c onButtonClicked signal handler: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/basic.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/no-parameters.qml 0 +\endtable + +If the signal has parameters, they are accessible by parameter name in the signal handler. +In the example below, \c buttonClicked is emitted with \c xPos and \c yPos parameters instead: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/Button.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/parameters.qml 0 +\endtable + + +\section2 Connecting signals to methods and other signals + +Signal objects have a \c connect() method that can be used to a connect a signal to a method or +another signal. When a signal is connected to a method, the method is automatically invoked +whenever the signal is emitted. (In Qt terminology, the method is a \e slot that is connected +to the \e signal; all methods defined in QML are created as Qt slots.) This enables a signal +to be received by a method instead of a \l {Signal Handlers}{signal handler}. + +For example, the \c application.qml above could be rewritten as: + +\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectslots.qml 0 + +The \c myMethod() method will be called whenever the \c buttonClicked signal is received. + +In many cases it is sufficient to receive signals through signal handlers rather than using +the \c connect() function; the above example does not provide any improvements over using a +simple \c onButtonClicked handler. However, if you are \l{Dynamic Object Management in QML}{creating objects dynamically}, +or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find the +\c connect() method useful. For example, the component below creates three \c Button +objects dynamically, and connects the \c buttonClicked signal of each object to the +\c myMethod() function: + +\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectdynamic.qml 0 + +In the same way, you could connect a signal to methods defined in a dynamically +created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. + +There is also a corresponding \c disconnect() method for removing connected signals. The following +code removes the connection created in \c application.qml above: + +\qml +// application.qml +Item { + ... + + function removeSignal() { + button.clicked.disconnect(item.myMethod) + } +} +\endqml + + +\section3 Forwarding signals + +The \c connect() method can also connect a signal to other signals. This has the effect +of "forwarding" a signal: it is automatically emitted whenever the relevant signal is emitted. For +example, the MouseArea \c onClicked handler in \c Button.qml above could have been replaced with +a call to \c connect(): + +\qml +MouseArea { + anchors.fill: parent + Component.onCompleted: clicked.connect(item.buttonClicked) +} +\endqml + +Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will +automatically be emitted as well. + +*/ diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index dfc0ad9..7a59959 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -29,13 +29,13 @@ \page qmlruntime.html \title Qt Declarative UI Runtime -QML documents are loaded and executed by the QML runtime. This includes the +QML documents are loaded and executed by the QML runtime. This includes the Declarative UI engine along with the built-in QML elements and plugin modules, and it also provides access to third-party QML elements and modules. -Applications that use QML need to invoke the QML runtime in order to -execute QML documents. This can be done by creating a QDeclarativeView -or a QDeclarativeEngine, as described below. In addition, the Declarative UI +Applications that use QML need to invoke the QML runtime in order to +execute QML documents. This can be done by creating a QDeclarativeView +or a QDeclarativeEngine, as described below. In addition, the Declarative UI package includes the \QQV tool, which loads \c .qml files. This tool is useful for developing and testing QML code without the need to write a C++ application to load the QML runtime. @@ -44,7 +44,7 @@ a C++ application to load the QML runtime. \section1 Deploying QML-based applications -To deploy an application that uses QML, the QML runtime must be invoked by +To deploy an application that uses QML, the QML runtime must be invoked by the application. This is done by writing a Qt C++ application that loads the QDeclarativeEngine by either: @@ -61,12 +61,12 @@ For example, if there is a QML file, \c application.qml, like this: \qml import QtQuick 1.0 - + Rectangle { width: 100; height: 100; color: "red" } \endqml It can be loaded in a Qt application's \c main.cpp file like this: - + \code #include #include @@ -82,10 +82,10 @@ It can be loaded in a Qt application's \c main.cpp file like this: return app.exec(); } \endcode - -This creates a QWidget-based view that displays the contents of + +This creates a QWidget-based view that displays the contents of \c application.qml. - + The application's \c .pro \l{qmake Project Files}{project file} must specify the \c declarative module for the \c QT variable. For example: @@ -97,36 +97,36 @@ the \c declarative module for the \c QT variable. For example: \section2 Creating a QDeclarativeEngine directly - -If \c application.qml does not have any graphical components, or if it is + +If \c application.qml does not have any graphical components, or if it is preferred to avoid QDeclarativeView for other reasons, the QDeclarativeEngine can be constructed directly instead. In this case, \c application.qml is loaded as a QDeclarativeComponent instance rather than placed into a view: \code #include - #include + #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); - + QDeclarativeEngine engine; QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext()); - + QDeclarativeComponent component(&engine, "application.qml"); QObject *object = component.create(objectContext); - + // ... delete object and objectContext when necessary - + return app.exec(); } \endcode -See \l {Using QML in C++ Applications} for more information about using -QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well +See \l {Using QML Bindings in C++ Applications} for more information about using +QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}. @@ -135,8 +135,8 @@ as details on including QML files through \l{The Qt Resource System}{Qt's Resour The Declarative UI package includes a QML runtime tool, the \QQV, which loads and displays QML documents. This is useful during the application development -phase for prototyping QML-based applications without writing your own C++ -applications to invoke the QML runtime. +phase for prototyping QML-based applications without writing your own C++ +applications to invoke the QML runtime. See the \l{QML Viewer} documentation for more details. diff --git a/doc/src/declarative/qmlsyntax.qdoc b/doc/src/declarative/qmlsyntax.qdoc index 4ff2437..908b924 100644 --- a/doc/src/declarative/qmlsyntax.qdoc +++ b/doc/src/declarative/qmlsyntax.qdoc @@ -30,6 +30,7 @@ \title QML Syntax \ingroup QML Features \previouspage QML Features +\nextpage Property Binding \contentspage QML Features \tableofcontents @@ -38,11 +39,9 @@ QML is a declarative language designed to describe the user interface of a program: both what it looks like, and how it behaves. In QML, a user interface is specified as a tree of objects with properties. -This introduction is meant for those with little or no programming -experience. JavaScript is used as a scripting language in QML, so you may want +JavaScript is used as a scripting language in QML, so you may want to learn a bit more about it (\l{Javascript Guide}) before diving -deeper into QML. It's also helpful to have a basic understanding of other web -technologies like HTML and CSS, but it's not required. +deeper into QML. \section1 Basic QML Syntax diff --git a/doc/src/declarative/qmltexthandling.qdoc b/doc/src/declarative/qmltexthandling.qdoc new file mode 100644 index 0000000..c5a6bc9 --- /dev/null +++ b/doc/src/declarative/qmltexthandling.qdoc @@ -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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 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 texthandling.html +\title QML Text Handling and Validators +\ingroup QML Features +\previouspage {QML Mouse Events}{Mouse Events} +\nextpage {Keyboard Focus in QML}{Keyboard Focus} +\contentspage QML Features + +\tableofcontents + +\section1 Introduction + +\section1 Text Elements + +\list +\o \l{Text} +\o \l{TextInput} +\o \l{TextEdit} +\endlist + +\section1 Validators +\list +\o \l{IntValidator} +\o \l{DoubleValidator} +\o \l{RegExpValidator} +\endlist + +*/ diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index 82f1fec..551b20c 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -31,34 +31,34 @@ \title QML Viewer \ingroup qttools -The Declarative UI package includes \QQV, a tool for loading QML documents that -makes it easy to quickly develop and debug QML applications. It invokes the QML -runtime to load QML documents and also includes additional features useful for +The Declarative UI package includes \QQV, a tool for loading QML documents that +makes it easy to quickly develop and debug QML applications. It invokes the QML +runtime to load QML documents and also includes additional features useful for the development of QML-based applications. -The QML Viewer is a tool for testing and developing QML applications. It is -\e not intended for use in a production environment and should not be used for the +The QML Viewer is a tool for testing and developing QML applications. It is +\e not intended for use in a production environment and should not be used for the deployment of QML applications. In those cases, the QML runtime should be invoked from a Qt application instead; see \l {Qt Declarative UI Runtime} for more information. The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file -with the viewer, run the viewer and select the file to be opened, or provide the +with the viewer, run the viewer and select the file to be opened, or provide the file path on the command line: \code qmlviewer myqmlfile.qml \endcode - + On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You -can launch the viewer by opening the QMLViewer application from the Finder, or +can launch the viewer by opening the QMLViewer application from the Finder, or from the command line: \code QMLViewer.app/Contents/MacOS/QMLViewer myqmlfile.qml \endcode -The QML Viewer has a number of configuration options involving features such as +The QML Viewer has a number of configuration options involving features such as fullscreen display, module import path configurations, video recording of QML animations, and OpenGL support. @@ -68,7 +68,7 @@ To see the configuration options, run \c qmlviewer with the \c -help argument. \section1 Adding module import paths Additional module import paths can be provided using the \c -I flag. -For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates +For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates a C++ plugin identified as \c com.nokia.TimeExample. Since this has a namespaced identifier, the viewer has to be run with the \c -I flag from the example's base directory: @@ -87,16 +87,16 @@ the path is explicitly added. \section1 Loading translation files -When the QML Viewer loads a QML file, it installs a translation file from a -"i18n" subdirectory relative to that initial file. This directory should contain +When the QML Viewer loads a QML file, it installs a translation file from a +"i18n" subdirectory relative to that initial file. This directory should contain translation files named "qml_.qm", where is a two-letter ISO 639 language, such as "qml_fr.qm", optionally followed by an underscore and an uppercase two-letter ISO 3166 country code, such as "qml_fr_FR.qm" or -"qml_fr_CA.qm". +"qml_fr_CA.qm". Such files can be created using \l {Qt Linguist}. -The actual translation file that is loaded depends on the system locale. +The actual translation file that is loaded depends on the system locale. Additionally, the viewer will load any translation files specified on the command line via the \c -translation option. @@ -110,7 +110,7 @@ shows how JavaScript code in QML files can be made to use translatable strings. Often, QML applications are prototyped with fake data that is later replaced by real data sources from C++ plugins. QML Viewer assists in this aspect by loading fake data into the application context: it looks for a directory named -"dummydata" in the same directory as the target QML file, and any \c .qml +"dummydata" in the same directory as the target QML file, and any \c .qml files in that directory are loaded as QML objects and bound to the root context as properties named after the files. @@ -124,7 +124,7 @@ ListView { width: 200; height: 300 model: lottoNumbers delegate: Text { text: number } -} +} \endqml If within the document's directory, there is a "dummydata" directory which @@ -146,30 +146,30 @@ Child properties are included when loaded from dummy data. The following documen refers to a \c clock.time property: \qml -import QtQuick 1.0 +import QtQuick 1.0 Text { text: clock.time } \endqml - + The text value could be filled by a \c dummydata/clock.qml file with a \c time property in the root context: \qml -import QtQuick 1.0 +import QtQuick 1.0 QtObject { property int time: 54321 } \endqml To replace this with real data, you can simply bind the real data object to the root context in C++ using QDeclarativeContext::setContextProperty(). This -is detailed in \l {Using QML in C++ Applications}. +is detailed in \l {Using QML Bindings in C++ Applications}. \section1 Using the \c runtime object QML applications that are loaded with the QML Viewer have access to a special -\c runtime property on the root context. This property provides additional +\c runtime property on the root context. This property provides additional information about the application's runtime environment through the following properties: \table -\row +\row \o \c runtime.isActiveWindow @@ -177,9 +177,9 @@ information about the application's runtime environment through the following pr window on the system. It is useful for "pausing" an application, particularly animations, when the QML Viewer loses focus or moves to the background. -For example, the following animation is only played when the QML Viewer is +For example, the following animation is only played when the QML Viewer is the active window: - + \qml Rectangle { width: 200; height: 200 @@ -197,9 +197,9 @@ Rectangle { \o \c runtime.orientation \o This property indicates the current orientation of the QML Viewer. On the -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 +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 @@ -210,7 +210,7 @@ this indicates the orientation currently selected in the QML Viewer's \endlist When the viewer's orientation changes, the appearance of the loaded QML document -does not change unless it has been set to respond to changes in +does not change unless it has been set to respond to changes in \c runtime.orientation. For example, the following Rectangle changes its aspect ratio depending on the orientation of the QML Viewer: @@ -218,12 +218,12 @@ aspect ratio depending on the orientation of the QML Viewer: Rectangle { id: window width: 640; height: 480 - + states: State { name: "landscape" PropertyChanges { target: window; width: 480; height: 640 } } - state: (runtime.orientation == Orientation.Landscape + state: (runtime.orientation == Orientation.Landscape || runtime.orientation == Orientation.LandscapeInverted) ? 'landscape' : '' } \endqml diff --git a/doc/src/declarative/qmlviews.qdoc b/doc/src/declarative/qmlviews.qdoc new file mode 100644 index 0000000..3f74214 --- /dev/null +++ b/doc/src/declarative/qmlviews.qdoc @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** 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$ +** 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 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-views.html +\ingroup qml-features +\contentspage QML Features +\previouspage {QML Data Models}{Structuring Data with Models} +\nextpage {Extending QML Functionalities using C++} +\title Presenting Data with Views + +\section1 Introduction + +Qt Quick contains a set of standard items that can be used to present data in a +number of different ways. For simple user interfaces, +\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used +in combination with +\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} +to obtain pieces of data and arrange them in a user interface. However, when +large quantities of data are involved, it is often better to use models with +the standard views since these contain many built-in display and navigation +features. + +\section1 Views + +Views are scrolling containers for collections of items. They are feature-rich, +supporting many of the use cases found in typical applications, and can be +customized to meet requirements on style and behavior. + +A set of standard views are provided in the basic set of Qt Quick +graphical elements: + +\list +\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list +\o \l{#GridView}{GridView} arranges items in a grid within the available space +\o \l{#PathView}{PathView} arranges items on a path +\endlist + +Unlike these items, \l WebView is not a fully-featured view item, and needs +to be combined with a \l Flickable item to create a view that performs like +a Web browser. + +\section2 ListView + +\l ListView shows a classic list of items with horizontal or vertical placing +of items. + +\beginfloatright +\inlineimage qml-listview-snippet.png +\endfloat + +The following example shows a minimal ListView displaying a sequence of +numbers (using an \l{QML Data Models#An Integer}{integer as a model}). +A simple delegate is used to define an items for each piece of data in the +model. + +\clearfloat +\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document + + + +\section2 GridView + +\l GridView displays items in a grid like an file manager's icon view. + +\section2 PathView + +\l PathView displays items on a path, where the selection remains in +the same place and the items move around it. + +\section1 Decorating Views + +\section2 Headers and Footers + +\section2 Sections + +\section2 Navigation + +In traditional user interfaces, views can be scrolled using standard +controls, such as scroll bars and arrow buttons. In some situations, it +is also possible to drag the view directly by pressing and holding a +mouse button while moving the cursor. In touch-based user interfaces, +this dragging action is often complemented with a flicking action, where +scrolling continues after the user has stopped touching the view. + +\section1 Further Reading +*/ diff --git a/doc/src/declarative/qmlwebkit.qdoc b/doc/src/declarative/qmlwebkit.qdoc new file mode 100644 index 0000000..0f4e86b --- /dev/null +++ b/doc/src/declarative/qmlwebkit.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlwebkit.html + + \title QtWebKit QML Module + + Qt WebKit QML + + \section1 WebKit QML Elements + \list + \o \l WebView + \o \l FlickableWebView + \endlist + + \section1 Content + + \section1 Usage Ideas + + \section1 Other Suggestions + +*/ diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 0a66226..a7aacdb 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -28,10 +28,12 @@ /*! \page qtbinding.html \ingroup qml-features -\target qtbinding -\title Using QML in C++ Applications +\previouspage {Extending QML Functionalities using C++} +\nextpage {Integrating QML Code with Existing Qt UI Code} +\contentspage QML Features +\title Using QML Bindings in C++ Applications -QML is designed to be easily extensible from C++. The classes in the +QML is designed to be easily extensible to and from C++. The classes in the Qt Declarative module allow QML components to be loaded and manipulated from C++, and through Qt's \l{The Meta-Object System}{meta-object system}, QML and C++ objects can easily communicate through Qt signals and slots. In addition, QML plugins can be written to create @@ -86,7 +88,7 @@ delete rectangleInstance; QML documents can also be loaded using QDeclarativeView. This class provides a convenient QWidget-based view for embedding QML components into QGraphicsView-based applications. (For other -methods of integrating QML into QWidget-based applications, see \l {Integrating QML with existing Qt +methods of integrating QML into QWidget-based applications, see \l {Integrating QML Code with existing Qt UI code}.) @@ -254,8 +256,8 @@ Note that custom C++ types do not have to inherit from QDeclarativeItem; this is a displayable item. If the item is not displayable, it can simply inherit from QObject. For more information on defining new QML elements, see the \l {Tutorial: Writing QML extensions with C++} -{Writing QML extensions with C++} tutorial and the \l {Extending QML in C++} reference -documentation. +{Writing QML extensions with C++} tutorial and the +\l {Extending QML Functionalities using C++} reference documentation. @@ -485,7 +487,8 @@ can be registered using qmlRegisterUncreatableType(). To be accessible from QML must begin with a capital letter. See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++} tutorial and -the \l {Extending QML in C++} reference documentation for more information. +the \l {Extending QML Functionalities using C++} reference documentation for +more information. \section2 Automatic type conversion from strings diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index 0c14093..1746c31 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -48,7 +48,8 @@ QML provides direct access to the following concepts from Qt: \o Qt models - used directly in data binding (QAbstractItemModel) \endlist -Qt knowledge is \e required for \l {Extending QML in C++}, and also for \l{Integrating QML with existing Qt UI code}. +Qt knowledge is \e required for \l {Extending QML Functionalities using C++}, +and also for \l{Integrating QML Code with existing Qt UI code}. \section1 QML Items compared with QWidgets diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 0834527..9dad84a 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -29,7 +29,7 @@ \title Animation: Basics Example \example declarative/animation/basics - This example shows how to create and combine \l{QML Animation}{animations} in QML. + This example shows how to create and combine \l{QML Animation and Transitions}{animations} in QML. \table \row @@ -50,16 +50,16 @@ \title Animation: Behavior Examples \example declarative/animation/behaviors - This example shows how to use QML behaviors. + This example shows how to use QML behaviors. \image qml-behaviors-example.png */ /*! - \title Animation: Easing Example + \title Animation: Easing Example \example declarative/animation/easing - This example shows the different easing modes available for \l{QML Animation}{animations}. + This example shows the different easing modes available for \l{QML Animation and Transitions}{animations}. \image qml-easing-example.png */ @@ -122,9 +122,9 @@ \page declarative-cppextensions-reference.html \title C++ Extensions: Reference examples - These examples show how QML can be extended from C++ in various ways. - - The code for these examples is used throughout the \l {Extending QML in C++} reference + These examples show how QML can be extended from C++ in various ways. + + The code for these examples is used throughout the \l {Extending QML Functionalities using C++} reference documentation, which highlights the main principles demonstrated in each example. Furthermore, here are additional pages that discuss each example in detail: @@ -160,7 +160,7 @@ \title LayoutItem Example \example declarative/cppextensions/qgraphicslayouts/layoutitem - This example show how to use the LayoutItem element to integrate QML items into an existing + This example show how to use the LayoutItem element to integrate QML items into an existing \l{Graphics View Framework}{Graphics View}-based application. \image qml-layoutitem-example.png @@ -169,7 +169,7 @@ \title QGraphicsGridLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout - This example shows how to use QGraphicsGridLayout to lay out QML items. This is + This example shows how to use QGraphicsGridLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. @@ -179,10 +179,10 @@ \title QGraphicsLinearLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout - This example shows how to use QGraphicsLinearLayout to lay out QML items. This is + This example shows how to use QGraphicsLinearLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. - + \image qml-qgraphicslinearlayout-example.png */ /*! @@ -198,7 +198,7 @@ \o \l{declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout}{QGraphicsLinearLayout} \endlist - Also see \l {Integrating QML with existing Qt UI code} for information on using QML + Also see \l {Integrating QML Code with Existing Qt UI Code} for information on using QML in Qt applications that use the Graphics View framework or ordinary QWidget-based views. */ @@ -215,7 +215,7 @@ \title C++ Extensions: Image Provider Example \example declarative/cppextensions/imageprovider - This examples shows how to use QDeclarativeImageProvider to serve images + This examples shows how to use QDeclarativeImageProvider to serve images to QML image elements. \image qml-imageprovider-example.png @@ -525,7 +525,7 @@ \example declarative/toys/clocks This example displays a set of clocks with different times for different cities. - Each clock is created by combining \l Image elements with \l Rotation transforms + Each clock is created by combining \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors. \image qml-clocks-example.png diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index e3977bb..d2fc4ea 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -631,7 +631,7 @@ 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 + \l {Using QML Bindings 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. diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 5c48a33..96805d0 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -164,9 +164,32 @@ \brief Features of the QML Language - These are overviews of the many features of the QML Language. - - \generatelist {related} + These are overviews of the many features of the QML language. + + \list + \o \l{QML Syntax} + \o \l{Property Binding} + \o \l{QML Basic Types}{Data Types} + \o \l{QML Basic Elements}{Basic Elements} + \o \l{Using QML Positioner and Repeater Items}{Component Layouts} + \o \l{Anchor-based Layout in QML}{Layouts using Anchors} + \o \l{Mouse Events} + \o \l{QML Text Handling and Validators}{Text Handling and Validators} + \o \l{Keyboard Focus in QML}{Keyboard Focus} + \o \l{Importing Reusable Components} + \o \l{QML States}{States} + \o \l{QML Animation and Transitions}{Animation and Transitions} + \o \l{QML Data Models}{Structuring Data with Models} + \o \l{Presenting Data with Views} + \o \l{Extending QML Functionalities using C++} + \o \l{Using QML Bindings in C++ Applications} + \o \l{Integrating QML Code with Existing Qt UI Code} + \o \l{QML Signal and Handler Event System}{Signal and Handler Event System} + \o \l{Dynamic Object Management in QML}{Dynamic Object Management} + \o \l{Network Transparency}{Loading Resources in QML} + \o \l{QML Internationalization}{Internationalization} + \o \l{QML Graphical Effects}{Graphical Effects} + \endlist */ /*! \group qml-architecture diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 0a03157..516f2c5 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -244,3 +244,19 @@ \externalpage http://labs.qt.nokia.com \title Qt Labs */ + +/*! + \externalpage http://doc.qt.nokia.com/qtcreator-snapshot/index.html + \title Qt Creator Manual +*/ + +/*! + \externalpage http://doc.qt.nokia.com/qtcreator-snapshot/creator-qml-application.html + \title Developing Qt Quick Applications with Creator +*/ + +/*! + \externalpage http://qt.gitorious.org/qt/pages/QtCodingStyle + \title Qt Coding Style +*/ + diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/declarative/ui-components/tabwidget/TabWidget.qml index 2a74c46..c8f5711 100644 --- a/examples/declarative/ui-components/tabwidget/TabWidget.qml +++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml @@ -45,7 +45,7 @@ Item { // Setting the default property to stack.children means any child items // of the TabWidget are actually added to the 'stack' item's children. - // See the "Writing QML Components: Properties, Methods and Signals" + // See the "Property Binding" // documentation for details on default properties. default property alias content: stack.children diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index f118a85..48b6ba0 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -86,13 +86,13 @@ public: The following example shows a Flipable item that flips whenever it is clicked, rotating about the y-axis. - This flipable item has a \c flipped boolean property that is toggled - whenever the MouseArea within the flipable is clicked. When - \c flipped is true, the item changes to the "back" state; in this + This flipable item has a \c flipped boolean property that is toggled + whenever the MouseArea within the flipable is clicked. When + \c flipped is true, the item changes to the "back" state; in this state, the \c angle of the \l Rotation item is changed to 180 degrees to produce the flipping effect. When \c flipped is false, the - item reverts to the default state, in which the \c angle value is 0. - + item reverts to the default state, in which the \c angle value is 0. + \snippet doc/src/snippets/declarative/flipable/flipable.qml 0 \image flipable.gif @@ -103,8 +103,8 @@ public: its old and new values. See \l {QML States} for details on state changes and the default - state, and \l {QML Animation} for more information on how animations - work within transitions. + state, and \l {QML Animation and Transitions} for more information on how + animations work within transitions. \sa {declarative/ui-components/flipable}{Flipable example} */ diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 77fc925..edc7b2a 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -135,7 +135,7 @@ class QByteArray; } \endcode - \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} + \sa {Using QML Bindings in C++ Applications}, {Integrating QML Code with Existing Qt UI Code} */ /*! @@ -157,7 +157,7 @@ class QByteArray; \snippet doc/src/snippets/declarative/component.qml 0 - Notice that while a \l Rectangle by itself would be automatically + Notice that while a \l Rectangle by itself would be automatically rendered and displayed, this is not the case for the above rectangle because it is defined inside a \c Component. The component encapsulates the QML elements within, as if they were defined in a separate QML @@ -227,7 +227,7 @@ class QByteArray; /*! \enum QDeclarativeComponent::Status - + Specifies the loading status of the QDeclarativeComponent. \value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content. @@ -279,8 +279,8 @@ void QDeclarativeComponentPrivate::clear() typeData->release(); typeData = 0; } - - if (cc) { + + if (cc) { cc->release(); cc = 0; } @@ -436,12 +436,12 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const Q } /*! - Create a QDeclarativeComponent from the given \a fileName and give it the specified + Create a QDeclarativeComponent from the given \a fileName and give it the specified \a parent and \a engine. \sa loadUrl() */ -QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, +QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, QObject *parent) : QObject(*(new QDeclarativeComponentPrivate), parent) { @@ -480,7 +480,7 @@ void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url); - + if (typeData->isCompleteOrError()) { d->fromTypeData(typeData); } else { @@ -615,7 +615,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q /*! \qmlmethod object Component::createObject(Item parent) - Creates and returns an object instance of this component that will have the given + Creates and returns an object instance of this component that will have the given \a parent. Returns null if object creation fails. The object will be created in the same context as the one in which the component @@ -623,8 +623,8 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q which were not created in QML. If you wish to create an object without setting a parent, specify \c null for - the \a parent value. Note that if the returned object is to be displayed, you - must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} + the \a parent value. Note that if the returned object is to be displayed, you + must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} property, or else the object will not be visible. Dynamically created instances can be deleted with the \c destroy() method. @@ -669,7 +669,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) } } - if (needParent) + if (needParent) qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene."); } completeCreate(); @@ -682,7 +682,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) /*! Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. If \a context is 0 (the default), it will create the instance in the engine' s \l {QDeclarativeEngine::rootContext()}{root context}. @@ -699,7 +699,7 @@ QObject *QDeclarativeComponent::create(QDeclarativeContext *context) return rv; } -QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, +QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, const QBitField &bindings) { if (!context) @@ -712,21 +712,21 @@ QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. When QDeclarativeComponent constructs an instance, it occurs in three steps: \list 1 \i The object hierarchy is created, and constant values are assigned. \i Property bindings are evaluated for the the first time. \i If applicable, QDeclarativeParserStatus::componentComplete() is called on objects. - \endlist + \endlist QDeclarativeComponent::beginCreate() differs from QDeclarativeComponent::create() in that it - only performs step 1. QDeclarativeComponent::completeCreate() must be called to + only performs step 1. QDeclarativeComponent::completeCreate() must be called to complete steps 2 and 3. This breaking point is sometimes useful when using attached properties to @@ -777,7 +777,7 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons return begin(context, creationContext, cc, start, count, &state, 0, bindings); } -QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, +QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList *errors, @@ -789,7 +789,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided - if (isRoot) + if (isRoot) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); QDeclarativeContextData *ctxt = new QDeclarativeContextData; @@ -798,7 +798,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon ctxt->imports = component->importCache; // Nested global imports - if (componentCreationContext && start != -1) + if (componentCreationContext && start != -1) ctxt->importedScripts = componentCreationContext->importedScripts; component->importCache->addref(); @@ -850,7 +850,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi QDeclarativeVME vme; vme.runDeferred(object); - if (vme.isError()) + if (vme.isError()) state->errors = vme.errors(); if (isRoot) { @@ -877,13 +877,13 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri if (state->completePending) { for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList bv = + QDeclarativeEnginePrivate::SimpleList bv = state->bindValues.at(ii); for (int jj = 0; jj < bv.count; ++jj) { if(bv.at(jj)) { // XXX akennedy bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } } @@ -891,7 +891,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri } for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList ps = + QDeclarativeEnginePrivate::SimpleList ps = state->parserStatus.at(ii); for (int jj = ps.count - 1; jj >= 0; --jj) { @@ -942,7 +942,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Complete a component creation begin with QDeclarativeComponent::beginCreate(). diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 3ee0e6f..dff90b4 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -72,10 +72,10 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() Contexts allow data to be exposed to the QML components instantiated by the QML engine. - Each QDeclarativeContext contains a set of properties, distinct from its QObject - properties, that allow data to be explicitly bound to a context by name. The - context properties are defined and updated by calling - QDeclarativeContext::setContextProperty(). The following example shows a Qt model + Each QDeclarativeContext contains a set of properties, distinct from its QObject + properties, that allow data to be explicitly bound to a context by name. The + context properties are defined and updated by calling + QDeclarativeContext::setContextProperty(). The following example shows a Qt model being bound to a context and then accessed from a QML file. \code @@ -97,8 +97,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls - to QDeclarativeContext::setContextProperty(). Changes to the property's values are - detected through the property's notify signal. Setting a context object is both + to QDeclarativeContext::setContextProperty(). Changes to the property's values are + detected through the property's notify signal. Setting a context object is both faster and easier than manually adding and maintaing context property values. The following example has the same effect as the previous one, but it uses a context @@ -121,7 +121,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() component.create(context); \endcode - All properties added explicitly by QDeclarativeContext::setContextProperty() take + All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. \section2 The Context Hierarchy @@ -147,8 +147,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context2->setContextProperty("b", 15); \endcode - While QML objects instantiated in a context are not strictly owned by that - context, their bindings are. If a context is destroyed, the property bindings of + While QML objects instantiated in a context are not strictly owned by that + context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. \warning Setting the context object or adding new context properties after an object @@ -156,7 +156,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. - \sa {Using QML in C++ Applications} + \sa {Using QML Bindings in C++ Applications} */ /*! \internal */ @@ -223,7 +223,7 @@ QDeclarativeContext::~QDeclarativeContext() /*! Returns whether the context is valid. - To be valid, a context must have a engine, and it's contextObject(), if any, + To be valid, a context must have a engine, and it's contextObject(), if any, must not have been deleted. */ bool QDeclarativeContext::isValid() const @@ -384,7 +384,7 @@ QVariant QDeclarativeContext::contextProperty(const QString &name) const if (data->contextObject) { QObject *obj = data->contextObject; QDeclarativePropertyCache::Data local; - QDeclarativePropertyCache::Data *property = + QDeclarativePropertyCache::Data *property = QDeclarativePropertyCache::property(data->engine, obj, name, local); if (property) value = obj->metaObject()->property(property->coreIndex).read(obj); @@ -461,7 +461,7 @@ QUrl QDeclarativeContext::baseUrl() const { Q_D(const QDeclarativeContext); const QDeclarativeContextData* data = d->data; - while (data && data->url.isEmpty()) + while (data && data->url.isEmpty()) data = data->parent; if (data) @@ -515,7 +515,7 @@ QDeclarativeContextData::QDeclarativeContextData(QDeclarativeContext *ctxt) void QDeclarativeContextData::invalidate() { - while (childContexts) + while (childContexts) childContexts->invalidate(); while (componentAttached) { @@ -570,7 +570,7 @@ void QDeclarativeContextData::clearContext() void QDeclarativeContextData::destroy() { - if (linkedContext) + if (linkedContext) linkedContext->destroy(); if (engine) invalidate(); @@ -626,9 +626,9 @@ void QDeclarativeContextData::setParent(QDeclarativeContextData *p) } } -/* -Refreshes all expressions that could possibly depend on this context. Refreshing flushes all -context-tree dependent caches in the expressions, and should occur every time the context tree +/* +Refreshes all expressions that could possibly depend on this context. Refreshing flushes all +context-tree dependent caches in the expressions, and should occur every time the context tree *structure* (not values) changes. */ void QDeclarativeContextData::refreshExpressions() @@ -656,7 +656,7 @@ void QDeclarativeContextData::addObject(QObject *o) data->outerContext = this; data->nextContextObject = contextObjects; - if (data->nextContextObject) + if (data->nextContextObject) data->nextContextObject->prevContextObject = &data->nextContextObject; data->prevContextObject = &contextObjects; contextObjects = data; @@ -664,7 +664,7 @@ void QDeclarativeContextData::addObject(QObject *o) void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script) { - if (!engine) + if (!engine) return; QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); @@ -684,7 +684,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url)); scriptContext->pushScope(enginePriv->globalClass->staticGlobalObject()); - + QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(scriptEngine); scriptContext->pushScope(scope); @@ -752,7 +752,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const for (int i=0; ifindId(i); - } + } if (linkedContext) return linkedContext->findObjectId(obj); @@ -761,7 +761,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const QDeclarativeContext *QDeclarativeContextData::asQDeclarativeContext() { - if (!publicContext) + if (!publicContext) publicContext = new QDeclarativeContext(this); return publicContext; } diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index dd7e5fd..8c3d3da 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -569,7 +569,7 @@ void QDeclarativeAbstractAnimation::timelineComplete() } \endcode - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativePauseAnimation::QDeclarativePauseAnimation(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePauseAnimationPrivate), parent) @@ -628,27 +628,27 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() \inherits PropertyAnimation \brief The ColorAnimation element animates changes in color values. - ColorAnimation is a specialized PropertyAnimation that defines an + ColorAnimation is a specialized PropertyAnimation that defines an animation to be applied when a color value changes. - Here is a ColorAnimation applied to the \c color property of a \l Rectangle - as a property value source. It animates the \c color property's value from + Here is a ColorAnimation applied to the \c color property of a \l Rectangle + as a property value source. It animates the \c color property's value from its current value to a value of "red", over 1000 milliseconds: \snippet doc/src/snippets/declarative/coloranimation.qml 0 Like any other animation element, a ColorAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. - - For convenience, when a ColorAnimation is used in a \l Transition, it will - animate any \c color properties that have been modified during the state - change. If a \l{PropertyAnimation::}{property} or - \l{PropertyAnimation::}{properties} are explicitly set for the animation, + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. + + For convenience, when a ColorAnimation is used in a \l Transition, it will + animate any \c color properties that have been modified during the state + change. If a \l{PropertyAnimation::}{property} or + \l{PropertyAnimation::}{properties} are explicitly set for the animation, then those are used instead. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeColorAnimation::QDeclarativeColorAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -682,10 +682,10 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() If the ColorAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QColor QDeclarativeColorAnimation::from() const { @@ -708,7 +708,7 @@ void QDeclarativeColorAnimation::setFrom(const QColor &f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QColor QDeclarativeColorAnimation::to() const { @@ -875,7 +875,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. - PropertyAction is used to specify an immediate property change during an + PropertyAction is used to specify an immediate property change during an animation. The property change is not animated. It is useful for setting non-animated property values during an animation. @@ -886,9 +886,9 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \snippet doc/src/snippets/declarative/propertyaction.qml standalone - PropertyAction is also useful for setting the exact point at which a property - change should occur during a \l Transition. For example, if PropertyChanges - was used in a \l State to rotate an item around a particular + PropertyAction is also useful for setting the exact point at which a property + change should occur during a \l Transition. For example, if PropertyChanges + was used in a \l State to rotate an item around a particular \l {Item::}{transformOrigin}, it might be implemented like this: \snippet doc/src/snippets/declarative/propertyaction.qml transition @@ -896,7 +896,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of a transition. The animation would rotate at the default \c transformOrigin, - then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges + then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges before the RotationAnimation begins: \qml @@ -907,13 +907,13 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() } } \endqml - + This immediately sets the \c transformOrigin property to the value defined - in the end state of the \l Transition (i.e. the value defined in the + in the end state of the \l Transition (i.e. the value defined in the PropertyChanges object) so that the rotation animation begins with the correct transform origin. - \sa {QML Animation}, QtDeclarative + \sa {QML Animation and Transitions}, QtDeclarative */ QDeclarativePropertyAction::QDeclarativePropertyAction(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePropertyActionPrivate), parent) @@ -1143,25 +1143,25 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, \inherits PropertyAnimation \brief The NumberAnimation element animates changes in qreal-type values. - NumberAnimation is a specialized PropertyAnimation that defines an + NumberAnimation is a specialized PropertyAnimation that defines an animation to be applied when a numerical value changes. - Here is a NumberAnimation applied to the \c x property of a \l Rectangle - as a property value source. It animates the \c x value from its current + Here is a NumberAnimation applied to the \c x property of a \l Rectangle + as a property value source. It animates the \c x value from its current value to a value of 50, over 1000 milliseconds: \snippet doc/src/snippets/declarative/numberanimation.qml 0 Like any other animation element, a NumberAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. Note that NumberAnimation may not animate smoothly if there are irregular changes in the number value that it is tracking. If this is the case, use SmoothedAnimation instead. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -1205,10 +1205,10 @@ void QDeclarativeNumberAnimation::init() If the NumberAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeNumberAnimation::from() const @@ -1231,7 +1231,7 @@ void QDeclarativeNumberAnimation::setFrom(qreal f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeNumberAnimation::to() const { @@ -1253,15 +1253,15 @@ void QDeclarativeNumberAnimation::setTo(qreal t) \inherits PropertyAnimation \brief The Vector3dAnimation element animates changes in QVector3d values. - Vector3dAnimation is a specialized PropertyAnimation that defines an + Vector3dAnimation is a specialized PropertyAnimation that defines an animation to be applied when a Vector3d value changes. Like any other animation element, a Vector3dAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -1282,10 +1282,10 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation() If the Vector3dAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVector3D QDeclarativeVector3dAnimation::from() const { @@ -1307,7 +1307,7 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVector3D QDeclarativeVector3dAnimation::to() const { @@ -1330,7 +1330,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \brief The RotationAnimation element animates changes in rotation values. RotationAnimation is a specialized PropertyAnimation that gives control - over the direction of rotation during an animation. + over the direction of rotation during an animation. By default, it rotates in the direction of the numerical change; a rotation from 0 to 240 will rotate 240 degrees @@ -1346,7 +1346,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing - your own properties via \l {PropertyAnimation::properties}{properties} or + your own properties via \l {PropertyAnimation::properties}{properties} or \l {PropertyAnimation::property}{property}. Also, note the \l Rectangle will be rotated around its default @@ -1356,11 +1356,11 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) PropertyAction documentation for more details. Like any other animation element, a RotationAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress) { @@ -1431,10 +1431,10 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() If the RotationAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeRotationAnimation::from() const { @@ -1456,7 +1456,7 @@ void QDeclarativeRotationAnimation::setFrom(qreal f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeRotationAnimation::to() const { @@ -1582,15 +1582,15 @@ QDeclarativeListProperty QDeclarativeAnimationGro if this is the preferred behavior. Like any other animation element, a SequentialAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \note Once an animation has been grouped into a SequentialAnimation or + \note Once an animation has been grouped into a SequentialAnimation or ParallelAnimation, it cannot be individually started and stopped; the SequentialAnimation or ParallelAnimation must be started and stopped as a group. - - \sa ParallelAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + + \sa ParallelAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent) : @@ -1652,15 +1652,15 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio \snippet doc/src/snippets/declarative/parallelanimation.qml 0 Like any other animation element, a ParallelAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \note Once an animation has been grouped into a SequentialAnimation or + \note Once an animation has been grouped into a SequentialAnimation or ParallelAnimation, it cannot be individually started and stopped; the SequentialAnimation or ParallelAnimation must be started and stopped as a group. - \sa SequentialAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa SequentialAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) @@ -1755,14 +1755,14 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int \inherits Animation \brief The PropertyAnimation element animates changes in property values. - PropertyAnimation provides a way to animate changes to a property's value. + PropertyAnimation provides a way to animate changes to a property's value. It can be used to define animations in a number of ways: - + \list \o In a \l Transition - For example, to animate any objects that have changed their \c x or \c y properties + For example, to animate any objects that have changed their \c x or \c y properties as a result of a state change, using an \c InOutQuad easing curve: \snippet doc/src/snippets/declarative/propertyanimation.qml transition @@ -1802,12 +1802,12 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Depending on how the animation is used, the set of properties normally used will be different. For more information see the individual property documentation, as well - as the \l{QML Animation} introduction. + as the \l{QML Animation and Transitions} introduction. Note that PropertyAnimation inherits the abstract \l Animation element. This includes additional properties and methods for controlling the animation. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativePropertyAnimation::QDeclarativePropertyAnimation(QObject *parent) @@ -1867,10 +1867,10 @@ void QDeclarativePropertyAnimation::setDuration(int duration) If the PropertyAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVariant QDeclarativePropertyAnimation::from() const { @@ -1897,7 +1897,7 @@ void QDeclarativePropertyAnimation::setFrom(const QVariant &f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVariant QDeclarativePropertyAnimation::to() const { @@ -2264,7 +2264,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) As seen in the above example, properties is specified as a comma-separated string of property names to animate. - \sa exclude, {QML Animation} + \sa exclude, {QML Animation and Transitions} */ QDeclarativeListProperty QDeclarativePropertyAnimation::targets() { @@ -2447,7 +2447,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions ParentAnimation is used to animate a parent change for an \l Item. For example, the following ParentChange changes \c blueRect to become - a child of \c redRect when it is clicked. The inclusion of the + a child of \c redRect when it is clicked. The inclusion of the ParentAnimation, which defines a NumberAnimation to be applied during the transition, ensures the item animates smoothly as it moves to its new parent: @@ -2462,17 +2462,17 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions to animate the parent change via another item that does not have clipping enabled. Such an item can be set using the \l via property. - For convenience, when a ParentAnimation is used in a \l Transition, it will - animate any ParentChange that has occurred during the state change. + For convenience, when a ParentAnimation is used in a \l Transition, it will + animate any ParentChange that has occurred during the state change. This can be overridden by setting a specific target item using the \l target property. Like any other animation element, a ParentAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) @@ -2803,23 +2803,23 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation() \inherits Animation \brief The AnchorAnimation element animates changes in anchor values. - AnchorAnimation is used to animate an anchor change. + AnchorAnimation is used to animate an anchor change. In the following snippet we animate the addition of a right anchor to a \l Rectangle: \snippet doc/src/snippets/declarative/anchoranimation.qml 0 - For convenience, when an AnchorAnimation is used in a \l Transition, it will - animate any AnchorChanges that have occurred during the state change. + For convenience, when an AnchorAnimation is used in a \l Transition, it will + animate any AnchorChanges that have occurred during the state change. This can be overridden by setting a specific target item using the \l target property. Like any other animation element, an AnchorAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, AnchorChanges + \sa {QML Animation and Transitions}, AnchorChanges */ QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(QObject *parent) diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index f1b6f9a..45257de 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -76,7 +76,7 @@ public: \since 4.7 \brief The Behavior element allows you to specify a default animation for a property change. - A Behavior defines the default animation to be applied whenever a + A Behavior defines the default animation to be applied whenever a particular property value changes. For example, the following Behavior defines a NumberAnimation to be run @@ -93,7 +93,7 @@ public: Behavior, the \l Transition animation overrides the Behavior for that state change. - \sa {QML Animation}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative + \sa {QML Animation and Transitions}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative */ @@ -205,7 +205,7 @@ void QDeclarativeBehavior::write(const QVariant &value) d->animation->qtAnimation()->start(); d->blockRunningChanged = false; if (!after.contains(d->property)) - QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property) diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index ca83c52..da4c707 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -257,8 +257,8 @@ void QSmoothedAnimation::init() A SmoothedAnimation animates a property's value to a set target value using an ease in/out quad easing curve. When the target value changes, - the easing curves used to animate between the old and new target values - are smoothly spliced together to create a smooth movement to the new + the easing curves used to animate between the old and new target values + are smoothly spliced together to create a smooth movement to the new target value that maintains the current velocity. The follow example shows one \l Rectangle tracking the position of another @@ -288,11 +288,11 @@ void QSmoothedAnimation::init() of 0.5 will take 2000 ms to complete. Like any other animation element, a SmoothedAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa SpringAnimation, NumberAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa SpringAnimation, NumberAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeSmoothedAnimation::QDeclarativeSmoothedAnimation(QObject *parent) diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index e0fc45d..ccebe82 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -246,19 +246,19 @@ void QDeclarativeSpringAnimationPrivate::updateMode() You can also limit the maximum \l velocity of the animation. - The following \l Rectangle moves to the position of the mouse using a + The following \l Rectangle moves to the position of the mouse using a SpringAnimation when the mouse is clicked. The use of the \l Behavior - on the \c x and \c y values indicates that whenever these values are + on the \c x and \c y values indicates that whenever these values are changed, a SpringAnimation should be applied. \snippet doc/src/snippets/declarative/springanimation.qml 0 Like any other animation element, a SpringAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa SmoothedAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} + \sa SmoothedAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} */ QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent) @@ -299,7 +299,7 @@ void QDeclarativeSpringAnimation::setVelocity(qreal velocity) This property describes how strongly the target is pulled towards the source. The default value is 0 (that is, the spring-like motion is disabled). - + The useful value range is 0 - 5.0. When this property is set and the \l velocity value is greater than 0, @@ -394,9 +394,9 @@ void QDeclarativeSpringAnimation::setModulus(qreal modulus) \qmlproperty real SpringAnimation::mass This property holds the "mass" of the property being moved. - The value is 1.0 by default. - - A greater mass causes slower movement and a greater spring-like + The value is 1.0 by default. + + A greater mass causes slower movement and a greater spring-like motion when an item comes to rest. */ qreal QDeclarativeSpringAnimation::mass() const diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index c8bc7b3..49f0000 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -60,24 +60,24 @@ QT_BEGIN_NAMESPACE A Transition defines the animations to be applied when a \l State change occurs. For example, the following \l Rectangle has two states: the default state, and - an added "moved" state. In the "moved state, the rectangle's position changes + an added "moved" state. In the "moved state, the rectangle's position changes to (50, 50). The added Transition specifies that when the rectangle changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. \snippet doc/src/snippets/declarative/transition.qml 0 - Notice the example does not require \l{PropertyAnimation::}{to} and + Notice the example does not require \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience, these properties are automatically set to the values of \c x and \c y before and after the state change; the \c from values are provided by the current values of \c x and \c y, and the \c to values are provided by - the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and + the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values anyway to override the default values. - By default, a Transition's animations are applied for any state change in the - parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to} - values can be set to restrict the animations to only be applied when changing + By default, a Transition's animations are applied for any state change in the + parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to} + values can be set to restrict the animations to only be applied when changing from one particular state to another. To define multiple transitions, specify \l Item::transitions as a list: @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE \l Behavior, the Transition animation overrides the \l Behavior for that state change. - \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} + \sa {QML Animation and Transitions}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} */ //ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting @@ -119,8 +119,8 @@ class QDeclarativeTransitionPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeTransition) public: - QDeclarativeTransitionPrivate() - : fromState(QLatin1String("*")), toState(QLatin1String("*")), + QDeclarativeTransitionPrivate() + : fromState(QLatin1String("*")), toState(QLatin1String("*")), reversed(false), reversible(false), endState(0) { group.trans = this; @@ -223,7 +223,7 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act If the transition was changed to this: \qml - transitions: Transition { + transitions: Transition { to: "brighter" ColorAnimation { duration: 1000 } } @@ -263,7 +263,7 @@ void QDeclarativeTransition::setFromState(const QString &f) is reversed, and it is not necessary to set this property to reverse the transition. - However, if a SequentialAnimation is used, or if the \l from or \l to + However, if a SequentialAnimation is used, or if the \l from or \l to properties have been set, this property will need to be set to reverse a transition when a state change is reverted. For example, the following transition applies a sequential animation when the mouse is pressed, @@ -271,7 +271,7 @@ void QDeclarativeTransition::setFromState(const QString &f) \snippet doc/src/snippets/declarative/transition-reversible.qml 0 - If the transition did not set the \c to and \c reversible values, then + If the transition did not set the \c to and \c reversible values, then on the mouse release, the transition would play the PropertyAnimation before the ColorAnimation instead of reversing the sequence. */ diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index c22f200..e1cf6d7 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -195,9 +195,9 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, \since 4.7 \brief The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface. - QDeclarativeItem objects can be placed on a standard QGraphicsScene and - displayed with QGraphicsView. QDeclarativeView is a QGraphicsView subclass - provided as a convenience for displaying QML files, and connecting between + QDeclarativeItem objects can be placed on a standard QGraphicsScene and + displayed with QGraphicsView. QDeclarativeView is a QGraphicsView subclass + provided as a convenience for displaying QML files, and connecting between QML and C++ Qt objects. QDeclarativeView provides: @@ -234,7 +234,7 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, you can connect to the statusChanged() signal and monitor for QDeclarativeView::Error. The errors are available via QDeclarativeView::errors(). - \sa {Integrating QML with existing Qt UI code}, {Using QML in C++ Applications} + \sa {Integrating QML Code with Existing Qt UI Code}, {Using QML Bindings in C++ Applications} */ @@ -248,7 +248,7 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, /*! \fn QDeclarativeView::QDeclarativeView(QWidget *parent) - + Constructs a QDeclarativeView with the given \a parent. */ QDeclarativeView::QDeclarativeView(QWidget *parent) @@ -695,7 +695,7 @@ void QDeclarativeView::paintEvent(QPaintEvent *event) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Painting); int time = 0; - if (frameRateDebug()) + if (frameRateDebug()) time = d->frameTimer.restart(); #ifdef Q_WS_MAC -- cgit v0.12