src/declarative/QmlChanges.txt
changeset 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
       
     1 =============================================================================
       
     2 The changes below are pre Qt 4.7.0 RC
       
     3 
       
     4 Flickable:
       
     5    - overShoot is replaced by boundsBehavior enumeration
       
     6    - flickingHorizontally and flickingVertically properties added
       
     7    - movingHorizontally and movingVertically properties added
       
     8    - flickDirection is renamed flickableDirection
       
     9 Component:
       
    10     - isReady, isLoading, isError and isNull properties removed, use
       
    11       status property instead
       
    12     - errorsString() renamed to errorString()
       
    13 
       
    14 QList<QObject*> models no longer provide properties in model object.  The
       
    15 properties are now updated when the object changes.  An object's property
       
    16 "foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo"
       
    17 component.createObject has gained a mandatory "parent" argument
       
    18 
       
    19 C++ API
       
    20 -------
       
    21 QDeclarativeExpression::value() has been renamed to
       
    22 QDeclarativeExpression::evaluate()
       
    23 
       
    24 The QDeclarativeExpression constructor has changed from
       
    25     QDeclarativeExpression(context, expression, scope)
       
    26 to
       
    27     QDeclarativeExpression(context, scope, expression, parent = 0)
       
    28 
       
    29 QML Viewer
       
    30 ------------
       
    31 The standalone qml executable has been renamed back to Qml Viewer. Runtime warnings
       
    32 can be now accessed via the menu (Debugging->Show Warnings).
       
    33 
       
    34 =============================================================================
       
    35 The changes below are pre Qt 4.7.0 beta 1
       
    36 
       
    37 TextEdit: wrap property is replaced by wrapMode enumeration.
       
    38 Text: wrap property is replaced by wrapMode enumeration.
       
    39 Removed Q-prefix from validators (IntValidator, DoubleValidator, and RegExpValidator)
       
    40 PathView: offset property now uses range 0-1.0 rather than 0-100
       
    41 ListView, GridView::positionViewAtIndex() gained a 'mode' parameter
       
    42 Removed Qt.playSound (replaced by SoundEffect element)
       
    43 Removed Qt.closestAngle (use RotationAnimation instead)
       
    44 Removed NumberFormatter
       
    45 Removed DateTimeFormatter (use Qt.formatDateTime() instead)
       
    46 Using WebView now requires "import org.webkit 1.0"
       
    47 Using Particles now requires "import Qt.labs.particles 1.0"
       
    48 AnchorAnimation must now be used to animate anchor changes (and not NumberAnimation)
       
    49 Removed ParentAction (use ParentAnimation instead)
       
    50 ScriptAction: renamed stateChangeScriptName -> scriptName
       
    51 Animation: replace repeat with loops (loops: Animation.Infinite gives the old repeat behavior)
       
    52 AnchorChanges: use natural form to specify anchors (anchors.left instead of left)
       
    53 AnchorChanges: removed reset property. (reset: "left" should now be anchors.left: undefined)
       
    54 PathView: snapPosition replaced by preferredHighlightBegin, preferredHighlightEnd
       
    55 createQmlObject: Moved to the Qt object, now use Qt.createQmlObject()
       
    56 createComponent: Moved to the Qt object, now use Qt.createComponent()
       
    57 
       
    58 C++ API
       
    59 -------
       
    60 QDeclarativeContext::addDefaultObject() has been replaced with
       
    61 QDeclarativeContext::setContextObject()
       
    62 
       
    63 Behavior and Animation syntax
       
    64 -----------------------------
       
    65 Previously animations and behaviors could be "assigned" to properties like this:
       
    66     Item { x: Behavior {}; y: NumberAnimation {} }
       
    67 To make it more obvious that these are not regular value assignments a new "on"
       
    68 syntax has been introduced:
       
    69     Item { Behavior on x {}; NumberAnimation on y {} }
       
    70 Only the syntax has changed, the behavior is identical.
       
    71 
       
    72 EaseFollow renamed to SmoothedFollow
       
    73 ---------------------------------------
       
    74 This element shares the internal implementation with SmoothedAnimation,
       
    75 both providing the same easing function, but with SmoothedFollow it's
       
    76 easier to set a start value to animate intially and then start to follow,
       
    77 while SmoothedAnimation is still convenient for using inside Behaviors
       
    78 and Transitions.
       
    79 
       
    80 
       
    81 Add SmoothedAnimation element
       
    82 ---------------------------------------
       
    83 SmoothedAnimation inherits from NumberAnimaton and as a
       
    84 consequence SmoothedAnimation can be used inside Behaviors,
       
    85 as PropertySourceValues or in state transitions, like any other animation.
       
    86 
       
    87 The old EaseFollow properties changed to comply with the other declarative
       
    88 animations ('source' changed to 'to'), so now 'to' changes are not
       
    89 automatically 'followed' anymore.
       
    90 
       
    91 If you want to follow an hypothetical rect1, you should do now:
       
    92 
       
    93      Rectangle {
       
    94          color: "green"
       
    95          width: 60; height: 60;
       
    96          x: rect1.x - 5; y: rect1.y - 5;
       
    97          Behavior on x { SmoothedAnimation { velocity: 200 } }
       
    98          Behavior on y { SmoothedAnimation { velocity: 200 } }
       
    99      }
       
   100 
       
   101 instead of the old automatic source changed tracking:
       
   102 
       
   103      Rectangle {
       
   104          color: "green"
       
   105          width: 60; height: 60;
       
   106          EaseFollow on x { source: rect1.x - 5; velocity: 200 }
       
   107          EaseFollow on y { source: rect1.y - 5; velocity: 200 }
       
   108     }
       
   109 
       
   110 This is a syntax and behavior change.
       
   111 
       
   112 
       
   113 Script element removed
       
   114 ----------------------
       
   115 Inline Script{} blocks have been deprecated, and will soon be removed entirely.
       
   116 If you used Script to write inline javascript code, it can simply be removed.
       
   117 For example
       
   118 
       
   119 Item {
       
   120     Script {
       
   121         function doSomething() {}
       
   122     }
       
   123 }
       
   124 
       
   125 becomes
       
   126 
       
   127 Item {
       
   128     function doSomething() {}
       
   129 }
       
   130 
       
   131 If you used Script to include external JavaScript files, you can replace the
       
   132 Script element with an “import” line.  For example
       
   133 
       
   134 MouseArea {
       
   135     Script {
       
   136         source: “foo.js”
       
   137     }
       
   138     onClicked: foo()
       
   139 }
       
   140 
       
   141 becomes
       
   142 
       
   143 import “foo.js” as Foo
       
   144 MouseArea {
       
   145     onClicked: Foo.foo()
       
   146 }
       
   147 
       
   148 The “as” qualifier is mandatory for script imports (as opposed to type
       
   149 imports where it is optional).
       
   150 
       
   151 
       
   152 =============================================================================
       
   153 The changes below are pre Qt 4.7.0 alpha
       
   154 
       
   155 Flickable: renamed viewportWidth -> contentWidth
       
   156 Flickable: renamed viewportHeight -> contentHeight
       
   157 Flickable: renamed viewportX -> contentX
       
   158 Flickable: renamed viewportY -> contentY
       
   159 Removed Flickable.reportedVelocitySmoothing
       
   160 Renamed MouseRegion -> MouseArea
       
   161 Connection: syntax and rename:
       
   162     Connection { sender: a; signal: foo(); script: xxx }
       
   163     Connection { sender: a; signal: bar(); script: yyy }
       
   164   becomes:
       
   165     Connections { target: a; onFoo: xxx; onBar: yyy }
       
   166 
       
   167 ListView::sectionExpression has been replaced by section.property, section.criteria
       
   168 
       
   169 ListModel
       
   170 ---------
       
   171 - types are strictly checked (previously, everything was a string)
       
   172  - foo: "bar"  continues to work as before
       
   173  - foo: bar  is now invalid, use  foo: "bar"
       
   174  - foo: true  is now a bool (not string "true")
       
   175  - foo: false  is now a bool (not string "false" == true!)
       
   176 
       
   177 PropertyAnimation
       
   178 ------------------
       
   179 matchProperties and matchTargets have been renamed back to properties and targets.
       
   180 The semantics are explained in the PropertyAnimation::properties documentation
       
   181 and the animation overview documentation.
       
   182 
       
   183 Easing curves and their parameters are now specified via dot properties:
       
   184 * easing.type : enum
       
   185 * easing.amplitude : real
       
   186 * easing.overshoot : real
       
   187 * easing.period : real
       
   188 For example:
       
   189 PropertyAnimation { properties: "y"; easing.type: "InOutElastic"; easing.amplitude: 2.0; easing.period: 1.5 }
       
   190 
       
   191 C++ API
       
   192 -------
       
   193 QML_DEFINE_... definition macros, previously global macros, are replaced by
       
   194 qmlRegisterType registration functions, which must be called explicitly.
       
   195 C++ API users should also consider using the QmlExtensionPlugin (previously
       
   196 named QmlModulePlugin) as a cleaner mechanism for publishing libraries of QML
       
   197 types, or the upcoming application plugin features of the qmlviewer /
       
   198 qmlruntime / qml.
       
   199 
       
   200 QmlView
       
   201 -------
       
   202 The API of QmlView has been narrowed and its role as a convenience class
       
   203 reinforced.
       
   204 - remove addItem()
       
   205 - remove clearItems() - use 'delete root()'
       
   206 - remove reset()
       
   207 - resizeContent -> enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView }
       
   208 - remove setQml(), qml()
       
   209 - rename setUrl(), ur() to setSource(), source()
       
   210 - root() -> rootObject(),  returns QGraphicsObject rather than QmlGraphicsItem
       
   211 - remove quit() signal -> use quit() signal of engine()
       
   212 - initialSize() signal removed
       
   213 - Added status() to determine status of the internal QmlComponent
       
   214 - removed execute() - setSource() will also execute the QML.
       
   215 
       
   216 
       
   217 =============================================================================
       
   218 The changes below are pre-4.6.0 release.
       
   219 
       
   220 QML API Review
       
   221 ==============
       
   222 
       
   223 The QML API is being reviewed.  This file documents the changes.
       
   224 Note that the changes are incremental, so a rename A->B for example may be followed
       
   225 by another subsequent rename B->C, if later reviews override earlier reviews.
       
   226 
       
   227 API Changes
       
   228 ===========
       
   229 
       
   230 Renamed Elements:
       
   231 LineEdit         -> TextInput
       
   232 VerticalLayout   -> Column
       
   233 HorizontalLayout -> Row
       
   234 VerticalPositioner -> Column
       
   235 HorizontalPositioner -> Row
       
   236 GridLayout       -> Grid
       
   237 GridPositioner   -> Grid
       
   238 Rect             -> Rectangle
       
   239 FocusRealm       -> FocusScope
       
   240 FontFamily       -> FontLoader
       
   241 Palette          -> SystemPalette
       
   242 Bind             -> Binding
       
   243 SetProperties    -> PropertyChanges
       
   244 RunScript        -> StateChangeScript
       
   245 SetAnchors       -> AnchorChanges
       
   246 SetPropertyAction  -> PropertyAction
       
   247 RunScriptAction    -> ScriptAction
       
   248 ParentChangeAction -> ParentAction
       
   249 VisualModel        -> VisualDataModel
       
   250 Follow             -> SpringFollow
       
   251 
       
   252 Renamed properties:
       
   253 Item: contents         -> childrenRect
       
   254 MouseRegion: xmin      -> minimumX
       
   255 MouseRegion: xmax      -> maximumX
       
   256 MouseRegion: ymin      -> minimumY
       
   257 MouseRegion: ymin      -> maximumY
       
   258 Text elements: hAlign  -> horizontalAlignment
       
   259 Text elements: vAlign  -> verticalAlignment
       
   260 Text elements: highlightColor -> selectionColor
       
   261 Text elements: highlightedTextColor -> selectedTextColor
       
   262 Text elements: preserveSelection -> persistentSelection
       
   263 State: operations      -> changes
       
   264 Transition: operations -> animations
       
   265 Transition: fromState  -> from
       
   266 Transition: toState    -> to
       
   267 Follow: followValue    -> value
       
   268 Flickable: xPosition   -> viewportX
       
   269 Flickable: yPosition   -> viewportY
       
   270 Flickable: xVelocity   -> horizontalVelocity
       
   271 Flickable: yVelocity   -> verticalVelocity
       
   272 Flickable: velocityDecay -> reportedVelocitySmoothing
       
   273 Flickable: locked      -> interactive (note reversal of meaning)
       
   274 Flickable: pageXPosition -> visibleArea.xPosition
       
   275 Flickable: pageYPosition -> visibleArea.yPosition
       
   276 Flickable: pageWidth    -> visibleArea.widthRatio
       
   277 Flickable: pageHeight   -> visibleArea.heightRatio
       
   278 WebView: idealWidth    -> preferredWidth
       
   279 WebView: idealHeight   -> preferredHeight
       
   280 WebView: status        -> statusText
       
   281 WebView: mouseX        -> clickX (parameter to onDoubleClick)
       
   282 WebView: mouseY        -> clickY (parameter to onDoubleClick)
       
   283 WebView: cacheSize     -> pixelCacheSize
       
   284 Repeater: component    -> delegate
       
   285 Repeater: dataSource   -> model
       
   286 ListView: current      -> currentItem
       
   287 GridView: current      -> currentItem
       
   288 ListView: wrap         -> keyNavigationWraps
       
   289 ListView: autoHighlight -> highlightFollowsCurrentItem
       
   290 GridView: wrap         -> keyNavigationWraps
       
   291 GridView: autoHighlight -> highlightFollowsCurrentItem
       
   292 Animation: targets -> matchTargets
       
   293 Animation: properties -> matchProperties
       
   294 
       
   295 Additions:
       
   296 MouseRegion: add "acceptedButtons" property
       
   297 MouseRegion: add "hoverEnabled" property
       
   298 MouseRegion: add "pressedButtons" property
       
   299 Timer: add start() and stop() slots
       
   300 WebView: add newWindowComponent and newWindowParent properties
       
   301 Loader: add status() and progress() properties
       
   302 Loader: add sourceComponent property
       
   303 Loader: add resizeMode property
       
   304 ListView: preferredHighlightBegin, preferredHighlightEnd
       
   305 ListView: strictlyEnforceHighlightRange
       
   306 Particles: Added emissionRate, emissionVariance and burst()
       
   307 
       
   308 Deletions:
       
   309 Column/VerticalPositioner: lost "margins" property
       
   310 Row/HorizontalPositioner: lost "margins" property
       
   311 Grid/Positioner/Layout: lost "margins" property
       
   312 WebView: lost "interactive" property (always true now)
       
   313 Flickable: removed "dragMode" property
       
   314 ComponentInstance: removed.  Replaced by Loader.sourceComponent
       
   315 ListView: removed currentItemMode.  Replaced by highligh range.
       
   316 ListView: removed snapPos.
       
   317 Particles: removed streamIn. Replaced by emissionRate
       
   318 
       
   319 Other Changes:
       
   320 ids must be lowercase: Text { id: foo }, not Text { id: Foo }
       
   321 Drag: axis becomes an enum with values "XAxis", "YAxis", "XandYAxis"
       
   322 Image: scaleGrid property removed. New item called BorderImage instead.
       
   323 KeyActions: changed to a Keys attached property on any item.
       
   324 KeyProxy: changed to a Keys.forwardTo property on any item.
       
   325 Script: now an intrinsic type in the language
       
   326  - cannot be assigned to properties
       
   327  - good: Item { Script { ... } }
       
   328  - bad:  Item { resources: Script { ... } }
       
   329 Script: delay-loaded of the QML file until their source has been loaded (this only effects QML files loaded across the network.)
       
   330 Scope: declared properties shadow a property of the same name (was previously the reverse)
       
   331 ScriptAction and StateChangeScript: the script property now takes script rather than a string containing script (script: doSomething() rather than script: "doSomething()")
       
   332 QmlGraphicsItem::transformOrigin default changed from TopLeft to Center
       
   333 Animations used as PropertySourceValues are set to 'running: true' as default