49ef474a676325d9682970f0a74fcdff5c7f08f2
[profile/ivi/qtdeclarative.git] / doc / src / declarative / whatsnew.qdoc
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
6 **
7 ** This file is part of the documentation of the Qt Toolkit.
8 **
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
14 ** this file.
15 **
16 ** Other Usage
17 ** Alternatively, this file may be used in accordance with the terms
18 ** and conditions contained in a signed written agreement between you
19 ** and Nokia.
20 **
21 **
22 **
23 **
24 ** $QT_END_LICENSE$
25 **
26 ****************************************************************************/
27
28 /*!
29 \title What's New in Qt Quick 2
30 \page qtquick2-whatsnew.html
31 \inqmlmodule QtQuick 2
32
33 \section1 Qt 5.0.0 includes QtQuick 2.0
34
35 QtQuick 2.0 is a major update.
36
37 \section2 SceneGraph renderer
38
39 QtQuick 2 is based on an OpenGL scenegraph.  The following
40 classes replace their equivalents in QtQuick 1:
41
42 \list
43 \o QQuickView
44 \o QQuickCanvas
45 \o QQuickItem
46 \o QQuickPaintedItem
47 \endlist
48
49 \section2 QML Engine/Language Improvements
50
51 JS engine changed to V8. For most QML users this should not make a visible difference beyond performance improvements, however a lot of undefined behavior semantics may have changed as well. As always, it is recommended not to rely on undefined behavior.
52
53 Parser and compiler optimizations.
54
55 New binding optimizer.
56
57 ValueType improvements:
58  - QColor is now a value type.  The red, green, blue and alpha channels can be accessed via "r", "g", "b" and "a" properties
59  - Improved support for QVector4D, now constructible in QML via Qt.vector4d()
60
61 Arbitrary functionality may be provided in a namespace through a Module API.  See \l{qmlRegisterModuleApi()} for more information.
62
63 JavaScript (.js) files may now import QML modules and other JavaScript files.  See \l{Importing One JavaScript File From Another} for more information.
64
65 A new property type "var" has been added which obsoletes the old "variant" property type.
66 Properties of the "var" type may hold JavaScript references.  See \l{QML Basic Types} for more information.
67
68 QML properties of type \c var and \c variant can now hold pixmaps.  See \l{Scarce Resources in JavaScript} for more information
69
70 QDeclarativeExpression can now be directly (and more efficiently) constructed from a
71 QDeclarativeScriptString.
72
73 Support for certain sequence types (QList<int>, QList<qreal>, QList<bool>, QList<QUrl>, QList<QString> and QStringList) has been improved.
74 QObjects can define Q_PROPERTYs of these types which can be accessed transparently from JavaScript.  See the section on
75 sequences in \l{Extending QML Functionalities using C++} for more information.
76
77 \section2 Canvas Item
78
79 The new \l Canvas item provides a HTML5 canvas like API, with some enhancements:
80 1) Supports 2 render targets: Canvas.Image and Canvas.FramebufferObject
81 2) Supports background thread rendering
82 3) Supports tiled canvas rendering
83
84 The Canvas item supports most of the HTML5 context2d APIs, the API details please look at the canvas item documentation.
85
86
87 \section2 Particle System
88
89 The \l{QtQuick.Particles 2}{QtQuick.Particles} module contains elements that can be composed to form 2D particle system.
90
91
92 \section2 Element API/Behavior Changes
93
94 New \l SpriteImage element renders animated sprites and can transition between animations.
95 It uses the \l Sprite element to represent each animation.
96
97 MouseArea can now propagate clicked, doubleClicked and pressAndHold differently to pressed. 
98 These can now be propagated to the highest-stacking-order enabled MouseArea which has a handler for them.
99 You can still ignore these events in the handler to let them pass through.
100 This behavior is triggered with the new property propagateComposedEvents.
101
102 The Binding element can now be used as a value source, and will also restore any previously
103 set binding when its \i when clause becomes false.
104
105 Flickable: added dragging, draggingHorizontally and draggingVerically properties.
106 Added topMargin, bottomMargin, leftMargin, rightMargin, xOrigin, yOrigin properties.
107
108 Image has two new properties: horizontalAlignment and verticalAlignment. It also has a new value for
109 fillMode (Image.Pad) that does not transform the image.
110
111 Grid now has rowSpacing and columnSpacing properties.
112
113 Positioners now have attached properties that can be used to determine a subitem's location within a
114 container such as Column or Row: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem.
115
116 Loader improvements:
117  - "active" property added to Loader, to allow delaying instantiation of a Loader element's item property
118  - "setSource(JSObject)" method added to Loader to allow initial property values to be specified (similar to Component.createObject())
119  - now only emits the \c sourceChanged signal when the source is changed and the
120 \c sourceComponentChanged signal when the sourceComponent is changed. It used to emit both signals when one of the properties was changed.
121
122 Text improvements:
123  - 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.
124  - a \c doLayout method was added to trigger the layout from Javascript.
125  - now automatically switch to StyledText instead of RichText if textFormat is set to AutoText.
126
127 TextEdit:
128  - the default value of the textFormat property is now PlainText instead of AutoText.
129
130 TextInput has new wrapMode and verticalAlignment properties, and the positionAt function now takes
131 a y parameter.
132
133 PathView now has a \c currentItem property
134
135 ListView and GridView:
136  - now have headerItem and footerItem properties (the instantiated header and footer items).
137  - In RightToLeft layout the preferredHighlightBegin/End are now also reversed.
138
139 ListView section.labelPositioning property added to allow keeping the current section label
140 at the start and/or next section label at the end of the view.
141
142 A new property type ("var") has been introduced which obsoletes "variant" properties in QML.
143 Properties of this type are equivalent to regular JavaScript variables.  See the documentation
144 on \l{QML Basic Types} for more information about "var" properties.
145
146 New elements have been added for contructing paths: PathArc, PathCurve, PathSvg.
147
148 \section2 QtQuick 1 is now a separate library and module
149
150 Writing C++ applications using QtQuick 1 specific API, i.e. QDeclarativeView or QDeclarativeItem
151 requires adding the "qtquick1" module to the .pro file, e.g. QT += declarative qtquick1
152
153 QDeclarativeView and QDeclarativeItem headers are now in the QtQuick 1 module, i.e.
154 #include <QtQuick1/QDeclarativeView>
155 #include <QtQuick1/QDeclarativeItem>
156
157 "import QtQuick 1.0" loads the module dynamically.  To deploy QtQuick 1 applications
158 the library (lib/libQtQuick1*) and plugin (imports/QtQuick/) must be installed.
159
160 \sa {What's New in Qt Quick 1}{What's New in Qt Quick 1}
161
162 */