We will focus on the \c TextBalloon class first and continue with the
\c textballoons.qml file. For an example on how to implement a \l {Qt Quick}
- plugin please look at \l{declarative/tutorials/extending/chapter6-plugins}
+ plugin please look at \l{Chapter 6: Writing an Extension Plugin}
{Writing an Extension Plugin}
\section1 TextBalloon Class Declaration
The application is a straightforward QML application, with a
QGuiApplication and a QQuickView that we pass a .qml file. To make
use of the BezierCurve item, we need to register it in the QML
- engine, using the qmlRegisterType function. We give it the name
+ engine, using the qmlRegisterType() function. We give it the name
BezierCurve and make it part of the \c {CustomGeometry 1.0}
module.
This second function is called when the knob is released and we want to make sure that the knob does not end up between states
(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing.
-For more information on scripts see \l{Using JavaScript Expressions in QML}.
+For more information on scripts see \l{JavaScript Expressions in QML Documents}.
\section2 Transition
\snippet ui-components/slideswitch/content/Switch.qml 7
with a combined value of all key roles that is not already present in
the model.
- \sa {RSS News}
+ \sa {Qt Quick Demo - RSS News}
*/
QQuickXmlListModel::QQuickXmlListModel(QObject *parent)
Note that the sprite image will be scaled to a square based on the size of
the particle being rendered.
- For full details, see the \l{Sprite Animation} overview.
+ For full details, see the \l{Sprite Animations} overview.
*/
/*!
\qmlproperty url QtQuick.Particles::ImageParticle::colorTable
\li \l {Models and Views: AbstractItemModel Example}{AbstractItemModel}
\endlist
-demonstrating the use of QStringList, \l{QList<QObject*>}-based models and
+demonstrating the use of QStringList, QList<QObject*>-based models and
QAbstractItemModel in QML views.
Also see the QQmlContext documentation for more information.
\section1 Basic Qt Data Types
By default, QML recognizes the following Qt data types, which are
-automatically converted to a corresponding \l {QML Basic Type}{QML basic type}
+automatically converted to a corresponding \l {QML Basic Types}{QML basic type}
when passed from C++ to QML and vice-versa:
\table
\section1 Defining QML Types from C++
QML types can be defined in C++ and then registered with the \l{qtqml-typesystem-topic.html}{QML
-type system}. This allows a C++ class to be instantiated as a \l {QML object type}, enabling custom
+type system}. This allows a C++ class to be instantiated as a \l {QML Object Types}{QML object type}, enabling custom
object types to be implemented in C++ and integrated into existing QML code. A C++ class may be also
registered for other purposes: for example, it could be registered as a \e {Singleton Type} to enable a
single class instance to be imported by QML code, or it could be registered to enable the
\li \l{Method Attributes}{custom methods} can be defined
in QML files as JavaScript functions
\li JavaScript files providing functions and variables can be
- \l{Importing JavaScript Files in QML Documents}{imported} in a QML
+ \l{Importing JavaScript Resources in QML}{imported} in a QML
document
\endlist
value whose type can be assigned to the property.
There are two ways to define a property binding: the first (and most common)
-is, as previously shown, in a \l{QML Object Attributes#property-initialization}
+is, as previously shown, in a \l{QML Object Attributes#Value Assignment on Initialization}
{property initialization}. The second (and much rarer) way is to assign the
property a function returned from the \l{Qt::binding()}{Qt.binding()} function,
from within imperative JavaScript code, as shown below:
\endqml
For more information about loading external JavaScript files into QML, read
-the section about \l{Importing JavaScript Files in QML Documents}.
+the section about \l{Importing JavaScript Resources in QML}.
\l{qtqml-javascript-resources.html}{JavaScript resources} may be imported by
QML documents and other JavaScript resources. JavaScript resources may be
imported via either relative or absolute URLs. In the case of a relative URL,
-the location is resolved relative to the location of the \l {QML Document} or
+the location is resolved relative to the location of the \l {QML Documents}{QML document} or
\l{qtqml-javascript-resources.html}{JavaScript Resource} that contains the
import. If the script file is not accessible, an error will occur. If the
JavaScript needs to be fetched from a network resource, the component's
\fn void qmlClearTypeRegistrations()
\relates QQmlEngine
- Clears all stored type registrations, such as those produced with \l qmlRegisterType.
+ Clears all stored type registrations, such as those produced with qmlRegisterType().
Do not call this function while a QQmlEngine exists or behavior will be undefined.
Any existing QQmlEngines must be deleted before calling this function. This function
\section1 Type Names and Imported JavaScript Files
-\l {QML Document}s include import statements that define the type names
+\l {QML Documents} include import statements that define the type names
and JavaScript files visible to the document. In addition to their use in the
QML declaration itself, type names are used by JavaScript code when accessing
\l {Attached Properties} and enumeration values.
\li The 'with' statement has been deprecated and is slated for removal in a
future version of the language.
\li New \l Qt.platform object with an os property
-\li New \l qmlClearTypeRegistations() function drops all data from qmlRegisterType calls
-\li New \l qmlRegisterType function for registering composite types.
+\li New \l qmlClearTypeRegistrations() function drops all data from qmlRegisterType() calls
+\li New \l qmlRegisterType() function for registering composite types.
\endlist
\section2 New Submodule
Components are often defined by \l {{QML Documents}}{component files} -
that is, \c .qml files. The \e Component type essentially allows QML components
- to be defined inline, within a \l {QML Document}{QML document}, rather than as a separate QML file.
+ to be defined inline, within a \l {QML Documents}{QML document}, rather than as a separate QML file.
This may be useful for reusing a small component within a QML file, or for defining
a component that logically belongs with other QML components within a file.
two \l Loader objects). Because Component is not derived from Item, you cannot
anchor anything to it.
- Defining a \c Component is similar to defining a \l {QML Document}{QML document}.
+ Defining a \c Component is similar to defining a \l {QML Documents}{QML document}.
A QML document has a single top-level item that defines the behavior and
properties of that component, and cannot define properties or behavior outside
of that top-level item. In the same way, a \c Component definition contains a single
elapsed time will be reset to 0, and the Timer will be triggered
1000ms later.
- \sa {declarative/toys/clocks}{Clocks example}
+ \sa {Qt Quick Demo - Clocks}
*/
QQmlTimer::QQmlTimer(QObject *parent)
\snippet quick/views/package/view.qml 0
- \sa {quick/views/package}{Package example}, {quick/demos/photoviewer}{Photo
- Viewer example}, {Qt QML}
+ \sa {quick/views/package}{Package example}, {Qt Quick Demo - Photo Viewer}, {Qt QML}
*/
/*!
}
\endqml
- The \l{declarative/rssnews}{RSS News demo} shows how XmlListModel can
+ The \l{Qt Quick Demo - RSS News}{RSS News demo} shows how XmlListModel can
be used to display an RSS feed.
Positioner items are container items that manage the positions of
items in a declarative user interface. Positioners behave in a similar way to
-the \l{Widgets and Layouts}{layout managers} used with standard Qt widgets,
+the \l{Qt Widgets}{layout managers} used with standard Qt widgets,
except that they are also containers in their own right.
Positioners make it easier to work with many items when they need
qmlviewer myapp.qml -reverse
\endcode
-The layout direction can also be set from C++ by calling the static function \l QApplication::setLayoutDirection():
+The layout direction can also be set from C++ by calling the static function \l QGuiApplication::setLayoutDirection():
\code
QApplication app(argc, argv);
the property that is to be animated, and apply the animation depending on the
type of behavior that is required.
+\sa {Qt Quick Examples - Animation}
+
\section1 Triggering Animations
There are several ways of setting animation to an object.
\l{qml-transition-animations}{transition animations} because animations are
played in parallel inside transitions.
-See the \l {declarative/animation/basics}{Animation basics example} for a
-demonstration of creating and combining multiple animations in QML.
-
\keyword qml-controlling-animations
\section1 Controlling Animations
\page qml-tutorial.html
\title QML Tutorial
\brief An introduction to the basic concepts and features of QML.
-\previouspage Introduction to the QML Language
\nextpage QML Tutorial 1 - Basic Types
This tutorial gives an introduction to QML, the declarative language for Qt Quick. It doesn't cover everything;
as multiple frames in the same image file. You can play it at a fixed speed, at the
frame rate of your display, or manually advance and control the progress.
- For details of how a sprite animation is defined see the \l{Sprite Animation} overview.
+ For details of how a sprite animation is defined see the \l{Sprite Animations} overview.
Note that the AnimatedSprite type does not use Sprite types to define multiple animations,
but instead encapsulates a single animation itself.
*/
\image gridview-layout-toptobottom-rtl-btt.png
\endtable
- \sa {quick/modelviews/gridview}{GridView example}
+ \sa {QML Data Models}, ListView, PathView, {Qt Quick Examples - Views}
*/
QQuickGridView::QQuickGridView(QQuickItem *parent)
ParentChange that has occurred during the state change. This can be
overridden by setting a specific target item using the \l target property.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickParentAnimation::QQuickParentAnimation(QObject *parent)
: QQuickAnimationGroup(*(new QQuickParentAnimationPrivate), parent)
\image listview-layout-righttoleft.png
\endtable
- \sa {QML Data Models}, GridView, {quick/modelviews/listview}{ListView examples}
+ \sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views}
*/
QQuickListView::QQuickListView(QQuickItem *parent)
: QQuickItemView(*(new QQuickListViewPrivate), parent)
so as to stay with the current item, unless the highlightFollowsCurrentItem
property is false.
- \sa highlightItem, highlightFollowsCurrentItem, {quick/modelviews/listview}{ListView examples}
+ \sa highlightItem, highlightFollowsCurrentItem,
+ {Qt Quick Examples - Views#Highlight demonstrates adding a custom highlight to a ListView.}{ListView highlight example}
*/
/*!
to set \e {clip: true} in order to have the out of view items clipped
nicely.
- \sa Path, {quick/modelviews/pathview}{PathView example}
+ \sa Path, {QML Data Models}, ListView, GridView, {Qt Quick Examples - Views}
*/
QQuickPathView::QQuickPathView(QQuickItem *parent)
can be in the middle of an image file, or split along multiple rows, as long as they form
a contiguous line wrapping to the next row of the file from the left edge of the file.
- For full details, see the \l{Sprite Animation} overview.
+ For full details, see the \l{Sprite Animations} overview.
*/
/*!
\qmlproperty int QtQuick::Sprite::duration
SpriteSequence renders and controls a list of animations defined
by \l Sprite types.
- For full details, see the \l{Sprite Animation} overview.
+ For full details, see the \l{Sprite Animations} overview.
*/
/*!
\qmlproperty bool QtQuick::SpriteSequence::running
\image axisrotation.png
- \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {declarative/toys/clocks}{Clocks example}
+ \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {Qt Quick Demo - Clocks}
*/
QQuickRotation::QQuickRotation(QObject *parent)
: QQuickTransform(*new QQuickRotationPrivate, parent)
Grabs the contents of the window and returns it as an image.
It is possible to call the grabWindow() function when the window is not
- visible. This requires that the window is \l{QWindow::create} {created}
+ visible. This requires that the window is \l{QWindow::create()} {created}
and has a valid size and that no other QQuickWindow instances are rendering
in the same process.
}
\endcode
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickPauseAnimation::QQuickPauseAnimation(QObject *parent)
: QQuickAbstractAnimation(*(new QQuickPauseAnimationPrivate), parent)
\l{PropertyAnimation::}{properties} are explicitly set for the animation,
then those are used instead.
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickColorAnimation::QQuickColorAnimation(QObject *parent)
: QQuickPropertyAnimation(parent)
changes in the number value that it is tracking. If this is the case, use
SmoothedAnimation instead.
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickNumberAnimation::QQuickNumberAnimation(QObject *parent)
: QQuickPropertyAnimation(parent)
sources. The \l {Animation and Transitions in Qt Quick} documentation shows a
variety of methods for creating animations.
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickVector3dAnimation::QQuickVector3dAnimation(QObject *parent)
: QQuickPropertyAnimation(parent)
sources. The \l {Animation and Transitions in Qt Quick} documentation shows a
variety of methods for creating animations.
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress)
{
ParallelAnimation, it cannot be individually started and stopped; the
SequentialAnimation or ParallelAnimation must be started and stopped as a group.
- \sa ParallelAnimation, {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa ParallelAnimation, {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickSequentialAnimation::QQuickSequentialAnimation(QObject *parent) :
ParallelAnimation, it cannot be individually started and stopped; the
SequentialAnimation or ParallelAnimation must be started and stopped as a group.
- \sa SequentialAnimation, {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa SequentialAnimation, {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickParallelAnimation::QQuickParallelAnimation(QObject *parent) :
QQuickAnimationGroup(parent)
Note that PropertyAnimation inherits the abstract \l Animation type.
This includes additional properties and methods for controlling the animation.
- \sa {Animation and Transitions in Qt Quick}, {qml/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickPropertyAnimation::QQuickPropertyAnimation(QObject *parent)
sources. The \l {Animation and Transitions in Qt Quick} documentation shows a
variety of methods for creating animations.
- \sa SpringAnimation, NumberAnimation, {Animation and Transitions in Qt Quick}, {declarative/animation/basics}{Animation basics example}
+ \sa SpringAnimation, NumberAnimation, {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickSmoothedAnimation::QQuickSmoothedAnimation(QObject *parent)
sources. The \l {Animation and Transitions in Qt Quick} documentation shows a
variety of methods for creating animations.
- \sa SmoothedAnimation, {Animation and Transitions in Qt Quick}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example}
+ \sa SmoothedAnimation, {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}, {Qt Quick Demo - Clocks}
*/
QQuickSpringAnimation::QQuickSpringAnimation(QObject *parent)