1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the documentation of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:FDL$
10 ** GNU Free Documentation License
11 ** Alternatively, this file may be used under the terms of the GNU Free
12 ** Documentation License version 1.3 as published by the Free Software
13 ** Foundation and appearing in the file included in the packaging of
17 ** Alternatively, this file may be used in accordance with the terms
18 ** and conditions contained in a signed written agreement between you
26 ****************************************************************************/
29 \title What's New in Qt Quick 2
30 \page qtquick2-whatsnew.html
32 \section1 Qt 5.0.0 includes QtQuick 2.0
34 QtQuick 2.0 is a major update.
36 \section2 SceneGraph renderer
38 QtQuick 2 is based on an OpenGL scenegraph. The following
39 classes replace their equivalents in QtQuick 1:
48 \section2 QML Engine/Language Improvements
50 JS engine changed to V8.
52 Parser and compiler optimizations.
54 New binding optimizer.
56 ValueType improvements:
57 - QColor is now a value type. The red, green, blue and alpha channels can be accessed via "r", "g", "b" and "a" properties
58 - Improved support for QVector4D, now constructible in QML via Qt.vector4d()
60 Arbitrary functionality may be provided in a namespace through a Module API. See \l{qmlRegisterModuleApi()} for more information.
62 JavaScript (.js) files may now import QML modules and other JavaScript files. See \l{Importing One JavaScript File From Another} for more information.
64 QML properties of type \c variant can now hold pixmaps. See \l{Scarce Resources in JavaScript} for more information
66 QDeclarativeExpression can now be directly (and more efficiently) constructed from a
67 QDeclarativeScriptString.
71 The new \l Canvas item provides a HTML5 canvas like API, with some enhancements:
72 1) Supports 2 render targets: Canvas.Image and Canvas.FramebufferObject
73 2) Supports background thread rendering
74 3) Supports tiled canvas rendering
76 The Canvas item supports most of the HTML5 context2d APIs, the API details please look at the canvas item documentation.
79 \section2 Particle System
81 The \l{QtQuick.Particles 2}{QtQuick.Particles} module contains elements that can be composed to form 2D particle system.
84 \section2 Element API/Behavior Changes
86 New \l SpriteImage element renders animated sprites and can transition between animations.
87 It uses the \l Sprite element to represent each animation.
89 MouseArea can now propagate clicked, doubleClicked and pressAndHold differently to pressed.
90 These can now be propagated to the highest-stacking-order enabled MouseArea which has a handler for them.
91 You can still ignore these events in the handler to let them pass through.
92 This behavior is triggered with the new property propagateComposedEvents.
94 The Binding element can now be used as a value source, and will also restore any previously
95 set binding when its \i when clause becomes false.
97 Flickable: added dragging, draggingHorizontally and draggingVerically properties.
98 Added topMargin, bottomMargin, leftMargin, rightMargin, xOrigin, yOrigin properties.
100 Image has two new properties: horizontalAlignment and verticalAlignment. It also has a new value for
101 fillMode (Image.Pad) that does not transform the image.
103 Grid now has rowSpacing and columnSpacing properties.
105 Positioners now have attached properties that can be used to determine a subitem's location within a
106 container such as Column or Row: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem.
109 - "active" property added to Loader, to allow delaying instantiation of a Loader element's item property
110 - "setSource(JSObject)" method added to Loader to allow initial property values to be specified (similar to Component.createObject())
111 - now only emits the \c sourceChanged signal when the source is changed and the
112 \c sourceComponentChanged signal when the sourceComponent is changed. It used to emit both signals when one of the properties was changed.
115 - a \c onLineLaidOut handler is called for every line during the layout process. This gives the opportunity to position and resize a line as it is being laid out.
116 - a \c doLayout method was added to trigger the layout from Javascript.
117 - now automatically switch to StyledText instead of RichText if textFormat is set to AutoText.
119 PathView now has a \c currentItem property
121 ListView and GridView:
122 - now have headerItem and footerItem properties (the instantiated header and footer items).
123 - In RightToLeft layout the preferredHighlightBegin/End are now also reversed.
125 ListView section.labelPositioning property added to allow keeping the current section label
126 at the start and/or next section label at the end of the view.
128 A new property type ("var") has been introduced which obsoletes "variant" properties in QML.
129 Properties of this type are equivalent to regular JavaScript variables. See the documentation
130 on \l{QML Basic Types} for more information about "var" properties.
132 \section2 QtQuick 1 is now a separate library and module
134 Writing C++ applications using QtQuick 1 specific API, i.e. QDeclarativeView or QDeclarativeItem
135 requires adding the "qtquick1" module to the .pro file, e.g. QT += declarative qtquick1
137 QDeclarativeView and QDeclarativeItem headers are now in the QtQuick 1 module, i.e.
138 #include <QtQuick1/QDeclarativeView>
139 #include <QtQuick1/QDeclarativeItem>
141 "import QtQuick 1.0" loads the module dynamically. To deploy QtQuick 1 applications
142 the library (lib/libQtQuick1*) and plugin (imports/QtQuick/) must be installed.
144 \sa {What's New in Qt Quick 1}{What's New in Qt Quick 1}