2011-09-27 11:56:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2011-09-27 11:56:42 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator
|
2011-09-27 11:56:42 +02:00
|
|
|
**
|
|
|
|
**
|
|
|
|
** 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.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
// **********************************************************************
|
|
|
|
// NOTE: the sections are not ordered by their logical order to avoid
|
|
|
|
// reshuffling the file each time the index order changes (i.e., often).
|
|
|
|
// Run the fixnavi.pl script to adjust the links to the index order.
|
|
|
|
// **********************************************************************
|
|
|
|
|
|
|
|
/*!
|
2014-03-17 12:18:12 +01:00
|
|
|
\contentspage {Qt Creator Manual}
|
2011-11-29 14:13:59 +01:00
|
|
|
\previouspage creator-tutorials.html
|
2015-06-26 15:38:24 +02:00
|
|
|
\example transitions
|
2012-08-23 16:10:58 +02:00
|
|
|
\nextpage creator-writing-program.html
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-03-06 15:48:13 +01:00
|
|
|
\title Creating a Qt Quick Application
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-03-13 11:39:36 +01:00
|
|
|
This tutorial uses built-in QML types and illustrates basic concepts of
|
2013-11-25 17:37:19 +01:00
|
|
|
\l{Qt Quick}.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
This tutorial describes how to use \QC to implement Qt Quick states and
|
|
|
|
transitions. We
|
2013-03-06 15:48:13 +01:00
|
|
|
create an application that displays a Qt logo that moves between three rectangles on the
|
|
|
|
page when you click them.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\image qmldesigner-tutorial.png "States and transitions example"
|
|
|
|
|
|
|
|
For more information about using \QMLD, see
|
|
|
|
\l{Developing Qt Quick Applications}.
|
|
|
|
|
2015-06-26 14:40:35 +02:00
|
|
|
For tutorials that describe using Qt Quick Controls, see
|
|
|
|
\l{Qt Quick Text Editor Guide} and \l{Qt Quick Controls - UI Forms}.
|
|
|
|
|
2011-09-27 11:56:42 +02:00
|
|
|
\section1 Creating the Project
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Select \uicontrol{File > New File or Project > Application >
|
2015-09-29 19:46:34 +08:00
|
|
|
Qt Quick Controls Application > Choose}.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol{Name} field, type \e {Transitions}.
|
2011-11-15 09:48:08 +01:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol {Create in} field, enter the path for the project files.
|
|
|
|
For example, \c {C:\Qt\examples}, and then click \uicontrol{Next} (on
|
|
|
|
Windows and Linux) or \uicontrol Continue (on OS X).
|
2011-11-15 09:48:08 +01:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol {Minimal required Qt version} field, select the Qt
|
|
|
|
version to develop with.
|
2013-11-05 12:55:47 +01:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\note This page determines the set of files that the wizard
|
2015-05-04 11:39:53 +02:00
|
|
|
generates and their contents. The instructions in this tutorial
|
2015-06-26 15:38:24 +02:00
|
|
|
might not apply if you select the \uicontrol {With .ui.qml file}
|
|
|
|
check box.
|
2015-05-04 11:39:53 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select \l{glossary-buildandrun-kit}{kits} for running and building your project,
|
2014-12-11 15:43:19 +01:00
|
|
|
and then click \uicontrol{Next}.
|
2011-11-15 09:48:08 +01:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\note Kits are listed if they have been specified in \uicontrol Tools >
|
|
|
|
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol Kits (on Windows and Linux)
|
|
|
|
or in \uicontrol {Qt Creator} > \uicontrol Preferences \uicontrol {Build & Run} >
|
|
|
|
\uicontrol Kits (on OS X).
|
2011-11-15 09:48:08 +01:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Select \uicontrol Next in the following dialogs to use the default
|
2011-11-15 09:48:08 +01:00
|
|
|
settings.
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Review the project settings, and click \uicontrol{Finish} (on Windows and
|
|
|
|
Linux) or \uicontrol Done (on OS X) to create the project.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-06-13 17:36:37 +02:00
|
|
|
\li Press \key {Ctrl+R} (or \key {Cmd+R}) to run the application.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
\QC generates a default QML file that you can modify to create the main view
|
|
|
|
of the application.
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial-project.png "Transitions project in Edit mode"
|
|
|
|
|
|
|
|
\section1 Creating the Main View
|
|
|
|
|
|
|
|
The main view of the application displays a Qt logo in the top left corner
|
|
|
|
of the screen and two empty rectangles.
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
To use the states.svg image in your application, you must copy it to the
|
2011-09-27 11:56:42 +02:00
|
|
|
project directory (same subdirectory as the QML file) from the examples
|
|
|
|
directory in the Qt installation directory. For example:
|
2015-05-04 11:39:53 +02:00
|
|
|
\c {C:\Qt\Examples\Qt-5.4\declarative\animation\states}. The image appears
|
2014-12-11 15:43:19 +01:00
|
|
|
in \uicontrol Resources. You can also use any other image or a QML
|
2013-03-13 11:39:36 +01:00
|
|
|
type, instead.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Projects view, double-click the main.qml file
|
2011-09-27 11:56:42 +02:00
|
|
|
to open it in the code editor.
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Click \uicontrol Design to open the file in \QMLD.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-15 11:12:42 +01:00
|
|
|
\image qmldesigner-tutorial-design-mode.png "Transitions project in Design Mode"
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Navigator, select \uicontrol Label and press
|
|
|
|
\key Delete to delete it.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li Select \uicontrol ApplicationWindow to edit its properties.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\image qmldesigner-tutorial-page.png "Page properties"
|
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Id field, enter \e page, to be able to reference the
|
2014-04-08 16:08:32 +02:00
|
|
|
window from other places.
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Title field, type \e Transitions.
|
|
|
|
|
|
|
|
\li In the \uicontrol Size field, set \uicontrol W and \uicontrol H
|
|
|
|
to \e 330.
|
|
|
|
|
2015-05-04 11:39:53 +02:00
|
|
|
\li In the \uicontrol Color field, set the window background color
|
2015-06-26 15:38:24 +02:00
|
|
|
to \e #343434.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In \uicontrol Library > \uicontrol Resources, select states.svg and
|
2011-09-27 11:56:42 +02:00
|
|
|
drag and drop it to the canvas.
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial-user-icon.png "Image properties"
|
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Id field, enter \e icon.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Position field, set \uicontrol X to \e 10 and
|
|
|
|
\uicontrol Y to \e 20.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2015-05-04 11:39:53 +02:00
|
|
|
\li Right-click the resource file, qml.qrc, in the \uicontrol Projects
|
2015-06-26 15:38:24 +02:00
|
|
|
view, and select \uicontrol {Open in Editor} to add states.svg to
|
2015-05-04 11:39:53 +02:00
|
|
|
the resource file for deployment.
|
2014-04-08 16:08:32 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li Click \uicontrol Add > \uicontrol {Add File} and select
|
|
|
|
\e states.svg.
|
2014-04-08 16:08:32 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Design mode, \uicontrol Library view, \uicontrol {QML Types} tab,
|
|
|
|
select \uicontrol Rectangle,
|
2011-09-27 11:56:42 +02:00
|
|
|
drag and drop it to the canvas, and edit its properties.
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial-topleftrect.png "Rectangle properties"
|
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Id field, enter \e topLeftRect.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Size field, set \uicontrol W and \uicontrol H
|
|
|
|
to \e 44, for the rectangle size to match the image size.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Color field, click the
|
2011-09-27 11:56:42 +02:00
|
|
|
\inlineimage qmldesigner-transparent-button.png
|
2014-12-11 15:43:19 +01:00
|
|
|
(\uicontrol Transparent) button to make the rectangle transparent.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Border field, set the border color to
|
|
|
|
\e #808080.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Rectangle group, \uicontrol Border field, set the border
|
2015-06-26 15:38:24 +02:00
|
|
|
width to \e 1.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Radius field, select \e 6 to create rounded
|
|
|
|
corners for the rectangle.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Click \uicontrol {Layout}, and then click the top and left anchor
|
2011-09-27 11:56:42 +02:00
|
|
|
buttons to anchor the rectangle to the top left corner of the
|
|
|
|
page.
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial-topleftrect-layout.png "Layout tab"
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Margin field, select \e 20 for the top anchor
|
|
|
|
and \e 10 for the left anchor.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2015-05-04 11:39:53 +02:00
|
|
|
\li Drag and drop a \uicontrol {Mouse Area} type from the
|
|
|
|
\uicontrol Library to \e topLeftRect in the \uicontrol Navigator.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Edit the \uicontrol {Mouse Area} properties:
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Click \uicontrol {Layout}, and then click the
|
2011-09-27 11:56:42 +02:00
|
|
|
\inlineimage qmldesigner-anchor-fill-screen.png
|
2014-12-11 15:43:19 +01:00
|
|
|
(\uicontrol {Fill to Parent}) button to anchor the mouse area to the
|
2012-03-08 16:07:16 +01:00
|
|
|
rectangle.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In the code editor, edit the pointer to the clicked expression
|
2013-03-13 11:39:36 +01:00
|
|
|
in the mouse area, as illustrated by the following code
|
2011-09-27 11:56:42 +02:00
|
|
|
snippet:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\quotefromfile transitions/main.qml
|
|
|
|
\skipto MouseArea
|
|
|
|
\printuntil }
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
The expression sets the state to the base state and returns the
|
|
|
|
image to its initial position.
|
2014-04-08 16:08:32 +02:00
|
|
|
You will create stateGroup later.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2011-11-16 10:32:37 +01:00
|
|
|
The qml.main file should now look as follows:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\quotefromfile transitions/main.qml
|
|
|
|
\skipto Window {
|
2015-05-04 11:39:53 +02:00
|
|
|
\printuntil mouseArea1
|
2014-04-08 16:08:32 +02:00
|
|
|
\printuntil }
|
2011-11-16 10:32:37 +01:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Navigator, copy topLeftRect (by pressing
|
2011-09-27 11:56:42 +02:00
|
|
|
\key {Ctrl+C}) and paste it to the canvas twice (by pressing
|
2013-03-13 11:39:36 +01:00
|
|
|
\key {Ctrl+V}). \QC renames the new instances of the type
|
2011-09-27 11:56:42 +02:00
|
|
|
topLeftRect1 and topLeftRect2.
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select topLeftRect1 and edit its properties:
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Id field, enter \e middleRightRect.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In \uicontrol {Layout}, select the vertical center anchor button and
|
2011-09-27 11:56:42 +02:00
|
|
|
then the right anchor button to
|
|
|
|
anchor the rectangle to the middle right margin of the screen.
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Margin field, select \e 10 for the right
|
|
|
|
anchor and \e 0 for the vertical center anchor.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-06-13 17:36:37 +02:00
|
|
|
\li In the code editor, add a pointer to a clicked expression to the
|
2013-03-13 11:39:36 +01:00
|
|
|
mouse area. The following expression sets the state to
|
2011-09-27 11:56:42 +02:00
|
|
|
\e State1:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\c {onClicked: stateGroup.state = 'State1'}
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
You will create State1 later.
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select topLeftRect2 and edit its properties:
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Id field, enter \e bottomLeftRect.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In \uicontrol {Layout}, select the bottom and left anchor buttons to
|
2011-09-27 11:56:42 +02:00
|
|
|
anchor the rectangle to the bottom left margin of the screen.
|
|
|
|
|
2015-06-26 15:38:24 +02:00
|
|
|
\li In the \uicontrol Margin field, select \e 20 for the bottom
|
|
|
|
anchor and \e 10 for the left anchor.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In the code editor, add a pointer to a clicked expression to the
|
2013-03-13 11:39:36 +01:00
|
|
|
mouse area. The following expression sets the state to
|
2011-09-27 11:56:42 +02:00
|
|
|
\e State2:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\c {onClicked: stateGroup.state = 'State2'}
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
You will create State2 later.
|
|
|
|
|
2011-11-16 10:32:37 +01:00
|
|
|
The qml.main file should now look as follows:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\quotefromfile transitions/main.qml
|
|
|
|
\skipto Window {
|
2015-05-04 11:39:53 +02:00
|
|
|
\printuntil mouseArea3
|
2014-04-08 16:08:32 +02:00
|
|
|
\printuntil }
|
|
|
|
\printuntil }
|
2011-11-16 10:32:37 +01:00
|
|
|
|
2011-09-27 11:56:42 +02:00
|
|
|
\endlist
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Press \key {Ctrl+S} to save the changes.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Press \key {Ctrl+R} to run the application.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial.png "States and transitions example"
|
|
|
|
|
|
|
|
You should see the Qt logo in the top left rectangle, and two additional
|
|
|
|
rectangles in the center right and bottom left of the screen.
|
|
|
|
|
|
|
|
You can now create additional states to add views to the application.
|
|
|
|
|
|
|
|
\section1 Adding Views
|
|
|
|
|
|
|
|
In the .qml file, you already created pointers to two additional states:
|
2014-04-08 16:08:32 +02:00
|
|
|
State1 and State2. You cannot use the \QMLD to add states for a Window QML
|
|
|
|
type. Use the code editor to add the states inside a StateGroup QML type and
|
|
|
|
refer to them by using the id of the state group:
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\li Bind the position of the Qt logo to the
|
2011-09-27 11:56:42 +02:00
|
|
|
rectangle to make sure that the logo is displayed within the
|
|
|
|
rectangle when the view is scaled on different sizes of screens. Set
|
|
|
|
expressions for the x and y properties, as illustrated by the
|
|
|
|
following code snippet:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\quotefromfile transitions/main.qml
|
|
|
|
\skipto StateGroup {
|
|
|
|
\printuntil ]
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Press \key {Ctrl+R} to run the application.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
Click the rectangles to move the Qt logo from one rectangle to another.
|
|
|
|
|
|
|
|
\section1 Adding Animation to the View
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
Add transitions inside the state group to define how the properties change
|
|
|
|
when the Qt logo moves
|
2011-09-27 11:56:42 +02:00
|
|
|
between states. The transitions apply animations to the Qt logo. For example,
|
|
|
|
the Qt logo bounces back when it moves to the middleRightRect and eases into
|
|
|
|
bottomLeftRect. Add the transitions in the code editor.
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li In the code editor, add the following code to specify that when
|
2011-09-27 11:56:42 +02:00
|
|
|
moving to State1, the x and y coordinates of the Qt logo change
|
|
|
|
linearly over a duration of 1 second:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\dots
|
|
|
|
\skipto transitions
|
|
|
|
\printuntil },
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li You can use the Qt Quick toolbar for animation to change the easing
|
2011-09-27 11:56:42 +02:00
|
|
|
curve type from linear to OutBounce:
|
|
|
|
|
|
|
|
\list a
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Click \uicontrol NumberAnimation in the code editor to display the
|
2011-09-27 11:56:42 +02:00
|
|
|
\inlineimage qml-toolbar-indicator.png
|
|
|
|
icon, and then click the icon to open the toolbar:
|
|
|
|
|
|
|
|
\image qmldesigner-tutorial-quick-toolbar.png "Qt Quick toolbar for animation"
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Easing field, select \uicontrol Bounce.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Subtype field, select \uicontrol Out.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Add the following code to specify that when moving to State2, the x
|
2011-09-27 11:56:42 +02:00
|
|
|
and y coordinates of the Qt logo change over a duration of 2
|
|
|
|
seconds, and an InOutQuad easing function is used:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\dots
|
|
|
|
\printuntil },
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Add the following code to specify that for any other state changes,
|
2011-09-27 11:56:42 +02:00
|
|
|
the x and y coordinates of the Qt logo change linearly over a
|
|
|
|
duration of 200 milliseconds:
|
|
|
|
|
2014-04-08 16:08:32 +02:00
|
|
|
\dots
|
|
|
|
\printuntil ]
|
2011-09-27 11:56:42 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Press \key {Ctrl+R} to run the application.
|
2011-09-27 11:56:42 +02:00
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
Click the rectangles to view the animated transitions.
|
|
|
|
*/
|