aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.1.022
-rw-r--r--examples/HACKING2
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc (renamed from examples/quick/doc/src/qml-extending.qdoc)36
-rw-r--r--examples/qml/tutorials/extending/chapter1-basics/app.qml (renamed from examples/quick/tutorials/extending/chapter1-basics/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro (renamed from examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter1-basics/main.cpp (renamed from examples/quick/tutorials/extending/chapter1-basics/main.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter1-basics/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter1-basics/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter1-basics/piechart.h (renamed from examples/quick/tutorials/extending/chapter1-basics/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter2-methods/app.qml (renamed from examples/quick/tutorials/extending/chapter2-methods/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro (renamed from examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter2-methods/main.cpp (renamed from examples/quick/tutorials/extending/chapter2-methods/main.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter2-methods/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter2-methods/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter2-methods/piechart.h (renamed from examples/quick/tutorials/extending/chapter2-methods/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter3-bindings/app.qml (renamed from examples/quick/tutorials/extending/chapter3-bindings/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro (renamed from examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter3-bindings/main.cpp (renamed from examples/quick/tutorials/extending/chapter3-bindings/main.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter3-bindings/piechart.h (renamed from examples/quick/tutorials/extending/chapter3-bindings/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h (renamed from examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/app.qml (renamed from examples/quick/tutorials/extending/chapter5-listproperties/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro (renamed from examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/main.cpp (renamed from examples/quick/tutorials/extending/chapter5-listproperties/main.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/piechart.h (renamed from examples/quick/tutorials/extending/chapter5-listproperties/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp (renamed from examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h (renamed from examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/Charts/qmldir (renamed from examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/app.qml (renamed from examples/quick/tutorials/extending/chapter6-plugins/app.qml)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro (renamed from examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp (renamed from examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h (renamed from examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp (renamed from examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/piechart.h (renamed from examples/quick/tutorials/extending/chapter6-plugins/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp (renamed from examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp)0
-rw-r--r--examples/qml/tutorials/extending/chapter6-plugins/pieslice.h (renamed from examples/quick/tutorials/extending/chapter6-plugins/pieslice.h)0
-rw-r--r--examples/qml/tutorials/extending/extending.pro (renamed from examples/quick/tutorials/extending/extending.pro)0
-rw-r--r--examples/quick/accessibility/doc/src/accessibility.qdoc4
-rw-r--r--examples/quick/animation/doc/src/animation.qdoc20
-rw-r--r--examples/quick/canvas/doc/src/canvas.qdoc10
-rw-r--r--examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml5
-rw-r--r--examples/quick/customitems/maskedmousearea/maskedmousearea.cpp4
-rw-r--r--examples/quick/customitems/painteditem/painteditem.pro3
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.pro19
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.qml11
-rw-r--r--examples/quick/demos/calqlatr/content/Display.qml20
-rw-r--r--examples/quick/demos/calqlatr/content/NumberPad.qml2
-rw-r--r--examples/quick/demos/calqlatr/content/calculator.js8
-rw-r--r--examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png (renamed from examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png)bin37120 -> 37120 bytes
-rw-r--r--examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc10
-rw-r--r--examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.pngbin0 -> 26067 bytes
-rw-r--r--examples/quick/demos/clocks/doc/src/clocks.qdoc35
-rw-r--r--examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.pngbin0 -> 73390 bytes
-rw-r--r--examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.pngbin0 -> 61303 bytes
-rw-r--r--examples/quick/demos/maroon/doc/src/maroon.qdoc36
-rw-r--r--examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png (renamed from examples/quick/demos/photosurface/doc/images/qml-photosurface-example-small.png)bin47271 -> 47271 bytes
-rw-r--r--examples/quick/demos/photosurface/doc/src/photosurface.qdoc8
-rw-r--r--examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.pngbin0 -> 73662 bytes
-rw-r--r--examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc35
-rw-r--r--examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.pngbin0 -> 43372 bytes
-rw-r--r--examples/quick/demos/rssnews/doc/src/rssnews.qdoc35
-rw-r--r--examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.pngbin0 -> 100713 bytes
-rw-r--r--examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.pngbin0 -> 134892 bytes
-rw-r--r--examples/quick/demos/samegame/doc/src/samegame.qdoc36
-rw-r--r--examples/quick/demos/stocqt/content/CheckBox.qml21
-rw-r--r--examples/quick/demos/stocqt/content/StockSettings.qml3
-rw-r--r--examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.pngbin0 -> 24592 bytes
-rw-r--r--examples/quick/demos/stocqt/doc/src/stocqt.qdoc35
-rw-r--r--examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.pngbin0 -> 18531 bytes
-rw-r--r--examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.pngbin0 -> 90622 bytes
-rw-r--r--examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc36
-rw-r--r--examples/quick/dialogs/ColorDialogs.qml40
-rw-r--r--examples/quick/dialogs/FileDialogs.qml79
-rw-r--r--examples/quick/dialogs/dialogs.pro17
-rw-r--r--examples/quick/dialogs/dialogs.qml (renamed from examples/quick/window/window/Window.qml)25
-rw-r--r--examples/quick/dialogs/dialogs.qrc7
-rw-r--r--examples/quick/dialogs/doc/images/dialogs-example.jpgbin0 -> 47413 bytes
-rw-r--r--examples/quick/dialogs/doc/src/dialogs.qdoc44
-rw-r--r--examples/quick/dialogs/main.cpp (renamed from src/qml/doc/snippets/qml/qtbinding/resources/main.qml)11
-rw-r--r--examples/quick/draganddrop/doc/src/draganddrop.qdoc10
-rw-r--r--examples/quick/imageelements/doc/src/imageelements.qdoc10
-rw-r--r--examples/quick/mousearea/doc/src/mousearea.qdoc4
-rw-r--r--examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc18
-rw-r--r--examples/quick/particles/affectors/content/attractor.qml6
-rw-r--r--examples/quick/particles/affectors/content/groupgoal.qml4
-rw-r--r--examples/quick/particles/affectors/content/move.qml6
-rw-r--r--examples/quick/particles/affectors/content/spritegoal.qml4
-rw-r--r--examples/quick/particles/affectors/content/turbulence.qml4
-rw-r--r--examples/quick/particles/affectors/doc/src/affectors.qdoc34
-rw-r--r--examples/quick/particles/customparticle/content/imagecolors.qml2
-rw-r--r--examples/quick/particles/customparticle/doc/src/customparticle.qdoc10
-rw-r--r--examples/quick/particles/emitters/content/burstandpulse.qml2
-rw-r--r--examples/quick/particles/emitters/content/customemitter.qml2
-rw-r--r--examples/quick/particles/emitters/content/emitmask.qml2
-rw-r--r--examples/quick/particles/emitters/content/maximumemitted.qml2
-rw-r--r--examples/quick/particles/emitters/content/shapeanddirection.qml2
-rw-r--r--examples/quick/particles/emitters/content/trailemitter.qml4
-rw-r--r--examples/quick/particles/emitters/content/velocityfrommotion.qml8
-rw-r--r--examples/quick/particles/emitters/doc/src/emitters.qdoc12
-rw-r--r--examples/quick/particles/imageparticle/content/colored.qml4
-rw-r--r--examples/quick/particles/imageparticle/content/colortable.qml2
-rw-r--r--examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc14
-rw-r--r--examples/quick/particles/images.qrc3
-rw-r--r--examples/quick/particles/system/content/dynamiccomparison.qml4
-rw-r--r--examples/quick/particles/system/content/dynamicemitters.qml2
-rw-r--r--examples/quick/particles/system/content/multiplepainters.qml2
-rw-r--r--examples/quick/particles/system/content/startstop.qml2
-rw-r--r--examples/quick/particles/system/content/timedgroupchanges.qml2
-rw-r--r--examples/quick/particles/system/doc/src/system.qdoc12
-rw-r--r--examples/quick/positioners/doc/src/positioners.qdoc8
-rw-r--r--examples/quick/quick.pro1
-rw-r--r--examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc32
-rw-r--r--examples/quick/scenegraph/graph/doc/images/graph-example.jpgbin0 -> 18923 bytes
-rw-r--r--examples/quick/scenegraph/graph/doc/src/graph.qdoc38
-rw-r--r--examples/quick/scenegraph/graph/graph.cpp128
-rw-r--r--examples/quick/scenegraph/graph/graph.h67
-rw-r--r--examples/quick/scenegraph/graph/graph.pro34
-rw-r--r--examples/quick/scenegraph/graph/graph.qrc9
-rw-r--r--examples/quick/scenegraph/graph/gridnode.cpp95
-rw-r--r--examples/quick/scenegraph/graph/gridnode.h59
-rw-r--r--examples/quick/scenegraph/graph/linenode.cpp151
-rw-r--r--examples/quick/scenegraph/graph/linenode.h58
-rw-r--r--examples/quick/scenegraph/graph/main.cpp60
-rw-r--r--examples/quick/scenegraph/graph/main.qml85
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp142
-rw-r--r--examples/quick/scenegraph/graph/noisynode.h56
-rw-r--r--examples/quick/scenegraph/graph/shaders/line.fsh (renamed from examples/quick/window/window/nogui.qml)20
-rw-r--r--examples/quick/scenegraph/graph/shaders/line.vsh (renamed from src/qml/doc/snippets/qml/qtbinding/resources/main.cpp)27
-rw-r--r--examples/quick/scenegraph/graph/shaders/noisy.fsh55
-rw-r--r--examples/quick/scenegraph/graph/shaders/noisy.vsh54
-rw-r--r--examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc32
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp11
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h6
-rw-r--r--examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc26
-rw-r--r--examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc2
-rw-r--r--examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc2
-rw-r--r--examples/quick/scenegraph/textureinthread/error.qml (renamed from src/quick/doc/snippets/qml/usecases/MyText.qml)11
-rw-r--r--examples/quick/scenegraph/textureinthread/main.cpp42
-rw-r--r--examples/quick/scenegraph/textureinthread/textureinthread.pro6
-rw-r--r--examples/quick/scenegraph/textureinthread/textureinthread.qrc3
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.cpp69
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.h6
-rw-r--r--examples/quick/shadereffects/doc/src/shadereffects.qdoc12
-rw-r--r--examples/quick/shared/TabSet.qml (renamed from examples/quick/window/screen/screenInfo.qml)85
-rw-r--r--examples/quick/shared/images/qt-logo.pngbin0 -> 13923 bytes
-rw-r--r--examples/quick/shared/images/tab.pngbin0 -> 507 bytes
-rw-r--r--examples/quick/shared/qmldir1
-rw-r--r--examples/quick/shared/shared.h2
-rw-r--r--examples/quick/shared/shared.qrc4
-rw-r--r--examples/quick/text/doc/src/text.qdoc18
-rw-r--r--examples/quick/textureprovider/etcprovider.cpp6
-rw-r--r--examples/quick/threading/doc/src/threading.qdoc10
-rw-r--r--examples/quick/touchinteraction/doc/src/touchinteraction.qdoc10
-rw-r--r--examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc20
-rw-r--r--examples/quick/views/doc/src/views.qdoc32
-rw-r--r--examples/quick/window/ScreenInfo.qml (renamed from examples/quick/window/window/twowindows.qml)92
-rw-r--r--examples/quick/window/Splash.qml (renamed from src/quick/doc/snippets/qml/usecases/visual-opacity.qml)66
-rw-r--r--examples/quick/window/doc/images/qml-window-example.pngbin0 -> 9863 bytes
-rw-r--r--examples/quick/window/doc/src/window.qdoc71
-rw-r--r--examples/quick/window/main.cpp (renamed from examples/quick/window/window/window.cpp)4
-rw-r--r--examples/quick/window/resources/icon.icnsbin0 -> 59662 bytes
-rw-r--r--examples/quick/window/resources/icon.icobin0 -> 11825 bytes
-rw-r--r--examples/quick/window/resources/icon.svg208
-rw-r--r--examples/quick/window/resources/icon64.pngbin0 -> 3004 bytes
-rw-r--r--examples/quick/window/resources/window.rc32
-rw-r--r--examples/quick/window/window.pro18
-rw-r--r--examples/quick/window/window.qml181
-rw-r--r--examples/quick/window/window.qrc7
-rw-r--r--examples/quick/window/window/standalone.qml128
-rw-r--r--examples/quick/window/window/window.pro13
-rw-r--r--examples/quick/window/window/window.qrc5
-rw-r--r--qtdeclarative.pro1
-rw-r--r--src/imports/dialogs/dialogs.pro2
-rw-r--r--src/imports/dialogs/doc/qtquickdialogs.qdocconf36
-rw-r--r--src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc36
-rw-r--r--src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc58
-rw-r--r--src/imports/dialogs/plugin.cpp2
-rw-r--r--src/imports/dialogs/plugins.qmltypes80
-rw-r--r--src/imports/dialogs/qquickplatformcolordialog.cpp2
-rw-r--r--src/imports/dialogs/qquickplatformfiledialog.cpp2
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp13
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h4
-rw-r--r--src/imports/folderlistmodel/plugins.qmltypes8
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp32
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/localstorage/plugin.cpp2
-rw-r--r--src/imports/localstorage/plugins.qmltypes5
-rw-r--r--src/imports/models/models.pro2
-rw-r--r--src/imports/models/plugin.cpp5
-rw-r--r--src/imports/particles/plugins.qmltypes86
-rw-r--r--src/imports/qtquick2/plugins.qmltypes625
-rw-r--r--src/imports/testlib/TestCase.qml10
-rw-r--r--src/imports/testlib/plugins.qmltypes32
-rw-r--r--src/imports/widgets/plugins.qmltypes68
-rw-r--r--src/imports/widgets/widgetsplugin.cpp2
-rw-r--r--src/imports/window/plugins.qmltypes85
-rw-r--r--src/imports/xmllistmodel/plugins.qmltypes8
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp2
-rw-r--r--src/particles/particleresources/fuzzydot.png (renamed from examples/quick/particles/images/particle4.png)bin1799 -> 1799 bytes
-rw-r--r--src/particles/particleresources/glowdot.png (renamed from examples/quick/particles/images/particle.png)bin861 -> 861 bytes
-rw-r--r--src/particles/particleresources/star.png (renamed from examples/quick/particles/images/star.png)bin1550 -> 1550 bytes
-rw-r--r--src/particles/particles.qrc3
-rw-r--r--src/particles/qquickimageparticle.cpp25
-rw-r--r--src/particles/qquickmaskextruder.cpp35
-rw-r--r--src/particles/qquickparticleemitter.cpp6
-rw-r--r--src/particles/qquickparticlepainter.cpp2
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickitem.cpp149
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickitem.h40
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickview.cpp13
-rw-r--r--src/plugins/accessible/shared/qqmlaccessible.cpp9
-rw-r--r--src/plugins/accessible/shared/qqmlaccessible.h4
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp4
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp20
-rw-r--r--src/qml/debugger/qqmldebugserver_p.h2
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp137
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h98
-rw-r--r--src/qml/debugger/qv8debugservice.cpp16
-rw-r--r--src/qml/debugger/qv8debugservice_p.h5
-rw-r--r--src/qml/doc/qtqml.qdocconf14
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatagroup.qml (renamed from src/quick/doc/snippets/qml/visualdatagroup.qml)0
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel.qml (renamed from src/quick/doc/snippets/qml/visualdatamodel.qml)0
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp (renamed from src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp)0
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml (renamed from src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml)0
-rw-r--r--src/qml/doc/snippets/qml/imports/merged-named-imports.qml15
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc (renamed from src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml)12
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/example.qrc10
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/resources.pro4
-rw-r--r--src/qml/doc/src/cppclasses/topic.qdoc20
-rw-r--r--src/qml/doc/src/cppintegration/contextproperties.qdoc2
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc8
-rw-r--r--src/qml/doc/src/cppintegration/definetypes.qdoc20
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc98
-rw-r--r--src/qml/doc/src/cppintegration/topic.qdoc10
-rw-r--r--src/qml/doc/src/javascript/date.qdoc3
-rw-r--r--src/qml/doc/src/javascript/dynamicobjectcreation.qdoc22
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc9
-rw-r--r--src/qml/doc/src/javascript/imports.qdoc10
-rw-r--r--src/qml/doc/src/javascript/number.qdoc3
-rw-r--r--src/qml/doc/src/javascript/string.qdoc3
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc28
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc (renamed from src/qml/doc/src/documents/definetypes.qdoc)2
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc (renamed from src/qml/doc/src/documents/networktransparency.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/scope.qdoc (renamed from src/qml/doc/src/documents/scope.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/structure.qdoc (renamed from src/qml/doc/src/documents/structure.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/topic.qdoc (renamed from src/qml/doc/src/documents/topic.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc (renamed from src/qml/doc/src/modules/cppplugins.qdoc)8
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc (renamed from src/qml/doc/src/modules/identifiedmodules.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc (renamed from src/qml/doc/src/modules/legacymodules.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc (renamed from src/qml/doc/src/modules/qmldir.qdoc)7
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/topic.qdoc (renamed from src/qml/doc/src/modules/topic.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/qmlreference.qdoc113
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/basics.qdoc (renamed from src/qml/doc/src/syntax/basics.qdoc)8
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc (renamed from src/qml/doc/src/syntax/directoryimports.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/imports.qdoc (renamed from src/qml/doc/src/syntax/imports.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc (renamed from src/qml/doc/src/syntax/objectattributes.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc (renamed from src/qml/doc/src/syntax/propertybinding.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/signals.qdoc (renamed from src/qml/doc/src/syntax/signals.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc (renamed from src/qml/doc/src/typesystem/basictypes.qdoc)4
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc (renamed from src/qml/doc/src/typesystem/objecttypes.qdoc)0
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc (renamed from src/qml/doc/src/typesystem/topic.qdoc)0
-rw-r--r--src/qml/doc/src/qmltypereference.qdoc111
-rw-r--r--src/qml/doc/src/qtqml.qdoc215
-rw-r--r--src/qml/doc/src/whatsnew.qdoc39
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp6
-rw-r--r--src/qml/qml/parser/qqmljs.g4
-rw-r--r--src/qml/qml/parser/qqmljsparser.cpp4
-rw-r--r--src/qml/qml/qml.pri2
-rw-r--r--src/qml/qml/qqml.h18
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.cpp91
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor_p.h66
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp11
-rw-r--r--src/qml/qml/qqmlcompileddata.cpp1
-rw-r--r--src/qml/qml/qqmlcompiler.cpp5
-rw-r--r--src/qml/qml/qqmlcomponent.cpp69
-rw-r--r--src/qml/qml/qqmlcomponentattached_p.h3
-rw-r--r--src/qml/qml/qqmlcontext.cpp16
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h2
-rw-r--r--src/qml/qml/qqmldata_p.h9
-rw-r--r--src/qml/qml/qqmlengine.cpp109
-rw-r--r--src/qml/qml/qqmlengine.h4
-rw-r--r--src/qml/qml/qqmlengine_p.h5
-rw-r--r--src/qml/qml/qqmlerror.cpp27
-rw-r--r--src/qml/qml/qqmlerror.h2
-rw-r--r--src/qml/qml/qqmlexpression.cpp2
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp30
-rw-r--r--src/qml/qml/qqmlglobal_p.h6
-rw-r--r--src/qml/qml/qqmlimport.cpp10
-rw-r--r--src/qml/qml/qqmlimport_p.h2
-rw-r--r--src/qml/qml/qqmlinfo.cpp24
-rw-r--r--src/qml/qml/qqmlinfo.h19
-rw-r--r--src/qml/qml/qqmlinstruction.cpp2
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp7
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h1
-rw-r--r--src/qml/qml/qqmllist.cpp4
-rw-r--r--src/qml/qml/qqmllocale.cpp8
-rw-r--r--src/qml/qml/qqmlmetatype.cpp46
-rw-r--r--src/qml/qml/qqmlmetatype_p.h2
-rw-r--r--src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp2
-rw-r--r--src/qml/qml/qqmlparserstatus.cpp2
-rw-r--r--src/qml/qml/qqmlprivate.h2
-rw-r--r--src/qml/qml/qqmlproperty.cpp7
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp51
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h2
-rw-r--r--src/qml/qml/qqmlscript.cpp6
-rw-r--r--src/qml/qml/qqmlscript_p.h2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp31
-rw-r--r--src/qml/qml/qqmltypeloader_p.h11
-rw-r--r--src/qml/qml/qqmlvme.cpp50
-rw-r--r--src/qml/qml/qqmlvme_p.h6
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp5
-rw-r--r--src/qml/qml/v4/qv4jsonobject_p.h1
-rw-r--r--src/qml/qml/v4/qv4qobjectwrapper.cpp10
-rw-r--r--src/qml/qml/v8/qjsengine.cpp4
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp28
-rw-r--r--src/qml/types/qqmlbind.cpp2
-rw-r--r--src/qml/types/qqmlconnections.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp134
-rw-r--r--src/qml/types/qqmlinstantiator.cpp10
-rw-r--r--src/qml/types/qqmlinstantiator_p_p.h9
-rw-r--r--src/qml/types/qqmllistmodel.cpp34
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h7
-rw-r--r--src/qml/types/qqmlobjectmodel.cpp3
-rw-r--r--src/qml/types/qquickpackage.cpp3
-rw-r--r--src/qmldevtools/qmldevtools.pro5
-rw-r--r--src/qmltest/quicktest.cpp2
-rw-r--r--src/quick/designer/designersupport.cpp23
-rw-r--r--src/quick/designer/designersupport.h4
-rw-r--r--src/quick/designer/designerwindowmanager_p.h2
-rw-r--r--src/quick/doc/images/particles/fuzzydot.pngbin0 -> 1799 bytes
-rw-r--r--src/quick/doc/images/particles/glowdot.pngbin0 -> 861 bytes
-rw-r--r--src/quick/doc/images/particles/star.pngbin0 -> 1550 bytes
-rw-r--r--src/quick/doc/images/qml-extending-types.pngbin738 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-animation.pngbin474 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-integratingjs.pngbin679 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-anchors.pngbin946 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-direct.pngbin344 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-layouts-positioners.pngbin471 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-styling-text.pngbin29158 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-styling.pngbin6330 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-text.pngbin41485 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-userinput.pngbin6713 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-opacity.pngbin211 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-rectangles.pngbin770 -> 0 bytes
-rw-r--r--src/quick/doc/images/qml-uses-visual-transforms.pngbin671 -> 0 bytes
-rw-r--r--src/quick/doc/qtquick.qdocconf7
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/dotproperties.qml68
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/javascript.qml73
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/lists.qml62
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/myscript.js9
-rw-r--r--src/quick/doc/snippets/qml/codingconventions/photo.qml85
-rw-r--r--src/quick/doc/snippets/qml/colors.qml (renamed from src/qml/doc/snippets/qml/colors.qml)2
-rw-r--r--src/quick/doc/snippets/qml/text/onLinkActivated.qml2
-rw-r--r--src/quick/doc/snippets/qml/usecases/Button.qml86
-rw-r--r--src/quick/doc/snippets/qml/usecases/animations.qml187
-rw-r--r--src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml79
-rw-r--r--src/quick/doc/snippets/qml/usecases/integratingjs.qml71
-rw-r--r--src/quick/doc/snippets/qml/usecases/layouts.qml142
-rw-r--r--src/quick/doc/snippets/qml/usecases/myscript.js46
-rw-r--r--src/quick/doc/snippets/qml/usecases/styling.qml65
-rw-r--r--src/quick/doc/snippets/qml/usecases/text.qml105
-rw-r--r--src/quick/doc/snippets/qml/usecases/userinput-keys.qml71
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual-rects.qml78
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual-transforms.qml72
-rw-r--r--src/quick/doc/snippets/qml/usecases/visual.qml66
-rw-r--r--src/quick/doc/snippets/qml/xmlrole.qml (renamed from src/qml/doc/snippets/qml/xmlrole.qml)0
-rw-r--r--src/quick/doc/src/advtutorial.qdoc63
-rw-r--r--src/quick/doc/src/appdevguide/applicationdevelopers.qdoc145
-rw-r--r--src/quick/doc/src/appdevguide/codingconventions.qdoc106
-rw-r--r--src/quick/doc/src/appdevguide/debugging.qdoc158
-rw-r--r--src/quick/doc/src/appdevguide/deployment.qdoc211
-rw-r--r--src/quick/doc/src/appdevguide/glossary.qdoc193
-rw-r--r--src/quick/doc/src/appdevguide/internationalization.qdoc280
-rw-r--r--src/quick/doc/src/appdevguide/performance.qdoc1143
-rw-r--r--src/quick/doc/src/appdevguide/porting.qdoc255
-rw-r--r--src/quick/doc/src/appdevguide/qmlscene.qdoc146
-rw-r--r--src/quick/doc/src/appdevguide/qtquicktest.qdoc132
-rw-r--r--src/quick/doc/src/appdevguide/quickstart/basics.qdoc118
-rw-r--r--src/quick/doc/src/appdevguide/quickstart/essentials.qdoc184
-rw-r--r--src/quick/doc/src/appdevguide/usecases/animations.qdoc73
-rw-r--r--src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc70
-rw-r--r--src/quick/doc/src/appdevguide/usecases/layouts.qdoc79
-rw-r--r--src/quick/doc/src/appdevguide/usecases/styling.qdoc63
-rw-r--r--src/quick/doc/src/appdevguide/usecases/text.qdoc58
-rw-r--r--src/quick/doc/src/appdevguide/usecases/userinput.qdoc83
-rw-r--r--src/quick/doc/src/appdevguide/usecases/visual.qdoc85
-rw-r--r--src/quick/doc/src/concepts/convenience/topic.qdoc2
-rw-r--r--src/quick/doc/src/concepts/effects/particles.qdoc2
-rw-r--r--src/quick/doc/src/concepts/effects/sprites.qdoc3
-rw-r--r--src/quick/doc/src/concepts/input/focus.qdoc22
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc26
-rw-r--r--src/quick/doc/src/concepts/positioning/layouts.qdoc9
-rw-r--r--src/quick/doc/src/concepts/positioning/righttoleft.qdoc3
-rw-r--r--src/quick/doc/src/concepts/positioning/topic.qdoc25
-rw-r--r--src/quick/doc/src/dynamicview-tutorial.qdoc53
-rw-r--r--src/quick/doc/src/examples.qdoc8
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc69
-rw-r--r--src/quick/doc/src/qtquick.qdoc17
-rw-r--r--src/quick/doc/src/tutorial.qdoc36
-rw-r--r--src/quick/doc/src/whatsnew.qdoc64
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp38
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp146
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h3
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp206
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp1
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp3
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h4
-rw-r--r--src/quick/items/qquickdrag.cpp10
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickevents_p_p.h2
-rw-r--r--src/quick/items/qquickflickable.cpp22
-rw-r--r--src/quick/items/qquickflickable_p_p.h2
-rw-r--r--src/quick/items/qquickgridview.cpp16
-rw-r--r--src/quick/items/qquickimage.cpp6
-rw-r--r--src/quick/items/qquickitem.cpp209
-rw-r--r--src/quick/items/qquickitem.h4
-rw-r--r--src/quick/items/qquickitem_p.h12
-rw-r--r--src/quick/items/qquickitemsmodule.cpp7
-rw-r--r--src/quick/items/qquickitemview.cpp21
-rw-r--r--src/quick/items/qquickitemview_p.h1
-rw-r--r--src/quick/items/qquicklistview.cpp19
-rw-r--r--src/quick/items/qquickloader.cpp8
-rw-r--r--src/quick/items/qquickmousearea.cpp9
-rw-r--r--src/quick/items/qquickmousearea_p.h2
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp28
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h4
-rw-r--r--src/quick/items/qquickpathview.cpp2
-rw-r--r--src/quick/items/qquickpincharea.cpp28
-rw-r--r--src/quick/items/qquickpincharea_p.h4
-rw-r--r--src/quick/items/qquickpositioners.cpp106
-rw-r--r--src/quick/items/qquickrectangle.cpp2
-rw-r--r--src/quick/items/qquickrepeater.cpp17
-rw-r--r--src/quick/items/qquickrepeater_p_p.h2
-rw-r--r--src/quick/items/qquickscreen.cpp86
-rw-r--r--src/quick/items/qquickscreen_p.h11
-rw-r--r--src/quick/items/qquickshadereffect.cpp4
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp6
-rw-r--r--src/quick/items/qquicktext.cpp98
-rw-r--r--src/quick/items/qquicktext_p.h8
-rw-r--r--src/quick/items/qquicktext_p_p.h4
-rw-r--r--src/quick/items/qquicktextcontrol.cpp50
-rw-r--r--src/quick/items/qquicktextcontrol_p.h2
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h3
-rw-r--r--src/quick/items/qquicktextdocument.h2
-rw-r--r--src/quick/items/qquicktextedit.cpp224
-rw-r--r--src/quick/items/qquicktextedit_p.h9
-rw-r--r--src/quick/items/qquicktextedit_p_p.h4
-rw-r--r--src/quick/items/qquicktextinput.cpp27
-rw-r--r--src/quick/items/qquicktextinput_p_p.h2
-rw-r--r--src/quick/items/qquicktextnode.cpp6
-rw-r--r--src/quick/items/qquicktextnode_p.h5
-rw-r--r--src/quick/items/qquickview.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp320
-rw-r--r--src/quick/items/qquickwindow.h7
-rw-r--r--src/quick/items/qquickwindow_p.h29
-rw-r--r--src/quick/items/qquickwindowmodule.cpp24
-rw-r--r--src/quick/quick.pro7
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp18
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp1
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp52
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h11
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode_p.h76
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp52
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp21
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp66
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h1
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp7
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode.cpp8
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode_p.h8
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode.cpp8
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode_p.h8
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp39
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h12
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp122
-rw-r--r--src/quick/scenegraph/qsgrenderloop_p.h9
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp98
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop_p.h6
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp469
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop_p.h116
-rw-r--r--src/quick/scenegraph/scenegraph.pri17
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp10
-rw-r--r--src/quick/scenegraph/util/qsgpainternode.cpp31
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp81
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.h16
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp60
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp6
-rw-r--r--src/quick/util/qquickanimation.cpp6
-rw-r--r--src/quick/util/qquickbehavior.cpp2
-rw-r--r--src/quick/util/qquickimageprovider.cpp8
-rw-r--r--src/quick/util/qquickpath.cpp109
-rw-r--r--src/quick/util/qquickpath_p.h9
-rw-r--r--src/quick/util/qquickpath_p_p.h3
-rw-r--r--src/quick/util/qquickpixmapcache.cpp24
-rw-r--r--src/quick/util/qquickpropertychanges.cpp2
-rw-r--r--src/quick/util/qquickstate.cpp2
-rw-r--r--src/quick/util/qquickstategroup.cpp2
-rw-r--r--src/quick/util/qquicksvgparser.cpp2
-rw-r--r--src/quick/util/qquicktransition.cpp2
-rw-r--r--sync.profile5
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp5
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp9
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp9
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.pngbin0 -> 158 bytes
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/pixmapCacheTest.qml13
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/scenegraphTest.qml18
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp158
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp8
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h5
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp2
-rw-r--r--tests/auto/qml/qml.pro4
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp2
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp4
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp6
-rw-r--r--tests/auto/qml/qqmlcomponent/data/createWindow.qml29
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/MyDeferredComponent.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/MyDeferredComponent2.qml3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deferredPropertiesInComponents.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp32
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/Intercepted.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted2.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/qmldir/urlInterceptor.qml12
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/Intercepted.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/intercepted/Intercepted.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/intercepted/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/intercepted/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/strings/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/Intercepted.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/Intercepted2.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted2.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/intercepted/intercepted.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/intercepted/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/types/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp96
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp1
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp61
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/showDotAndDotDot.qml5
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp54
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp2
-rw-r--r--tests/auto/qmldevtools/compile/compile.pro7
-rw-r--r--tests/auto/qmltest/fontloader/tst_fontloader.qml27
-rw-r--r--tests/auto/qmltest/listmodel/tst_listmodel.qml12
-rw-r--r--tests/auto/qmltest/listview/data/asynclistviewloader.qml (renamed from src/quick/doc/snippets/qml/usecases/styling-text.qml)54
-rw-r--r--tests/auto/qmltest/listview/data/asyncloadercurrentindex.qml (renamed from src/qml/doc/snippets/qml/folderlistmodel.qml)35
-rw-r--r--tests/auto/qmltest/listview/tst_listview.qml98
-rw-r--r--tests/auto/qmltest/qmltest.pro1
-rw-r--r--tests/auto/qmltest/selftests/tst_destroy.qml62
-rw-r--r--tests/auto/qmltest/text/tst_text.qml17
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml10
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp10
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_context.qml16
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_image.qml11
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp37
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp28
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml144
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml36
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml36
-rw-r--r--tests/auto/quick/qquickitem2/data/resourcesProperty.qml23
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp330
-rw-r--r--tests/auto/quick/qquicklistview/data/delayedChanges.qml39
-rw-r--r--tests/auto/quick/qquicklistview/data/emptymodel.qml4
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp106
-rw-r--r--tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml29
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp30
-rw-r--r--tests/auto/quick/qquickrepeater/data/visualitemmodel.qml23
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp12
-rw-r--r--tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml10
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp182
-rw-r--r--tests/auto/quick/qquicktextedit/data/linkInteraction.qml (renamed from tests/auto/quick/qquicktextedit/data/linkActivated.qml)0
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp179
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp13
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp7
-rw-r--r--tests/auto/quick/qquickwindow/data/active.qml29
-rw-r--r--tests/auto/quick/qquickwindow/data/ucantclosethis.qml32
-rw-r--r--tests/auto/quick/qquickwindow/qquickwindow.pro1
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp91
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp20
-rw-r--r--tests/auto/shared/testhttpserver.cpp53
-rw-r--r--tests/auto/shared/testhttpserver.h5
-rw-r--r--tests/benchmarks/qml/animation/animation.pro5
-rw-r--r--tests/benchmarks/qml/compilation/tst_compilation.cpp6
-rw-r--r--tests/benchmarks/qml/creation/creation.pro3
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp8
-rw-r--r--tests/benchmarks/qml/holistic/testtypes.cpp14
-rw-r--r--tests/benchmarks/qml/painting/paintbenchmark.cpp5
-rw-r--r--tests/benchmarks/qml/pointers/pointers.pro2
-rw-r--r--tests/benchmarks/qml/pointers/tst_pointers.cpp2
-rw-r--r--tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp4
-rw-r--r--tests/benchmarks/qml/typeimports/tst_typeimports.cpp2
-rw-r--r--tests/manual/qmltypememory/README3
-rw-r--r--tests/manual/qmltypememory/TestPlugin/plugin.cpp (renamed from src/quick/doc/snippets/qml/usecases/userinput.qml)47
-rw-r--r--tests/manual/qmltypememory/TestPlugin/plugin.pro7
-rw-r--r--tests/manual/qmltypememory/TestPlugin/qmldir2
-rw-r--r--tests/manual/qmltypememory/TestType.qml43
-rw-r--r--tests/manual/qmltypememory/main.cpp56
-rw-r--r--tests/manual/qmltypememory/main.qml54
-rw-r--r--tests/manual/qmltypememory/qmldir2
-rw-r--r--tests/manual/qmltypememory/qmltypememory.pro8
-rw-r--r--tests/manual/qmltypememory/testdriver.cpp105
-rw-r--r--tests/manual/qmltypememory/testdriver.h65
-rw-r--r--tests/testapplications/elements/content/Help.qml2
-rw-r--r--tests/testapplications/text/textedit.qml2
-rw-r--r--tools/qmlplugindump/main.cpp99
-rw-r--r--tools/qmlplugindump/qmlplugindump.pro9
-rw-r--r--tools/qmlprofiler/qmlprofiler.pro2
-rw-r--r--tools/qmlprofiler/qqmldebugclient.cpp2
-rw-r--r--tools/qmlscene/main.cpp10
-rw-r--r--tools/tools.pro11
625 files changed, 11041 insertions, 7904 deletions
diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0
index cee8d4b382..eaf6d05094 100644
--- a/dist/changes-5.1.0
+++ b/dist/changes-5.1.0
@@ -32,10 +32,32 @@ Third party components
* Important Behavior Changes *
****************************************************************************
+ - A Window declared nested inside another Item or Window automatically
+ becomes transient for (centered upon) its parent's window, if x and y
+ were not explicitly specified
+ - The resources property of Item is now its own property independent
+ of QObject. It no longer returns all QObject children, or explicitly
+ sets QObject parent. The resources property now behaves as documented.
+
+ - As part of a fix for QTBUG-30555, ListView and GridView properties, such
+ as count, which are based off of the data model will no longer update
+ immediately if queried. Updates are batched to happen once per frame (or
+ when properties are being set).
+
+ - tryCompare now correctly fails when it only gets two parameters
+
+ - If a QObject has a property and a slot (or invokable method) with the same
+ name, in QML the previous behavior was to let the property obscure the
+ method; from Qt 5.1 things work in the opposite way, that is a property can
+ never obscure a method having the same name. This is especially important
+ for objects having dynamic properties, such as QQmlPropertyMap. This change
+ was a consequence of the fix for QTBUG-29836.
****************************************************************************
* Library *
****************************************************************************
+ - QTBUG-30837: The Flickable type no longer fixes up the content area on
+ startup to move it inside the viewport.
****************************************************************************
diff --git a/examples/HACKING b/examples/HACKING
index 9539d2d129..7d2a61a481 100644
--- a/examples/HACKING
+++ b/examples/HACKING
@@ -1,4 +1,4 @@
-Some guidelines for QtQml examples
+Some guidelines for Qt QML examples
Snippets
---
diff --git a/examples/quick/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index ee2dd06623..7dbd147cc1 100644
--- a/examples/quick/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -34,7 +34,7 @@
The Adding Types Example shows how to add a new object type, \c Person, to QML.
The \c Person type can be used from QML like this:
-\snippet qml/referenceexamples/adding/example.qml 0
+\snippet referenceexamples/adding/example.qml 0
\section1 Declare the Person class
@@ -43,11 +43,11 @@ with the two properties we want accessible on the QML type - name and shoeSize.
Although in this example we use the same name for the C++ class as the QML
type, the C++ class can be named differently, or appear in a namespace.
-\snippet qml/referenceexamples/adding/person.h 0
+\snippet referenceexamples/adding/person.h 0
\section1 Define the Person class
-\snippet qml/referenceexamples/adding/person.cpp 0
+\snippet referenceexamples/adding/person.cpp 0
The Person class implementation is quite basic. The property accessors simply
return members of the object instance.
@@ -78,33 +78,33 @@ properties in QML. This example adds a BirthdayParty type that specifies
a birthday party, consisting of a celebrant and a list of guests. People are
specified using the People QML type built in the previous example.
-\snippet qml/referenceexamples/properties/example.qml 0
+\snippet referenceexamples/properties/example.qml 0
\section1 Declare the BirthdayParty
The BirthdayParty class is declared like this:
-\snippet qml/referenceexamples/properties/birthdayparty.h 0
-\snippet qml/referenceexamples/properties/birthdayparty.h 1
-\snippet qml/referenceexamples/properties/birthdayparty.h 2
-\snippet qml/referenceexamples/properties/birthdayparty.h 3
+\snippet referenceexamples/properties/birthdayparty.h 0
+\snippet referenceexamples/properties/birthdayparty.h 1
+\snippet referenceexamples/properties/birthdayparty.h 2
+\snippet referenceexamples/properties/birthdayparty.h 3
The class contains a member to store the celebrant object, and also a
QList<Person *> member.
In QML, the type of a list properties - and the guests property is a list of
-people - are all of type QDeclarativeListProperty<T>. QDeclarativeListProperty is simple value
+people - are all of type QQmlListProperty<T>. QQmlListProperty is simple value
type that contains a set of function pointers. QML calls these function
pointers whenever it needs to read from, write to or otherwise interact with
the list. In addition to concrete lists like the people list used in this
-example, the use of QDeclarativeListProperty allows for "virtual lists" and other advanced
+example, the use of QQmlListProperty allows for "virtual lists" and other advanced
scenarios.
\section2 Define the BirthdayParty
The implementation of BirthdayParty property accessors is straight forward.
-\snippet qml/referenceexamples/properties/birthdayparty.cpp 0
+\snippet referenceexamples/properties/birthdayparty.cpp 0
\section1 Running the example
@@ -128,11 +128,11 @@ The Inheritance and Coercion Example shows how to use base classes to assign
types of more than one type to a property. It specializes the Person type
developed in the previous examples into two types - a \c Boy and a \c Girl.
-\snippet qml/referenceexamples/coercion/example.qml 0
+\snippet referenceexamples/coercion/example.qml 0
\section1 Declare Boy and Girl
-\snippet qml/referenceexamples/coercion/person.h 0
+\snippet referenceexamples/coercion/person.h 0
The Person class remains unaltered in this example and the Boy and Girl C++
classes are trivial extensions of it. As an example, the inheritance used here
@@ -147,7 +147,7 @@ previous example. However, as we have repurposed the People class as a common
base for Boy and Girl, we want to prevent it from being instantiated from QML
directly - an explicit Boy or Girl should be instantiated instead.
-\snippet qml/referenceexamples/coercion/main.cpp 0
+\snippet referenceexamples/coercion/main.cpp 0
While we want to disallow instantiating Person from within QML, it still needs
to be registered with the QML engine, so that it can be used as a property type
@@ -157,7 +157,7 @@ and other types can be coerced to it.
The implementation of Boy and Girl are trivial.
-\snippet qml/referenceexamples/coercion/person.cpp 1
+\snippet referenceexamples/coercion/person.cpp 1
All that is necessary is to implement the constructor, and to register the types
and their QML name with the QML engine.
@@ -167,7 +167,7 @@ and their QML name with the QML engine.
The BirthdayParty type has not changed since the previous example. The
celebrant and guests property still use the People type.
-\snippet qml/referenceexamples/coercion/birthdayparty.h 0
+\snippet referenceexamples/coercion/birthdayparty.h 0
However, as all three types, Person, Boy and Girl, have been registered with the
QML system, on assignment QML automatically (and type-safely) converts the Boy
@@ -194,14 +194,14 @@ The Default Property Example is a minor modification of the
\l {Extending QML - Inheritance and Coercion Example} that simplifies the
specification of a BirthdayParty through the use of a default property.
-\snippet qml/referenceexamples/default/example.qml 0
+\snippet referenceexamples/default/example.qml 0
\section1 Declaring the BirthdayParty class
The only difference between this example and the last, is the addition of the
\c DefaultProperty class info annotation.
-\snippet qml/referenceexamples/default/birthdayparty.h 0
+\snippet referenceexamples/default/birthdayparty.h 0
The default property specifies the property to assign to whenever an explicit
property is not specified, in the case of the BirthdayParty type the guest
diff --git a/examples/quick/tutorials/extending/chapter1-basics/app.qml b/examples/qml/tutorials/extending/chapter1-basics/app.qml
index d2f03daf83..d2f03daf83 100644
--- a/examples/quick/tutorials/extending/chapter1-basics/app.qml
+++ b/examples/qml/tutorials/extending/chapter1-basics/app.qml
diff --git a/examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro
index 8ed66f8b66..8ed66f8b66 100644
--- a/examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro
+++ b/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro
diff --git a/examples/quick/tutorials/extending/chapter1-basics/main.cpp b/examples/qml/tutorials/extending/chapter1-basics/main.cpp
index d30628fd5a..d30628fd5a 100644
--- a/examples/quick/tutorials/extending/chapter1-basics/main.cpp
+++ b/examples/qml/tutorials/extending/chapter1-basics/main.cpp
diff --git a/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp b/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp
index fa005781d8..fa005781d8 100644
--- a/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter1-basics/piechart.h b/examples/qml/tutorials/extending/chapter1-basics/piechart.h
index a6272453ce..a6272453ce 100644
--- a/examples/quick/tutorials/extending/chapter1-basics/piechart.h
+++ b/examples/qml/tutorials/extending/chapter1-basics/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter2-methods/app.qml b/examples/qml/tutorials/extending/chapter2-methods/app.qml
index 06ecb3a09d..06ecb3a09d 100644
--- a/examples/quick/tutorials/extending/chapter2-methods/app.qml
+++ b/examples/qml/tutorials/extending/chapter2-methods/app.qml
diff --git a/examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro
index 8ed66f8b66..8ed66f8b66 100644
--- a/examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro
+++ b/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro
diff --git a/examples/quick/tutorials/extending/chapter2-methods/main.cpp b/examples/qml/tutorials/extending/chapter2-methods/main.cpp
index d30628fd5a..d30628fd5a 100644
--- a/examples/quick/tutorials/extending/chapter2-methods/main.cpp
+++ b/examples/qml/tutorials/extending/chapter2-methods/main.cpp
diff --git a/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp b/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp
index ddcb1b3efd..ddcb1b3efd 100644
--- a/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter2-methods/piechart.h b/examples/qml/tutorials/extending/chapter2-methods/piechart.h
index 86750197d2..86750197d2 100644
--- a/examples/quick/tutorials/extending/chapter2-methods/piechart.h
+++ b/examples/qml/tutorials/extending/chapter2-methods/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter3-bindings/app.qml b/examples/qml/tutorials/extending/chapter3-bindings/app.qml
index afb9e25c51..afb9e25c51 100644
--- a/examples/quick/tutorials/extending/chapter3-bindings/app.qml
+++ b/examples/qml/tutorials/extending/chapter3-bindings/app.qml
diff --git a/examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
index 8ed66f8b66..8ed66f8b66 100644
--- a/examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
+++ b/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
diff --git a/examples/quick/tutorials/extending/chapter3-bindings/main.cpp b/examples/qml/tutorials/extending/chapter3-bindings/main.cpp
index d30628fd5a..d30628fd5a 100644
--- a/examples/quick/tutorials/extending/chapter3-bindings/main.cpp
+++ b/examples/qml/tutorials/extending/chapter3-bindings/main.cpp
diff --git a/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp
index a63035033f..a63035033f 100644
--- a/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending/chapter3-bindings/piechart.h
index 25e82d66cc..25e82d66cc 100644
--- a/examples/quick/tutorials/extending/chapter3-bindings/piechart.h
+++ b/examples/qml/tutorials/extending/chapter3-bindings/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml
index 441b7f9b82..441b7f9b82 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
index 23eb222ea3..23eb222ea3 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp
index 5b6e1cf451..5b6e1cf451 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
index c1e2996e83..c1e2996e83 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h
index 9f0ea47eb9..9f0ea47eb9 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
index 2afe82048f..2afe82048f 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
index 4eef9bb6d1..4eef9bb6d1 100644
--- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
+++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/app.qml b/examples/qml/tutorials/extending/chapter5-listproperties/app.qml
index a57d1b833f..a57d1b833f 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/app.qml
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/app.qml
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
index 23eb222ea3..23eb222ea3 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp
index f8826f6c31..f8826f6c31 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp
index 9fb61d9cd8..9fb61d9cd8 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h
index 55488f4900..55488f4900 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp
index 52b409aa22..52b409aa22 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp
diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h
index f324179481..f324179481 100644
--- a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h
+++ b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir b/examples/qml/tutorials/extending/chapter6-plugins/Charts/qmldir
index d9e8471b3c..d9e8471b3c 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir
+++ b/examples/qml/tutorials/extending/chapter6-plugins/Charts/qmldir
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/app.qml b/examples/qml/tutorials/extending/chapter6-plugins/app.qml
index 417fc6651a..417fc6651a 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/app.qml
+++ b/examples/qml/tutorials/extending/chapter6-plugins/app.qml
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
index 6bf44b4d15..6bf44b4d15 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
+++ b/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp
index fea4c1aa85..fea4c1aa85 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp
+++ b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h
index d768306967..d768306967 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h
+++ b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp
index 295bb8961d..295bb8961d 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp
+++ b/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.h b/examples/qml/tutorials/extending/chapter6-plugins/piechart.h
index b37bcdd411..b37bcdd411 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/piechart.h
+++ b/examples/qml/tutorials/extending/chapter6-plugins/piechart.h
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp
index 52b409aa22..52b409aa22 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp
+++ b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp
diff --git a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h
index 0b488b4835..0b488b4835 100644
--- a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h
+++ b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h
diff --git a/examples/quick/tutorials/extending/extending.pro b/examples/qml/tutorials/extending/extending.pro
index 967473fda0..967473fda0 100644
--- a/examples/quick/tutorials/extending/extending.pro
+++ b/examples/qml/tutorials/extending/extending.pro
diff --git a/examples/quick/accessibility/doc/src/accessibility.qdoc b/examples/quick/accessibility/doc/src/accessibility.qdoc
index a637383324..0281ffff4e 100644
--- a/examples/quick/accessibility/doc/src/accessibility.qdoc
+++ b/examples/quick/accessibility/doc/src/accessibility.qdoc
@@ -33,8 +33,8 @@
Types in this example are augmented with meta-data for accessiblity systems.
For example, the button identifies itself and its functionality to the accessibility system:
- \snippet quick/accessibility/content/Button.qml button
+ \snippet accessibility/content/Button.qml button
As do Text types inside the example:
- \snippet quick/accessibility/accessibility.qml text
+ \snippet accessibility/accessibility.qml text
*/
diff --git a/examples/quick/animation/doc/src/animation.qdoc b/examples/quick/animation/doc/src/animation.qdoc
index 064717835d..734b1af118 100644
--- a/examples/quick/animation/doc/src/animation.qdoc
+++ b/examples/quick/animation/doc/src/animation.qdoc
@@ -36,37 +36,37 @@
a small QML file emphasizing a particular type or feature.
ColorAnimation demonstrates using a color animation to fade a sky from day to night.
- \snippet quick/animation/basics/color-animation.qml 0
+ \snippet animation/basics/color-animation.qml 0
PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
- \snippet quick/animation/basics/property-animation.qml 0
+ \snippet animation/basics/property-animation.qml 0
Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
- \snippet quick/animation/behaviors/behavior-example.qml 0
+ \snippet animation/behaviors/behavior-example.qml 0
Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
It does this by assigning a complex binding to each letter:
- \snippet quick/animation/behaviors/wigglytext.qml 0
+ \snippet animation/behaviors/wigglytext.qml 0
Then, it uses behaviors to animate the movement on each letter:
- \snippet quick/animation/behaviors/wigglytext.qml 1
+ \snippet animation/behaviors/wigglytext.qml 1
Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game.
Again a binding which depends on other values is applied to the position and a behavior provided the animation.
- \snippet quick/animation/behaviors/tvtennis.qml 0
+ \snippet animation/behaviors/tvtennis.qml 0
Easing Curves shows off all the easing curves available in Qt Quick animations.
States demonstrates how the properties of an item can vary between states.
It defines several states:
- \snippet quick/animation/states/states.qml 0
+ \snippet animation/states/states.qml 0
Note that there is also the implicit 'base state' from properties set directly on objects.
Transitions takes the States example and animates the property changes by setting transitions:
- \snippet quick/animation/states/transitions.qml 0
+ \snippet animation/states/transitions.qml 0
PathAnimation animates an image along a beizer curve using a PathAnimation.
- \snippet quick/animation/pathanimation/pathanimation.qml 0
+ \snippet animation/pathanimation/pathanimation.qml 0
PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
- \snippet quick/animation/pathinterpolator/pathinterpolator.qml 0
+ \snippet animation/pathinterpolator/pathinterpolator.qml 0
*/
diff --git a/examples/quick/canvas/doc/src/canvas.qdoc b/examples/quick/canvas/doc/src/canvas.qdoc
index 638d25d83f..f3eb78e1d1 100644
--- a/examples/quick/canvas/doc/src/canvas.qdoc
+++ b/examples/quick/canvas/doc/src/canvas.qdoc
@@ -36,12 +36,12 @@
a small QML file emphasizing a particular type or feature.
Red heart demonstrates using a bezierCurve API to stroke and fill a red heart.
- \snippet quick/canvas/bezierCurve/bezierCurve.qml 0
+ \snippet canvas/bezierCurve/bezierCurve.qml 0
Talk bubble demonstrates using a quadraticCurveTo API to stroke and fill a customized talk bubble:
- \snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 0
+ \snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 0
This example also demonstrates the fillText API:
- \snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 1
+ \snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 1
Squircle demonstrates using a collection of simple moveTo/lineTo path APIs to draw a smooth squircle.
@@ -50,9 +50,9 @@
Smile face demonstrates using several complex path APIs to draw an fill a smile face.
Clip demonstrates using clip API to clip a given image.
- \snippet quick/canvas/clip/clip.qml 0
+ \snippet canvas/clip/clip.qml 0
Tiger demonstrates using SVG path API to draw a tiger with a collection of SVG path strings.
- \snippet quick/canvas/tiger/tiger.qml 0
+ \snippet canvas/tiger/tiger.qml 0
*/
diff --git a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml
index 0756d339ff..69e703cca7 100644
--- a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml
+++ b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml
@@ -116,13 +116,12 @@ Item {
if (canvas.stroke)
ctx.stroke();
- ctx.restore();
-
// ![1]
ctx.fillStyle = "white";
ctx.font = "Bold 17px";
- ctx.fillText("Qt Quick", 110, 140);
+ ctx.fillText("Qt Quick", 40, 70);
// ![1]
+ ctx.restore();
}
}
}
diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
index be37a5936d..4f0818ac71 100644
--- a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
+++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp
@@ -42,7 +42,7 @@
#include <QStyleHints>
#include <QGuiApplication>
-
+#include <qqmlfile.h>
MaskedMouseArea::MaskedMouseArea(QQuickItem *parent)
: QQuickItem(parent),
@@ -74,7 +74,7 @@ void MaskedMouseArea::setMaskSource(const QUrl &source)
{
if (m_maskSource != source) {
m_maskSource = source;
- m_maskImage = QImage(source.toLocalFile());
+ m_maskImage = QImage(QQmlFile::urlToLocalFileOrQrc(source));
emit maskSourceChanged();
}
}
diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro
index 77e4d146e1..3ec6420abf 100644
--- a/examples/quick/customitems/painteditem/painteditem.pro
+++ b/examples/quick/customitems/painteditem/painteditem.pro
@@ -18,3 +18,6 @@ qmldir.files = TextBalloonPlugin/qmldir
qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin
INSTALLS += qmldir target
+
+OTHER_FILES += \
+ textballoons.qml
diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro
index 1b002a5f27..91d52a293e 100644
--- a/examples/quick/demos/calqlatr/calqlatr.pro
+++ b/examples/quick/demos/calqlatr/calqlatr.pro
@@ -6,5 +6,24 @@ SOURCES += main.cpp
RESOURCES += calqlatr.qrc \
../../shared/shared.qrc
+OTHER_FILES = calqlatr.qml \
+ content/Button.qml \
+ content/Display.qml \
+ content/NumberPad.qml \
+ content/StyleLabel.qml \
+ content/audio/touch.wav \
+ content/calculator.js \
+ content/images/icon-back.png \
+ content/images/icon-close.png \
+ content/images/icon-settings.png \
+ content/images/logo.png \
+ content/images/paper-edge-left.png \
+ content/images/paper-edge-right.png \
+ content/images/paper-grip.png \
+ content/images/settings-selected-a.png \
+ content/images/settings-selected-b.png \
+ content/images/touch-green.png \
+ content/images/touch-white.png
+
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr
INSTALLS += target
diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml
index 16b2e19724..0a092c25da 100644
--- a/examples/quick/demos/calqlatr/calqlatr.qml
+++ b/examples/quick/demos/calqlatr/calqlatr.qml
@@ -57,7 +57,7 @@ Rectangle {
Item {
id: pad
- width: window.width * 0.58
+ width: 180
NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter }
}
@@ -77,7 +77,7 @@ Rectangle {
Display {
id: display
x: -16
- width: window.width * 0.42
+ width: window.width - pad.width
height: parent.height
MouseArea {
@@ -85,7 +85,12 @@ Rectangle {
property real oldP: 0
property bool rewind: false
- anchors.fill: parent
+ anchors {
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ }
+ height: 50
onPositionChanged: {
var reverse = startX > window.width / 2
var mx = mapToItem(window, mouse.x).x
diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml
index 4a78a3ebcd..ec8edfea66 100644
--- a/examples/quick/demos/calqlatr/content/Display.qml
+++ b/examples/quick/demos/calqlatr/content/Display.qml
@@ -42,23 +42,38 @@ import QtQuick 2.0
Item {
id: display
+ property bool enteringDigits: false
function displayOperator(operator)
{
listView.model.append({ "operator": operator, "operand": "" })
+ enteringDigits = true
}
function newLine(operator, operand)
{
listView.model.append({ "operator": operator, "operand": operand })
+ enteringDigits = false
+ listView.positionViewAtEnd()
}
function appendDigit(digit)
{
- if (!listView.model.count)
+ if (!enteringDigits)
listView.model.append({ "operator": "", "operand": "" })
var i = listView.model.count - 1;
listView.model.get(i).operand = listView.model.get(i).operand + digit;
+ enteringDigits = true
+ }
+
+ function clear()
+ {
+ if (enteringDigits) {
+ var i = listView.model.count - 1
+ if (i >= 0)
+ listView.model.remove(i)
+ enteringDigits = false
+ }
}
Item {
@@ -87,6 +102,7 @@ Item {
}
Image {
+ id: grip
source: "images/paper-grip.png"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
@@ -97,7 +113,7 @@ Item {
id: listView
x: 16; y: 30
width: display.width
- height: display.height
+ height: display.height - 50 - y
delegate: Item {
height: 20
width: parent.width
diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml
index 3203e18431..c7f2680651 100644
--- a/examples/quick/demos/calqlatr/content/NumberPad.qml
+++ b/examples/quick/demos/calqlatr/content/NumberPad.qml
@@ -60,7 +60,7 @@ Grid {
Button { text: "±"; color: "#6da43d"; operator: true }
Button { text: "−"; color: "#6da43d"; operator: true }
Button { text: "+"; color: "#6da43d"; operator: true }
- Button { text: " "; color: "#6da43d"; operator: true }
+ Button { text: "√"; color: "#6da43d"; operator: true }
Button { text: "÷"; color: "#6da43d"; operator: true }
Button { text: "×"; color: "#6da43d"; operator: true }
Button { text: "C"; color: "#6da43d"; operator: true }
diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js
index d86fecbf39..da8e940b16 100644
--- a/examples/quick/demos/calqlatr/content/calculator.js
+++ b/examples/quick/demos/calqlatr/content/calculator.js
@@ -84,7 +84,7 @@ function operatorPressed(op)
} else if (previousOperator == "×") {
digits = Number(curVal) * Number(digits.valueOf())
} else if (previousOperator == "÷") {
- digits = Number(Number(curVal) / Number(digits.valueOf())).toString()
+ digits = Number(curVal) / Number(digits.valueOf())
} else if (previousOperator == "=") {
}
@@ -110,9 +110,9 @@ function operatorPressed(op)
digits = (Math.abs(digits.valueOf())).toString()
} else if (op == "Int") {
digits = (Math.floor(digits.valueOf())).toString()
- } else if (op == window.plusminus) {
+ } else if (op == "±") {
digits = (digits.valueOf() * -1).toString()
- } else if (op == window.squareRoot) {
+ } else if (op == "√") {
digits = (Math.sqrt(digits.valueOf())).toString()
} else if (op == "mc") {
memory = 0;
@@ -130,7 +130,7 @@ function operatorPressed(op)
} else if (op == "Off") {
Qt.quit();
} else if (op == "C") {
- digits = "0"
+ display.clear()
} else if (op == "AC") {
curVal = 0
memory = 0
diff --git a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png b/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png
index af67f63dd1..af67f63dd1 100644
--- a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png
+++ b/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png
Binary files differ
diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc
index 60a9725e53..7217c7d806 100644
--- a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc
+++ b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc
@@ -26,13 +26,11 @@
****************************************************************************/
/*!
- \title QML Demo - Calqlatr
+ \title Qt Quick Demo - Calqlatr
+ \ingroup qtquickdemos
\example demos/calqlatr
- \brief This is an example calculator written in QML.
- \image qml-calqlatr-demo-small.png
- \ingroup qmldemos
-
- This demo implements a simple calculator app, designed for portrait devices.
+ \brief A simple calculator app, designed for portrait devices.
+ \image qtquick-demo-calqlatr.png
This app has the logic implemented in Javascipt and the appearance implemented in QML.
*/
diff --git a/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png b/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png
new file mode 100644
index 0000000000..94b641d891
--- /dev/null
+++ b/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png
Binary files differ
diff --git a/examples/quick/demos/clocks/doc/src/clocks.qdoc b/examples/quick/demos/clocks/doc/src/clocks.qdoc
new file mode 100644
index 0000000000..b34f844cc6
--- /dev/null
+++ b/examples/quick/demos/clocks/doc/src/clocks.qdoc
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - Clocks
+ \ingroup qtquickdemos
+ \example demos/clocks
+ \brief An app that shows the current time in different cities.
+ \image qtquick-demo-clocks-small.png
+*/
+
diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png
new file mode 100644
index 0000000000..6d41179c23
--- /dev/null
+++ b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png
Binary files differ
diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png
new file mode 100644
index 0000000000..c8f37486f6
--- /dev/null
+++ b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png
Binary files differ
diff --git a/examples/quick/demos/maroon/doc/src/maroon.qdoc b/examples/quick/demos/maroon/doc/src/maroon.qdoc
new file mode 100644
index 0000000000..c18b6bc874
--- /dev/null
+++ b/examples/quick/demos/maroon/doc/src/maroon.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - Maroon in Trouble
+ \ingroup qtquickdemos
+ \example demos/maroon
+ \brief A cute game designed for touchscreens.
+ \image qtquick-demo-maroon-med-1.png
+ \image qtquick-demo-maroon-med-2.png
+*/
+
diff --git a/examples/quick/demos/photosurface/doc/images/qml-photosurface-example-small.png b/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png
index a0cd823999..a0cd823999 100644
--- a/examples/quick/demos/photosurface/doc/images/qml-photosurface-example-small.png
+++ b/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png
Binary files differ
diff --git a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
index 343acce14a..48f8e8a14b 100644
--- a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
+++ b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \title QML Demo - Photo Surface
+ \title Qt Quick Demo - Photo Surface
+ \ingroup qtquickdemos
\example demos/photosurface
- \brief This is the typical touch photo-shuffling example written in QML.
- \image qml-photosurface-example-small.png
- \ingroup qtquickexamples
+ \brief A touch-based app for shuffling photos around a virtual surface.
+ \image qtquick-demo-photosurface-small.png
This example demonstrates how to handle dragging, rotation and
pinch zooming within the same item using a PinchArea containing a MouseArea.
diff --git a/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png b/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png
new file mode 100644
index 0000000000..d872310a3e
--- /dev/null
+++ b/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png
Binary files differ
diff --git a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
new file mode 100644
index 0000000000..b0f1368a1c
--- /dev/null
+++ b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - Photo Viewer
+ \ingroup qtquickdemos
+ \example demos/photoviewer
+ \brief An online photo viewer that displays Flickr feeds.
+ \image qtquick-demo-photoviewer-small.png
+*/
+
diff --git a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png
new file mode 100644
index 0000000000..0ad6c02251
--- /dev/null
+++ b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png
Binary files differ
diff --git a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc
new file mode 100644
index 0000000000..019b54d609
--- /dev/null
+++ b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - RSS News
+ \ingroup qtquickdemos
+ \example demos/rssnews
+ \brief An RSS news reader.
+ \image qtquick-demo-rssnews-small.png
+*/
+
diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png
new file mode 100644
index 0000000000..cce9f11017
--- /dev/null
+++ b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png
Binary files differ
diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png
new file mode 100644
index 0000000000..ca9e8368b1
--- /dev/null
+++ b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png
Binary files differ
diff --git a/examples/quick/demos/samegame/doc/src/samegame.qdoc b/examples/quick/demos/samegame/doc/src/samegame.qdoc
new file mode 100644
index 0000000000..70042d73f0
--- /dev/null
+++ b/examples/quick/demos/samegame/doc/src/samegame.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - Same Game
+ \ingroup qtquickdemos
+ \example demos/samegame
+ \brief A QML implementation of the popular puzzle game by Kuniaki Moribe.
+ \image qtquick-demo-samegame-med-1.png
+ \image qtquick-demo-samegame-med-2.png
+*/
+
diff --git a/examples/quick/demos/stocqt/content/CheckBox.qml b/examples/quick/demos/stocqt/content/CheckBox.qml
index 9c429d65dc..1e7dcf7c74 100644
--- a/examples/quick/demos/stocqt/content/CheckBox.qml
+++ b/examples/quick/demos/stocqt/content/CheckBox.qml
@@ -40,13 +40,12 @@
import QtQuick 2.0
-Row {
+Item {
id: button
property alias text: txt.text
property bool buttonEnabled: true
width: 140
height: 25
- spacing: 5
x: 5
MouseArea {
id: mouse
@@ -75,14 +74,14 @@ Row {
radius: 1
color: mouse.pressed || buttonEnabled ? "#76644A" : "transparent"
}
- Text {
- id: txt
- anchors.left: checkbox.right
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- text: "Close "
- color: "#ecc089"
- font.pixelSize: 18
- }
+ }
+ Text {
+ id: txt
+ anchors.left: checkbox.right
+ anchors.leftMargin: 4
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Close "
+ color: "#ecc089"
+ font.pixelSize: 18
}
}
diff --git a/examples/quick/demos/stocqt/content/StockSettings.qml b/examples/quick/demos/stocqt/content/StockSettings.qml
index 5978a3b6a0..07152410fa 100644
--- a/examples/quick/demos/stocqt/content/StockSettings.qml
+++ b/examples/quick/demos/stocqt/content/StockSettings.qml
@@ -88,7 +88,6 @@ Rectangle {
anchors.leftMargin: 30
anchors.top: startDateText.bottom
anchors.topMargin: 8
- date: new Date(1995, 3, 25)
}
Text {
@@ -212,4 +211,6 @@ Rectangle {
onClicked: root.chartType = "all"
}
}
+
+ Component.onCompleted: startDatePicker.date = new Date(1995, 3, 25)
}
diff --git a/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png b/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png
new file mode 100644
index 0000000000..1783881e1f
--- /dev/null
+++ b/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png
Binary files differ
diff --git a/examples/quick/demos/stocqt/doc/src/stocqt.qdoc b/examples/quick/demos/stocqt/doc/src/stocqt.qdoc
new file mode 100644
index 0000000000..7001bfb395
--- /dev/null
+++ b/examples/quick/demos/stocqt/doc/src/stocqt.qdoc
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - StocQt
+ \ingroup qtquickdemos
+ \example demos/stocqt
+ \brief A configurable stock chart for the NASDAQ-100.
+ \image qtquick-demo-stocqt.png
+*/
+
diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png
new file mode 100644
index 0000000000..930ee39929
--- /dev/null
+++ b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png
Binary files differ
diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png
new file mode 100644
index 0000000000..9eff191a47
--- /dev/null
+++ b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png
Binary files differ
diff --git a/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc b/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc
new file mode 100644
index 0000000000..9ba252fcb5
--- /dev/null
+++ b/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick Demo - Tweet Search
+ \ingroup qtquickdemos
+ \example demos/tweetsearch
+ \brief A Twitter search client with 3D effects.
+ \image qtquick-demo-tweetsearch-med-1.png
+ \image qtquick-demo-tweetsearch-med-2.png
+*/
+
diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml
index 7817c8edf8..6a0af7f730 100644
--- a/examples/quick/dialogs/ColorDialogs.qml
+++ b/examples/quick/dialogs/ColorDialogs.qml
@@ -46,9 +46,10 @@ Rectangle {
width: 320
height: 200
color: palette.window
-
SystemPalette { id: palette }
+ clip: true
+ //! [colordialog]
ColorDialog {
id: colorDialog
visible: colorDialogVisible.checked
@@ -59,10 +60,11 @@ Rectangle {
onAccepted: { console.log("Accepted: " + color) }
onRejected: { console.log("Rejected") }
}
+ //! [colordialog]
Column {
anchors.fill: parent
- anchors.margins: 8
+ anchors.margins: 12
spacing: 8
Text {
font.bold: true
@@ -106,4 +108,38 @@ Rectangle {
}
}
}
+
+ Rectangle {
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: 50
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ height: parent.height - 6
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.open()
+ }
+ Button {
+ text: "Close"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.close()
+ }
+ Button {
+ text: "set to green"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.color = "green"
+ }
+ }
+ }
}
diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml
index a6df29bb37..d1278609f9 100644
--- a/examples/quick/dialogs/FileDialogs.qml
+++ b/examples/quick/dialogs/FileDialogs.qml
@@ -43,44 +43,13 @@ import QtQuick.Dialogs 1.0
import "../shared"
Rectangle {
-
width: 580
- height: 360
+ height: 400
color: palette.window
SystemPalette { id: palette }
+ clip: true
- Rectangle {
- id: toolbar
- width: parent.width
- height: 40
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
- Row {
- spacing: 6
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 8
- height: parent.height - 6
- width: parent.width
- Button {
- text: "Open"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: fileDialog.open()
- }
- Button {
- text: "Close"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: fileDialog.close()
- }
- Button {
- text: "/tmp"
- anchors.verticalCenter: parent.verticalCenter
- // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
- onClicked: fileDialog.folder = "/tmp"
- }
- }
- }
-
+ //! [filedialog]
FileDialog {
id: fileDialog
visible: fileDialogVisible.checked
@@ -95,12 +64,11 @@ Rectangle {
onAccepted: { console.log("Accepted: " + fileUrls) }
onRejected: { console.log("Rejected") }
}
+ //! [filedialog]
Column {
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: toolbar.bottom
- anchors.margins: 8
+ anchors.fill: parent
+ anchors.margins: 12
spacing: 8
Text {
color: palette.windowText
@@ -163,4 +131,39 @@ Rectangle {
wrapMode: Text.Wrap
}
}
+
+ Rectangle {
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: 50
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ height: parent.height - 6
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fileDialog.open()
+ }
+ Button {
+ text: "Close"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fileDialog.close()
+ }
+ Button {
+ text: "go to /tmp"
+ anchors.verticalCenter: parent.verticalCenter
+ // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
+ onClicked: fileDialog.folder = "/tmp"
+ }
+ }
+ }
}
diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro
new file mode 100644
index 0000000000..b76f396e9d
--- /dev/null
+++ b/examples/quick/dialogs/dialogs.pro
@@ -0,0 +1,17 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+RESOURCES += dialogs.qrc ../shared/shared.qrc
+
+OTHER_FILES += \
+ dialogs.qml \
+ FileDialogs.qml \
+ ColorDialogs.qml
+
+EXAMPLE_FILES = \
+ FileDialogs.qml \
+ ColorDialogs.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs
+INSTALLS += target
diff --git a/examples/quick/window/window/Window.qml b/examples/quick/dialogs/dialogs.qml
index 07900930d3..b5f9841a3f 100644
--- a/examples/quick/window/window/Window.qml
+++ b/examples/quick/dialogs/dialogs.qml
@@ -39,20 +39,21 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.0
+import "../shared"
-Window {
- width: 640
- height: 480
- visible: true //It's false by default
- property Component self
- Component.onCompleted: self = Qt.createComponent("Window.qml")
- Text{
- text: "Hello World!"
- anchors.centerIn: parent
+TabSet {
+ width: 580
+ height: 440
+
+ FileDialogs {
+ property string title: "File Dialog"
+ anchors.fill: parent
+ color: "#e3e3e3" // to match tab.png
}
- MouseArea{
+
+ ColorDialogs {
+ property string title: "Color Dialog"
anchors.fill: parent
- onClicked: self.createObject();
+ color: "#e3e3e3" // to match tab.png
}
}
diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc
new file mode 100644
index 0000000000..efebfe4845
--- /dev/null
+++ b/examples/quick/dialogs/dialogs.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/dialogs">
+ <file>dialogs.qml</file>
+ <file>FileDialogs.qml</file>
+ <file>ColorDialogs.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/dialogs/doc/images/dialogs-example.jpg b/examples/quick/dialogs/doc/images/dialogs-example.jpg
new file mode 100644
index 0000000000..4517a39308
--- /dev/null
+++ b/examples/quick/dialogs/doc/images/dialogs-example.jpg
Binary files differ
diff --git a/examples/quick/dialogs/doc/src/dialogs.qdoc b/examples/quick/dialogs/doc/src/dialogs.qdoc
new file mode 100644
index 0000000000..daac914c60
--- /dev/null
+++ b/examples/quick/dialogs/doc/src/dialogs.qdoc
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \title Qt Quick Dialog Examples
+ \example dialogs
+ \brief This example demonstrates the dialog types in QML
+ \image dialogs-example.jpg
+ \ingroup qtquickdialog_examples
+
+ This example demonstrates the system dialogs in the \l{Qt Quick Dialogs}
+ module. The appearance and behavior is platform-dependent.
+
+ A \l FileDialog is used to choose a single file, multiple files or a
+ single directory, depending on how it is configured.
+ \snippet dialogs/FileDialogs.qml filedialog
+
+ A \l ColorDialog is used to choose a color, with or without alpha (transparency)
+ depending on how it is configured.
+ \snippet dialogs/ColorDialogs.qml colordialog
+*/
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml b/examples/quick/dialogs/main.cpp
index 410b3f68d1..bbf0c48104 100644
--- a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml
+++ b/examples/quick/dialogs/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** 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:
@@ -37,10 +37,5 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-//![0]
-// main.qml
-import QtQuick 2.0
-
-Image { source: "images/background.png" }
-//![0]
+#include "../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs)
diff --git a/examples/quick/draganddrop/doc/src/draganddrop.qdoc b/examples/quick/draganddrop/doc/src/draganddrop.qdoc
index 381fdd1299..2c62e271e6 100644
--- a/examples/quick/draganddrop/doc/src/draganddrop.qdoc
+++ b/examples/quick/draganddrop/doc/src/draganddrop.qdoc
@@ -37,12 +37,12 @@
It has a DragTile component which uses a MouseArea to move an item when dragged:
- \snippet quick/draganddrop/tiles/DragTile.qml 0
- \snippet quick/draganddrop/tiles/DragTile.qml 1
+ \snippet draganddrop/tiles/DragTile.qml 0
+ \snippet draganddrop/tiles/DragTile.qml 1
And a DropTile component which the dragged tiles can be dropped onto:
- \snippet quick/draganddrop/tiles/DropTile.qml 0
+ \snippet draganddrop/tiles/DropTile.qml 0
The keys property of the DropArea will only allow an item with matching key in
it's Drag.keys property to be dropped on it.
@@ -52,7 +52,7 @@
It uses a DelegateModel to move a delegate item to the position of another item
it is dragged over.
- \snippet quick/draganddrop/views/gridview.qml 0
- \snippet quick/draganddrop/views/gridview.qml 1
+ \snippet draganddrop/views/gridview.qml 0
+ \snippet draganddrop/views/gridview.qml 1
*/
diff --git a/examples/quick/imageelements/doc/src/imageelements.qdoc b/examples/quick/imageelements/doc/src/imageelements.qdoc
index 5abcece4fc..d88201faf9 100644
--- a/examples/quick/imageelements/doc/src/imageelements.qdoc
+++ b/examples/quick/imageelements/doc/src/imageelements.qdoc
@@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
- \title QML Examples - Image Elements
+ \title Qt Quick Examples - Image Elements
\example imageelements
\brief This is a collection of QML examples relating to image types.
\image qml-imageelements-example.png
@@ -40,20 +40,20 @@
'Shadows' shows how to create a drop shadow effect for a rectangular item
using a BorderImage:
- \snippet quick/imageelements/content/ShadowRectangle.qml shadow
+ \snippet imageelements/content/ShadowRectangle.qml shadow
'AnimatedSprite' shows how to display a simple animation using an
AnimatedSprite object:
- \snippet quick/imageelements/animatedsprite.qml sprite
+ \snippet imageelements/animatedsprite.qml sprite
The sprite animation will loop 3 times.
'SpriteSequence' demonstrates using a sprite sequence to draw an animated
and interactive bear.
The SpriteSequence defines 5 different sprites. The bear is initially in
a 'still' state:
- \snippet quick/imageelements/spritesequence.qml still
+ \snippet imageelements/spritesequence.qml still
When the scene is clicked, an animation sets the sprite sequence to the
'falling' states and animates the bear's y property.
- \snippet quick/imageelements/spritesequence.qml animation
+ \snippet imageelements/spritesequence.qml animation
At the end of the animation the bear is set back to its initial state.
*/
diff --git a/examples/quick/mousearea/doc/src/mousearea.qdoc b/examples/quick/mousearea/doc/src/mousearea.qdoc
index b0d9abce8f..091be69e5d 100644
--- a/examples/quick/mousearea/doc/src/mousearea.qdoc
+++ b/examples/quick/mousearea/doc/src/mousearea.qdoc
@@ -37,10 +37,10 @@
of that click which are available to QML.
Signals are emitted by the MouseArea when clicks or other discrete operations occur within it
- \snippet quick/mousearea/mousearea.qml clicks
+ \snippet mousearea/mousearea.qml clicks
The MouseArea can also be used to drag items around. By setting the parameters of the drag property,
the target item will be dragged around if the user starts to drag within the MouseArea.
- \snippet quick/mousearea/mousearea.qml drag
+ \snippet mousearea/mousearea.qml drag
*/
diff --git a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc
index d4aabc01d8..7869383ca2 100644
--- a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc
+++ b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc
@@ -27,7 +27,7 @@
/*!
- \title Scenegraph Painted Item Example
+ \title Scene Graph - Painted Item
\brief Shows how to implement QPainter-based custom scenegraph items.
\example customitems/painteditem
\ingroup qtquickexamples
@@ -43,12 +43,12 @@
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 QQuickPaintedItem, the \c TextBalloonPlugin class
- represents the skeleton code for a QtQuick plugin and the
+ represents the skeleton code for a \l {Qt Quick} 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
+ \c textballoons.qml file. For an example on how to implement a \l {Qt Quick}
plugin please look at \l{declarative/tutorials/extending/chapter6-plugins}
{Writing an Extension Plugin}
@@ -58,7 +58,7 @@
is the base class for all QPainter based items in the QML Scene Graph
framework.
- \snippet quick/customitems/painteditem/textballoon.h 0
+ \snippet customitems/painteditem/textballoon.h 0
To implement a QQuickPaintedItem you must implement QQuickPaintedIem's pure
virtual function \l {QQuickPaintedItem::}{paint()} which implements the
@@ -69,13 +69,13 @@
We have to be sure to initialize the rightAligned property for a
TextBalloon item.
- \snippet quick/customitems/painteditem/textballoon.cpp 0
+ \snippet customitems/painteditem/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
+ the Scene Graph framework to paint the contents of the item. The function
paints the item in local coordinates.
- \snippet quick/customitems/painteditem/textballoon.cpp 1
+ \snippet customitems/painteditem/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 {QQuickPaintedItem::}{boundingRect()}
@@ -90,7 +90,7 @@
\section2 BalloonView
- \snippet quick/customitems/painteditem/textballoons.qml 0
+ \snippet customitems/painteditem/textballoons.qml 0
The balloonModel contains two types at application start which will be
displayed by the balloonView. The balloonView alernates the TextBalloon
@@ -98,7 +98,7 @@
\section2 Controls
- \snippet quick/customitems/painteditem/textballoons.qml 1
+ \snippet customitems/painteditem/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
diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/content/attractor.qml
index fd7fd65b9c..349132e61a 100644
--- a/examples/quick/particles/affectors/content/attractor.qml
+++ b/examples/quick/particles/affectors/content/attractor.qml
@@ -77,7 +77,7 @@ Rectangle {
ImageParticle {
id: stars
groups: ["stars"]
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color: "white"
colorVariation: 0.1
alpha: 0
@@ -96,7 +96,7 @@ Rectangle {
ImageParticle {
id: shot
groups: ["shot"]
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color: "#0FF06600"
colorVariation: 0.3
@@ -104,7 +104,7 @@ Rectangle {
ImageParticle {
id: engine
groups: ["engine"]
- source: "../../images/particle4.png"
+ source: "qrc:///particleresources/fuzzydot.png"
color: "orange"
SequentialAnimation on color {
diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/content/groupgoal.qml
index 19fa041288..cf4361eb94 100644
--- a/examples/quick/particles/affectors/content/groupgoal.qml
+++ b/examples/quick/particles/affectors/content/groupgoal.qml
@@ -124,7 +124,7 @@ Rectangle {
id: smoke
anchors.fill: parent
groups: ["smoke"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorVariation: 0
color: "#00111111"
}
@@ -132,7 +132,7 @@ Rectangle {
id: pilot
anchors.fill: parent
groups: ["pilot"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
redVariation: 0.01
blueVariation: 0.4
color: "#0010004f"
diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/content/move.qml
index b4d83318b0..e90f8c685c 100644
--- a/examples/quick/particles/affectors/content/move.qml
+++ b/examples/quick/particles/affectors/content/move.qml
@@ -50,7 +50,7 @@ Rectangle {
ImageParticle {
groups: ["A"]
anchors.fill: parent
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color:"#FF1010"
redVariation: 0.8
}
@@ -80,7 +80,7 @@ Rectangle {
ImageParticle {
groups: ["B"]
anchors.fill: parent
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color:"#10FF10"
greenVariation: 0.8
}
@@ -112,7 +112,7 @@ Rectangle {
ImageParticle {
groups: ["C"]
anchors.fill: parent
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color:"#1010FF"
blueVariation: 0.8
}
diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/content/spritegoal.qml
index 78b161f25b..ab108bb065 100644
--- a/examples/quick/particles/affectors/content/spritegoal.qml
+++ b/examples/quick/particles/affectors/content/spritegoal.qml
@@ -66,7 +66,7 @@ Item {
ImageParticle {
system: sys
groups: ["starfield"]
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
colorVariation: 0.3
color: "white"
}
@@ -170,7 +170,7 @@ Item {
z:0
system: sys
groups: ["exhaust"]
- source: "../../images/particle4.png"
+ source: "qrc:///particleresources/fuzzydot.png"
color: "orange"
SequentialAnimation on color {
diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/content/turbulence.qml
index d7a86039b4..eacedbe153 100644
--- a/examples/quick/particles/affectors/content/turbulence.qml
+++ b/examples/quick/particles/affectors/content/turbulence.qml
@@ -75,13 +75,13 @@ Rectangle {
ImageParticle {
groups: ["smoke"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
color: "#11111111"
colorVariation: 0
}
ImageParticle {
groups: ["flame"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
color: "#11ff400f"
colorVariation: 0.1
}
diff --git a/examples/quick/particles/affectors/doc/src/affectors.qdoc b/examples/quick/particles/affectors/doc/src/affectors.qdoc
index 58661d5b70..a1407abda2 100644
--- a/examples/quick/particles/affectors/doc/src/affectors.qdoc
+++ b/examples/quick/particles/affectors/doc/src/affectors.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Age demonstrates using an Age affector to prematurely end the lives of particles.
- \snippet quick/particles/affectors/content/age.qml 0
+ \snippet particles/affectors/content/age.qml 0
As you move the affector around the screen, the particles inside it
(which haven't already been affected) jump to a period near the end
@@ -44,7 +44,7 @@
the end of their life instantly.
Attractor demonstrates using an Attractor affector to simulate a black hole
- \snippet quick/particles/affectors/content/attractor.qml 0
+ \snippet particles/affectors/content/attractor.qml 0
All particles in the scene, including the rocket ship's exhaust and pellets, are pulled
towards the black hole. This effect is stronger closer to the black hole, so the
@@ -55,58 +55,58 @@
Custom Affector manipulates the properties of the particles directly in javascript.
One Affector is used to make the leaves rock back and forth as they fall, looking more
leaf-like than just spinning in circles:
- \snippet quick/particles/affectors/content/customaffector.qml 0
+ \snippet particles/affectors/content/customaffector.qml 0
Another is used to provide a slightly varying friction to the leaves as they 'land',
to look more natural:
- \snippet quick/particles/affectors/content/customaffector.qml 1
+ \snippet particles/affectors/content/customaffector.qml 1
Friction is similar to the falling leaves in the custom affector, except that it uses a
flat friction the whole way down instead of custom affectors.
- \snippet quick/particles/affectors/content/friction.qml 0
+ \snippet particles/affectors/content/friction.qml 0
Gravity is a convenience affector for applying a constant acceleration to particles inside it
- \snippet quick/particles/affectors/content/gravity.qml 0
+ \snippet particles/affectors/content/gravity.qml 0
GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various
ways to transition between them.
- \snippet quick/particles/affectors/content/groupgoal.qml unlit
+ \snippet particles/affectors/content/groupgoal.qml unlit
The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also
have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding
with particles in the lit group, and cause them to move to the lighting group.
- \snippet quick/particles/affectors/content/groupgoal.qml lighting
+ \snippet particles/affectors/content/groupgoal.qml lighting
lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically
moves into the lit group after 100ms.
- \snippet quick/particles/affectors/content/groupgoal.qml lit
+ \snippet particles/affectors/content/groupgoal.qml lit
The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere.
There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group
(and then to the lit group).
- \snippet quick/particles/affectors/content/groupgoal.qml groupgoal-pilot
+ \snippet particles/affectors/content/groupgoal.qml groupgoal-pilot
The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame,
they go straight to lit because the pilot flame is so hot.
- \snippet quick/particles/affectors/content/groupgoal.qml groupgoal-ma
+ \snippet particles/affectors/content/groupgoal.qml groupgoal-ma
The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which
is hard due to their constant movement) causes them to move to the lighting group.
Move shows some simple effects you can get by altering trajectory midway.
The red particles have an affector that affects their position, jumping them forwards by 120px.
- \snippet quick/particles/affectors/content/move.qml A
+ \snippet particles/affectors/content/move.qml A
The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction
velocity to their existing forwards velocity, they begin to spray off in a cone.
- \snippet quick/particles/affectors/content/move.qml B
+ \snippet particles/affectors/content/move.qml B
The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of
adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases.
- \snippet quick/particles/affectors/content/move.qml C
+ \snippet particles/affectors/content/move.qml C
SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle.
- \snippet quick/particles/affectors/content/spritegoal.qml 0
+ \snippet particles/affectors/content/spritegoal.qml 0
The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites,
it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces.
Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect.
- \snippet quick/particles/affectors/content/turbulence.qml 0
+ \snippet particles/affectors/content/turbulence.qml 0
To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source).
Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down.
- \snippet quick/particles/affectors/content/wander.qml 0
+ \snippet particles/affectors/content/wander.qml 0
There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference.
*/
diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml
index 130518a6f9..3fb4c9f378 100644
--- a/examples/quick/particles/customparticle/content/imagecolors.qml
+++ b/examples/quick/particles/customparticle/content/imagecolors.qml
@@ -71,7 +71,7 @@ Rectangle {
}
Image {
id: particle
- source: "../../images/particle4.png"
+ source: "qrc:///particleresources/fuzzydot.png"
}
//! [vertex]
vertexShader:"
diff --git a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc
index ccef82c922..fb53a67831 100644
--- a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc
+++ b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc
@@ -36,19 +36,19 @@
Blur Particles adds a blur effect to the particles, which increases over the particle's life time.
It uses a custom vertex shader:
- \snippet quick/particles/customparticle/content/blurparticles.qml vertex
+ \snippet particles/customparticle/content/blurparticles.qml vertex
to propagate life time simulation to a custom fragement shader:
- \snippet quick/particles/customparticle/content/blurparticles.qml fragment
+ \snippet particles/customparticle/content/blurparticles.qml fragment
which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect.
Fragment Shader just uses the particle system as a vertex delivery system.
- \snippet quick/particles/customparticle/content/fragmentshader.qml 0
+ \snippet particles/customparticle/content/fragmentshader.qml 0
Image Colors uses CustomParticle to assign colors to particles based on their location in a picture.
The vertex shader,
- \snippet quick/particles/customparticle/content/imagecolors.qml vertex
+ \snippet particles/customparticle/content/imagecolors.qml vertex
passes along the starting position for each vertex to the fragment shader,
- \snippet quick/particles/customparticle/content/imagecolors.qml fragment
+ \snippet particles/customparticle/content/imagecolors.qml fragment
which uses it to determine the color for that particle.
*/
diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/content/burstandpulse.qml
index 18d1c43933..28c56b326d 100644
--- a/examples/quick/particles/emitters/content/burstandpulse.qml
+++ b/examples/quick/particles/emitters/content/burstandpulse.qml
@@ -67,7 +67,7 @@ Rectangle {
id: particles
anchors.fill: parent
ImageParticle {
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
alpha: 0
colorVariation: 0.6
}
diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/content/customemitter.qml
index 966c78e70f..9ad504ebc8 100644
--- a/examples/quick/particles/emitters/content/customemitter.qml
+++ b/examples/quick/particles/emitters/content/customemitter.qml
@@ -90,7 +90,7 @@ ParticleSystem {
}
ImageParticle {
- source: "../../images/particle4.png"
+ source: "qrc:///particleresources/fuzzydot.png"
alpha: 0.0
}
}
diff --git a/examples/quick/particles/emitters/content/emitmask.qml b/examples/quick/particles/emitters/content/emitmask.qml
index 08c04f6e5f..1c2e7b458f 100644
--- a/examples/quick/particles/emitters/content/emitmask.qml
+++ b/examples/quick/particles/emitters/content/emitmask.qml
@@ -51,7 +51,7 @@ Rectangle {
anchors.centerIn: parent
ImageParticle {
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
z: 2
anchors.fill: parent
color: "#336666CC"
diff --git a/examples/quick/particles/emitters/content/maximumemitted.qml b/examples/quick/particles/emitters/content/maximumemitted.qml
index df92f05f4b..4bd9079770 100644
--- a/examples/quick/particles/emitters/content/maximumemitted.qml
+++ b/examples/quick/particles/emitters/content/maximumemitted.qml
@@ -53,7 +53,7 @@ Rectangle {
ImageParticle {
system: sys
id: cp
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorVariation: 0.4
color: "#000000FF"
}
diff --git a/examples/quick/particles/emitters/content/shapeanddirection.qml b/examples/quick/particles/emitters/content/shapeanddirection.qml
index 1dec5b2fa7..0ca433cfba 100644
--- a/examples/quick/particles/emitters/content/shapeanddirection.qml
+++ b/examples/quick/particles/emitters/content/shapeanddirection.qml
@@ -58,7 +58,7 @@ Rectangle {
ImageParticle {
groups: ["center","edge"]
anchors.fill: parent
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorVariation: 0.1
color: "#009999FF"
}
diff --git a/examples/quick/particles/emitters/content/trailemitter.qml b/examples/quick/particles/emitters/content/trailemitter.qml
index a4972b7b73..3186b511ef 100644
--- a/examples/quick/particles/emitters/content/trailemitter.qml
+++ b/examples/quick/particles/emitters/content/trailemitter.qml
@@ -56,7 +56,7 @@ Rectangle {
system: particles
anchors.fill: parent
groups: ["A", "B"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorVariation: 0
color: "#00111111"
}
@@ -65,7 +65,7 @@ Rectangle {
anchors.fill: parent
system: particles
groups: ["C", "D"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorVariation: 0.1
color: "#00ff400f"
}
diff --git a/examples/quick/particles/emitters/content/velocityfrommotion.qml b/examples/quick/particles/emitters/content/velocityfrommotion.qml
index 1f1d6607d0..d325f9b7e1 100644
--- a/examples/quick/particles/emitters/content/velocityfrommotion.qml
+++ b/examples/quick/particles/emitters/content/velocityfrommotion.qml
@@ -61,7 +61,7 @@ Rectangle {
ParticleSystem { id: sys1 }
ImageParticle {
system: sys1
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
color: "cyan"
alpha: 0
SequentialAnimation on color {
@@ -127,7 +127,7 @@ Rectangle {
}
}
colorVariation: 0.5
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
}
Emitter {
id: trailsStars
@@ -149,7 +149,7 @@ Rectangle {
}
ParticleSystem { id: sys3; }
ImageParticle {
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
system: sys3
color: "orange"
alpha: 0
@@ -191,7 +191,7 @@ Rectangle {
ParticleSystem { id: sys4; }
ImageParticle {
system: sys4
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
color: "green"
alpha: 0
SequentialAnimation on color {
diff --git a/examples/quick/particles/emitters/doc/src/emitters.qdoc b/examples/quick/particles/emitters/doc/src/emitters.qdoc
index 8eb7919000..acf8ce41c4 100644
--- a/examples/quick/particles/emitters/doc/src/emitters.qdoc
+++ b/examples/quick/particles/emitters/doc/src/emitters.qdoc
@@ -34,27 +34,27 @@
Each example is a small QML file emphasizing a particular type or feature.
Velocity from motion gives the effect of strong particle motion through primarily moving the emitters:
- \snippet quick/particles/emitters/content/velocityfrommotion.qml 0
+ \snippet particles/emitters/content/velocityfrommotion.qml 0
Burst and pulse calls the burst and pulse methods on two idential emitters.
- \snippet quick/particles/emitters/content/burstandpulse.qml 0
+ \snippet particles/emitters/content/burstandpulse.qml 0
Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for.
This gives a slightly different behaviour, which is easy to see in this example.
Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted;
- \snippet quick/particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/content/customemitter.qml 0
This is used to emit curving particles in six rotating spokes.
Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape.
- \snippet quick/particles/emitters/content/emitmask.qml 0
+ \snippet particles/emitters/content/emitmask.qml 0
Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached.
Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection
- \snippet quick/particles/emitters/content/shapeanddirection.qml 0
+ \snippet particles/emitters/content/shapeanddirection.qml 0
This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center.
TrailEmitter uses that type to add smoke particles to trail the fire particles in the scene.
- \snippet quick/particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/content/customemitter.qml 0
*/
diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/content/colored.qml
index 939ec7e437..236cc0f372 100644
--- a/examples/quick/particles/imageparticle/content/colored.qml
+++ b/examples/quick/particles/imageparticle/content/colored.qml
@@ -50,7 +50,7 @@ Rectangle {
ImageParticle {
groups: ["stars"]
anchors.fill: parent
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
}
Emitter {
group: "stars"
@@ -64,7 +64,7 @@ Rectangle {
// ![0]
ImageParticle {
anchors.fill: parent
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
alpha: 0
alphaVariation: 0.2
colorVariation: 1.0
diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/content/colortable.qml
index 4090163872..87b5ae2678 100644
--- a/examples/quick/particles/imageparticle/content/colortable.qml
+++ b/examples/quick/particles/imageparticle/content/colortable.qml
@@ -55,7 +55,7 @@ Rectangle {
alpha: 0
//! [0]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
colorTable: "../../images/colortable.png"
sizeTable: "../../images/colortable.png"
//! [0]
diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
index c8f2dc988b..4fda13746a 100644
--- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
+++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
@@ -35,25 +35,25 @@
Each example is a small QML file emphasizing a particular type or feature.
All at once shows off several of the features of ImageParticle at the same time.
- \snippet quick/particles/imageparticle/content/allatonce.qml 0
+ \snippet particles/imageparticle/content/allatonce.qml 0
Colored shows a simple ImageParticle with some color variation.
- \snippet quick/particles/imageparticle/content/colored.qml 0
+ \snippet particles/imageparticle/content/colored.qml 0
Color Table sets the color over life on the particles to provide a fixed rainbow effect.
- \snippet quick/particles/imageparticle/content/colortable.qml 0
+ \snippet particles/imageparticle/content/colortable.qml 0
Deformation spins and squishes a starfish particle.
- \snippet quick/particles/imageparticle/content/deformation.qml spin
- \snippet quick/particles/imageparticle/content/deformation.qml deform
+ \snippet particles/imageparticle/content/deformation.qml spin
+ \snippet particles/imageparticle/content/deformation.qml deform
Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel.
Sharing demonstrates what happens when multiple ImageParticles try to render the same particle.
The following ImageParticle renders the particles inside the ListView:
- \snippet quick/particles/imageparticle/content/sharing.qml 0
+ \snippet particles/imageparticle/content/sharing.qml 0
The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle.
- \snippet quick/particles/imageparticle/content/sharing.qml 1
+ \snippet particles/imageparticle/content/sharing.qml 1
Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color.
Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both.
Note that you can undo rotation in another ImageParticle, you just need to explicity set rotationVariation to 0.
diff --git a/examples/quick/particles/images.qrc b/examples/quick/particles/images.qrc
index 9f284a087d..1f754838a8 100644
--- a/examples/quick/particles/images.qrc
+++ b/examples/quick/particles/images.qrc
@@ -12,10 +12,8 @@
<file>images/meteor.png</file>
<file>images/meteors.png</file>
<file>images/nullRock.png</file>
- <file>images/particle.png</file>
<file>images/particle2.png</file>
<file>images/particle3.png</file>
- <file>images/particle4.png</file>
<file>images/particleA.png</file>
<file>images/portal_bg.png</file>
<file>images/realLeaf1.png</file>
@@ -27,7 +25,6 @@
<file>images/sizeInOut.png</file>
<file>images/snowflake.png</file>
<file>images/sparkleSize.png</file>
- <file>images/star.png</file>
<file>images/starfish_0.png</file>
<file>images/starfish_1.png</file>
<file>images/starfish_2.png</file>
diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/content/dynamiccomparison.qml
index 247a25a17d..9db7c0a1ec 100644
--- a/examples/quick/particles/system/content/dynamiccomparison.qml
+++ b/examples/quick/particles/system/content/dynamiccomparison.qml
@@ -52,7 +52,7 @@ Rectangle {
ImageParticle {
system: sys
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
color: "white"
colorVariation: 1.0
alpha: 0.1
@@ -90,7 +90,7 @@ Rectangle {
property int lifeSpan: 10000
width: 32
height: 32
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
y: 0
PropertyAnimation on y {from: -16; to: root.height-16; duration: container.lifeSpan; running: true}
SequentialAnimation on opacity {
diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml
index 10ac33bd76..72ec1ffc23 100644
--- a/examples/quick/particles/system/content/dynamicemitters.qml
+++ b/examples/quick/particles/system/content/dynamicemitters.qml
@@ -51,7 +51,7 @@ Rectangle {
}
ImageParticle {
system: sys
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
color: "white"
colorVariation: 1.0
alpha: 0.1
diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/content/multiplepainters.qml
index 8a38874533..e0a1288588 100644
--- a/examples/quick/particles/system/content/multiplepainters.qml
+++ b/examples/quick/particles/system/content/multiplepainters.qml
@@ -91,6 +91,6 @@ Rectangle {
height: 240
width: root.width
z: 1
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
}
}
diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml
index 5ce8729a43..e787919b05 100644
--- a/examples/quick/particles/system/content/startstop.qml
+++ b/examples/quick/particles/system/content/startstop.qml
@@ -69,7 +69,7 @@ Rectangle {
ImageParticle {
anchors.fill: parent
system: particles
- source: "../../images/star.png"
+ source: "qrc:///particleresources/star.png"
sizeTable: "../../images/sparkleSize.png"
alpha: 0
colorVariation: 0.6
diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml
index 6443878a36..7131633769 100644
--- a/examples/quick/particles/system/content/timedgroupchanges.qml
+++ b/examples/quick/particles/system/content/timedgroupchanges.qml
@@ -119,7 +119,7 @@ Rectangle {
ImageParticle {
groups: ["works", "fire", "splode"]
- source: "../../images/particle.png"
+ source: "qrc:///particleresources/glowdot.png"
entryEffect: ImageParticle.Scale
}
}
diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc
index 04dc1727d2..99be23d9d1 100644
--- a/examples/quick/particles/system/doc/src/system.qdoc
+++ b/examples/quick/particles/system/doc/src/system.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image types.
- \snippet quick/particles/system/content/dynamiccomparison.qml fake
+ \snippet particles/system/content/dynamiccomparison.qml fake
Note how the Image objects are not able to be randomly colorized.
Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was.
@@ -43,16 +43,16 @@
Timed group changes is an example that highlights the ParticleGroup type. While normally referring to groups with a string name is sufficient, additional effects can be
done by setting properties on groups.
The first group has a variable duration on it, but always transitions to the second group.
- \snippet quick/particles/system/content/timedgroupchanges.qml 0
+ \snippet particles/system/content/timedgroupchanges.qml 0
The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow.
- \snippet quick/particles/system/content/timedgroupchanges.qml 1
+ \snippet particles/system/content/timedgroupchanges.qml 1
The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle.
- \snippet quick/particles/system/content/timedgroupchanges.qml 2
+ \snippet particles/system/content/timedgroupchanges.qml 2
If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle
- \snippet quick/particles/system/content/dynamicemitters.qml 0
+ \snippet particles/system/content/dynamicemitters.qml 0
Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply.
- Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for QtQuick items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle.
+ Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for \l {Qt Quick} items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle.
*/
diff --git a/examples/quick/positioners/doc/src/positioners.qdoc b/examples/quick/positioners/doc/src/positioners.qdoc
index 3a20b145ef..794b3b25f9 100644
--- a/examples/quick/positioners/doc/src/positioners.qdoc
+++ b/examples/quick/positioners/doc/src/positioners.qdoc
@@ -38,15 +38,15 @@
It consists of a scene populated with items in a variety of positioners: Column, Row, Grid and Flow.
Each positioner has animations described as Transitions.
- \snippet quick/positioners/positioners-transitions.qml move
+ \snippet positioners/positioners-transitions.qml move
The move transition specifies how items inside a positioner will animate when they are displaced by the appearance or disappearance of other items.
- \snippet quick/positioners/positioners-transitions.qml add
+ \snippet positioners/positioners-transitions.qml add
The add transition specifies how items will appear when they are added to a positioner.
- \snippet quick/positioners/positioners-transitions.qml populate
+ \snippet positioners/positioners-transitions.qml populate
The populate transition specifies how items will appear when their parent positioner is first created.
Attached Properties shows how the Positioner attached property can be used to determine where an item is within a positioner.
- \snippet quick/positioners/positioners-attachedproperties.qml 0
+ \snippet positioners/positioners-attachedproperties.qml 0
*/
diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro
index 2d8acb3345..311e264af1 100644
--- a/examples/quick/quick.pro
+++ b/examples/quick/quick.pro
@@ -20,6 +20,7 @@ SUBDIRS = accessibility \
customitems \
imageprovider \
window \
+ dialogs \
particles \
demos
diff --git a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
index d98407b6c1..e3cef52bf7 100644
--- a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
+++ b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
@@ -41,7 +41,7 @@
\section1 BezierCurve Declaration
- \snippet quick/scenegraph/customgeometry/beziercurve.h 1
+ \snippet scenegraph/customgeometry/beziercurve.h 1
The item declaration subclasses the QQuickItem class and adds five
properties. One for each of the four control points in the bezier
@@ -52,7 +52,7 @@
signals for each of them so changes will be picked up the QML
engine and used accordingly.
- \snippet quick/scenegraph/customgeometry/beziercurve.h 2
+ \snippet scenegraph/customgeometry/beziercurve.h 2
The synchronization point between the QML scene and the rendering
scene graph is the virtual function \l
@@ -67,7 +67,7 @@
\section1 BezierCurve Implementation
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 1
+ \snippet scenegraph/customgeometry/beziercurve.cpp 1
The BezierCurve constructor sets up default values for the
control points and the number of segments. The bezier curve
@@ -80,7 +80,7 @@
QQuickItem::updatePaintNode() when it is time for the QML scene to
be synchronized with the rendering scene graph.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 2
+ \snippet scenegraph/customgeometry/beziercurve.cpp 2
The BezierCurve class has no data members that need to be cleaned
up so the destructor does nothing. It is worth mentioning that the
@@ -89,7 +89,7 @@
QSGNode references in the QQuickItem class nor try to clean them
up explicitly.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 3
+ \snippet scenegraph/customgeometry/beziercurve.cpp 3
The setter function for the p1 property checks if the value is
unchanged and exits early if this is the case. Then it updates the
@@ -103,7 +103,7 @@
The other property setters are equivalent, and are omitted from
this example.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 4
+ \snippet scenegraph/customgeometry/beziercurve.cpp 4
The updatePaintNode() function is the primary integration point
for synchronizing the state of the QML scene with the rendering
@@ -113,7 +113,7 @@
our QSGGeometryNode which we will fill with geometry and a
material.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 5
+ \snippet scenegraph/customgeometry/beziercurve.cpp 5
We then create the geometry and add it to the node. The first
argument to the QSGGeometry constructor is a definition of the
@@ -135,7 +135,7 @@
geometry a member of a QSGGeometryNode subclass, in which case, we
would not have set the QSGGeometryNode::OwnsGeometry flag.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 6
+ \snippet scenegraph/customgeometry/beziercurve.cpp 6
The scene graph API provides a few commonly used used material
implementations. In this example we use the QSGFlatColorMaterial
@@ -143,7 +143,7 @@
color. Again we pass the ownership of the material to the node, so
it can be cleaned up by the scene graph.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 7
+ \snippet scenegraph/customgeometry/beziercurve.cpp 7
In the case where the QML item has changed and we only want to
modify the existing node's geometry, we cast the \c oldNode to a
@@ -151,7 +151,7 @@
segment count has changed, we call QSGGeometry::allocate() to make
sure it has the right number of vertices.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 8
+ \snippet scenegraph/customgeometry/beziercurve.cpp 8
To fill the geometry, we first extract the vertex array from
it. Since we are using one of the default attribute sets, we can
@@ -159,14 +159,14 @@
Then we go through each segment and calculate its position and
write that value to the vertex.
- \snippet quick/scenegraph/customgeometry/beziercurve.cpp 9
+ \snippet scenegraph/customgeometry/beziercurve.cpp 9
In the end of the function, we return the node so the scene graph
can render it.
\section1 Application Entry-Point
- \snippet quick/scenegraph/customgeometry/main.cpp 1
+ \snippet scenegraph/customgeometry/main.cpp 1
The application is a straightforward QML application, with a
QGuiApplication and a QQuickView that we pass a .qml file. To make
@@ -183,24 +183,24 @@
\section1 Using the Item
- \snippet quick/scenegraph/customgeometry/main.qml 1
+ \snippet scenegraph/customgeometry/main.qml 1
Our .qml file imports the \c {QtQuick 2.0} module to get the
standard types and also our own \c {CustomGeometry 1.0} module
which contains our newly created BezierCurve objects.
- \snippet quick/scenegraph/customgeometry/main.qml 2
+ \snippet scenegraph/customgeometry/main.qml 2
Then we create the our root item and an instance of the
BezierCurve which we anchor to fill the root.
- \snippet quick/scenegraph/customgeometry/main.qml 3
+ \snippet scenegraph/customgeometry/main.qml 3
To make the example a bit more interesting we add an animation to
change the two control points in the curve. The end points stay
unchanged.
- \snippet quick/scenegraph/customgeometry/main.qml 4
+ \snippet scenegraph/customgeometry/main.qml 4
Finally we overlay a short text outlining what the example shows.
diff --git a/examples/quick/scenegraph/graph/doc/images/graph-example.jpg b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg
new file mode 100644
index 0000000000..74975ee7c4
--- /dev/null
+++ b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg
Binary files differ
diff --git a/examples/quick/scenegraph/graph/doc/src/graph.qdoc b/examples/quick/scenegraph/graph/doc/src/graph.qdoc
new file mode 100644
index 0000000000..d5a07cdc48
--- /dev/null
+++ b/examples/quick/scenegraph/graph/doc/src/graph.qdoc
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example scenegraph/graph
+ \title Scene Graph - Graph
+ \ingroup qtquickexamples
+
+ \brief Demonstrates how one can combine custom materials and geometries
+ under a single QQuickItem.
+
+ \image graph-example.jpg
+
+ */
diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp
new file mode 100644
index 0000000000..ad75307e57
--- /dev/null
+++ b/examples/quick/scenegraph/graph/graph.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 "graph.h"
+
+#include "noisynode.h"
+#include "gridnode.h"
+#include "linenode.h"
+
+Graph::Graph()
+ : m_samplesChanged(false)
+ , m_geometryChanged(false)
+{
+ setFlag(ItemHasContents, true);
+}
+
+
+void Graph::appendSample(qreal value)
+{
+ m_samples << value;
+ m_samplesChanged = true;
+ update();
+}
+
+
+void Graph::removeFirstSample()
+{
+ m_samples.removeFirst();
+ m_samplesChanged = true;
+ update();
+}
+
+void Graph::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ m_geometryChanged = true;
+ update();
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+}
+
+
+class GraphNode : public QSGNode
+{
+public:
+ NoisyNode *background;
+ GridNode *grid;
+ LineNode *line;
+ LineNode *shadow;
+};
+
+
+QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+{
+ GraphNode *n= static_cast<GraphNode *>(oldNode);
+
+ QRectF rect = boundingRect();
+
+ if (rect.isEmpty()) {
+ delete n;
+ return 0;
+ }
+
+ if (!n) {
+ n = new GraphNode();
+
+ n->background = new NoisyNode(window());
+ n->grid = new GridNode();
+ n->line = new LineNode(10, 0.5, QColor("steelblue"));
+ n->shadow = new LineNode(20, 0.2, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4));
+
+ n->appendChildNode(n->background);
+ n->appendChildNode(n->grid);
+ n->appendChildNode(n->shadow);
+ n->appendChildNode(n->line);
+ }
+
+ if (m_geometryChanged) {
+ n->background->setRect(rect);
+ n->grid->setRect(rect);
+ }
+
+ if (m_geometryChanged || m_samplesChanged) {
+ n->line->updateGeometry(rect, m_samples);
+ // We don't need to calculate the geometry twice, so just steal it from the other one...
+ n->shadow->setGeometry(n->line->geometry());
+ }
+
+ m_geometryChanged = false;
+ m_samplesChanged = false;
+
+ return n;
+}
diff --git a/examples/quick/scenegraph/graph/graph.h b/examples/quick/scenegraph/graph/graph.h
new file mode 100644
index 0000000000..28d14f166a
--- /dev/null
+++ b/examples/quick/scenegraph/graph/graph.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+#ifndef GRAPH_H
+#define GRAPH_H
+
+#include <QQuickItem>
+
+class Graph : public QQuickItem
+{
+ Q_OBJECT
+public:
+ Graph();
+
+protected:
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+
+public slots:
+ void appendSample(qreal value);
+ void removeFirstSample();
+
+private:
+ QList<qreal> m_samples;
+
+ bool m_samplesChanged;
+ bool m_geometryChanged;
+};
+
+#endif // GRAPH_H
diff --git a/examples/quick/scenegraph/graph/graph.pro b/examples/quick/scenegraph/graph/graph.pro
new file mode 100644
index 0000000000..5991f799dc
--- /dev/null
+++ b/examples/quick/scenegraph/graph/graph.pro
@@ -0,0 +1,34 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2013-06-11T13:13:18
+#
+#-------------------------------------------------
+
+QT += core gui quick
+
+TARGET = graph
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ graph.cpp \
+ noisynode.cpp \
+ gridnode.cpp \
+ linenode.cpp
+
+HEADERS += \
+ graph.h \
+ noisynode.h \
+ gridnode.h \
+ linenode.h
+
+RESOURCES += \
+ graph.qrc
+
+OTHER_FILES += \
+ main.qml \
+ shaders/noisy.vsh \
+ shaders/noisy.fsh \
+ shaders/line.fsh \
+ shaders/line.vsh
+
diff --git a/examples/quick/scenegraph/graph/graph.qrc b/examples/quick/scenegraph/graph/graph.qrc
new file mode 100644
index 0000000000..2adaeac751
--- /dev/null
+++ b/examples/quick/scenegraph/graph/graph.qrc
@@ -0,0 +1,9 @@
+<RCC>
+ <qresource prefix="/scenegraph/graph">
+ <file>main.qml</file>
+ <file>shaders/noisy.vsh</file>
+ <file>shaders/noisy.fsh</file>
+ <file>shaders/line.vsh</file>
+ <file>shaders/line.fsh</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/scenegraph/graph/gridnode.cpp b/examples/quick/scenegraph/graph/gridnode.cpp
new file mode 100644
index 0000000000..2b5e8cac16
--- /dev/null
+++ b/examples/quick/scenegraph/graph/gridnode.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 "gridnode.h"
+
+#include "qmath.h"
+
+#define GRID_SIZE 32
+
+GridNode::GridNode()
+ : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0)
+{
+ setGeometry(&m_geometry);
+ m_geometry.setDrawingMode(GL_LINES);
+
+ setMaterial(&m_material);
+ m_material.setColor(Qt::gray);
+}
+
+/*
+ * The function hardcodes a fixed set of grid lines and scales
+ * those to the bounding rect.
+ */
+void GridNode::setRect(const QRectF &rect)
+{
+ int vCount = int((rect.width() - 1) / GRID_SIZE);
+ int hCount = int((rect.height() - 1) / GRID_SIZE);
+
+ int lineCount = vCount + hCount;
+
+ QSGGeometry *g = geometry();
+
+ g->allocate(lineCount * 2);
+
+ float x = rect.x();
+ float y = rect.y();
+ float w = rect.width();
+ float h = rect.height();
+
+ QSGGeometry::Point2D *v = g->vertexDataAsPoint2D();
+
+ // Then write the vertical lines
+ for (int i=0; i<vCount; ++i) {
+ float dx = (i + 1) * GRID_SIZE;
+ v[i*2].set(dx, y);
+ v[i*2+1].set(dx, y + h);
+ }
+ v += vCount * 2;
+ // Then write the horizontal lines
+ for (int i=0; i<hCount; ++i) {
+ float dy = (i + 1) * GRID_SIZE;
+ v[i*2].set(x, dy);
+ v[i*2+1].set(x + w, dy);
+ }
+
+ // Tell the scenegraph we updated the geometry..
+ markDirty(QSGNode::DirtyGeometry);
+}
diff --git a/examples/quick/scenegraph/graph/gridnode.h b/examples/quick/scenegraph/graph/gridnode.h
new file mode 100644
index 0000000000..8581a993ae
--- /dev/null
+++ b/examples/quick/scenegraph/graph/gridnode.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+#ifndef GRIDNODE_H
+#define GRIDNODE_H
+
+#include <QtQuick/QSGGeometryNode>
+#include <QtQuick/QSGFlatColorMaterial>
+
+class GridNode : public QSGGeometryNode
+{
+public:
+ GridNode();
+
+ void setRect(const QRectF &rect);
+
+private:
+ QSGFlatColorMaterial m_material;
+ QSGGeometry m_geometry;
+};
+
+#endif // GRIDNODE_H
diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp
new file mode 100644
index 0000000000..0d1229cf1d
--- /dev/null
+++ b/examples/quick/scenegraph/graph/linenode.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 "linenode.h"
+
+#include <QtCore/QResource>
+
+#include <QtGui/QColor>
+
+#include <QtQuick/QSGSimpleMaterial>
+
+struct LineMaterial
+{
+ QColor color;
+ float spread;
+ float size;
+};
+
+class LineShader : public QSGSimpleMaterialShader<LineMaterial>
+{
+ QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial)
+
+public:
+ const char *vertexShader() const {
+ QResource r(":/scenegraph/graph/shaders/line.vsh");
+ Q_ASSERT(r.isValid());
+ return (const char *) r.data();
+ }
+
+ const char *fragmentShader() const {
+ QResource r(":/scenegraph/graph/shaders/line.fsh");
+ Q_ASSERT(r.isValid());
+ return (const char *) r.data();
+ }
+
+ QList<QByteArray> attributes() const { return QList<QByteArray>() << "pos" << "t"; }
+
+ void updateState(const LineMaterial *m, const LineMaterial *) {
+ program()->setUniformValue(id_color, m->color);
+ program()->setUniformValue(id_spread, m->spread);
+ program()->setUniformValue(id_size, m->size);
+ }
+
+ void resolveUniforms() {
+ id_spread = program()->uniformLocation("spread");
+ id_size = program()->uniformLocation("size");
+ id_color = program()->uniformLocation("color");
+ }
+
+private:
+ int id_color;
+ int id_spread;
+ int id_size;
+};
+
+struct LineVertex {
+ float x;
+ float y;
+ float t;
+ inline void set(float xx, float yy, float tt) { x = xx; y = yy; t = tt; }
+};
+
+static const QSGGeometry::AttributeSet &attributes()
+{
+ static QSGGeometry::Attribute attr[] = {
+ QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
+ QSGGeometry::Attribute::create(1, 1, GL_FLOAT)
+ };
+ static QSGGeometry::AttributeSet set = { 2, 3 * sizeof(float), attr };
+ return set;
+}
+
+LineNode::LineNode(float size, float spread, const QColor &color)
+ : m_geometry(attributes(), 0)
+{
+ setGeometry(&m_geometry);
+ m_geometry.setDrawingMode(GL_TRIANGLE_STRIP);
+
+ QSGSimpleMaterial<LineMaterial> *m = LineShader::createMaterial();
+ m->state()->color = color;
+ m->state()->size = size;
+ m->state()->spread = spread;
+ m->setFlag(QSGMaterial::Blending);
+ setMaterial(m);
+ setFlag(OwnsMaterial);
+}
+
+/*
+ * Assumes that samples have values in the range of 0 to 1 and scales them to
+ * the height of bounds. The samples are stretched out horizontally along the
+ * width of the bounds.
+ *
+ * The position of each pair of points is identical, but we use the third value
+ * "t" to shift the point up or down and to add antialiasing.
+ */
+void LineNode::updateGeometry(const QRectF &bounds, const QList<qreal> &samples)
+{
+ m_geometry.allocate(samples.size() * 2);
+
+ float x = bounds.x();
+ float y = bounds.y();
+ float w = bounds.width();
+ float h = bounds.height();
+
+ float dx = w / (samples.size() - 1);
+
+ LineVertex *v = (LineVertex *) m_geometry.vertexData();
+ for (int i=0; i<samples.size(); ++i) {
+ v[i*2+0].set(x + dx * i, y + samples.at(i) * h, 0);
+ v[i*2+1].set(x + dx * i, y + samples.at(i) * h, 1);
+ }
+
+ markDirty(QSGNode::DirtyGeometry);
+}
diff --git a/examples/quick/scenegraph/graph/linenode.h b/examples/quick/scenegraph/graph/linenode.h
new file mode 100644
index 0000000000..192bedbefc
--- /dev/null
+++ b/examples/quick/scenegraph/graph/linenode.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+#ifndef LINENODE_H
+#define LINENODE_H
+
+#include <QSGGeometryNode>
+
+class LineNode : public QSGGeometryNode
+{
+public:
+ LineNode(float size, float spread, const QColor &color);
+
+ void updateGeometry(const QRectF &bounds, const QList<qreal> &samples);
+
+private:
+ QSGGeometry m_geometry;
+
+};
+
+#endif // LINENODE_H
diff --git a/examples/quick/scenegraph/graph/main.cpp b/examples/quick/scenegraph/graph/main.cpp
new file mode 100644
index 0000000000..ed54ae59b1
--- /dev/null
+++ b/examples/quick/scenegraph/graph/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 <QGuiApplication>
+#include <QQuickView>
+
+#include "graph.h"
+#include <QtQml/QQmlContext>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication a(argc, argv);
+
+ qmlRegisterType<Graph>("Graph", 1, 0, "Graph");
+
+ QQuickView view;
+ view.resize(800, 400);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:///scenegraph/graph/main.qml"));
+ view.show();
+
+ return a.exec();
+}
diff --git a/examples/quick/scenegraph/graph/main.qml b/examples/quick/scenegraph/graph/main.qml
new file mode 100644
index 0000000000..ad952bcf1a
--- /dev/null
+++ b/examples/quick/scenegraph/graph/main.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 2.0
+
+import Graph 1.0
+
+Item {
+ width: 800
+ height: 400
+
+ Graph {
+ id: graph
+ anchors.fill: parent
+ anchors.margins: 100
+
+ function newSample(i) {
+ return (Math.sin(i / 100.0 * Math.PI * 2) + 1) * 0.4 + Math.random() * 0.05;
+ }
+
+ Component.onCompleted: {
+ for (var i=0; i<100; ++i)
+ appendSample(newSample(i));
+ }
+
+ property int offset: 100;
+ }
+
+ Timer {
+ id: timer
+ interval: 500
+ repeat: true
+ running: true
+ onTriggered: {
+ graph.removeFirstSample();
+ graph.appendSample(graph.newSample(++graph.offset));
+ }
+
+ }
+
+ Rectangle {
+ anchors.fill: graph
+ color: "transparent"
+ border.color: "black"
+ border.width: 2
+ }
+
+}
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
new file mode 100644
index 0000000000..1fc87a2b97
--- /dev/null
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 "noisynode.h"
+
+#include <QtCore/QResource>
+
+#include <QtQuick/QSGSimpleMaterialShader>
+#include <QtQuick/QSGTexture>
+#include <QtQuick/QQuickWindow>
+
+#define NOISE_SIZE 64
+
+struct NoisyMaterial
+{
+ ~NoisyMaterial() {
+ delete texture;
+ }
+
+ QColor color;
+ QSGTexture *texture;
+};
+
+class NoisyShader : public QSGSimpleMaterialShader<NoisyMaterial>
+{
+ QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial)
+
+public:
+ const char *vertexShader() const {
+ QResource r(":/scenegraph/graph/shaders/noisy.vsh");
+ Q_ASSERT(r.isValid());
+ return (const char *) r.data();
+ }
+
+ const char *fragmentShader() const {
+ QResource r(":/scenegraph/graph/shaders/noisy.fsh");
+ Q_ASSERT(r.isValid());
+ return (const char *) r.data();
+ }
+
+ QList<QByteArray> attributes() const { return QList<QByteArray>() << "aVertex" << "aTexCoord"; }
+
+ void updateState(const NoisyMaterial *m, const NoisyMaterial *) {
+
+ // Set the color
+ program()->setUniformValue(id_color, m->color);
+
+ // Bind the texture and set program to use texture unit 0 (the default)
+ m->texture->bind();
+
+ // Then set the texture size so we can adjust the texture coordinates accordingly in the
+ // vertex shader..
+ QSize s = m->texture->textureSize();
+ program()->setUniformValue(id_textureSize, QSizeF(1.0 / s.width(), 1.0 / s.height()));
+ }
+
+ void resolveUniforms() {
+ id_texture = program()->uniformLocation("texture");
+ id_textureSize = program()->uniformLocation("textureSize");
+ id_color = program()->uniformLocation("color");
+
+ // We will only use texture unit 0, so set it only once.
+ program()->setUniformValue(id_texture, 0);
+ }
+
+private:
+ int id_color;
+ int id_texture;
+ int id_textureSize;
+};
+
+NoisyNode::NoisyNode(QQuickWindow *window)
+{
+ // Make some noise...
+ QImage image(NOISE_SIZE, NOISE_SIZE, QImage::Format_RGB32);
+ uint *data = (uint *) image.bits();
+ for (int i=0; i<NOISE_SIZE * NOISE_SIZE; ++i) {
+ uint g = rand() & 0xff;
+ data[i] = 0xff000000 | (g << 16) | (g << 8) | g;
+ }
+
+ QSGTexture *t = window->createTextureFromImage(image);
+ t->setFiltering(QSGTexture::Nearest);
+ t->setHorizontalWrapMode(QSGTexture::Repeat);
+ t->setVerticalWrapMode(QSGTexture::Repeat);
+
+ QSGSimpleMaterial<NoisyMaterial> *m = NoisyShader::createMaterial();
+ m->state()->texture = t;
+ m->state()->color = QColor::fromRgbF(0.95, 0.95, 0.97);
+ m->setFlag(QSGMaterial::Blending);
+
+ setMaterial(m);
+ setFlag(OwnsMaterial, true);
+
+ QSGGeometry *g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
+ QSGGeometry::updateTexturedRectGeometry(g, QRect(), QRect());
+ setGeometry(g);
+ setFlag(OwnsGeometry, true);
+}
+
+void NoisyNode::setRect(const QRectF &bounds)
+{
+ QSGGeometry::updateTexturedRectGeometry(geometry(), bounds, QRectF(0, 0, 1, 1));
+ markDirty(QSGNode::DirtyGeometry);
+}
diff --git a/examples/quick/scenegraph/graph/noisynode.h b/examples/quick/scenegraph/graph/noisynode.h
new file mode 100644
index 0000000000..b5a291330f
--- /dev/null
+++ b/examples/quick/scenegraph/graph/noisynode.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+#ifndef NOISYNODE_H
+#define NOISYNODE_H
+
+#include <QSGGeometryNode>
+
+class QQuickWindow;
+
+class NoisyNode : public QSGGeometryNode
+{
+public:
+ NoisyNode(QQuickWindow *window);
+
+ void setRect(const QRectF &bounds);
+};
+
+#endif // NOISYNODE_H
diff --git a/examples/quick/window/window/nogui.qml b/examples/quick/scenegraph/graph/shaders/line.fsh
index 2a5734c773..b07558c2ab 100644
--- a/examples/quick/window/window/nogui.qml
+++ b/examples/quick/scenegraph/graph/shaders/line.fsh
@@ -38,13 +38,17 @@
**
****************************************************************************/
-import QtQml 2.0
+uniform lowp vec4 color;
+uniform lowp float qt_Opacity;
+uniform lowp float spread;
-/*
- This object's only functionality is to exist as a root object and
- display nothing, proving that qmlscene can run without windows.
- (A QtObject can't even have Component.onCompleted)
-*/
-QtObject {
- property string philosophy: "hello bleak windowless world"
+varying lowp float vT;
+
+#define PI 3.14159265359
+
+void main(void)
+{
+ lowp float tt = smoothstep(spread, 1.0, sin(vT * PI));
+
+ gl_FragColor = color * qt_Opacity * tt;
}
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp b/examples/quick/scenegraph/graph/shaders/line.vsh
index 844c850366..84353b852c 100644
--- a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp
+++ b/examples/quick/scenegraph/graph/shaders/line.vsh
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** 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:
@@ -38,20 +38,19 @@
**
****************************************************************************/
-#include <QApplication>
-#include <QQuickView>
-#include <QQmlContext>
+attribute highp vec4 pos;
+attribute highp float t;
-//![0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
+uniform lowp float size;
+uniform highp mat4 qt_Matrix;
- QQuickView view;
- view.setSource(QUrl("qrc:/main.qml"));
- view.show();
+varying lowp float vT;
- return app.exec();
-}
-//![0]
+void main(void)
+{
+ vec4 adjustedPos = pos;
+ adjustedPos.y += (t * size);
+ gl_Position = qt_Matrix * adjustedPos;
+ vT = t;
+}
diff --git a/examples/quick/scenegraph/graph/shaders/noisy.fsh b/examples/quick/scenegraph/graph/shaders/noisy.fsh
new file mode 100644
index 0000000000..227c2b5974
--- /dev/null
+++ b/examples/quick/scenegraph/graph/shaders/noisy.fsh
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+uniform sampler2D texture;
+uniform lowp float qt_Opacity;
+uniform lowp vec4 color;
+
+varying highp vec2 vTexCoord;
+varying lowp vec2 vShadeCoord;
+
+#define PI 3.14159265359
+
+void main()
+{
+ lowp float shade = texture2D(texture, vTexCoord).r * 0.05 - length(vec2(0.5, 0.4) - vShadeCoord) * 0.3;
+ lowp vec4 c = vec4(color.xyz + shade, color.w);
+ gl_FragColor = c * qt_Opacity;
+}
diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vsh b/examples/quick/scenegraph/graph/shaders/noisy.vsh
new file mode 100644
index 0000000000..ce648e51b9
--- /dev/null
+++ b/examples/quick/scenegraph/graph/shaders/noisy.vsh
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+attribute highp vec4 aVertex;
+attribute highp vec2 aTexCoord;
+
+uniform highp mat4 qt_Matrix;
+uniform highp vec2 textureSize;
+
+varying highp vec2 vTexCoord;
+varying lowp vec2 vShadeCoord;
+
+void main() {
+ gl_Position = qt_Matrix * aVertex;
+ vTexCoord = aVertex.xy * textureSize;
+ vShadeCoord = aTexCoord;
+}
diff --git a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
index 4bf5444d79..1f87412aa4 100644
--- a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
+++ b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
@@ -50,7 +50,7 @@
in the QML file and this value is used by the OpenGL shader
program that draws the squircles.
- \snippet quick/scenegraph/openglunderqml/squircle.h 1
+ \snippet scenegraph/openglunderqml/squircle.h 1
First of all, we need a QObject with a slot to connect the signals
to. We subclass QQuickItem in order to use the \l
@@ -73,13 +73,13 @@
Lets move on to the implementation.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 7
+ \snippet scenegraph/openglunderqml/squircle.cpp 7
The constructor of the \c Squircle class simply initializes the
values. The shader program will be initialized during rendering
later.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 8
+ \snippet scenegraph/openglunderqml/squircle.cpp 8
The property setter checks that the value has indeed changed
before updating its internal variable. It then calls \l
@@ -88,13 +88,13 @@
initialization, before the object has been entered into the scene
and before it has a window.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 1
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 2
+ \snippet scenegraph/openglunderqml/squircle.cpp 1
+ \snippet scenegraph/openglunderqml/squircle.cpp 2
For our paint function to be called, we need to connect to the
window's signals. When Squircle object is populated into the
- scene, the itemChange function is called with the change type \c
- ItemSceneChange. We connect \l QQuickWindow::beforeRendering() to
+ scene, the windowChanged signal is emitted. In our handler,
+ we connect \l QQuickWindow::beforeRendering() to
\c paint() to do the rendering, and \l
QQuickWindow::beforeSynchronizing() to \c sync() to copy the state
of the \c t property for the upcoming frame.
@@ -106,14 +106,14 @@
slots are invoked on the wrong thread with no OpenGL context
present.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 3
+ \snippet scenegraph/openglunderqml/squircle.cpp 3
The default behavior of the scene graph is to clear the
framebuffer before rendering. Since we render before the scene
graph, we need to turn this clearing off. This means that we need
to clear ourselves in the \c paint() function.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 4
+ \snippet scenegraph/openglunderqml/squircle.cpp 4
The first thing we do in the \c paint() function is to
initialize the shader program. By initializing the shader program
@@ -126,18 +126,18 @@
all rendering related operations must happen on the rendering
thread.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 5
+ \snippet scenegraph/openglunderqml/squircle.cpp 5
We use the shader program to draw the squircle. At the end of the
\c paint function we release the program and disable the
attributes we used so that the OpenGL context is in a "clean"
state for the scene graph to pick it up.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 6
+ \snippet scenegraph/openglunderqml/squircle.cpp 6
In the \c cleanup() function we delete the program.
- \snippet quick/scenegraph/openglunderqml/squircle.cpp 9
+ \snippet scenegraph/openglunderqml/squircle.cpp 9
We use the \c sync() function to copy the state of the
object in the GUI thread into the rendering thread.
@@ -146,20 +146,20 @@
thread is blocked, so it is safe to simply copy the value without
any additional protection.
- \snippet quick/scenegraph/openglunderqml/main.cpp 1
+ \snippet scenegraph/openglunderqml/main.cpp 1
The application's \c main() function instantiates a QQuickView and
launches the \c main.qml file. The only thing worth noting is that
we export the \c Squircle class to QML using the \l
qmlRegisterType() macro.
- \snippet quick/scenegraph/openglunderqml/main.qml 1
+ \snippet scenegraph/openglunderqml/main.qml 1
We import the Squircle QML type with the name we registered in the
\c main() function. We then instantiate it and create a running
- NumberAnimation on the its \c t property.
+ NumberAnimation on its \c t property.
- \snippet quick/scenegraph/openglunderqml/main.qml 2
+ \snippet scenegraph/openglunderqml/main.qml 2
Then we overlay a short descriptive text, so that it is clearly
visible that we are in fact rendering OpenGL under our Qt Quick
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 84509fb615..8ceb9c5f9e 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -51,6 +51,7 @@ Squircle::Squircle()
, m_t(0)
, m_thread_t(0)
{
+ connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*)));
}
//! [7]
@@ -66,17 +67,11 @@ void Squircle::setT(qreal t)
}
//! [8]
-
//! [1]
-void Squircle::itemChange(ItemChange change, const ItemChangeData &)
+void Squircle::handleWindowChanged(QQuickWindow *win)
{
- // The ItemSceneChange event is sent when we are first attached to a window.
- if (change == ItemSceneChange) {
- QQuickWindow *win = window();
- if (!win)
- return;
+ if (win) {
//! [1]
-
// Connect the beforeRendering signal to our paint function.
// Since this call is executed on the rendering thread it must be
// a Qt::DirectConnection
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index e292ca325f..449e02bbf1 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -61,14 +61,14 @@ public:
signals:
void tChanged();
-protected:
- void itemChange(ItemChange change, const ItemChangeData &);
-
public slots:
void paint();
void cleanup();
void sync();
+private slots:
+ void handleWindowChanged(QQuickWindow *win);
+
private:
QOpenGLShaderProgram *m_program;
diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc
index 1529649798..5d83b9fa5f 100644
--- a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc
+++ b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc
@@ -47,7 +47,7 @@
material state is what we assign to each individual node, in this
case to give them different colors.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 1
+ \snippet scenegraph/simplematerial/simplematerial.cpp 1
The first thing we do when creating custom materials with the
simplified scheme is to create a state class. In this case the
@@ -55,7 +55,7 @@
compare function which the scene graph can use to reorder the node
rendering.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 2
+ \snippet scenegraph/simplematerial/simplematerial.cpp 2
Next we define the material shader, by subclassing a template
instantiation of \l QSGSimpleMaterialShader with our \c State.
@@ -74,21 +74,21 @@
classes. Using the same \c State class in multiple shaders will
will lead to undefined behavior.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 3
+ \snippet scenegraph/simplematerial/simplematerial.cpp 3
Next comes the declaration of the shader source code, where we
define a vertex and fragment shader. The simple material assumes
the presence of \c qt_Matrix in the vertex shader and \c
qt_Opacity in the fragment shader.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 4
+ \snippet scenegraph/simplematerial/simplematerial.cpp 4
We reimplement the \c attributes function to return the name of
the \c aVertex and \c aTexCoord attribute names. These attributes
will be mapped to attribute indices 0 and 1 in the node's
geometry.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 6
+ \snippet scenegraph/simplematerial/simplematerial.cpp 6
Uniforms can be accessed either by name or by index, where index
is faster than name, so we reimplement the \c resolveUniforms()
@@ -96,7 +96,7 @@
to worry about resolving \c qt_Opacity or \c qt_Matrix as these
are handled by the baseclass.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 5
+ \snippet scenegraph/simplematerial/simplematerial.cpp 5
The \c updateState() function is called once for every unique
state and we use it to update the shader program with the current
@@ -105,7 +105,7 @@
usecase, where all the colors are different, the updateState will
be called once for every node.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 7
+ \snippet scenegraph/simplematerial/simplematerial.cpp 7
The \c ColorNode class is supposed to draw something, so it needs
to be a subclass of \l QSGGeometryNode.
@@ -129,12 +129,12 @@
Finally, we tell the node to take ownership of the material, so we
do not have to explicitly memorymanage it.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 8
+ \snippet scenegraph/simplematerial/simplematerial.cpp 8
Since the Item is providing its own graphics to the scene graph,
we set the flag \l QQuickItem::ItemHasContents.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 9
+ \snippet scenegraph/simplematerial/simplematerial.cpp 9
Whenever the Item has changed graphically, the \l
QQuickItem::updatePaintNode() function is called.
@@ -157,23 +157,23 @@
state. Finally, we notify the scene graph that the node has
undergone changes to its geometry and material.
- \snippet quick/scenegraph/simplematerial/simplematerial.cpp 11
+ \snippet scenegraph/simplematerial/simplematerial.cpp 11
The \c main() function of the application adds the custom QML type
using \l qmlRegisterType() and opens up a \l QQuickView with our
QML file.
- \snippet quick/scenegraph/simplematerial/main.qml 1
+ \snippet scenegraph/simplematerial/main.qml 1
In the QML file, we import our custom type so we can instantiate
it.
- \snippet quick/scenegraph/simplematerial/main.qml 2
+ \snippet scenegraph/simplematerial/main.qml 2
Then we create a column of three instances of our custom item,
each with a different color.
- \snippet quick/scenegraph/simplematerial/main.qml 3
+ \snippet scenegraph/simplematerial/main.qml 3
And finally we overlay a short descriptive text.
diff --git a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc b/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc
index b24b0bd97b..0917604a35 100644
--- a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc
+++ b/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example quick/scenegraph/textureinsgnode
+ \example scenegraph/textureinsgnode
\title Scene Graph - Rendering FBOs
\ingroup qtquickexamples
diff --git a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc b/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc
index 476605b268..6f4a2514f0 100644
--- a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc
+++ b/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example quick/scenegraph/textureinthread
+ \example scenegraph/textureinthread
\title Scene Graph - Rendering FBOs in a thread
\ingroup qtquickexamples
diff --git a/src/quick/doc/snippets/qml/usecases/MyText.qml b/examples/quick/scenegraph/textureinthread/error.qml
index d58a4036bb..1dbd576ef7 100644
--- a/src/quick/doc/snippets/qml/usecases/MyText.qml
+++ b/examples/quick/scenegraph/textureinthread/error.qml
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** 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:
@@ -38,11 +38,12 @@
**
****************************************************************************/
-//![0]
import QtQuick 2.0
Text {
- color: "lightsteelblue"
- font { family: 'Courier'; pixelSize: 20; bold: true; capitalization: Font.SmallCaps }
+ width: 400
+ height: 100
+ text: 'Platform does not support threaded OpenGL needed by this example.'
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
}
-//![0]
diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp
index e415d254a1..801f1891b9 100644
--- a/examples/quick/scenegraph/textureinthread/main.cpp
+++ b/examples/quick/scenegraph/textureinthread/main.cpp
@@ -38,8 +38,13 @@
**
****************************************************************************/
+#include <QtCore/QThread>
+
#include <QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+
#include <QtQuick/QQuickView>
#include "threadrenderer.h"
@@ -48,12 +53,39 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+ if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) {
+ QQuickView view;
+ view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml"));
+ view.show();
+ return app.exec();
+ }
+
qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer");
+ int execReturn = 0;
+
+ {
+ QQuickView view;
+
+ // Rendering in a thread introduces a slightly more complicated cleanup
+ // so we ensure that no cleanup of graphics resources happen until the
+ // application is shutting down.
+ view.setPersistentOpenGLContext(true);
+ view.setPersistentSceneGraph(true);
+
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml"));
+ view.show();
+
+ execReturn = app.exec();
+ }
- QQuickView view;
- view.setResizeMode(QQuickView::SizeRootObjectToView);
- view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml"));
- view.show();
+ // As the render threads make use of our QGuiApplication object
+ // to clean up gracefully, wait for them to finish before
+ // QGuiApp is taken off the heap.
+ foreach (QThread *t, ThreadRenderer::threads) {
+ t->wait();
+ delete t;
+ }
- return app.exec();
+ return execReturn;
}
diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.pro b/examples/quick/scenegraph/textureinthread/textureinthread.pro
index b48c2a1863..7f5fbb76e9 100644
--- a/examples/quick/scenegraph/textureinthread/textureinthread.pro
+++ b/examples/quick/scenegraph/textureinthread/textureinthread.pro
@@ -1,5 +1,8 @@
QT += quick
+# To make threaded gl check...
+QT += core-private gui-private
+
HEADERS += threadrenderer.h
SOURCES += threadrenderer.cpp main.cpp
@@ -13,4 +16,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread
INSTALLS += target
OTHER_FILES += \
- main.qml
+ main.qml \
+ error.qml
diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.qrc b/examples/quick/scenegraph/textureinthread/textureinthread.qrc
index 9ecf0ada1c..66eb53b736 100644
--- a/examples/quick/scenegraph/textureinthread/textureinthread.qrc
+++ b/examples/quick/scenegraph/textureinthread/textureinthread.qrc
@@ -1,5 +1,6 @@
<RCC>
- <qresource prefix="/scenegraph/textureinsgnode">
+ <qresource prefix="/scenegraph/textureinthread">
<file>main.qml</file>
+ <file>error.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
index 90b6b49880..7de1d294ba 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
@@ -46,10 +46,13 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFramebufferObject>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QOffscreenSurface>
#include <QtQuick/QQuickWindow>
#include <qsgsimpletexturenode.h>
+QList<QThread *> ThreadRenderer::threads;
/*
* The render thread shares a context with the scene graph and will
@@ -60,37 +63,39 @@ class RenderThread : public QThread
{
Q_OBJECT
public:
- RenderThread(const QSize &size)
+ RenderThread(const QSize &size, QOpenGLContext *context)
: m_renderFbo(0)
, m_displayFbo(0)
, m_logoRenderer(0)
+ , m_fakeSurface(0)
, m_size(size)
{
- // Since we're using queued connections, we need affinity to the rendering thread.
- moveToThread(this);
+ ThreadRenderer::threads << this;
// Set up the QOpenGLContext to use for rendering in this thread. It is sharing
// memory space with the GL context of the scene graph. This constructor is called
// during updatePaintNode, so we are currently on the scene graph thread with the
// scene graph's OpenGL context current.
- QOpenGLContext *current = QOpenGLContext::currentContext();
m_context = new QOpenGLContext();
- m_context->setShareContext(current);
- m_context->setFormat(current->format());
- m_context->create();
+ m_context->setShareContext(context);
+ m_context->setFormat(context->format());
m_context->moveToThread(this);
- // We need a non-visible surface to make current...
- m_fakeSurface = new QWindow();
- m_fakeSurface->setGeometry(0, 0, 64, 64);
- m_fakeSurface->setSurfaceType(QWindow::OpenGLSurface);
- m_fakeSurface->setFormat(current->format());
+ // We need a non-visible surface to make current in the other thread
+ // and QWindows must be created and managed on the GUI thread.
+ m_fakeSurface = new QOffscreenSurface();
+ m_fakeSurface->setFormat(context->format());
m_fakeSurface->create();
}
+ void setSurface(QOffscreenSurface *surface) { m_fakeSurface = surface; }
+
public slots:
void renderNext()
{
+ if (!m_context->isValid())
+ m_context->create();
+
m_context->makeCurrent(m_fakeSurface);
if (!m_renderFbo) {
@@ -119,6 +124,23 @@ public slots:
emit textureReady(m_displayFbo->texture(), m_size);
}
+ void shutDown()
+ {
+ m_context->makeCurrent(m_fakeSurface);
+ delete m_renderFbo;
+ delete m_displayFbo;
+ delete m_logoRenderer;
+ m_context->doneCurrent();
+ delete m_context;
+
+ // schedule this to be deleted only after we're done cleaning up
+ m_fakeSurface->deleteLater();
+
+ // Stop event processing, move the thread to GUI and make sure it is deleted.
+ exit();
+ moveToThread(QGuiApplication::instance()->thread());
+ }
+
signals:
void textureReady(int id, const QSize &size);
@@ -128,7 +150,7 @@ private:
LogoRenderer *m_logoRenderer;
- QWindow *m_fakeSurface;
+ QOffscreenSurface *m_fakeSurface;
QOpenGLContext *m_context;
QSize m_size;
};
@@ -209,19 +231,35 @@ private:
ThreadRenderer::ThreadRenderer()
+ : m_renderThread(0)
{
setFlag(ItemHasContents, true);
+ polish();
}
+void ThreadRenderer::updatePolish()
+{
+ if (!window() || !window()->openglContext())
+ return;
+ m_renderThread = new RenderThread(QSize(512, 512), window()->openglContext());
+ m_renderThread->moveToThread(m_renderThread);
+ m_renderThread->start();
+ connect(window(), SIGNAL(sceneGraphInvalidated()), m_renderThread, SLOT(shutDown()), Qt::QueuedConnection);
+}
QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
+ if (!m_renderThread) {
+ polish();
+ update();
+ return 0;
+ }
+
TextureNode *node = static_cast<TextureNode *>(oldNode);
if (!node) {
node = new TextureNode(window());
- m_renderThread = new RenderThread(QSize(512, 512));
/* Set up connections to get the production of FBO textures in sync with vsync on the
* rendering thread.
@@ -242,9 +280,6 @@ QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
connect(window(), SIGNAL(beforeRendering()), node, SLOT(prepareNode()), Qt::DirectConnection);
connect(node, SIGNAL(textureInUse()), m_renderThread, SLOT(renderNext()), Qt::QueuedConnection);
- // Start the render thread and enter let it process events.
- m_renderThread->start();
-
// Get the production of FBO textures started..
QMetaObject::invokeMethod(m_renderThread, "renderNext", Qt::QueuedConnection);
}
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.h b/examples/quick/scenegraph/textureinthread/threadrenderer.h
index f12e6404e5..8c68e27d92 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.h
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.h
@@ -52,9 +52,15 @@ class ThreadRenderer : public QQuickItem
public:
ThreadRenderer();
+ static QList<QThread *> threads;
+
+public slots:
+ void updatePolish();
+
protected:
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+
private:
RenderThread *m_renderThread;
};
diff --git a/examples/quick/shadereffects/doc/src/shadereffects.qdoc b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
index 5d1547a1fe..3d5f42eacc 100644
--- a/examples/quick/shadereffects/doc/src/shadereffects.qdoc
+++ b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
@@ -25,27 +25,27 @@
**
****************************************************************************/
/*!
- \title QML Examples - Shader Effects
+ \title Qt Quick Examples - Shader Effects
\example shadereffects
\image qml-shadereffects-example.png
\brief This is a shader effects example
\ingroup qtquickexamples
This example demonstrates a couple of visual effects that you can perform
- with shaders in QtQuick 2.0
+ with shaders in \l {Qt Quick}.
ShaderEffects typically operate on other types, using a ShaderEffectSource
- \snippet quick/shadereffects/shadereffects.qml source
+ \snippet shadereffects/shadereffects.qml source
In the above snippet, theItem is the id of a complex QML object in the file.
ShaderEffects can use this ShaderEffectSource as a texture in their fragment shader.
- \snippet quick/shadereffects/shadereffects.qml fragment
+ \snippet shadereffects/shadereffects.qml fragment
You can use any custom property on the ShaderEffect in your shader. This makes
animated shader code very easy.
- \snippet quick/shadereffects/shadereffects.qml properties
+ \snippet shadereffects/shadereffects.qml properties
ShaderEffects can also have a custom vertext shader. Setting the mesh property on ShaderEffect
provides more vertices for you to manipulate, enabling many effects.
- \snippet quick/shadereffects/shadereffects.qml vertex
+ \snippet shadereffects/shadereffects.qml vertex
*/
diff --git a/examples/quick/window/screen/screenInfo.qml b/examples/quick/shared/TabSet.qml
index 8f60d83933..10263a70ac 100644
--- a/examples/quick/window/screen/screenInfo.qml
+++ b/examples/quick/shared/TabSet.qml
@@ -39,52 +39,63 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.0 as Window
Item {
- id: root
- width: 400
- height: 200
- Item {
- id: main
- state: "orientation " + Window.Screen.orientation
+ id: tabWidget
- property bool landscapeWindow: Window.Screen.primaryOrientation == Qt.LandscapeOrientation
- property real baseWidth: landscapeWindow ? root.height : root.width
- property real baseHeight: landscapeWindow ? root.width : root.height
- property real rotationDelta: landscapeWindow ? -90 : 0
+ // Setting the default property to stack.children means any child items
+ // of the TabWidget are actually added to the 'stack' item's children.
+ // See the "Property Binding"
+ // documentation for details on default properties.
+ default property alias content: stack.children
- rotation: rotationDelta
- width: main.baseWidth
- height: main.baseHeight
- anchors.centerIn: parent
+ property int current: 0
- Text {
- text: "Screen is " + Window.Screen.width + "x" + Window.Screen.height + " and primarily orientation " + Window.Screen.primaryOrientation
- anchors.centerIn:parent
- }
+ onCurrentChanged: setZOrders()
+ Component.onCompleted: setZOrders()
+ function setZOrders() {
+ for (var i = 0; i < stack.children.length; ++i)
+ stack.children[i].z = (i == current ? 1 : 0)
+ }
- states: [
- State {
- name: "orientation " + Qt.LandscapeOrientation
- PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
- },
- State {
- name: "orientation " + Qt.InvertedPortraitOrientation
- PropertyChanges { target: main; rotation: 180 + rotationDelta; }
- },
- State {
- name: "orientation " + Qt.InvertedLandscapeOrientation
- PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
- }
- ]
+ Row {
+ id: header
- transitions: Transition {
- SequentialAnimation {
- RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint }
- NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
+ Repeater {
+ model: stack.children.length
+ delegate: Rectangle {
+ width: tabWidget.width / stack.children.length; height: 36
+
+ Rectangle {
+ width: parent.width; height: 1
+ anchors { bottom: parent.bottom; bottomMargin: 1 }
+ color: "#acb2c2"
+ }
+ BorderImage {
+ anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
+ border { left: 7; right: 7 }
+ source: "images/tab.png"
+ visible: tabWidget.current == index
+ }
+ Text {
+ horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ text: stack.children[index].title
+ elide: Text.ElideRight
+ font.bold: tabWidget.current == index
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: tabWidget.current = index
+ }
}
}
}
+
+ Item {
+ id: stack
+ width: tabWidget.width
+ anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
+ }
}
diff --git a/examples/quick/shared/images/qt-logo.png b/examples/quick/shared/images/qt-logo.png
new file mode 100644
index 0000000000..7d3e97eb36
--- /dev/null
+++ b/examples/quick/shared/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/shared/images/tab.png b/examples/quick/shared/images/tab.png
new file mode 100644
index 0000000000..ad8021605f
--- /dev/null
+++ b/examples/quick/shared/images/tab.png
Binary files differ
diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir
index cc4eb3c793..4f7c50540d 100644
--- a/examples/quick/shared/qmldir
+++ b/examples/quick/shared/qmldir
@@ -3,3 +3,4 @@ CheckBox 2.1 CheckBox.qml
LauncherList 2.0 LauncherList.qml
SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml
Slider 2.0 Slider.qml
+TabSet 2.1 TabSet.qml
diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h
index eab15f3e0a..c59e858d47 100644
--- a/examples/quick/shared/shared.h
+++ b/examples/quick/shared/shared.h
@@ -47,9 +47,9 @@
QQuickView view;\
view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
view.setSource(QUrl("qrc:///" #NAME ".qml")); \
+ view.setResizeMode(QQuickView::SizeRootObjectToView);\
if (QGuiApplication::platformName() == QLatin1String("qnx") || \
QGuiApplication::platformName() == QLatin1String("eglfs")) {\
- view.setResizeMode(QQuickView::SizeRootObjectToView);\
view.showFullScreen();\
} else {\
view.show();\
diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc
index 0b574ac879..6aaeca5211 100644
--- a/examples/quick/shared/shared.qrc
+++ b/examples/quick/shared/shared.qrc
@@ -6,7 +6,11 @@
<file>Slider.qml</file>
<file>images/slider_handle.png</file>
<file>CheckBox.qml</file>
+ <file>TabSet.qml</file>
<file>images/back.png</file>
<file>images/next.png</file>
+ <file>images/qt-logo.png</file>
+ <file>images/checkmark.png</file>
+ <file>images/tab.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc
index 1f173ac843..c93d2db8aa 100644
--- a/examples/quick/text/doc/src/text.qdoc
+++ b/examples/quick/text/doc/src/text.qdoc
@@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
- \title QML Examples - Text
+ \title Qt Quick Examples - Text
\example text
\brief This is a collection of QML examples relating to text
\image qml-text-example.png
@@ -38,24 +38,24 @@
'Hello' shows how to change and animate the letter spacing of a Text type.
It uses a sequential animation to first animate the font.letterSpacing property
from 0 to 50 over 3 seconds and then move the text to a random position on screen:
- \snippet quick/text/fonts/hello.qml letterspacing
+ \snippet text/fonts/hello.qml letterspacing
'Fonts' shows different ways of using fonts with the Text type.
Simply by name, using the font.family property directly:
- \snippet quick/text/fonts/fonts.qml name
+ \snippet text/fonts/fonts.qml name
or using a FontLoader type:
- \snippet quick/text/fonts/fonts.qml fontloader
+ \snippet text/fonts/fonts.qml fontloader
or using a FontLoader and specifying a local font file:
- \snippet quick/text/fonts/fonts.qml fontloaderlocal
+ \snippet text/fonts/fonts.qml fontloaderlocal
or finally using a FontLoader and specifying a remote font file:
- \snippet quick/text/fonts/fonts.qml fontloaderremote
+ \snippet text/fonts/fonts.qml fontloaderremote
'Available Fonts' shows how to use the QML global Qt object and a list view
to display all the fonts available on the system.
The ListView type uses the list of fonts available as its model:
- \snippet quick/text/fonts/availableFonts.qml model
+ \snippet text/fonts/availableFonts.qml model
Inside the delegate, the font family is set with the modelData:
- \snippet quick/text/fonts/availableFonts.qml delegate
+ \snippet text/fonts/availableFonts.qml delegate
'Banner' is a simple example showing how to create a banner using a row of text
types and a NumberAnimation.
@@ -66,5 +66,5 @@
'Text Layout' shows how to create a more complex layout for a text item.
This example lays out the text in two columns using the onLineLaidOut handler
that allows you to position and resize each line:
- \snippet quick/text/styledtext-layout.qml layout
+ \snippet text/styledtext-layout.qml layout
*/
diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp
index 52c2c17cfe..04545fe830 100644
--- a/examples/quick/textureprovider/etcprovider.cpp
+++ b/examples/quick/textureprovider/etcprovider.cpp
@@ -121,6 +121,10 @@ void EtcTexture::bind()
"paddedWidth: " << m_paddedSize.width() << "paddedHeight: " << m_paddedSize.height();
#endif
+#ifndef QT_NO_DEBUG
+ while (glGetError() != GL_NO_ERROR) { }
+#endif
+
QOpenGLContext *ctx = QOpenGLContext::currentContext();
Q_ASSERT(ctx != 0);
ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES,
@@ -128,6 +132,7 @@ void EtcTexture::bind()
(m_paddedSize.width() * m_paddedSize.height()) >> 1,
m_data.data() + 16);
+#ifndef QT_NO_DEBUG
// Gracefully fail in case of an error...
GLuint error = glGetError();
if (error != GL_NO_ERROR) {
@@ -137,6 +142,7 @@ void EtcTexture::bind()
m_texture_id = 0;
return;
}
+#endif
m_uploaded = true;
updateBindOptions(true);
diff --git a/examples/quick/threading/doc/src/threading.qdoc b/examples/quick/threading/doc/src/threading.qdoc
index 71fcdf820b..1cced3b9d3 100644
--- a/examples/quick/threading/doc/src/threading.qdoc
+++ b/examples/quick/threading/doc/src/threading.qdoc
@@ -33,17 +33,17 @@
Threaded ListModel contains a ListView and a ListModel. The ListModel is updated asynchronusly in another thread, and the results propagate back to the main thread.
A timer requests updates from the worker thread periodically:
- \snippet quick/threading/threadedlistmodel/timedisplay.qml 0
+ \snippet threading/threadedlistmodel/timedisplay.qml 0
Inside the worker thread, the ListModel is synchronized once the data is finished loading:
- \snippet quick/threading/threadedlistmodel/dataloader.js 0
+ \snippet threading/threadedlistmodel/dataloader.js 0
WorkerScript contains an example of using a WorkerScript to offload expensive calculations into another thread. This keeps the UI from being blocked. This example calculates numbers in Pascal's Triangle, and not in a very optimal way, so it will often take several seconds to complete the calculation. By doing this in a WorkerScript in another thread, the UI is not blocked during this time.
When the UI needs another value, a request is sent to the WorkerScript:
- \snippet quick/threading/workerscript/workerscript.qml 0
+ \snippet threading/workerscript/workerscript.qml 0
The workerscript then is free to take a really long time to calculate it:
- \snippet quick/threading/workerscript/workerscript.js 0
+ \snippet threading/workerscript/workerscript.js 0
When it's done, the result returns to the main scene via the WorkerScript type:
- \snippet quick/threading/workerscript/workerscript.qml 1
+ \snippet threading/workerscript/workerscript.qml 1
*/
diff --git a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
index 164409076c..09a5f51105 100644
--- a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
+++ b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
@@ -34,21 +34,21 @@
Multipoint Flames demonstrates distinguishing different fingers in a MultiPointTouchArea, by assigning a different colored flame to each touch point.
The MultipointTouchArea sets up multiple touch points:
- \snippet quick/touchinteraction/multipointtouch/multiflame.qml 0
+ \snippet touchinteraction/multipointtouch/multiflame.qml 0
The flames are then simply bound to the coordiates of the touch point, and whether it is currently pressed, like so:
- \snippet quick/touchinteraction/multipointtouch/multiflame.qml 1
+ \snippet touchinteraction/multipointtouch/multiflame.qml 1
Bear-Whack demonstrates using a MultiPointTouchArea to add multiple finger support to a simple game. The interaction with the game
is done through a SpriteGoal that follows the TouchPoint. The TouchPoints added to the MultiPointTouchArea are a component with all
this logic embedded into it:
- \snippet quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0
+ \snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0
Flick Resize uses a PinchArea to allow Pinch-to-Resize behavior. This is easily achieved just by listening to the PinchArea signals and responding
to user input.
- \snippet quick/touchinteraction/pincharea/flickresize.qml 0
+ \snippet touchinteraction/pincharea/flickresize.qml 0
Flickable is a simple example demonstrating the Flickable type. The object inside the flickable is very big, but the flickable itself is very small:
- \snippet quick/touchinteraction/flickable/basic-flickable.qml 0
+ \snippet touchinteraction/flickable/basic-flickable.qml 0
Corkboards shows a more complex Flickable usecase, with types on the flickable that respond to mouse and keyboard interaction.
This doesn't require special code, the Qt Quick types automatically cooperate with Flickable for accepting the touch events.
diff --git a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
index 1ebe7eb9f5..3a14dd465a 100644
--- a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
+++ b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc
@@ -28,7 +28,7 @@
/*!
\page qmlexampletoggleswitch.html tutorial
-\title QML Example - Toggle Switch
+\title Qt Quick Examples - Toggle Switch
\brief A reusable switch component made in QML
\ingroup qtquickexamples
@@ -48,12 +48,12 @@ The objects that compose the switch are:
\endlist
\section1 Switch.qml
-\snippet quick/ui-components/slideswitch/content/Switch.qml 0
+\snippet ui-components/slideswitch/content/Switch.qml 0
\section1 Walkthrough
\section2 Interface
-\snippet quick/ui-components/slideswitch/content/Switch.qml 1
+\snippet 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.
@@ -76,14 +76,14 @@ Item {
the text will only be visible when the switch is on.
\section2 Images and user interaction
-\snippet quick/ui-components/slideswitch/content/Switch.qml 4
+\snippet 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 quick/ui-components/slideswitch/content/Switch.qml 5
+\snippet 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
@@ -91,7 +91,7 @@ property of the \c MouseArea is for. We also want to toggle the switch if the kn
in the \c dorelease() function that is called in the \c onReleased property.
\section2 States
-\snippet quick/ui-components/slideswitch/content/Switch.qml 6
+\snippet ui-components/slideswitch/content/Switch.qml 6
We define the two states of the switch:
\list
@@ -105,13 +105,13 @@ For more information on states see \l{Qt Quick States}.
We add two JavaScript functions to our switch:
-\snippet quick/ui-components/slideswitch/content/Switch.qml 2
+\snippet 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 quick/ui-components/slideswitch/content/Switch.qml 3
+\snippet 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.
@@ -119,7 +119,7 @@ This second function is called when the knob is released and we want to make sur
For more information on scripts see \l{Using JavaScript Expressions in QML}.
\section2 Transition
-\snippet quick/ui-components/slideswitch/content/Switch.qml 7
+\snippet 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 knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms.
@@ -128,5 +128,5 @@ For more information on transitions see \l{Animation and Transitions in Qt Quick
\section1 Usage
The switch can be used in a QML file, like this:
-\snippet quick/ui-components/slideswitch/slideswitch.qml 0
+\snippet ui-components/slideswitch/slideswitch.qml 0
*/
diff --git a/examples/quick/views/doc/src/views.qdoc b/examples/quick/views/doc/src/views.qdoc
index cc8112f4dd..2d664c9bd9 100644
--- a/examples/quick/views/doc/src/views.qdoc
+++ b/examples/quick/views/doc/src/views.qdoc
@@ -32,51 +32,51 @@
\image qml-modelviews-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to model and view functionality. They demonstrate how to show data from a model using the QtQuick view types.
+ This is a collection of small QML examples relating to model and view functionality. They demonstrate how to show data from a model using the \l {Qt Quick} view types.
\section2 GridView and PathView demonstrate usage of these types to display views.
- \snippet quick/views/gridview/gridview-example.qml 0
+ \snippet views/gridview/gridview-example.qml 0
\section2 Dynamic List demonstrates animation of runtime additions and removals to a ListView.
The ListView.onAdd signal handler runs an animation when new items are added to the
view, and the ListView.onRemove another when they are removed.
- \snippet quick/views/listview/dynamiclist.qml 0
- \snippet quick/views/listview/dynamiclist.qml 1
+ \snippet views/listview/dynamiclist.qml 0
+ \snippet views/listview/dynamiclist.qml 1
\section2 Expanding Delegates demonstrates delegates that expand when activated.
It has a complex delegate the size and appearance of which can change, displacing
other items in the view.
- \snippet quick/views/listview/expandingdelegates.qml 0
- \snippet quick/views/listview/expandingdelegates.qml 1
- \snippet quick/views/listview/expandingdelegates.qml 2
- \snippet quick/views/listview/expandingdelegates.qml 3
+ \snippet views/listview/expandingdelegates.qml 0
+ \snippet views/listview/expandingdelegates.qml 1
+ \snippet views/listview/expandingdelegates.qml 2
+ \snippet views/listview/expandingdelegates.qml 3
\section2 Highlight demonstrates adding a custom highlight to a ListView.
- \snippet quick/views/listview/highlight.qml 0
+ \snippet views/listview/highlight.qml 0
\section2 Highlight Ranges shows the three different highlight range modes of ListView.
- \snippet quick/views/listview/highlightranges.qml 0
- \snippet quick/views/listview/highlightranges.qml 1
- \snippet quick/views/listview/highlightranges.qml 2
+ \snippet views/listview/highlightranges.qml 0
+ \snippet views/listview/highlightranges.qml 1
+ \snippet views/listview/highlightranges.qml 2
\section2 Sections demonstrates the various section headers and footers available to ListView.
- \snippet quick/views/listview/sections.qml 0
+ \snippet views/listview/sections.qml 0
\section2 Packages demonstrates using Packages to transition delegates between two views.
It has a Package which defines delegate items for each view and an item that can
be transferred between delegates.
- \snippet quick/views/package/Delegate.qml 0
+ \snippet views/package/Delegate.qml 0
A DelegateModel allows the individual views to access their specific items from
the shared package delegate.
- \snippet quick/views/package/view.qml 0
+ \snippet views/package/view.qml 0
\section2 ObjectModel uses an ObjectModel for the model instead of a ListModel.
- \snippet quick/views/visualitemmodel/visualitemmodel.qml 0
+ \snippet views/objectmodel/objectmodel.qml 0
*/
diff --git a/examples/quick/window/window/twowindows.qml b/examples/quick/window/ScreenInfo.qml
index 4a8d2f4f1b..e4abc8d69d 100644
--- a/examples/quick/window/window/twowindows.qml
+++ b/examples/quick/window/ScreenInfo.qml
@@ -38,52 +38,58 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Window 2.0
+import QtQuick 2.1
+import QtQuick.Window 2.1
-QtObject {
- property var win1: Window {
- width: 320
- height: 240
- x: 0
- y: 0
- visible: true
- color: "#ccffff"
- title: "First Window"
- Text {
- anchors.centerIn: parent
- text: "First Window"
- Text {
- id: statusText
- anchors.top: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: win2.visible = !win2.visible
+Item {
+ id: root
+ width: 400
+ height: propertyGrid.implicitHeight + 16
+
+ function orientationToString(o) {
+ switch (o) {
+ case Qt.PrimaryOrientation:
+ return "primary";
+ case Qt.PortraitOrientation:
+ return "portrait";
+ case Qt.LandscapeOrientation:
+ return "landscape";
+ case Qt.InvertedPortraitOrientation:
+ return "inverted portrait";
+ case Qt.InvertedLandscapeOrientation:
+ return "inverted landscape";
}
+ return "unknown";
}
- property var win2: Window {
- width: 320
- height: 240
- x: 220
- y: 120
- visible: true
- color: "green"
- title: "Second Window: " + color
- Rectangle {
- anchors.fill: parent
- anchors.margins: 10
- Text {
- anchors.centerIn: parent
- text: "Second Window"
- }
- MouseArea {
- anchors.fill: parent
- onClicked: win2.color = "#ffffcc"
- }
+
+ Grid {
+ id: propertyGrid
+ columns: 2
+ spacing: 8
+ x: spacing
+ y: spacing
+
+ //! [screen]
+ Text {
+ text: "Screen \"" + Screen.name + "\":"
+ font.bold: true
}
- onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible")
+ Item { width: 1; height: 1 } // spacer
+
+ Text { text: "dimensions" }
+ Text { text: Screen.width + "x" + Screen.height }
+
+ Text { text: "logical pixel density" }
+ Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm" }
+
+ Text { text: "available virtual desktop" }
+ Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
+
+ Text { text: "orientation" }
+ Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+
+ Text { text: "primary orientation" }
+ Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
+ //! [screen]
}
}
diff --git a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml b/examples/quick/window/Splash.qml
index d5a1e6f91f..c981bd2585 100644
--- a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml
+++ b/examples/quick/window/Splash.qml
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** 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:
@@ -38,46 +38,42 @@
**
****************************************************************************/
-//![0]
import QtQuick 2.0
+import QtQuick.Window 2.1
-Item {
+//! [splash-properties]
+Window {
+ id: splash
+ visible: true
+ width: splashImage.width
+ height: splashImage.height
+ color: "transparent"
+ title: "Splash Window"
+ modality: Qt.ApplicationModal
+ flags: Qt.SplashScreen
+ property int timeoutInterval: 2000
+ signal timeout
+//! [splash-properties]
+//! [screen-properties]
+ x: (Screen.width - splashImage.width) / 2
+ y: (Screen.height - splashImage.height) / 2
+//! [screen-properties]
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Item {
- x: 20
- y: 270
- width: 200
- height: 200
+ Image {
+ id: splashImage
+ source: "../../shared/images/qt-logo.png"
MouseArea {
anchors.fill: parent
- onClicked: topRect.visible = !topRect.visible
+ onClicked: Qt.quit()
}
- Rectangle {
- x: 20
- y: 20
- width: 100
- height: 100
- color: "red"
- }
- Rectangle {
- id: topRect
- opacity: 0.5
-
- x: 100
- y: 100
- width: 100
- height: 100
- color: "blue"
+ }
+ //! [timer]
+ Timer {
+ interval: timeoutInterval; running: true; repeat: false
+ onTriggered: {
+ visible = false
+ splash.timeout()
}
}
+ //! [timer]
}
-//![0]
diff --git a/examples/quick/window/doc/images/qml-window-example.png b/examples/quick/window/doc/images/qml-window-example.png
new file mode 100644
index 0000000000..72487b4d93
--- /dev/null
+++ b/examples/quick/window/doc/images/qml-window-example.png
Binary files differ
diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc
new file mode 100644
index 0000000000..07d2f115c1
--- /dev/null
+++ b/examples/quick/window/doc/src/window.qdoc
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \title Qt Quick Examples - Window and Screen
+ \example window
+ \brief This example demonstrates the Window and Screen types in QML
+ \image qml-window-example.png
+ \ingroup qtquickexamples
+
+ This example shows you how to create a Window in QML, how to control its
+ \l {QQuickWindow::visibility} {visibility}, how to present a splash screen
+ during application startup, and how to access the properties of the
+ \l Screen. It also demonstrates how to package QML into
+ \l {The Qt Resource System} {resources} and provide an
+ \l {Setting the Application Icon} {icon} to create a standalone QML desktop application.
+
+ A splash screen can be created with the \l {Qt::SplashScreen} {Qt.SplashScreen} flag,
+ and should be \l {Qt::ApplicationModal} {ApplicationModal} to prevent interaction
+ with the main window. If the splash window is also transparent, and showing a
+ partially transparent image, then it will look like a shaped window.
+ \snippet window/Splash.qml splash-properties
+
+ In this example a \l Timer will automatically dismiss the splash screen,
+ but in a real application you might want to connect to a signal from the
+ application logic to hide the splash when initialization is complete.
+ \snippet window/Splash.qml timer
+
+ The main window in this example is the control window, with some buttons
+ and checkboxes to control and provide feedback on the state of a secondary
+ window. Each checkbox has a binding to the property whose state it is
+ displaying, and also an onClicked handler to change the state. This is the
+ typical pattern to create a two-way binding while avoiding binding loops.
+ \snippet window/window.qml windowedCheckbox
+
+ The \l Screen has several properties which are generally useful to applications
+ which need to rotate some content when the screen orientation changes, to position
+ windows on the screen or to convert real units to logical pixel units. ScreenInfo.qml
+ (which is displayed inline in window.qml, or can be run by itself with qmlscene)
+ simply displays the property values, while the splash screen uses them to
+ center the window on the screen.
+ \snippet window/Splash.qml screen-properties
+
+ If a Window is nested inside an \l Item or another Window, the inner window
+ becomes "transient for" the outer one (see \l Window for more explanation).
+ But if you want to create multiple top-level windows as unrelated peers, you
+ can create them inside a non-visual \l QtObject root item, as this example does.
+*/
diff --git a/examples/quick/window/window/window.cpp b/examples/quick/window/main.cpp
index 277effc20c..7872c7183c 100644
--- a/examples/quick/window/window/window.cpp
+++ b/examples/quick/window/main.cpp
@@ -41,6 +41,7 @@
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlComponent>
+#include <QtQuick/QQuickWindow>
#include <QtCore/QUrl>
#include <QDebug>
@@ -49,7 +50,8 @@ int main(int argc, char* argv[])
QGuiApplication app(argc, argv);
QQmlEngine engine;
QQmlComponent component(&engine);
- component.loadUrl(QUrl("qrc:///window/window/Window.qml"));
+ QQuickWindow::setDefaultAlphaBuffer(true);
+ component.loadUrl(QUrl("qrc:///window/window.qml"));
if ( component.isReady() )
component.create();
else
diff --git a/examples/quick/window/resources/icon.icns b/examples/quick/window/resources/icon.icns
new file mode 100644
index 0000000000..88b4b24449
--- /dev/null
+++ b/examples/quick/window/resources/icon.icns
Binary files differ
diff --git a/examples/quick/window/resources/icon.ico b/examples/quick/window/resources/icon.ico
new file mode 100644
index 0000000000..52af30a6ca
--- /dev/null
+++ b/examples/quick/window/resources/icon.ico
Binary files differ
diff --git a/examples/quick/window/resources/icon.svg b/examples/quick/window/resources/icon.svg
new file mode 100644
index 0000000000..0b6153206d
--- /dev/null
+++ b/examples/quick/window/resources/icon.svg
@@ -0,0 +1,208 @@
+<?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://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"
+ width="128"
+ height="128"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.48.2 r9819"
+ version="1.0"
+ sodipodi:docname="icon.svg"
+ inkscape:export-filename="/Users/rutledge/dev/qt5-stable/qtdeclarative/examples/quick/window/window/icon80.png"
+ inkscape:export-xdpi="61.509998"
+ inkscape:export-ydpi="61.509998"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient4009">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4011" />
+ <stop
+ id="stop4019"
+ offset="0.875"
+ style="stop-color:#ffffff;stop-opacity:0.49803922;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop4013" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 186.64798 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="559.62469 : 186.64798 : 1"
+ inkscape:persp3d-origin="279.81235 : 124.43199 : 1"
+ id="perspective4876" />
+ <inkscape:perspective
+ id="perspective2836"
+ inkscape:persp3d-origin="22 : 14.666667 : 1"
+ inkscape:vp_z="44 : 22 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 22 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <filter
+ inkscape:collect="always"
+ id="filter4063"
+ x="-0.195491"
+ width="1.390982"
+ y="-0.16235915"
+ height="1.3247183">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="3.3077485"
+ id="feGaussianBlur4065" />
+ </filter>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10"
+ guidetolerance="10"
+ objecttolerance="10000"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.9775825"
+ inkscape:cx="62.656189"
+ inkscape:cy="42.423381"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1280"
+ inkscape:window-height="744"
+ inkscape:window-x="2003"
+ inkscape:window-y="156"
+ showgrid="true"
+ borderlayer="true"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:snap-global="false"
+ inkscape:window-maximized="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid7194"
+ visible="true"
+ enabled="true"
+ spacingx="8px"
+ spacingy="8px" />
+ </sodipodi:namedview>
+ <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" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-66.38047,-391.3222)">
+ <path
+ id="path7304"
+ d="M 95.556318,434.65407 L 165.25811,434.65407 L 165.25811,490.10429 L 95.556318,490.10429 L 95.556318,434.65407 z"
+ style="fill:#01afaf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ style="fill:#a7c706;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 96.869177,465.30846 c 27.677903,3.04574 41.155393,12.11589 48.000003,24 l -48.000003,0 0,-24 z"
+ id="path7300"
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path7302"
+ d="M 165.46767,465.22201 C 137.78977,468.26775 124.31228,477.33791 117.46767,489.22201 L 165.46767,489.22201 L 165.46767,465.22201 z"
+ style="fill:#966406;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1" />
+ <path
+ style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1;fill-opacity:1"
+ d="M 95.532809,434.35736 L 74.567964,420.38079 L 74.567964,497.25189 L 95.532809,490.26361 L 95.532809,434.35736 z"
+ id="path7270"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#00ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 74.567964,455.3222 L 95.532809,462.31048"
+ id="path7272"
+ sodipodi:nodetypes="cc" />
+ <g
+ style="fill:#80ffff;fill-opacity:1"
+ id="g7278"
+ transform="matrix(-0.8735352,0,0,0.8735352,244.36615,64.570513)">
+ <path
+ style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ d="M 24,32 L 0,16 L 0,104 L 24,96 L 24,32 z"
+ id="path7280"
+ transform="translate(66.38047,391.3222)" />
+ <path
+ style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ d="M 0,56 L 24,64"
+ id="path7282"
+ transform="translate(66.38047,391.3222)"
+ sodipodi:nodetypes="cc" />
+ </g>
+ <path
+ style="fill:#ffffff;fill-opacity:1;filter:url(#filter4063)"
+ d="m 119.74679,437.94232 c -0.0487,0.003 -0.0932,0.0315 -0.14149,0.0354 -0.1659,0.0132 -0.33372,0.008 -0.49523,0.0354 -0.96156,0.0643 -1.9037,0.14607 -2.86523,0.21224 -2.94807,0.23566 -5.19987,2.66253 -5.19987,6.01345 l 0,39.51194 3.32508,3.07747 0,-0.0354 33.2155,-5.58898 c 2.28673,-0.39587 4.06792,-3.06727 4.06792,-5.97808 l 0,-32.18967 -30.5625,-5.023 c -0.45263,-0.0748 -0.91269,-0.0942 -1.34418,-0.0708 z"
+ id="path3987"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g3"
+ transform="matrix(0.20572087,0,0,0.20572087,113.4162,440.80626)">
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path5"
+ style="fill:#006225"
+ d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path7"
+ style="fill:#80c342"
+ d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path11"
+ style="fill:#006225"
+ d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path13"
+ style="fill:#006225"
+ d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z"
+ style="fill:#ffffff"
+ id="path17"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19"
+ style="fill:#006225"
+ d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z"
+ style="fill:#006225"
+ id="path21"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 96.506224,434.65407 L 166.20801,434.65407 L 166.20801,490.10429 L 96.506224,490.10429 L 96.506224,434.65407 z"
+ id="rect7265" />
+ </g>
+</svg>
diff --git a/examples/quick/window/resources/icon64.png b/examples/quick/window/resources/icon64.png
new file mode 100644
index 0000000000..0fa324401f
--- /dev/null
+++ b/examples/quick/window/resources/icon64.png
Binary files differ
diff --git a/examples/quick/window/resources/window.rc b/examples/quick/window/resources/window.rc
new file mode 100644
index 0000000000..4de84d297e
--- /dev/null
+++ b/examples/quick/window/resources/window.rc
@@ -0,0 +1,32 @@
+#include "winver.h"
+
+IDI_ICON1 ICON DISCARDABLE "icon.ico"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGS 0x0L
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x00040004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)"
+ VALUE "FileDescription", "QtQuick Window Example"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)."
+ VALUE "InternalName", "window"
+ VALUE "OriginalFilename", "window.exe"
+ VALUE "ProductName", "QtQuick Window Example"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/examples/quick/window/window.pro b/examples/quick/window/window.pro
index 93e43fcd65..be35b24325 100644
--- a/examples/quick/window/window.pro
+++ b/examples/quick/window/window.pro
@@ -1,6 +1,16 @@
-TEMPLATE = subdirs
-SUBDIRS += \
- window
+TEMPLATE = app
+QT += quick qml
+SOURCES += main.cpp
+RESOURCES += \
+ window.qrc \
+ ../shared/shared.qrc
EXAMPLE_FILES = \
- screen
+ window.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/window
+INSTALLS += target
+
+ICON = resources/icon64.png
+macx: ICON = resources/icon.icns
+win32: RC_FILE = resources/window.rc
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml
new file mode 100644
index 0000000000..67e2ba40ff
--- /dev/null
+++ b/examples/quick/window/window.qml
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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 2.0
+import QtQuick.Window 2.1
+import "../shared" as Shared
+
+QtObject {
+ property real defaultSpacing: 10
+ property SystemPalette palette: SystemPalette { }
+
+ property var controlWindow: Window {
+ width: 400
+ height: col.implicitHeight + defaultSpacing * 2
+ color: palette.window
+ title: "Control Window"
+ Column {
+ id: col
+ anchors.fill: parent
+ anchors.margins: defaultSpacing
+ spacing: defaultSpacing
+ property real cellWidth: col.width / 3 - spacing
+ Text { text: "Control the second window:" }
+ Grid {
+ id: grid
+ columns: 3
+ spacing: defaultSpacing
+ width: parent.width
+ Shared.Button {
+ id: showButton
+ width: col.cellWidth
+ text: testWindow.visible ? "Hide" : "Show"
+ onClicked: testWindow.visible = !testWindow.visible
+ }
+ //! [windowedCheckbox]
+ Shared.CheckBox {
+ text: "Windowed"
+ height: showButton.height
+ width: col.cellWidth
+ Binding on checked { value: testWindow.visibility === Window.Windowed }
+ onClicked: testWindow.visibility = Window.Windowed
+ }
+ //! [windowedCheckbox]
+ Shared.CheckBox {
+ height: showButton.height
+ width: col.cellWidth
+ text: "Full Screen"
+ Binding on checked { value: testWindow.visibility === Window.FullScreen }
+ onClicked: testWindow.visibility = Window.FullScreen
+ }
+ Shared.Button {
+ id: autoButton
+ width: col.cellWidth
+ text: "Automatic"
+ onClicked: testWindow.visibility = Window.AutomaticVisibility
+ }
+ Shared.CheckBox {
+ height: autoButton.height
+ text: "Minimized"
+ Binding on checked { value: testWindow.visibility === Window.Minimized }
+ onClicked: testWindow.visibility = Window.Minimized
+ }
+ Shared.CheckBox {
+ height: autoButton.height
+ text: "Maximized"
+ Binding on checked { value: testWindow.visibility === Window.Maximized }
+ onClicked: testWindow.visibility = Window.Maximized
+ }
+ }
+ function visibilityToString(v) {
+ switch (v) {
+ case Window.Windowed:
+ return "windowed";
+ case Window.Minimized:
+ return "minimized";
+ case Window.Maximized:
+ return "maximized";
+ case Window.FullScreen:
+ return "fullscreen";
+ case Window.AutomaticVisibility:
+ return "automatic";
+ case Window.Hidden:
+ return "hidden";
+ }
+ return "unknown";
+ }
+ Text {
+ text: "second window is " + (testWindow.visible ? "visible" : "invisible") +
+ " and has visibility " + parent.visibilityToString(testWindow.visibility)
+ }
+ Rectangle {
+ id: horizontalRule
+ color: "black"
+ width: parent.width
+ height: 1
+ }
+ ScreenInfo { }
+ }
+ }
+
+ property var testWindow: Window {
+ width: 320
+ height: 240
+ color: "#215400"
+ title: "Test Window with color " + color
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: defaultSpacing
+ Text {
+ anchors.centerIn: parent
+ text: "Second Window"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: testWindow.color = "#e0c31e"
+ }
+ Shared.Button {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: defaultSpacing
+ text: testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen"
+ width: 150
+ onClicked: {
+ if (testWindow.visibility === Window.FullScreen)
+ testWindow.visibility = Window.AutomaticVisibility
+ else
+ testWindow.visibility = Window.FullScreen
+ }
+ }
+ Shared.Button {
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.margins: defaultSpacing
+ text: "X"
+ width: 30
+ onClicked: testWindow.visible = false
+ }
+ }
+ }
+
+ property var splashWindow: Splash {
+ onTimeout: controlWindow.visible = true
+ }
+}
diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc
new file mode 100644
index 0000000000..dc211bdaaf
--- /dev/null
+++ b/examples/quick/window/window.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/window">
+ <file>window.qml</file>
+ <file>Splash.qml</file>
+ <file>ScreenInfo.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/window/window/standalone.qml b/examples/quick/window/window/standalone.qml
deleted file mode 100644
index db73bf66eb..0000000000
--- a/examples/quick/window/window/standalone.qml
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-import QtQuick.Window 2.0
-
-Item {
- width: 320
- height: 240
- // It's not possible to set an Item's windowTitle. If you want to modify
- // window properties, you need to explicitly create a Window.
- Text {
- id: text1
- anchors.centerIn: parent
- text: "First Window\n" + (Qt.application.supportsMultipleWindows ?
- "click the button to open a second window" : "only one window is allowed")
- }
- Rectangle {
- border.color: "black"
- radius: 4
- anchors.top: text1.bottom
- anchors.horizontalCenter: text1.horizontalCenter
- width: 100
- height: 30
- TextInput {
- id: ti1
- focus: true // but the modal popup will prevent input while it is open
- anchors.centerIn: parent
- }
- }
- Rectangle {
- border.color: "black"
- color: childWindow.visible ? "goldenrod" : "beige"
- radius: height / 4
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- anchors.margins: 10
- width: text.implicitWidth + 20
- height: text.implicitHeight + 20
- visible: Qt.application.supportsMultipleWindows
- Text {
- id: text
- text: "Pop up window"
- anchors.centerIn: parent
- }
- MouseArea {
- anchors.fill: parent
- onClicked: childWindow.visible = !childWindow.visible
- }
- }
-
- Window {
- id: childWindow
- width: 320
- height: 240
- x: 220
- y: 120
- color: "beige"
- title: "Second Window"
- modality: Qt.ApplicationModal
- flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
- Text {
- id: text2
- anchors.centerIn: parent
- text: "Modal Frameless Stay-on-Top Window"
- }
- Text {
- anchors.top: parent.top
- anchors.right: parent.right
- anchors.margins: 10
- text: "X"
- MouseArea{
- anchors.fill: parent
- onClicked: childWindow.visible = false
- }
- }
- Rectangle {
- border.color: "black"
- radius: 4
- anchors.top: text2.bottom
- anchors.horizontalCenter: text2.horizontalCenter
- width: 100
- height: 30
- TextInput {
- id: ti2
- focus: true
- anchors.centerIn: parent
- }
- }
- }
-}
diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro
deleted file mode 100644
index 3525a893fa..0000000000
--- a/examples/quick/window/window/window.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = app
-QT += qml
-
-SOURCES += window.cpp
-RESOURCES += window.qrc
-
-EXAMPLE_FILES = \
- nogui.qml \
- standalone.qml \
- twowindows.qml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window
-INSTALLS = target
diff --git a/examples/quick/window/window/window.qrc b/examples/quick/window/window/window.qrc
deleted file mode 100644
index c203c140fc..0000000000
--- a/examples/quick/window/window/window.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/window/window">
- <file>Window.qml</file>
- </qresource>
-</RCC>
diff --git a/qtdeclarative.pro b/qtdeclarative.pro
index 58c33f27ca..8bc15a5662 100644
--- a/qtdeclarative.pro
+++ b/qtdeclarative.pro
@@ -1 +1,2 @@
+CONFIG += tests_need_tools
load(qt_parts)
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro
index b7704dadda..53cad30cee 100644
--- a/src/imports/dialogs/dialogs.pro
+++ b/src/imports/dialogs/dialogs.pro
@@ -3,6 +3,8 @@ TARGET = dialogplugin
TARGETPATH = QtQuick/Dialogs
IMPORT_VERSION = 1.0
+QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
+
SOURCES += \
qquickabstractfiledialog.cpp \
qquickplatformfiledialog.cpp \
diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf
new file mode 100644
index 0000000000..34f19b5ff3
--- /dev/null
+++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf
@@ -0,0 +1,36 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtQuickDialogs
+description = Qt Quick Dialogs Reference Documentation
+url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/
+version = $QT_VERSION
+
+qhp.projects = QtQuickDialogs
+
+qhp.QtQuickDialogs.file = qtquickdialogs.qhp
+qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG
+qhp.QtQuickDialogs.virtualFolder = qtquickdialogs
+qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs
+qhp.QtQuickDialogs.indexRoot =
+
+qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc
+qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION
+qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION
+
+qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
+
+depends = qtqml qtquick qtgui qtwidgets qtdoc
+
+exampledirs += ../../../../examples/quick/dialogs
+
+examplesinstallpath = quick/dialogs
+
+headerdirs += ..
+
+sourcedirs += ..
+
+imagedirs += images
diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc
new file mode 100644
index 0000000000..ee277f48dc
--- /dev/null
+++ b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group qtquickdialog_examples
+ \ingroup qtquickexamples
+ \title Qt Quick Examples - Dialogs
+ \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML.
+
+ These examples show how to use the \l{Qt Quick Dialogs}.
+*/
+
diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc
new file mode 100644
index 0000000000..5a1223b04d
--- /dev/null
+++ b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group dialogs
+ \title Dialogs
+*/
+
+/*!
+ \page qtquickdialogs-index.html
+ \title Qt Quick Dialogs
+
+ \brief Qt Quick Dialogs submodule
+
+ The module is new in Qt 5.1.
+
+ \section1 Dialogs
+
+ \annotatedlist dialogs
+
+ \section1 Related information
+
+ \section2 Examples
+ \list
+ \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples}
+ \endlist
+
+ \section2 Reference
+ \list
+ \li \l{Qt Quick Dialogs QML Types}{QML Types}
+ \endlist
+
+*/
+
diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp
index 67653e5965..5502a65310 100644
--- a/src/imports/dialogs/plugin.cpp
+++ b/src/imports/dialogs/plugin.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmodule QtQuick.Dialogs 1
- \title Qt Quick Dialog QML Types
+ \title Qt Quick Dialogs QML Types
\ingroup qmlmodules
\brief Provides QML types for standard file, color picker and message dialogs
diff --git a/src/imports/dialogs/plugins.qmltypes b/src/imports/dialogs/plugins.qmltypes
index faf68de909..80eb8bd291 100644
--- a/src/imports/dialogs/plugins.qmltypes
+++ b/src/imports/dialogs/plugins.qmltypes
@@ -3,39 +3,72 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.Dialogs 1.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.Dialogs 1.0'.
Module {
Component {
- name: "QQuickAbstractFileDialog"
+ name: "QQuickAbstractColorDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "showAlphaChannel"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "arg"; type: "QColor" }
+ }
+ Method {
+ name: "setShowAlphaChannel"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractDialog"
prototype: "QObject"
Property { name: "visible"; type: "bool" }
Property { name: "modality"; type: "Qt::WindowModality" }
Property { name: "title"; type: "string" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickAbstractFileDialog"
+ prototype: "QQuickAbstractDialog"
Property { name: "selectExisting"; type: "bool" }
Property { name: "selectMultiple"; type: "bool" }
Property { name: "selectFolder"; type: "bool" }
Property { name: "folder"; type: "string" }
Property { name: "nameFilters"; type: "QStringList" }
Property { name: "selectedNameFilter"; type: "string" }
- Property { name: "filePath"; type: "string"; isReadonly: true }
- Property { name: "filePaths"; type: "QStringList"; isReadonly: true }
- Signal { name: "visibilityChanged" }
+ Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
+ Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
Signal { name: "filterSelected" }
Signal { name: "fileModeChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
+ Signal { name: "selectionAccepted" }
Method {
name: "setVisible"
Parameter { name: "v"; type: "bool" }
}
Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
name: "setTitle"
Parameter { name: "t"; type: "string" }
}
@@ -65,8 +98,25 @@ Module {
}
}
Component {
- name: "QQuickQFileDialog"
+ name: "QQuickColorDialog"
+ defaultProperty: "implementation"
+ prototype: "QQuickAbstractColorDialog"
+ exports: ["QtQuick.Dialogs/AbstractColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ name: "QQuickFileDialog"
+ defaultProperty: "implementation"
prototype: "QQuickAbstractFileDialog"
- exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"]
+ exports: ["QtQuick.Dialogs/AbstractFileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ Method { name: "clearSelection" }
+ Method {
+ name: "addSelection"
+ type: "bool"
+ Parameter { name: "path"; type: "string" }
+ }
}
}
diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp
index 491a2e687c..ea3114c86e 100644
--- a/src/imports/dialogs/qquickplatformcolordialog.cpp
+++ b/src/imports/dialogs/qquickplatformcolordialog.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\qmltype ColorDialog
\instantiates QQuickPlatformColorDialog
\inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
+ \ingroup dialogs
\brief Dialog component for choosing a color.
\since Qt 5.1
diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp
index d767f65499..5ae7fd0067 100644
--- a/src/imports/dialogs/qquickplatformfiledialog.cpp
+++ b/src/imports/dialogs/qquickplatformfiledialog.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\qmltype FileDialog
\instantiates QQuickPlatformFileDialog
\inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
+ \ingroup dialogs
\brief Dialog component for choosing files from a local filesystem.
\since Qt 5.1
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index 64a4b02e91..ad09f54381 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -57,7 +57,7 @@ FileInfoThread::FileInfoThread(QObject *parent)
sortUpdate(false),
showDirs(true),
showDirsFirst(false),
- showDotDot(false),
+ showDotAndDotDot(false),
showOnlyReadable(false)
{
#ifndef QT_NO_FILESYSTEMWATCHER
@@ -158,11 +158,12 @@ void FileInfoThread::setShowDirsFirst(bool show)
condition.wakeAll();
}
-void FileInfoThread::setShowDotDot(bool on)
+void FileInfoThread::setShowDotAndDotDot(bool on)
{
QMutexLocker locker(&mutex);
- showDotDot = on;
+ showDotAndDotDot = on;
folderUpdate = true;
+ needUpdate = true;
condition.wakeAll();
}
@@ -212,10 +213,12 @@ void FileInfoThread::run()
void FileInfoThread::getFileInfos(const QString &path)
{
QDir::Filters filter;
- filter = QDir::Files | QDir::NoDot | QDir::CaseSensitive;
+ filter = QDir::Files | QDir::CaseSensitive;
if (showDirs)
filter = filter | QDir::AllDirs | QDir::Drives;
- if ((path == rootPath) || !showDotDot)
+ if (!showDotAndDotDot)
+ filter = filter | QDir::NoDot | QDir::NoDotDot;
+ else if (path == rootPath)
filter = filter | QDir::NoDotDot;
if (showOnlyReadable)
filter = filter | QDir::Readable;
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index f9340ca75d..cf6572a279 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -72,7 +72,7 @@ public:
void setNameFilters(const QStringList & nameFilters);
void setShowDirs(bool showFolders);
void setShowDirsFirst(bool show);
- void setShowDotDot(bool on);
+ void setShowDotAndDotDot(bool on);
void setShowOnlyReadable(bool on);
public Q_SLOTS:
@@ -104,7 +104,7 @@ private:
bool sortUpdate;
bool showDirs;
bool showDirsFirst;
- bool showDotDot;
+ bool showDotAndDotDot;
bool showOnlyReadable;
};
diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes
index fabeb9e4b1..20914f4108 100644
--- a/src/imports/folderlistmodel/plugins.qmltypes
+++ b/src/imports/folderlistmodel/plugins.qmltypes
@@ -3,13 +3,17 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump Qt.labs.folderlistmodel 2.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable Qt.labs.folderlistmodel 2.0'.
Module {
Component {
name: "QQuickFolderListModel"
prototype: "QAbstractListModel"
- exports: ["FolderListModel 1.0", "FolderListModel 2.0"]
+ exports: [
+ "Qt.labs.folderlistmodel/FolderListModel 1.0",
+ "Qt.labs.folderlistmodel/FolderListModel 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
Enum {
name: "SortField"
values: {
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 421e215066..85b59e9c73 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -55,7 +55,7 @@ class QQuickFolderListModelPrivate
public:
QQuickFolderListModelPrivate(QQuickFolderListModel *q)
: q_ptr(q),
- sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDots(false), showOnlyReadable(false)
+ sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false)
{
nameFilters << QLatin1String("*");
}
@@ -72,7 +72,7 @@ public:
bool sortReversed;
bool showDirs;
bool showDirsFirst;
- bool showDots;
+ bool showDotAndDotDot;
bool showOnlyReadable;
~QQuickFolderListModelPrivate() {}
@@ -279,7 +279,27 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
The following example shows a FolderListModel being used to provide a list
of QML files in a \l ListView:
- \snippet qml/folderlistmodel.qml 0
+ \qml
+ import QtQuick 2.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
+ }
+ \endqml
\section1 Path Separators
@@ -661,15 +681,15 @@ void QQuickFolderListModel::setShowDirsFirst(bool on)
bool QQuickFolderListModel::showDotAndDotDot() const
{
Q_D(const QQuickFolderListModel);
- return d->showDots;
+ return d->showDotAndDotDot;
}
void QQuickFolderListModel::setShowDotAndDotDot(bool on)
{
Q_D(QQuickFolderListModel);
- if (on != d->showDots) {
- d->fileInfoThread.setShowDotDot(on);
+ if (on != d->showDotAndDotDot) {
+ d->fileInfoThread.setShowDotAndDotDot(on);
}
}
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 733c7c47bd..7a922a832e 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -16,4 +16,4 @@ qtHaveModule(quick) {
qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel
-qtHaveModule(widgets) : SUBDIRS += widgets
+qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += widgets
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 9357b5a43c..5bb8099b2e 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -502,7 +502,7 @@ Database connections are automatically closed during Javascript garbage collecti
The API can be used from JavaScript functions in your QML:
-\snippet quick/localstorage/localstorage/hello.qml 0
+\snippet localstorage/localstorage/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.
diff --git a/src/imports/localstorage/plugins.qmltypes b/src/imports/localstorage/plugins.qmltypes
index 107781d6be..bcd516c25e 100644
--- a/src/imports/localstorage/plugins.qmltypes
+++ b/src/imports/localstorage/plugins.qmltypes
@@ -3,13 +3,14 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.LocalStorage 2.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.LocalStorage 2.0'.
Module {
Component {
name: "QQuickLocalStorage"
prototype: "QObject"
- exports: ["LocalStorage 2.0"]
+ exports: ["QtQuick.LocalStorage/LocalStorage 2.0"]
+ exportMetaObjectRevisions: [0]
Method {
name: "openDatabaseSync"
Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro
index e96d4b9a44..98b0bd617a 100644
--- a/src/imports/models/models.pro
+++ b/src/imports/models/models.pro
@@ -6,6 +6,6 @@ IMPORT_VERSION = 2.1
SOURCES += \
plugin.cpp
-QT += qml-private
+QT = qml-private
load(qml_plugin)
diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp
index 2181562098..90e8a56399 100644
--- a/src/imports/models/plugin.cpp
+++ b/src/imports/models/plugin.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmodule QtQml.Models 2
- \title Qt QML Model QML Types
+ \title Qt QML Models QML Types
\ingroup qmlmodules
\brief Provides QML types for data models
\since 5.1
@@ -60,7 +60,8 @@ QT_BEGIN_NAMESPACE
import QtQml.Models 2.1
\endcode
- Note that QtQml.Models module started at version 2.1 to match the version of the parent module.
+ Note that QtQml.Models module started at version 2.1 to match the version
+ of the parent module, \l{Qt QML}.
*/
diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes
index f8acb168b8..495c072a41 100644
--- a/src/imports/particles/plugins.qmltypes
+++ b/src/imports/particles/plugins.qmltypes
@@ -3,14 +3,15 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.Particles 2.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.Particles 2.0'.
Module {
Component {
name: "QQuickAgeAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Age 2.0"]
+ exports: ["QtQuick.Particles/Age 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "lifeLeft"; type: "int" }
Property { name: "advancePosition"; type: "bool" }
Signal {
@@ -33,7 +34,8 @@ Module {
Component {
name: "QQuickAngleDirection"
prototype: "QQuickDirection"
- exports: ["AngleDirection 2.0"]
+ exports: ["QtQuick.Particles/AngleDirection 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "angle"; type: "double" }
Property { name: "magnitude"; type: "double" }
Property { name: "angleVariation"; type: "double" }
@@ -75,7 +77,8 @@ Module {
name: "QQuickAttractorAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Attractor 2.0"]
+ exports: ["QtQuick.Particles/Attractor 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Proportion"
values: {
@@ -144,14 +147,16 @@ Module {
name: "QQuickCumulativeDirection"
defaultProperty: "directions"
prototype: "QQuickDirection"
- exports: ["CumulativeDirection 2.0"]
+ exports: ["QtQuick.Particles/CumulativeDirection 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "directions"; type: "QQuickDirection"; isList: true; isReadonly: true }
}
Component {
name: "QQuickCustomAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Affector 2.0"]
+ exports: ["QtQuick.Particles/Affector 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "relative"; type: "bool" }
Property { name: "position"; type: "QQuickDirection"; isPointer: true }
Property { name: "velocity"; type: "QQuickDirection"; isPointer: true }
@@ -198,19 +203,22 @@ Module {
name: "QQuickCustomParticle"
defaultProperty: "data"
prototype: "QQuickParticlePainter"
- exports: ["CustomParticle 2.0"]
+ exports: ["QtQuick.Particles/CustomParticle 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "fragmentShader"; type: "QByteArray" }
Property { name: "vertexShader"; type: "QByteArray" }
}
Component {
name: "QQuickDirection"
prototype: "QObject"
- exports: ["NullVector 2.0"]
+ exports: ["QtQuick.Particles/NullVector 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickEllipseExtruder"
prototype: "QQuickParticleExtruder"
- exports: ["EllipseShape 2.0"]
+ exports: ["QtQuick.Particles/EllipseShape 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "fill"; type: "bool" }
Signal {
name: "fillChanged"
@@ -225,7 +233,8 @@ Module {
name: "QQuickFrictionAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Friction 2.0"]
+ exports: ["QtQuick.Particles/Friction 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "factor"; type: "double" }
Property { name: "threshold"; type: "double" }
Signal {
@@ -249,7 +258,8 @@ Module {
name: "QQuickGravityAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Gravity 2.0"]
+ exports: ["QtQuick.Particles/Gravity 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "magnitude"; type: "double" }
Property { name: "acceleration"; type: "double" }
Property { name: "angle"; type: "double" }
@@ -278,7 +288,8 @@ Module {
name: "QQuickGroupGoalAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["GroupGoal 2.0"]
+ exports: ["QtQuick.Particles/GroupGoal 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "goalState"; type: "string" }
Property { name: "jump"; type: "bool" }
Signal {
@@ -302,7 +313,8 @@ Module {
name: "QQuickImageParticle"
defaultProperty: "data"
prototype: "QQuickParticlePainter"
- exports: ["ImageParticle 2.0"]
+ exports: ["QtQuick.Particles/ImageParticle 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Status"
values: {
@@ -480,7 +492,8 @@ Module {
name: "QQuickItemParticle"
defaultProperty: "data"
prototype: "QQuickParticlePainter"
- exports: ["ItemParticle 2.0"]
+ exports: ["QtQuick.Particles/ItemParticle 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickItemParticleAttached"
Property { name: "fade"; type: "bool" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
@@ -528,7 +541,8 @@ Module {
Component {
name: "QQuickLineExtruder"
prototype: "QQuickParticleExtruder"
- exports: ["LineShape 2.0"]
+ exports: ["QtQuick.Particles/LineShape 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "mirrored"; type: "bool" }
Signal {
name: "mirroredChanged"
@@ -542,7 +556,8 @@ Module {
Component {
name: "QQuickMaskExtruder"
prototype: "QQuickParticleExtruder"
- exports: ["MaskShape 2.0"]
+ exports: ["QtQuick.Particles/MaskShape 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "source"; type: "QUrl" }
Signal {
name: "sourceChanged"
@@ -557,7 +572,8 @@ Module {
name: "QQuickParticleAffector"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["ParticleAffector 2.0"]
+ exports: ["QtQuick.Particles/ParticleAffector 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
Property { name: "groups"; type: "QStringList" }
Property { name: "whenCollidingWith"; type: "QStringList" }
@@ -623,7 +639,8 @@ Module {
name: "QQuickParticleEmitter"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["Emitter 2.0"]
+ exports: ["QtQuick.Particles/Emitter 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Lifetime"
values: {
@@ -781,13 +798,15 @@ Module {
Component {
name: "QQuickParticleExtruder"
prototype: "QObject"
- exports: ["ParticleExtruder 2.0"]
+ exports: ["QtQuick.Particles/ParticleExtruder 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickParticleGroup"
defaultProperty: "particleChildren"
prototype: "QQuickStochasticState"
- exports: ["ParticleGroup 2.0"]
+ exports: ["QtQuick.Particles/ParticleGroup 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
Property { name: "particleChildren"; type: "QObject"; isList: true; isReadonly: true }
Signal {
@@ -815,7 +834,8 @@ Module {
name: "QQuickParticlePainter"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["ParticlePainter 2.0"]
+ exports: ["QtQuick.Particles/ParticlePainter 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
Property { name: "groups"; type: "QStringList" }
Signal { name: "countChanged" }
@@ -845,7 +865,8 @@ Module {
name: "QQuickParticleSystem"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["ParticleSystem 2.0"]
+ exports: ["QtQuick.Particles/ParticleSystem 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "running"; type: "bool" }
Property { name: "paused"; type: "bool" }
Property { name: "empty"; type: "bool"; isReadonly: true }
@@ -881,7 +902,8 @@ Module {
Component {
name: "QQuickPointDirection"
prototype: "QQuickDirection"
- exports: ["PointDirection 2.0"]
+ exports: ["QtQuick.Particles/PointDirection 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "x"; type: "double" }
Property { name: "y"; type: "double" }
Property { name: "xVariation"; type: "double" }
@@ -922,7 +944,8 @@ Module {
Component {
name: "QQuickRectangleExtruder"
prototype: "QQuickParticleExtruder"
- exports: ["RectangleShape 2.0"]
+ exports: ["QtQuick.Particles/RectangleShape 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "fill"; type: "bool" }
Signal {
name: "fillChanged"
@@ -937,7 +960,8 @@ Module {
name: "QQuickSpriteGoalAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["SpriteGoal 2.0"]
+ exports: ["QtQuick.Particles/SpriteGoal 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "goalState"; type: "string" }
Property { name: "jump"; type: "bool" }
Property { name: "systemStates"; type: "bool" }
@@ -969,7 +993,8 @@ Module {
Component {
name: "QQuickTargetDirection"
prototype: "QQuickDirection"
- exports: ["TargetDirection 2.0"]
+ exports: ["QtQuick.Particles/TargetDirection 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "targetX"; type: "double" }
Property { name: "targetY"; type: "double" }
Property { name: "targetItem"; type: "QQuickItem"; isPointer: true }
@@ -1038,7 +1063,8 @@ Module {
name: "QQuickTrailEmitter"
defaultProperty: "data"
prototype: "QQuickParticleEmitter"
- exports: ["TrailEmitter 2.0"]
+ exports: ["QtQuick.Particles/TrailEmitter 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "EmitSize"
values: {
@@ -1100,7 +1126,8 @@ Module {
name: "QQuickTurbulenceAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Turbulence 2.0"]
+ exports: ["QtQuick.Particles/Turbulence 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "strength"; type: "double" }
Property { name: "noiseSource"; type: "QUrl" }
Signal {
@@ -1124,7 +1151,8 @@ Module {
name: "QQuickWanderAffector"
defaultProperty: "data"
prototype: "QQuickParticleAffector"
- exports: ["Wander 2.0"]
+ exports: ["QtQuick.Particles/Wander 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "AffectableParameters"
values: {
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index aa24e39f85..02c7d61536 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -3,12 +3,20 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump -builtins'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable -builtins'.
Module {
Component {
name: "QAbstractItemModel"
prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
Signal {
name: "dataChanged"
Parameter { name: "topLeft"; type: "QModelIndex" }
@@ -167,6 +175,7 @@ Module {
name: "QInputMethod"
prototype: "QObject"
exports: ["QtQuick/InputMethod 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Action"
values: {
@@ -215,6 +224,7 @@ Module {
Component {
name: "QObject"
exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "objectName"; type: "string" }
Signal {
name: "objectNameChanged"
@@ -228,9 +238,26 @@ Module {
}
}
Component {
+ name: "QQmlApplication"
+ prototype: "QObject"
+ Property { name: "arguments"; type: "QStringList"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "version"; type: "string" }
+ Signal { name: "aboutToQuit" }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setVersion"
+ Parameter { name: "arg"; type: "string" }
+ }
+ }
+ Component {
name: "QQmlBind"
prototype: "QObject"
exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "target"; type: "QObject"; isPointer: true }
Property { name: "property"; type: "string" }
Property { name: "value"; type: "QVariant" }
@@ -244,6 +271,7 @@ Module {
"QtQml/Component 2.0",
"QtQuick/Component 2.0"
]
+ exportMetaObjectRevisions: [0, 0, 0]
attachedType: "QQmlComponentAttached"
Enum {
name: "CompilationMode"
@@ -298,13 +326,105 @@ Module {
name: "QQmlConnections"
prototype: "QObject"
exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "target"; type: "QObject"; isPointer: true }
Property { name: "ignoreUnknownSignals"; type: "bool" }
}
Component {
+ name: "QQmlDelegateModel"
+ defaultProperty: "delegate"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualDataModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlDelegateModelAttached"
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "filterOnGroup"; type: "string" }
+ Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
+ Property {
+ name: "persistedItems"
+ type: "QQmlDelegateModelGroup"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
+ Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "rootIndex"; type: "QVariant" }
+ Signal { name: "filterGroupChanged" }
+ Signal { name: "defaultGroupsChanged" }
+ Method {
+ name: "modelIndex"
+ type: "QVariant"
+ Parameter { name: "idx"; type: "int" }
+ }
+ Method { name: "parentModelIndex"; type: "QVariant" }
+ }
+ Component {
+ name: "QQmlDelegateModelAttached"
+ prototype: "QObject"
+ Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
+ Property { name: "groups"; type: "QStringList" }
+ Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
+ Signal { name: "unresolvedChanged" }
+ }
+ Component {
+ name: "QQmlDelegateModelGroup"
+ prototype: "QObject"
+ exports: ["QtQuick/VisualDataGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "includeByDefault"; type: "bool" }
+ Signal { name: "defaultIncludeChanged" }
+ Signal {
+ name: "changed"
+ Parameter { name: "removed"; type: "QQmlV8Handle" }
+ Parameter { name: "inserted"; type: "QQmlV8Handle" }
+ }
+ Method {
+ name: "insert"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "create"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "resolve"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "remove"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "addGroups"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "removeGroups"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "setGroups"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "move"
+ Parameter { type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV8Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
+ Component {
name: "QQmlEasingValueType"
prototype: "QQmlValueType"
exports: ["QtQuick/Easing 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Type"
values: {
@@ -363,8 +483,111 @@ Module {
Property { name: "bezierCurve"; type: "QVariantList" }
}
Component {
+ name: "QQmlInstanceModel"
+ prototype: "QObject"
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "modelUpdated"
+ Parameter { name: "changeSet"; type: "QQmlChangeSet" }
+ Parameter { name: "reset"; type: "bool" }
+ }
+ Signal {
+ name: "createdItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "initItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "destroyingItem"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQmlInstantiator"
+ defaultProperty: "delegate"
+ prototype: "QObject"
+ exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "active"; type: "bool" }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "objectAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "objectRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "objectAt"
+ type: "QObject*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlListElement"
+ prototype: "QObject"
+ exports: ["QtQuick/ListElement 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQmlListModel"
+ prototype: "QAbstractListModel"
+ exports: ["QtQuick/ListModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "dynamicRoles"; type: "bool" }
+ Method { name: "clear" }
+ Method {
+ name: "remove"
+ Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV8Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "set"
+ Parameter { name: "index"; type: "int" }
+ Parameter { type: "QQmlV8Handle" }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "property"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "move"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method { name: "sync" }
+ }
+ Component {
name: "QQmlLocale"
exports: ["QtQuick/Locale 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "MeasurementSystem"
values: {
@@ -404,9 +627,24 @@ Module {
}
}
Component {
+ name: "QQmlObjectModel"
+ defaultProperty: "children"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualItemModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlObjectModelAttached"
+ Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQmlObjectModelAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ }
+ Component {
name: "QQmlTimer"
prototype: "QObject"
exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "interval"; type: "int" }
Property { name: "running"; type: "bool" }
Property { name: "repeat"; type: "bool" }
@@ -422,6 +660,7 @@ Module {
name: "QQuickAbstractAnimation"
prototype: "QObject"
exports: ["QtQuick/Animation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Loops"
values: {
@@ -461,14 +700,18 @@ Module {
name: "QQuickAccessibleAttached"
prototype: "QObject"
exports: ["QtQuick/Accessible 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "role"; type: "QAccessible::Role" }
Property { name: "name"; type: "string" }
Property { name: "description"; type: "string" }
+ Method { name: "valueChanged" }
+ Method { name: "cursorPositionChanged" }
}
Component {
name: "QQuickAnchorAnimation"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/AnchorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true }
Property { name: "duration"; type: "int" }
Property { name: "easing"; type: "QEasingCurve" }
@@ -485,6 +728,7 @@ Module {
name: "QQuickAnchorChanges"
prototype: "QQuickStateOperation"
exports: ["QtQuick/AnchorChanges 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "target"; type: "QQuickItem"; isPointer: true }
Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true }
}
@@ -527,6 +771,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImage"
exports: ["QtQuick/AnimatedImage 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "playing"; type: "bool" }
Property { name: "paused"; type: "bool" }
Property { name: "currentFrame"; type: "int" }
@@ -539,6 +784,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/AnimatedSprite 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "LoopParameters"
values: {
@@ -698,6 +944,7 @@ Module {
defaultProperty: "animation"
prototype: "QObject"
exports: ["QtQuick/AnimationController 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "progress"; type: "double" }
Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
Method { name: "reload" }
@@ -712,8 +959,9 @@ Module {
}
Component {
name: "QQuickApplication"
- prototype: "QObject"
+ prototype: "QQmlApplication"
exports: ["QtQuick/Application 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "active"; type: "bool"; isReadonly: true }
Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true }
@@ -723,6 +971,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
exports: ["QtQuick/Positioner 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickPositionerAttached"
Property { name: "spacing"; type: "double" }
Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
@@ -734,6 +983,7 @@ Module {
defaultProperty: "animation"
prototype: "QObject"
exports: ["QtQuick/Behavior 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
Property { name: "enabled"; type: "bool" }
}
@@ -742,6 +992,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImageBase"
exports: ["QtQuick/BorderImage 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "TileMode"
values: {
@@ -760,6 +1011,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/Canvas 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "RenderTarget"
values: {
@@ -846,6 +1098,7 @@ Module {
name: "QQuickColorAnimation"
prototype: "QQuickPropertyAnimation"
exports: ["QtQuick/ColorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "from"; type: "QColor" }
Property { name: "to"; type: "QColor" }
}
@@ -854,6 +1107,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickBasePositioner"
exports: ["QtQuick/Column 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickCurve"
@@ -867,6 +1121,7 @@ Module {
name: "QQuickDoubleValidator"
prototype: "QDoubleValidator"
exports: ["QtQuick/DoubleValidator 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "locale"; type: "string" }
Signal { name: "localeNameChanged" }
}
@@ -874,13 +1129,15 @@ Module {
name: "QQuickDrag"
prototype: "QObject"
exports: ["QtQuick/Drag 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickDragAttached"
Enum {
name: "Axis"
values: {
"XAxis": 1,
"YAxis": 2,
- "XAndYAxis": 3
+ "XAndYAxis": 3,
+ "XandYAxis": 3
}
}
Property { name: "target"; type: "QQuickItem"; isPointer: true }
@@ -914,6 +1171,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/DropArea 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "containsDrag"; type: "bool"; isReadonly: true }
Property { name: "keys"; type: "QStringList" }
Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true }
@@ -945,6 +1203,7 @@ Module {
defaultProperty: "flickableData"
prototype: "QQuickItem"
exports: ["QtQuick/Flickable 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "BoundsBehavior"
values: {
@@ -1054,6 +1313,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/Flipable 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Side"
values: {
@@ -1070,6 +1330,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickBasePositioner"
exports: ["QtQuick/Flow 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Flow"
values: {
@@ -1086,11 +1347,13 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/FocusScope 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickFontLoader"
prototype: "QObject"
exports: ["QtQuick/FontLoader 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Status"
values: {
@@ -1108,6 +1371,7 @@ Module {
name: "QQuickFontValueType"
prototype: "QQmlValueType"
exports: ["QtQuick/Font 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "FontWeight"
values: {
@@ -1146,6 +1410,7 @@ Module {
defaultProperty: "stops"
prototype: "QObject"
exports: ["QtQuick/Gradient 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true }
Signal { name: "updated" }
}
@@ -1153,6 +1418,7 @@ Module {
name: "QQuickGradientStop"
prototype: "QObject"
exports: ["QtQuick/GradientStop 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "position"; type: "double" }
Property { name: "color"; type: "QColor" }
}
@@ -1160,7 +1426,8 @@ Module {
name: "QQuickGrid"
defaultProperty: "data"
prototype: "QQuickBasePositioner"
- exports: ["QtQuick/Grid 2.0"]
+ exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "Flow"
values: {
@@ -1168,6 +1435,22 @@ Module {
"TopToBottom": 1
}
}
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
Property { name: "rows"; type: "int" }
Property { name: "columns"; type: "int" }
Property { name: "rowSpacing"; type: "double" }
@@ -1175,18 +1458,43 @@ Module {
Property { name: "flow"; type: "Flow" }
Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" }
+ Property {
+ name: "effectiveHorizontalItemAlignment"
+ revision: 1
+ type: "HAlignment"
+ isReadonly: true
+ }
+ Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "effectiveHorizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
}
Component {
name: "QQuickGridMesh"
prototype: "QQuickShaderEffectMesh"
exports: ["QtQuick/GridMesh 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "resolution"; type: "QSize" }
}
Component {
name: "QQuickGridView"
defaultProperty: "data"
prototype: "QQuickItemView"
- exports: ["QtQuick/GridView 2.0"]
+ exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickGridViewAttached"
Enum {
name: "Flow"
@@ -1223,6 +1531,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImageBase"
exports: ["QtQuick/Image 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "HAlignment"
values: {
@@ -1305,11 +1614,14 @@ Module {
prototype: "QQuickItem"
Property { name: "implicitWidth"; type: "double"; isReadonly: true }
Property { name: "implicitHeight"; type: "double"; isReadonly: true }
+ Signal { name: "implicitWidthChanged2"; revision: 1 }
+ Signal { name: "implicitHeightChanged2"; revision: 1 }
}
Component {
name: "QQuickIntValidator"
prototype: "QIntValidator"
exports: ["QtQuick/IntValidator 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "locale"; type: "string" }
Signal { name: "localeNameChanged" }
}
@@ -1317,7 +1629,8 @@ Module {
name: "QQuickItem"
defaultProperty: "data"
prototype: "QObject"
- exports: ["QtQuick/Item 2.0"]
+ exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "TransformOrigin"
values: {
@@ -1361,6 +1674,7 @@ Module {
Property { name: "clip"; type: "bool" }
Property { name: "focus"; type: "bool" }
Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
Property { name: "rotation"; type: "double" }
Property { name: "scale"; type: "double" }
Property { name: "transformOrigin"; type: "TransformOrigin" }
@@ -1392,6 +1706,11 @@ Module {
Parameter { type: "bool" }
}
Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
name: "parentChanged"
Parameter { type: "QQuickItem"; isPointer: true }
}
@@ -1411,6 +1730,11 @@ Module {
name: "clipChanged"
Parameter { type: "bool" }
}
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
Method { name: "update" }
Method {
name: "contains"
@@ -1427,6 +1751,16 @@ Module {
}
Method { name: "forceActiveFocus" }
Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; type: "QQuickItem*" }
+ Method {
name: "childAt"
type: "QQuickItem*"
Parameter { name: "x"; type: "double" }
@@ -1486,6 +1820,8 @@ Module {
name: "QQuickItemView"
defaultProperty: "flickableData"
prototype: "QQuickFlickable"
+ exports: ["QtQuick/ItemView 2.1"]
+ exportMetaObjectRevisions: [1]
Enum {
name: "LayoutDirection"
values: {
@@ -1577,6 +1913,7 @@ Module {
}
Method { name: "positionViewAtBeginning" }
Method { name: "positionViewAtEnd" }
+ Method { name: "forceLayout"; revision: 1 }
}
Component {
name: "QQuickItemViewAttached"
@@ -1595,6 +1932,7 @@ Module {
name: "QQuickKeyNavigationAttached"
prototype: "QObject"
exports: ["QtQuick/KeyNavigation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Priority"
values: {
@@ -1614,6 +1952,7 @@ Module {
name: "QQuickKeysAttached"
prototype: "QObject"
exports: ["QtQuick/Keys 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Priority"
values: {
@@ -1789,62 +2128,16 @@ Module {
name: "QQuickLayoutMirroringAttached"
prototype: "QObject"
exports: ["QtQuick/LayoutMirroring 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "enabled"; type: "bool" }
Property { name: "childrenInherit"; type: "bool" }
}
Component {
- name: "QQuickListElement"
- prototype: "QObject"
- exports: ["QtQuick/ListElement 2.0"]
- }
- Component {
- name: "QQuickListModel"
- prototype: "QAbstractListModel"
- exports: ["QtQuick/ListModel 2.0"]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "dynamicRoles"; type: "bool" }
- Method { name: "clear" }
- Method {
- name: "remove"
- Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "append"
- Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "insert"
- Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QQmlV4Handle"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "int" }
- Parameter { type: "QQmlV4Handle" }
- }
- Method {
- name: "setProperty"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "property"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "move"
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method { name: "sync" }
- }
- Component {
name: "QQuickListView"
defaultProperty: "data"
prototype: "QQuickItemView"
- exports: ["QtQuick/ListView 2.0"]
+ exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickListViewAttached"
Enum {
name: "Orientation"
@@ -1882,6 +2175,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
exports: ["QtQuick/Loader 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Status"
values: {
@@ -1909,6 +2203,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/MouseArea 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "mouseX"; type: "double"; isReadonly: true }
Property { name: "mouseY"; type: "double"; isReadonly: true }
Property { name: "containsMouse"; type: "bool"; isReadonly: true }
@@ -1979,6 +2274,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/MultiPointTouchArea 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true }
Property { name: "minimumTouchPoints"; type: "int" }
Property { name: "maximumTouchPoints"; type: "int" }
@@ -2011,6 +2307,7 @@ Module {
name: "QQuickNumberAnimation"
prototype: "QQuickPropertyAnimation"
exports: ["QtQuick/NumberAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "from"; type: "double" }
Property { name: "to"; type: "double" }
}
@@ -2019,6 +2316,7 @@ Module {
defaultProperty: "data"
prototype: "QObject"
exports: ["QtQuick/Package 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickPackageAttached"
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
}
@@ -2032,6 +2330,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/PaintedItem 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "RenderTarget"
values: {
@@ -2050,12 +2349,14 @@ Module {
defaultProperty: "animations"
prototype: "QQuickAnimationGroup"
exports: ["QtQuick/ParallelAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickParentAnimation"
defaultProperty: "animations"
prototype: "QQuickAnimationGroup"
exports: ["QtQuick/ParentAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "target"; type: "QQuickItem"; isPointer: true }
Property { name: "newParent"; type: "QQuickItem"; isPointer: true }
Property { name: "via"; type: "QQuickItem"; isPointer: true }
@@ -2064,6 +2365,7 @@ Module {
name: "QQuickParentChange"
prototype: "QQuickStateOperation"
exports: ["QtQuick/ParentChange 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "target"; type: "QQuickItem"; isPointer: true }
Property { name: "parent"; type: "QQuickItem"; isPointer: true }
Property { name: "x"; type: "QQmlScriptString" }
@@ -2078,6 +2380,7 @@ Module {
defaultProperty: "pathElements"
prototype: "QObject"
exports: ["QtQuick/Path 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true }
Property { name: "startX"; type: "double" }
Property { name: "startY"; type: "double" }
@@ -2088,6 +2391,7 @@ Module {
name: "QQuickPathAnimation"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/PathAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Orientation"
values: {
@@ -2140,6 +2444,7 @@ Module {
name: "QQuickPathArc"
prototype: "QQuickCurve"
exports: ["QtQuick/PathArc 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "ArcDirection"
values: {
@@ -2156,6 +2461,7 @@ Module {
name: "QQuickPathAttribute"
prototype: "QQuickPathElement"
exports: ["QtQuick/PathAttribute 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "name"; type: "string" }
Property { name: "value"; type: "double" }
}
@@ -2163,11 +2469,13 @@ Module {
name: "QQuickPathCatmullRomCurve"
prototype: "QQuickCurve"
exports: ["QtQuick/PathCurve 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickPathCubic"
prototype: "QQuickCurve"
exports: ["QtQuick/PathCubic 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "control1X"; type: "double" }
Property { name: "control1Y"; type: "double" }
Property { name: "control2X"; type: "double" }
@@ -2186,6 +2494,7 @@ Module {
name: "QQuickPathInterpolator"
prototype: "QObject"
exports: ["QtQuick/PathInterpolator 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "path"; type: "QQuickPath"; isPointer: true }
Property { name: "progress"; type: "double" }
Property { name: "x"; type: "double"; isReadonly: true }
@@ -2196,17 +2505,20 @@ Module {
name: "QQuickPathLine"
prototype: "QQuickCurve"
exports: ["QtQuick/PathLine 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickPathPercent"
prototype: "QQuickPathElement"
exports: ["QtQuick/PathPercent 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "value"; type: "double" }
}
Component {
name: "QQuickPathQuad"
prototype: "QQuickCurve"
exports: ["QtQuick/PathQuad 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "controlX"; type: "double" }
Property { name: "controlY"; type: "double" }
Property { name: "relativeControlX"; type: "double" }
@@ -2216,6 +2528,7 @@ Module {
name: "QQuickPathSvg"
prototype: "QQuickCurve"
exports: ["QtQuick/PathSvg 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "path"; type: "string" }
}
Component {
@@ -2223,6 +2536,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/PathView 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickPathViewAttached"
Enum {
name: "HighlightRangeMode"
@@ -2313,6 +2627,7 @@ Module {
name: "QQuickPauseAnimation"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/PauseAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "duration"; type: "int" }
Signal {
name: "durationChanged"
@@ -2331,13 +2646,15 @@ Module {
name: "QQuickPinch"
prototype: "QObject"
exports: ["QtQuick/Pinch 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Axis"
values: {
"NoDrag": 0,
"XAxis": 1,
"YAxis": 2,
- "XAndYAxis": 3
+ "XAndYAxis": 3,
+ "XandYAxis": 3
}
}
Property { name: "target"; type: "QQuickItem"; isPointer: true }
@@ -2357,6 +2674,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/PinchArea 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "enabled"; type: "bool" }
Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true }
Signal {
@@ -2383,6 +2701,7 @@ Module {
name: "QQuickPropertyAction"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/PropertyAction 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "target"; type: "QObject"; isPointer: true }
Property { name: "property"; type: "string" }
Property { name: "properties"; type: "string" }
@@ -2402,6 +2721,7 @@ Module {
name: "QQuickPropertyAnimation"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/PropertyAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "duration"; type: "int" }
Property { name: "from"; type: "QVariant" }
Property { name: "to"; type: "QVariant" }
@@ -2436,6 +2756,7 @@ Module {
name: "QQuickPropertyChanges"
prototype: "QQuickStateOperation"
exports: ["QtQuick/PropertyChanges 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "target"; type: "QObject"; isPointer: true }
Property { name: "restoreEntryValues"; type: "bool" }
Property { name: "explicit"; type: "bool" }
@@ -2445,6 +2766,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/Rectangle 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "color"; type: "QColor" }
Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
@@ -2455,6 +2777,7 @@ Module {
defaultProperty: "delegate"
prototype: "QQuickItem"
exports: ["QtQuick/Repeater 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "model"; type: "QVariant" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "count"; type: "int"; isReadonly: true }
@@ -2478,6 +2801,7 @@ Module {
name: "QQuickRotation"
prototype: "QQuickTransform"
exports: ["QtQuick/Rotation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "origin"; type: "QVector3D" }
Property { name: "angle"; type: "double" }
Property { name: "axis"; type: "QVector3D" }
@@ -2486,6 +2810,7 @@ Module {
name: "QQuickRotationAnimation"
prototype: "QQuickPropertyAnimation"
exports: ["QtQuick/RotationAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "RotationDirection"
values: {
@@ -2504,6 +2829,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickBasePositioner"
exports: ["QtQuick/Row 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
}
@@ -2511,6 +2837,7 @@ Module {
name: "QQuickScale"
prototype: "QQuickTransform"
exports: ["QtQuick/Scale 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "origin"; type: "QVector3D" }
Property { name: "xScale"; type: "double" }
Property { name: "yScale"; type: "double" }
@@ -2530,6 +2857,7 @@ Module {
name: "QQuickScriptAction"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/ScriptAction 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "script"; type: "QQmlScriptString" }
Property { name: "scriptName"; type: "string" }
}
@@ -2538,12 +2866,14 @@ Module {
defaultProperty: "animations"
prototype: "QQuickAnimationGroup"
exports: ["QtQuick/SequentialAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickShaderEffect"
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/ShaderEffect 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "CullMode"
values: {
@@ -2572,6 +2902,7 @@ Module {
name: "QQuickShaderEffectMesh"
prototype: "QObject"
exports: ["QtQuick/ShaderEffectMesh 2.0"]
+ exportMetaObjectRevisions: [0]
Signal { name: "geometryChanged" }
}
Component {
@@ -2579,6 +2910,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickItem"
exports: ["QtQuick/ShaderEffectSource 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "WrapMode"
values: {
@@ -2612,6 +2944,7 @@ Module {
name: "QQuickSmoothedAnimation"
prototype: "QQuickNumberAnimation"
exports: ["QtQuick/SmoothedAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "ReversingMode"
values: {
@@ -2628,6 +2961,7 @@ Module {
name: "QQuickSpringAnimation"
prototype: "QQuickNumberAnimation"
exports: ["QtQuick/SpringAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "velocity"; type: "double" }
Property { name: "spring"; type: "double" }
Property { name: "damping"; type: "double" }
@@ -2640,6 +2974,7 @@ Module {
name: "QQuickSprite"
prototype: "QQuickStochasticState"
exports: ["QtQuick/Sprite 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "source"; type: "QUrl" }
Property { name: "reverse"; type: "bool" }
Property { name: "frameSync"; type: "bool" }
@@ -2759,6 +3094,7 @@ Module {
defaultProperty: "sprites"
prototype: "QQuickItem"
exports: ["QtQuick/SpriteSequence 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "running"; type: "bool" }
Property { name: "interpolate"; type: "bool" }
Property { name: "goalSprite"; type: "string" }
@@ -2802,6 +3138,7 @@ Module {
defaultProperty: "changes"
prototype: "QObject"
exports: ["QtQuick/State 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "name"; type: "string" }
Property { name: "when"; type: "QQmlBinding"; isPointer: true }
Property { name: "extend"; type: "string" }
@@ -2812,6 +3149,7 @@ Module {
name: "QQuickStateChangeScript"
prototype: "QQuickStateOperation"
exports: ["QtQuick/StateChangeScript 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "script"; type: "QQmlScriptString" }
Property { name: "name"; type: "string" }
}
@@ -2819,6 +3157,7 @@ Module {
name: "QQuickStateGroup"
prototype: "QObject"
exports: ["QtQuick/StateGroup 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "state"; type: "string" }
Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
@@ -2882,6 +3221,7 @@ Module {
name: "QQuickSystemPalette"
prototype: "QObject"
exports: ["QtQuick/SystemPalette 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "ColorGroup"
values: {
@@ -2912,6 +3252,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
exports: ["QtQuick/Text 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "HAlignment"
values: {
@@ -3062,11 +3403,13 @@ Module {
}
Method { name: "doLayout" }
}
+ Component { name: "QQuickTextDocument"; prototype: "QObject" }
Component {
name: "QQuickTextEdit"
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
- exports: ["QtQuick/TextEdit 2.0"]
+ exports: ["QtQuick/TextEdit 2.0", "QtQuick/TextEdit 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "HAlignment"
values: {
@@ -3144,6 +3487,7 @@ Module {
Property { name: "persistentSelection"; type: "bool" }
Property { name: "textMargin"; type: "double" }
Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
Property { name: "selectByMouse"; type: "bool" }
Property { name: "mouseSelectionMode"; type: "SelectionMode" }
Property { name: "canPaste"; type: "bool"; isReadonly: true }
@@ -3152,6 +3496,13 @@ Module {
Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
Property { name: "baseUrl"; type: "QUrl" }
Property { name: "renderType"; type: "RenderType" }
+ Property {
+ name: "textDocument"
+ revision: 1
+ type: "QQuickTextDocument"
+ isReadonly: true
+ isPointer: true
+ }
Signal { name: "contentSizeChanged" }
Signal {
name: "colorChanged"
@@ -3202,6 +3553,11 @@ Module {
Parameter { name: "textMargin"; type: "double" }
}
Signal {
+ name: "selectByKeyboardChanged"
+ revision: 1
+ Parameter { name: "selectByKeyboard"; type: "bool" }
+ }
+ Signal {
name: "selectByMouseChanged"
Parameter { name: "selectByMouse"; type: "bool" }
}
@@ -3280,6 +3636,7 @@ Module {
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
exports: ["QtQuick/TextInput 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "EchoMode"
values: {
@@ -3482,6 +3839,7 @@ Module {
name: "QQuickTouchPoint"
prototype: "QObject"
exports: ["QtQuick/TouchPoint 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "pointId"; type: "int"; isReadonly: true }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "x"; type: "double"; isReadonly: true }
@@ -3502,6 +3860,7 @@ Module {
defaultProperty: "animations"
prototype: "QObject"
exports: ["QtQuick/Transition 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "from"; type: "string" }
Property { name: "to"; type: "string" }
Property { name: "reversible"; type: "bool" }
@@ -3513,6 +3872,7 @@ Module {
name: "QQuickTranslate"
prototype: "QQuickTransform"
exports: ["QtQuick/Translate 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "x"; type: "double" }
Property { name: "y"; type: "double" }
}
@@ -3520,6 +3880,7 @@ Module {
name: "QQuickVector3dAnimation"
prototype: "QQuickPropertyAnimation"
exports: ["QtQuick/Vector3dAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "from"; type: "QVector3D" }
Property { name: "to"; type: "QVector3D" }
}
@@ -3527,6 +3888,7 @@ Module {
name: "QQuickViewSection"
prototype: "QObject"
exports: ["QtQuick/ViewSection 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "SectionCriteria"
values: {
@@ -3552,6 +3914,7 @@ Module {
name: "QQuickViewTransitionAttached"
prototype: "QObject"
exports: ["QtQuick/ViewTransition 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "index"; type: "int"; isReadonly: true }
Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "destination"; type: "QPointF"; isReadonly: true }
@@ -3559,134 +3922,10 @@ Module {
Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true }
}
Component {
- name: "QQuickVisualDataGroup"
- prototype: "QObject"
- exports: ["QtQuick/VisualDataGroup 2.0"]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "name"; type: "string" }
- Property { name: "includeByDefault"; type: "bool" }
- Signal { name: "defaultIncludeChanged" }
- Signal {
- name: "changed"
- Parameter { name: "removed"; type: "QQmlV4Handle" }
- Parameter { name: "inserted"; type: "QQmlV4Handle" }
- }
- Method {
- name: "insert"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "create"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "resolve"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "remove"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "addGroups"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "removeGroups"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "setGroups"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "move"
- Parameter { type: "QQmlV8Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QQmlV4Handle"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QQuickVisualDataModel"
- defaultProperty: "delegate"
- prototype: "QQuickVisualModel"
- exports: ["QtQuick/VisualDataModel 2.0"]
- attachedType: "QQuickVisualDataModelAttached"
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "filterOnGroup"; type: "string" }
- Property { name: "items"; type: "QQuickVisualDataGroup"; isReadonly: true; isPointer: true }
- Property {
- name: "persistedItems"
- type: "QQuickVisualDataGroup"
- isReadonly: true
- isPointer: true
- }
- Property { name: "groups"; type: "QQuickVisualDataGroup"; isList: true; isReadonly: true }
- Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "rootIndex"; type: "QVariant" }
- Signal { name: "filterGroupChanged" }
- Signal { name: "defaultGroupsChanged" }
- Method {
- name: "modelIndex"
- type: "QVariant"
- Parameter { name: "idx"; type: "int" }
- }
- Method { name: "parentModelIndex"; type: "QVariant" }
- }
- Component {
- name: "QQuickVisualDataModelAttached"
- prototype: "QObject"
- Property { name: "model"; type: "QQuickVisualDataModel"; isReadonly: true; isPointer: true }
- Property { name: "groups"; type: "QStringList" }
- Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
- Signal { name: "unresolvedChanged" }
- }
- Component { name: "QQuickVisualDataModelParts"; prototype: "QObject" }
- Component {
- name: "QQuickVisualItemModel"
- defaultProperty: "children"
- prototype: "QQuickVisualModel"
- exports: ["QtQuick/VisualItemModel 2.0"]
- attachedType: "QQuickVisualItemModelAttached"
- Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickVisualItemModelAttached"
- prototype: "QObject"
- Property { name: "index"; type: "int"; isReadonly: true }
- }
- Component {
- name: "QQuickVisualModel"
- prototype: "QObject"
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "modelUpdated"
- Parameter { name: "changeSet"; type: "QQuickChangeSet" }
- Parameter { name: "reset"; type: "bool" }
- }
- Signal {
- name: "createdItem"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "initItem"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "destroyingItem"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- }
- Component {
name: "QQuickWorkerScript"
prototype: "QObject"
exports: ["QtQuick/WorkerScript 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "source"; type: "QUrl" }
Signal {
name: "message"
@@ -3701,6 +3940,7 @@ Module {
name: "QRegExpValidator"
prototype: "QValidator"
exports: ["QtQuick/RegExpValidator 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "regExp"; type: "QRegExp" }
Signal {
name: "regExpChanged"
@@ -3866,9 +4106,11 @@ Module {
"SplashScreen": 15,
"Desktop": 17,
"SubWindow": 18,
+ "ForeignWindow": 33,
"WindowType_Mask": 255,
"MSWindowsFixedSizeDialogHint": 256,
"MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
"X11BypassWindowManagerHint": 1024,
"FramelessWindowHint": 2048,
"WindowTitleHint": 4096,
@@ -3907,9 +4149,11 @@ Module {
"SplashScreen": 15,
"Desktop": 17,
"SubWindow": 18,
+ "ForeignWindow": 33,
"WindowType_Mask": 255,
"MSWindowsFixedSizeDialogHint": 256,
"MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
"X11BypassWindowManagerHint": 1024,
"FramelessWindowHint": 2048,
"WindowTitleHint": 4096,
@@ -4105,7 +4349,8 @@ Module {
"AA_X11InitThreads": 10,
"AA_SynthesizeTouchForUnhandledMouseEvents": 11,
"AA_SynthesizeMouseForUnhandledTouchEvents": 12,
- "AA_AttributeCount": 13
+ "AA_UseHighDpiPixmaps": 13,
+ "AA_AttributeCount": 14
}
}
Enum {
@@ -4790,6 +5035,15 @@ Module {
}
}
Enum {
+ name: "Edge"
+ values: {
+ "TopEdge": 1,
+ "LeftEdge": 2,
+ "RightEdge": 4,
+ "BottomEdge": 8
+ }
+ }
+ Enum {
name: "ConnectionType"
values: {
"AutoConnection": 0,
@@ -4916,6 +5170,7 @@ Module {
"ImhDate": 128,
"ImhTime": 256,
"ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
"ImhDigitsOnly": 65536,
"ImhFormattedNumbersOnly": 131072,
"ImhUppercaseOnly": 262144,
@@ -4941,6 +5196,7 @@ Module {
"ImhDate": 128,
"ImhTime": 256,
"ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
"ImhDigitsOnly": 65536,
"ImhFormattedNumbersOnly": 131072,
"ImhUppercaseOnly": 262144,
@@ -5010,7 +5266,8 @@ Module {
"ItemIsDropEnabled": 8,
"ItemIsUserCheckable": 16,
"ItemIsEnabled": 32,
- "ItemIsTristate": 64
+ "ItemIsTristate": 64,
+ "ItemNeverHasChildren": 128
}
}
Enum {
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index fbfad28209..0bec4cddf2 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -143,7 +143,7 @@ Item {
if ("mapFromItem" in o && "mapToItem" in o) {
return "declarativeitem"; // @todo improve detection of declarative items
} else if ("x" in o && "y" in o && "z" in o) {
- return "vector3d"; // Qt3D vector
+ return "vector3d"; // Qt 3D vector
}
return "object";
} else if (o instanceof Function) {
@@ -291,6 +291,11 @@ Item {
}
function tryCompare(obj, prop, value, timeout) {
+ if (arguments.length == 2) {
+ qtest_results.fail("A value is required for tryCompare",
+ util.callerFile(), util.callerLine())
+ throw new Error("QtQuickTest::fail")
+ }
if (!timeout)
timeout = 5000
if (!qtest_compareInternal(obj[prop], value))
@@ -682,6 +687,9 @@ Item {
qtest_runFunction(prop, null, isBenchmark)
}
qtest_results.finishTestFunction()
+ // wait(0) will call processEvents() so objects marked for deletion
+ // in the test function will be deleted.
+ wait(0)
qtest_results.skipped = false
}
diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes
index 5ad3f891f9..2865812eb2 100644
--- a/src/imports/testlib/plugins.qmltypes
+++ b/src/imports/testlib/plugins.qmltypes
@@ -3,13 +3,14 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtTest 1.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtTest 1.0'.
Module {
Component {
name: "QuickTestEvent"
prototype: "QObject"
- exports: ["TestEvent 1.0"]
+ exports: ["QtTest/TestEvent 1.0"]
+ exportMetaObjectRevisions: [0]
Method {
name: "keyPress"
type: "bool"
@@ -32,6 +33,27 @@ Module {
Parameter { name: "delay"; type: "int" }
}
Method {
+ name: "keyPressChar"
+ type: "bool"
+ Parameter { name: "character"; type: "string" }
+ Parameter { name: "modifiers"; type: "int" }
+ Parameter { name: "delay"; type: "int" }
+ }
+ Method {
+ name: "keyReleaseChar"
+ type: "bool"
+ Parameter { name: "character"; type: "string" }
+ Parameter { name: "modifiers"; type: "int" }
+ Parameter { name: "delay"; type: "int" }
+ }
+ Method {
+ name: "keyClickChar"
+ type: "bool"
+ Parameter { name: "character"; type: "string" }
+ Parameter { name: "modifiers"; type: "int" }
+ Parameter { name: "delay"; type: "int" }
+ }
+ Method {
name: "mousePress"
type: "bool"
Parameter { name: "item"; type: "QObject"; isPointer: true }
@@ -96,7 +118,8 @@ Module {
Component {
name: "QuickTestResult"
prototype: "QObject"
- exports: ["TestResult 1.0"]
+ exports: ["QtTest/TestResult 1.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "RunMode"
values: {
@@ -230,7 +253,8 @@ Module {
Component {
name: "QuickTestUtil"
prototype: "QObject"
- exports: ["TestUtil 1.0"]
+ exports: ["QtTest/TestUtil 1.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "printAvailableFunctions"; type: "bool"; isReadonly: true }
Property { name: "dragThreshold"; type: "int"; isReadonly: true }
Method {
diff --git a/src/imports/widgets/plugins.qmltypes b/src/imports/widgets/plugins.qmltypes
index f9fe1f722c..583a36a357 100644
--- a/src/imports/widgets/plugins.qmltypes
+++ b/src/imports/widgets/plugins.qmltypes
@@ -3,39 +3,72 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.PrivateWidgets 1.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.PrivateWidgets 1.0'.
Module {
Component {
- name: "QQuickAbstractFileDialog"
+ name: "QQuickAbstractColorDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "showAlphaChannel"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "arg"; type: "QColor" }
+ }
+ Method {
+ name: "setShowAlphaChannel"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractDialog"
prototype: "QObject"
Property { name: "visible"; type: "bool" }
Property { name: "modality"; type: "Qt::WindowModality" }
Property { name: "title"; type: "string" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickAbstractFileDialog"
+ prototype: "QQuickAbstractDialog"
Property { name: "selectExisting"; type: "bool" }
Property { name: "selectMultiple"; type: "bool" }
Property { name: "selectFolder"; type: "bool" }
Property { name: "folder"; type: "string" }
Property { name: "nameFilters"; type: "QStringList" }
Property { name: "selectedNameFilter"; type: "string" }
- Property { name: "filePath"; type: "string"; isReadonly: true }
- Property { name: "filePaths"; type: "QStringList"; isReadonly: true }
- Signal { name: "visibilityChanged" }
+ Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
+ Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
Signal { name: "filterSelected" }
Signal { name: "fileModeChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
+ Signal { name: "selectionAccepted" }
Method {
name: "setVisible"
Parameter { name: "v"; type: "bool" }
}
Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
name: "setTitle"
Parameter { name: "t"; type: "string" }
}
@@ -65,8 +98,15 @@ Module {
}
}
Component {
+ name: "QQuickQColorDialog"
+ prototype: "QQuickAbstractColorDialog"
+ exports: ["QtQuick.PrivateWidgets/QtColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickQFileDialog"
prototype: "QQuickAbstractFileDialog"
- exports: ["QtFileDialog 1.0"]
+ exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
}
}
diff --git a/src/imports/widgets/widgetsplugin.cpp b/src/imports/widgets/widgetsplugin.cpp
index a29c9b3609..be9d59f346 100644
--- a/src/imports/widgets/widgetsplugin.cpp
+++ b/src/imports/widgets/widgetsplugin.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\brief Provides QML types for certain QWidgets
\internal
- This QML module contains types which should not be depended upon in QtQuick
+ This QML module contains types which should not be depended upon in Qt Quick
applications, but are available if the Widgets module is linked. It is
recommended to load components from this module conditionally, if at all,
and to provide fallback implementations in case they fail to load.
diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes
index ff29466670..59e69114e1 100644
--- a/src/imports/window/plugins.qmltypes
+++ b/src/imports/window/plugins.qmltypes
@@ -3,7 +3,7 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.0'.
+// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.1 -notrelocatable'.
Module {
Component {
@@ -22,16 +22,24 @@ Module {
Component {
name: "QQuickScreen"
prototype: "QObject"
- exports: ["Screen 2.0"]
+ exports: ["QtQuick.Window/Screen 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQuickScreenAttached"
}
Component {
name: "QQuickScreenAttached"
prototype: "QObject"
+ Property { name: "name"; revision: 1; type: "string"; isReadonly: true }
Property { name: "width"; type: "int"; isReadonly: true }
Property { name: "height"; type: "int"; isReadonly: true }
+ Property { name: "desktopAvailableWidth"; revision: 1; type: "int"; isReadonly: true }
+ Property { name: "desktopAvailableHeight"; revision: 1; type: "int"; isReadonly: true }
+ Property { name: "logicalPixelDensity"; revision: 1; type: "double"; isReadonly: true }
Property { name: "primaryOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
+ Signal { name: "nameChanged"; revision: 1 }
+ Signal { name: "desktopGeometryChanged"; revision: 1 }
+ Signal { name: "logicalPixelDensityChanged"; revision: 1 }
Method {
name: "angleBetween"
type: "int"
@@ -43,10 +51,18 @@ Module {
name: "QQuickWindow"
defaultProperty: "data"
prototype: "QWindow"
- exports: ["Window 2.0"]
+ exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "color"; type: "QColor" }
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
Signal { name: "frameSwapped" }
Signal { name: "sceneGraphInitialized" }
Signal { name: "sceneGraphInvalidated" }
@@ -54,15 +70,32 @@ Module {
Signal { name: "beforeRendering" }
Signal { name: "afterRendering" }
Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
name: "colorChanged"
Parameter { type: "QColor" }
}
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
Method { name: "update" }
Method { name: "releaseResources" }
}
Component {
name: "QWindow"
prototype: "QObject"
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
Property { name: "title"; type: "string" }
Property { name: "modality"; type: "Qt::WindowModality" }
Property { name: "flags"; type: "Qt::WindowFlags" }
@@ -70,20 +103,15 @@ Module {
Property { name: "y"; type: "int" }
Property { name: "width"; type: "int" }
Property { name: "height"; type: "int" }
- Property { name: "minimumWidth"; type: "int" }
- Property { name: "minimumHeight"; type: "int" }
- Property { name: "maximumWidth"; type: "int" }
- Property { name: "maximumHeight"; type: "int" }
+ Property { name: "minimumWidth"; revision: 1; type: "int" }
+ Property { name: "minimumHeight"; revision: 1; type: "int" }
+ Property { name: "maximumWidth"; revision: 1; type: "int" }
+ Property { name: "maximumHeight"; revision: 1; type: "int" }
Property { name: "visible"; type: "bool" }
- Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
- Property { name: "windowTitle"; type: "string" }
- Property { name: "windowFilePath"; type: "string" }
- Property { name: "windowIcon"; type: "QIcon" }
- Property { name: "windowModality"; type: "Qt::WindowModality" }
- Signal {
- name: "windowModalityChanged"
- Parameter { name: "windowModality"; type: "Qt::WindowModality" }
- }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
Signal {
name: "screenChanged"
Parameter { name: "screen"; type: "QScreen"; isPointer: true }
@@ -114,18 +142,22 @@ Module {
}
Signal {
name: "minimumWidthChanged"
+ revision: 1
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "minimumHeightChanged"
+ revision: 1
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "maximumWidthChanged"
+ revision: 1
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "maximumHeightChanged"
+ revision: 1
Parameter { name: "arg"; type: "int" }
}
Signal {
@@ -133,13 +165,26 @@ Module {
Parameter { name: "arg"; type: "bool" }
}
Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
name: "contentOrientationChanged"
+ revision: 1
Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
}
Signal {
name: "focusObjectChanged"
Parameter { name: "object"; type: "QObject"; isPointer: true }
}
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
Method {
name: "setVisible"
Parameter { name: "visible"; type: "bool" }
@@ -175,19 +220,27 @@ Module {
}
Method {
name: "setMinimumWidth"
+ revision: 1
Parameter { name: "w"; type: "int" }
}
Method {
name: "setMinimumHeight"
+ revision: 1
Parameter { name: "h"; type: "int" }
}
Method {
name: "setMaximumWidth"
+ revision: 1
Parameter { name: "w"; type: "int" }
}
Method {
name: "setMaximumHeight"
+ revision: 1
Parameter { name: "h"; type: "int" }
}
+ Method {
+ name: "alert"
+ Parameter { name: "msec"; type: "int" }
+ }
}
}
diff --git a/src/imports/xmllistmodel/plugins.qmltypes b/src/imports/xmllistmodel/plugins.qmltypes
index c71899776f..d951d07719 100644
--- a/src/imports/xmllistmodel/plugins.qmltypes
+++ b/src/imports/xmllistmodel/plugins.qmltypes
@@ -3,14 +3,15 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump QtQuick.XmlListModel 2.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.XmlListModel 2.0'.
Module {
Component {
name: "QQuickXmlListModel"
defaultProperty: "roles"
prototype: "QAbstractListModel"
- exports: ["XmlListModel 2.0"]
+ exports: ["QtQuick.XmlListModel/XmlListModel 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Status"
values: {
@@ -47,7 +48,8 @@ Module {
Component {
name: "QQuickXmlListModelRole"
prototype: "QObject"
- exports: ["XmlRole 2.0"]
+ exports: ["QtQuick.XmlListModel/XmlRole 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "name"; type: "string" }
Property { name: "query"; type: "string" }
Property { name: "isKey"; type: "bool" }
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index e814eda04b..f3f78c8eae 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -95,7 +95,7 @@ typedef QPair<int, int> QQuickXmlListRange;
\brief For specifying a role to an XmlListModel
\ingroup qtquick-models
- \sa {QtQml}
+ \sa {Qt QML}
*/
/*!
diff --git a/examples/quick/particles/images/particle4.png b/src/particles/particleresources/fuzzydot.png
index bc95b703c1..bc95b703c1 100644
--- a/examples/quick/particles/images/particle4.png
+++ b/src/particles/particleresources/fuzzydot.png
Binary files differ
diff --git a/examples/quick/particles/images/particle.png b/src/particles/particleresources/glowdot.png
index 5c83896d22..5c83896d22 100644
--- a/examples/quick/particles/images/particle.png
+++ b/src/particles/particleresources/glowdot.png
Binary files differ
diff --git a/examples/quick/particles/images/star.png b/src/particles/particleresources/star.png
index 0d592cfa87..0d592cfa87 100644
--- a/examples/quick/particles/images/star.png
+++ b/src/particles/particleresources/star.png
Binary files differ
diff --git a/src/particles/particles.qrc b/src/particles/particles.qrc
index 344f9489a4..582520405f 100644
--- a/src/particles/particles.qrc
+++ b/src/particles/particles.qrc
@@ -1,5 +1,8 @@
<RCC>
<qresource prefix="/">
<file>particleresources/noise.png</file>
+ <file>particleresources/fuzzydot.png</file>
+ <file>particleresources/glowdot.png</file>
+ <file>particleresources/star.png</file>
</qresource>
</RCC>
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index e0572ef424..0145ce4edb 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -623,6 +623,22 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size)
The source image to be used.
If the image is a sprite animation, use the sprite property instead.
+
+ Since Qt 5.2, some default images are provided as resources to aid prototyping:
+ \table
+ \row
+ \li qrc:///particleresources/star.png
+ \li \inlineimage particles/star.png
+ \row
+ \li qrc:///particleresources/glowdot.png
+ \li \inlineimage particles/glowdot.png
+ \row
+ \li qrc:///particleresources/fuzzydot.png
+ \li \inlineimage particles/fuzzydot.png
+ \endtable
+
+ Note that the images are white and semi-transparent, to allow colorization
+ and alpha levels to have maximum effect.
*/
/*!
\qmlproperty list<Sprite> QtQuick.Particles2::ImageParticle::sprites
@@ -1363,6 +1379,15 @@ void QQuickImageParticle::finishBuildParticleNodes()
perfLevel = Deformable;
#endif
+#ifdef Q_OS_MAC
+ // Mac OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
+ // causing point sprites who read gl_PointCoord in the frag shader to come out as
+ // green-red blobs.
+ if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) {
+ perfLevel = Deformable;
+ }
+#endif
+
if (perfLevel >= Colored && !m_color.isValid())
m_color = QColor(Qt::white);//Hidden default, but different from unset
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 3153e2b7d0..d59902bf3a 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -114,12 +114,18 @@ bool QQuickMaskExtruder::contains(const QRectF &bounds, const QPointF &point)
ensureInitialized(bounds);//###Current usage patterns WILL lead to different bounds/r calls. Separate list?
if (m_img.isNull())
return false;
- QPoint p = point.toPoint() - bounds.topLeft().toPoint();
- return m_img.rect().contains(p) && (bool)m_img.pixelIndex(p);
+
+ QPointF pt = point - bounds.topLeft();
+ QPoint p(pt.x() * m_img.width() / bounds.width(),
+ pt.y() * m_img.height() / bounds.height());
+ return m_img.rect().contains(p) && (m_img.pixel(p) & 0xff000000);
}
-void QQuickMaskExtruder::ensureInitialized(const QRectF &r)
+void QQuickMaskExtruder::ensureInitialized(const QRectF &rf)
{
+ // Convert to integer coords to avoid comparing floats and ints which would
+ // often result in rounding errors.
+ QRect r = rf.toRect();
if (m_lastWidth == r.width() && m_lastHeight == r.height())
return;//Same as before
if (!m_pix.isReady())
@@ -129,13 +135,22 @@ void QQuickMaskExtruder::ensureInitialized(const QRectF &r)
m_mask.clear();
- m_img = m_pix.image().createAlphaMask();
- m_img = m_img.convertToFormat(QImage::Format_Mono);//Else LSB, but I think that's easier
- m_img = m_img.scaled(r.size().toSize());//TODO: Do they need aspect ratio stuff? Or tiling?
- for (int i=0; i<r.width(); i++){
- for (int j=0; j<r.height(); j++){
- if (m_img.pixelIndex(i,j))//Direct bit manipulation is presumably more efficient
- m_mask << QPointF(i,j);
+ m_img = m_pix.image();
+ // Image will in all likelyhood be in this format already, so
+ // no extra memory or conversion takes place
+ if (m_img.format() != QImage::Format_ARGB32 && m_img.format() != QImage::Format_ARGB32_Premultiplied)
+ m_img = m_img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+
+ // resample on the fly using 16-bit
+ int sx = (m_img.width() << 16) / r.width();
+ int sy = (m_img.height() << 16) / r.height();
+ int w = r.width();
+ int h = r.height();
+ for (int y=0; y<h; ++y) {
+ const uint *sl = (const uint *) m_img.constScanLine((y * sy) >> 16);
+ for (int x=0; x<w; ++x) {
+ if (sl[(x * sx) >> 16] & 0xff000000)
+ m_mask << QPointF(x, y);
}
}
}
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index cc410fbfbe..6627291c55 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE
Emits count particles from this emitter immediately.
*/
-/*! \qmlmethod QtQuick.Particles2::Emitter::burst(int x, int y, int count)
+/*! \qmlmethod QtQuick.Particles2::Emitter::burst(int count, int x, int y)
Emits count particles from this emitter immediately. The particles are emitted
as if the Emitter was positioned at x,y but all other properties are the same.
@@ -357,7 +357,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
m_last_timestamp = timeStamp/1000.;
m_last_emission = m_last_timestamp;
m_reset_last = false;
- m_emitCap = particleCount();
+ m_emitCap = -1;
}
if (m_pulseLeft){
@@ -424,6 +424,8 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
if (datum->lifeSpan >= m_system->maxLife){
datum->lifeSpan = m_system->maxLife;
+ if (m_emitCap == -1)
+ m_emitCap = particleCount();
m_emitCap--;//emitCap keeps us from reemitting 'infinite' particles after their life. Unless you reset the emitter.
}
diff --git a/src/particles/qquickparticlepainter.cpp b/src/particles/qquickparticlepainter.cpp
index a84f4a66f4..694391a701 100644
--- a/src/particles/qquickparticlepainter.cpp
+++ b/src/particles/qquickparticlepainter.cpp
@@ -80,8 +80,8 @@ void QQuickParticlePainter::itemChange(ItemChange change, const ItemChangeData &
m_window = data.window;
if (m_window)
connect(m_window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()), Qt::DirectConnection);
-
}
+ QQuickItem::itemChange(change, data);
}
void QQuickParticlePainter::componentComplete()
diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp
index da70fe0424..12884ffa4f 100644
--- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp
+++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp
@@ -40,16 +40,20 @@
****************************************************************************/
#include "qaccessiblequickitem.h"
+
+#include <QtGui/qtextdocument.h>
+
#include "QtQuick/private/qquickitem_p.h"
#include "QtQuick/private/qquicktext_p.h"
#include "QtQuick/private/qquickaccessibleattached_p.h"
+#include "QtQuick/qquicktextdocument.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
- : QQmlAccessible(item)
+ : QQmlAccessible(item), m_doc(textDocument())
{
}
@@ -86,7 +90,6 @@ bool QAccessibleQuickItem::clipsChildren() const
return static_cast<QQuickItem *>(item())->clip();
}
-
QAccessibleInterface *QAccessibleQuickItem::parent() const
{
QQuickItem *parent = item()->parentItem();
@@ -231,10 +234,11 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const
// the following block handles item-specific behavior
if (role() == QAccessible::EditableText) {
if (textType == QAccessible::Value) {
+ if (QTextDocument *doc = textDocument()) {
+ return doc->toPlainText();
+ }
QVariant text = object()->property("text");
return text.toString();
- } else if (textType == QAccessible::Name) {
- return object()->objectName();
}
}
@@ -310,6 +314,143 @@ QRect itemScreenRect(QQuickItem *item)
return QRect(screenPos, itemSize);
}
+QTextDocument *QAccessibleQuickItem::textDocument() const
+{
+ QVariant docVariant = item()->property("textDocument");
+ if (docVariant.canConvert<QQuickTextDocument*>()) {
+ QQuickTextDocument *qqdoc = docVariant.value<QQuickTextDocument*>();
+ return qqdoc->textDocument();
+ }
+ return 0;
+}
+
+int QAccessibleQuickItem::characterCount() const
+{
+ if (m_doc) {
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.movePosition(QTextCursor::End);
+ return cursor.position();
+ }
+ return text(QAccessible::Value).size();
+}
+
+int QAccessibleQuickItem::cursorPosition() const
+{
+ QVariant pos = item()->property("cursorPosition");
+ return pos.toInt();
+}
+
+void QAccessibleQuickItem::setCursorPosition(int position)
+{
+ item()->setProperty("cursorPosition", position);
+}
+
+QString QAccessibleQuickItem::text(int startOffset, int endOffset) const
+{
+ if (m_doc) {
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.setPosition(startOffset);
+ cursor.setPosition(endOffset, QTextCursor::KeepAnchor);
+ return cursor.selectedText();
+ }
+ return text(QAccessible::Value).mid(startOffset, endOffset - startOffset);
+}
+
+QString QAccessibleQuickItem::textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ Q_ASSERT(startOffset);
+ Q_ASSERT(endOffset);
+
+ if (m_doc) {
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.setPosition(offset);
+ QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);
+ cursor.setPosition(boundaries.first - 1);
+ boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);
+
+ *startOffset = boundaries.first;
+ *endOffset = boundaries.second;
+
+ return text(boundaries.first, boundaries.second);
+ } else {
+ return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
+ }
+}
+
+QString QAccessibleQuickItem::textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ Q_ASSERT(startOffset);
+ Q_ASSERT(endOffset);
+
+ if (m_doc) {
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.setPosition(offset);
+ QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);
+ cursor.setPosition(boundaries.second);
+ boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);
+
+ *startOffset = boundaries.first;
+ *endOffset = boundaries.second;
+
+ return text(boundaries.first, boundaries.second);
+ } else {
+ return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
+ }
+}
+
+QString QAccessibleQuickItem::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ Q_ASSERT(startOffset);
+ Q_ASSERT(endOffset);
+
+ if (m_doc) {
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.setPosition(offset);
+ QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);
+
+ *startOffset = boundaries.first;
+ *endOffset = boundaries.second;
+ return text(boundaries.first, boundaries.second);
+ } else {
+ return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
+ }
+}
+
+void QAccessibleQuickItem::selection(int selectionIndex, int *startOffset, int *endOffset) const
+{
+ if (selectionIndex == 0) {
+ *startOffset = item()->property("selectionStart").toInt();
+ *endOffset = item()->property("selectionEnd").toInt();
+ } else {
+ *startOffset = 0;
+ *endOffset = 0;
+ }
+}
+
+int QAccessibleQuickItem::selectionCount() const
+{
+ if (item()->property("selectionStart").toInt() != item()->property("selectionEnd").toInt())
+ return 1;
+ return 0;
+}
+
+void QAccessibleQuickItem::addSelection(int /* startOffset */, int /* endOffset */)
+{
+
+}
+void QAccessibleQuickItem::removeSelection(int /* selectionIndex */)
+{
+
+}
+void QAccessibleQuickItem::setSelection(int /* selectionIndex */, int /* startOffset */, int /* endOffset */)
+{
+
+}
+
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.h b/src/plugins/accessible/quick/qaccessiblequickitem.h
index e82b2f84d2..d9eb652030 100644
--- a/src/plugins/accessible/quick/qaccessiblequickitem.h
+++ b/src/plugins/accessible/quick/qaccessiblequickitem.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
+class QTextDocument;
+
class QAccessibleQuickItem : public QQmlAccessible, public QAccessibleValueInterface, public QAccessibleTextInterface
{
public:
@@ -81,37 +83,41 @@ public:
// Text Interface
- // selection (ignored for now)
- void selection(int /* selectionIndex */, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; }
- int selectionCount() const { return 0; }
- void addSelection(int /* startOffset */, int /* endOffset */) {}
- void removeSelection(int /* selectionIndex */) {}
- void setSelection(int /* selectionIndex */, int /* startOffset */, int /* endOffset */) {}
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const;
+ int selectionCount() const;
+ void addSelection(int startOffset, int endOffset);
+ void removeSelection(int selectionIndex);
+ void setSelection(int selectionIndex, int startOffset, int endOffset);
// cursor
- int cursorPosition() const { return 0; }
- void setCursorPosition(int /* position */) {}
+ int cursorPosition() const;
+ void setCursorPosition(int position);
// text
- QString text(int startOffset, int endOffset) const { return text(QAccessible::Name).mid(startOffset, endOffset - startOffset); }
-// QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType,
-// int *startOffset, int *endOffset) const;
-// QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
-// int *startOffset, int *endOffset) const;
-// QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
-// int *startOffset, int *endOffset) const;
- int characterCount() const { return text(QAccessible::Name).count(); }
+ QString text(int startOffset, int endOffset) const;
+ QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const;
+ QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const;
+ QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int *startOffset, int *endOffset) const;
+ int characterCount() const;
// character <-> geometry
QRect characterRect(int /* offset */) const { return QRect(); }
int offsetAtPoint(const QPoint & /* point */) const { return -1; }
void scrollToSubstring(int /* startIndex */, int /* endIndex */) {}
- QString attributes(int /* offset */, int * /* startOffset */, int * /* endOffset */) const { return QString(); }
+ QString attributes(int /* offset */, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; return QString(); }
+
+ QTextDocument *textDocument() const;
protected:
QQuickItem *item() const { return static_cast<QQuickItem*>(object()); }
void *interface_cast(QAccessible::InterfaceType t);
+
+private:
+ QTextDocument *m_doc;
};
QRect itemScreenRect(QQuickItem *item);
diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp
index 4251a80b33..1240b2ef4c 100644
--- a/src/plugins/accessible/quick/qaccessiblequickview.cpp
+++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp
@@ -60,8 +60,11 @@ QAccessibleQuickWindow::QAccessibleQuickWindow(QQuickWindow *object)
QQuickItem *QAccessibleQuickWindow::rootItem() const
{
- if (window()->contentItem())
- return window()->contentItem()->childItems().first();
+ if (QQuickItem *ci = window()->contentItem()) {
+ const QList<QQuickItem *> &childItems = ci->childItems();
+ if (!childItems.isEmpty())
+ return childItems.first();
+ }
return 0;
}
@@ -78,10 +81,8 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const
QAccessibleInterface *QAccessibleQuickWindow::child(int index) const
{
- if (index == 0) {
- if (QQuickItem *declarativeRoot = rootItem())
- return new QAccessibleQuickItem(declarativeRoot);
- }
+ if (index == 0)
+ return QAccessible::queryAccessibleInterface(rootItem());
return 0;
}
diff --git a/src/plugins/accessible/shared/qqmlaccessible.cpp b/src/plugins/accessible/shared/qqmlaccessible.cpp
index c4daa3e014..d08f9bdb2c 100644
--- a/src/plugins/accessible/shared/qqmlaccessible.cpp
+++ b/src/plugins/accessible/shared/qqmlaccessible.cpp
@@ -129,7 +129,8 @@ QStringList QQmlAccessible::actionNames() const
break;
case QAccessible::RadioButton:
case QAccessible::CheckBox:
- actions << QAccessibleActionInterface::toggleAction();
+ actions << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction();
break;
case QAccessible::Slider:
case QAccessible::SpinBox:
@@ -153,7 +154,7 @@ void QQmlAccessible::doAction(const QString &actionName)
return;
}
- // Role-specific default action handling follows. Items are excepted to provide
+ // Role-specific default action handling follows. Items are expected to provide
// properties according to role conventions. These will then be read and/or updated
// by the accessibility system.
// Checkable roles : checked
@@ -163,7 +164,9 @@ void QQmlAccessible::doAction(const QString &actionName)
case QAccessible::CheckBox: {
QVariant checked = object()->property("checked");
if (checked.isValid()) {
- if (actionName == QAccessibleActionInterface::toggleAction()) {
+ if (actionName == QAccessibleActionInterface::toggleAction() ||
+ actionName == QAccessibleActionInterface::pressAction()) {
+
object()->setProperty("checked", QVariant(!checked.toBool()));
}
}
diff --git a/src/plugins/accessible/shared/qqmlaccessible.h b/src/plugins/accessible/shared/qqmlaccessible.h
index c6ac4e49dd..5280c78485 100644
--- a/src/plugins/accessible/shared/qqmlaccessible.h
+++ b/src/plugins/accessible/shared/qqmlaccessible.h
@@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE
-- Declarative Accessibility Overview. --
* Item interface classes:
- QAccessibleDeclarativeItem for QtQuick1
- QAccessibleQuickItem for for QtQuick2
+ QAccessibleDeclarativeItem for Qt Quick 1
+ QAccessibleQuickItem for for Qt Quick 2
Common base class: QQmlAccessible
* View interface classes.
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index c649370680..b82e1850f7 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime)
if (atEnd()) {
//we make sure that we don't exceed the duration here
m_currentTime += m_currentAnimation->currentTime() - newCurrentTime;
- stop();
+ RETURN_IF_DELETED(stop());
}
} else {
//the only case where currentAnimation could be null
//is when all animations have been removed
Q_ASSERT(!firstChild());
m_currentTime = 0;
- stop();
+ RETURN_IF_DELETED(stop());
}
m_previousLoop = m_currentLoop;
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index 27e3d226cd..53ad15775c 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -102,9 +102,8 @@ public:
bool gotHello;
bool blockingMode;
- QMutex messageArrivedMutex;
- QWaitCondition messageArrivedCondition;
- QStringList waitingForMessageNames;
+ QMutex helloMutex;
+ QWaitCondition helloCondition;
QQmlDebugServerThread *thread;
QPluginLoader loader;
QAtomicInt changeServiceStateCalls;
@@ -298,6 +297,7 @@ QQmlDebugServer *QQmlDebugServer::instance()
for (; argsIt != argsItEnd; ++argsIt) {
const QString strArgument = *argsIt;
if (strArgument.startsWith(QLatin1String("port:"))) {
+ pluginName = QLatin1String("qmldbg_tcp");
portFrom = strArgument.mid(5).toInt(&ok);
portTo = portFrom;
QStringList::const_iterator argsNext = argsIt + 1;
@@ -308,7 +308,6 @@ QQmlDebugServer *QQmlDebugServer::instance()
portTo = nextArgument.toInt(&ok);
++argsIt;
}
- pluginName = QLatin1String("qmldbg_tcp");
} else if (strArgument.startsWith(QLatin1String("host:"))) {
hostAddress = strArgument.mid(5);
} else if (strArgument == QLatin1String("block")) {
@@ -331,11 +330,11 @@ QQmlDebugServer *QQmlDebugServer::instance()
QQmlDebugServerPrivate *d = qQmlDebugServer->d_func();
d->blockingMode = block;
- QMutexLocker locker(&d->messageArrivedMutex);
+ QMutexLocker locker(&d->helloMutex);
thread->start();
if (d->blockingMode)
- d->messageArrivedCondition.wait(&d->messageArrivedMutex);
+ d->helloCondition.wait(&d->helloMutex);
} else {
qWarning() << QString(QLatin1String(
@@ -418,10 +417,13 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
if (s_dataStreamVersion > QDataStream().version())
s_dataStreamVersion = QDataStream().version();
}
+
// Send the hello answer immediately, since it needs to arrive before
// the plugins below start sending messages.
+
QByteArray helloAnswer;
{
+ QReadLocker readPluginsLock(&d->pluginsLock);
QQmlDebugStream out(&helloAnswer, QIODevice::WriteOnly);
QStringList pluginNames;
QList<float> pluginVersions;
@@ -447,7 +449,8 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
d->_q_changeServiceState(iter.value()->name(), newState);
}
- d->messageArrivedCondition.wakeAll();
+ QMutexLocker helloLock(&d->helloMutex);
+ d->helloCondition.wakeAll();
} else if (op == 1) {
@@ -487,9 +490,6 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
qWarning() << "QML Debugger: Message received for missing plugin" << name << '.';
} else {
(*iter)->messageReceived(message);
-
- if (d->waitingForMessageNames.removeOne(name))
- d->messageArrivedCondition.wakeAll();
}
} else {
qWarning("QML Debugger: Invalid hello message.");
diff --git a/src/qml/debugger/qqmldebugserver_p.h b/src/qml/debugger/qqmldebugserver_p.h
index 27d54d6947..e285d7cfe7 100644
--- a/src/qml/debugger/qqmldebugserver_p.h
+++ b/src/qml/debugger/qqmldebugserver_p.h
@@ -71,8 +71,6 @@ public:
static QQmlDebugServer *instance();
- void setConnection(QQmlDebugServerConnection *connection);
-
bool hasDebuggingClient() const;
bool blockingMode() const;
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index cb85fc0e1f..0ba939cdca 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
// instance will be set, unset in constructor. Allows static methods to be inlined.
QQmlProfilerService *QQmlProfilerService::instance = 0;
Q_GLOBAL_STATIC(QQmlProfilerService, profilerInstance)
-
+bool QQmlProfilerService::enabled = false;
// convert to a QByteArray that can be sent to the debug client
// use of QDataStream can skew results
@@ -76,12 +76,46 @@ QByteArray QQmlProfilerData::toByteArray() const
if (messageType == (int)QQmlProfilerService::Event &&
detailType == (int)QQmlProfilerService::AnimationFrame)
ds << framerate << animationcount;
+ if (messageType == (int)QQmlProfilerService::PixmapCacheEvent) {
+ ds << detailData;
+ switch (detailType) {
+ case QQmlProfilerService::PixmapSizeKnown: ds << line << column; break;
+ case QQmlProfilerService::PixmapReferenceCountChanged: ds << animationcount; break;
+ case QQmlProfilerService::PixmapCacheCountChanged: ds << animationcount; break;
+ default: break;
+ }
+ }
+ if (messageType == (int)QQmlProfilerService::SceneGraphFrame) {
+ switch (detailType) {
+ // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
+ case QQmlProfilerService::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime
+ case QQmlProfilerService::SceneGraphAdaptationLayerFrame: ds << (int)subtime_1 << subtime_2 << subtime_3; break;
+ // ContextFrame: compiling material time
+ case QQmlProfilerService::SceneGraphContextFrame: ds << subtime_1; break;
+ // RenderLoop: syncTime, renderTime, swapTime
+ case QQmlProfilerService::SceneGraphRenderLoopFrame: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // TexturePrepare: bind, convert, swizzle, upload, mipmap
+ case QQmlProfilerService::SceneGraphTexturePrepare: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4 << subtime_5; break;
+ // TextureDeletion: deletionTime
+ case QQmlProfilerService::SceneGraphTextureDeletion: ds << subtime_1; break;
+ // PolishAndSync: polishTime, waitTime, syncTime, animationsTime,
+ case QQmlProfilerService::SceneGraphPolishAndSync: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // WindowsRenderLoop: GL time, make current time, SceneGraph time
+ case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // WindowsAnimations: update time
+ case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break;
+ // WindowsRenderWindow: polish time
+ case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break;
+ default:break;
+ }
+ }
+
return data;
}
QQmlProfilerService::QQmlProfilerService()
- : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1),
- m_enabled(false)
+ : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1)
{
m_timer.start();
@@ -131,6 +165,11 @@ void QQmlProfilerService::animationFrame(qint64 delta)
profilerInstance()->animationFrameImpl(delta);
}
+void QQmlProfilerService::sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5)
+{
+ profilerInstance()->sceneGraphFrameImpl(frameType, value1, value2, value3, value4, value5);
+}
+
void QQmlProfilerService::sendProfilingData()
{
profilerInstance()->sendMessages();
@@ -160,88 +199,136 @@ bool QQmlProfilerService::stopProfilingImpl()
void QQmlProfilerService::sendStartedProfilingMessageImpl()
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)StartTrace,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
QQmlDebugService::sendMessage(ed.toByteArray());
}
void QQmlProfilerService::addEventImpl(EventType event)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)event,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(ed);
}
void QQmlProfilerService::startRange(RangeType range, BindingType bindingType)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeStart, (int)range,
- QString(), -1, -1, 0, 0, (int)bindingType};
+ QString(), -1, -1, 0, 0, (int)bindingType,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeData(RangeType range, const QString &rData)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range,
- rData, -1, -1, 0, 0, 0};
+ rData, -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeData(RangeType range, const QUrl &rData)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range,
- rData.toString(), -1, -1, 0, 0, 0};
+ rData.toString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeLocation(RangeType range, const QString &fileName, int line, int column)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range,
- fileName, line, column, 0, 0, 0};
+ fileName, line, column, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range,
- fileName.toString(), line, column, 0, 0, 0};
+ fileName.toString(), line, column, 0, 0, 0,
+ 0, 0, 0, 0, 0};
processMessage(rd);
}
void QQmlProfilerService::endRange(RangeType range)
{
- if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled)
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
return;
QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeEnd, (int)range,
- QString(), -1, -1, 0, 0, 0};
+ QString(), -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), -1, -1, -1, -1, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), width, height, -1, -1, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count)
+{
+ // assuming enabled checked by caller
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType,
+ url.toString(), -1, -1, -1, count, -1,
+ 0, 0, 0, 0, 0};
+ processMessage(rd);
+}
+
+void QQmlProfilerService::sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5)
+{
+ if (!QQmlDebugService::isDebuggingEnabled() || !enabled)
+ return;
+
+ // because I already have some space to store ints in the struct, I'll use it to store the frame data
+ // even though the field names do not match
+ QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)SceneGraphFrame, (int)frameType, QString(),
+ -1, -1, -1, -1, -1,
+ value1, value2, value3, value4, value5};
processMessage(rd);
}
void QQmlProfilerService::animationFrameImpl(qint64 delta)
{
Q_ASSERT(QQmlDebugService::isDebuggingEnabled());
- if (!m_enabled)
+ if (!enabled)
return;
int animCount = QUnifiedTimer::instance()->runningAnimationCount();
@@ -250,7 +337,8 @@ void QQmlProfilerService::animationFrameImpl(qint64 delta)
// trim fps to integer
int fps = 1000 / delta;
QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)AnimationFrame,
- QString(), -1, -1, fps, animCount, 0};
+ QString(), -1, -1, fps, animCount, 0,
+ 0, 0, 0, 0, 0};
processMessage(ed);
}
}
@@ -267,12 +355,12 @@ void QQmlProfilerService::processMessage(const QQmlProfilerData &message)
bool QQmlProfilerService::profilingEnabled()
{
- return m_enabled;
+ return enabled;
}
void QQmlProfilerService::setProfilingEnabled(bool enable)
{
- m_enabled = enable;
+ enabled = enable;
}
/*
@@ -281,6 +369,7 @@ void QQmlProfilerService::setProfilingEnabled(bool enable)
void QQmlProfilerService::sendMessages()
{
QMutexLocker locker(&m_dataMutex);
+
QList<QByteArray> messages;
for (int i = 0; i < m_data.count(); ++i)
messages << m_data.at(i).toByteArray();
@@ -303,7 +392,7 @@ void QQmlProfilerService::stateAboutToBeChanged(QQmlDebugService::State newState
return;
if (state() == Enabled
- && m_enabled) {
+ && enabled) {
stopProfilingImpl();
sendMessages();
}
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index a50fb5ea08..fb08a30c6a 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -74,12 +74,18 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData
//###
QString detailData; //used by RangeData and RangeLocation
- int line; //used by RangeLocation
- int column; //used by RangeLocation
+ int line; //used by RangeLocation, also as "width" for pixmaps
+ int column; //used by RangeLocation, also as "height" for pixmaps
int framerate; //used by animation events
- int animationcount; //used by animation events
+ int animationcount; //used by animation events, also as "cache/reference count" for pixmaps
int bindingType;
+ qint64 subtime_1;
+ qint64 subtime_2;
+ qint64 subtime_3;
+ qint64 subtime_4;
+ qint64 subtime_5;
+
QByteArray toByteArray() const;
};
@@ -99,6 +105,8 @@ public:
RangeLocation,
RangeEnd,
Complete, // end of transmission
+ PixmapCacheEvent,
+ SceneGraphFrame,
MaximumMessage
};
@@ -132,14 +140,43 @@ public:
MaximumBindingType
};
+ enum PixmapEventType {
+ PixmapSizeKnown,
+ PixmapReferenceCountChanged,
+ PixmapCacheCountChanged,
+ PixmapLoadingStarted,
+ PixmapLoadingFinished,
+ PixmapLoadingError,
+
+ MaximumPixmapEventType
+ };
+
+ enum SceneGraphFrameType {
+ SceneGraphRendererFrame,
+ SceneGraphAdaptationLayerFrame,
+ SceneGraphContextFrame,
+ SceneGraphRenderLoopFrame,
+ SceneGraphTexturePrepare,
+ SceneGraphTextureDeletion,
+ SceneGraphPolishAndSync,
+ SceneGraphWindowsRenderShow,
+ SceneGraphWindowsAnimations,
+ SceneGraphWindowsPolishFrame,
+
+ MaximumSceneGraphFrameType
+ };
+
static void initialize();
static bool startProfiling();
static bool stopProfiling();
static void sendStartedProfilingMessage();
+ static bool profilingEnabled();
+
static void addEvent(EventType);
static void animationFrame(qint64);
+ static void sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2 = -1, qint64 value3 = -1, qint64 value4 = -1, qint64 value5 = -1);
static void sendProfilingData();
QQmlProfilerService();
@@ -163,15 +200,22 @@ private:
void rangeLocation(RangeType, const QUrl &, int, int);
void endRange(RangeType);
+ // overloading depending on parameters
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url);
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height);
+ void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count);
+
+ void sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5);
+
- bool profilingEnabled();
void setProfilingEnabled(bool enable);
void sendMessages();
void processMessage(const QQmlProfilerData &);
+public:
+ static bool enabled;
private:
QElapsedTimer m_timer;
- bool m_enabled;
QVector<QQmlProfilerData> m_data;
QMutex m_dataMutex;
QMutex m_initializeMutex;
@@ -183,6 +227,7 @@ private:
friend struct QQmlHandlingSignalProfiler;
friend struct QQmlObjectCreatingProfiler;
friend struct QQmlCompilingProfiler;
+ friend struct QQmlPixmapProfiler;
};
//
@@ -288,6 +333,49 @@ struct QQmlCompilingProfiler {
bool enabled;
};
+struct QQmlPixmapProfiler {
+ QQmlPixmapProfiler() {
+ QQmlProfilerService *instance = QQmlProfilerService::instance;
+ enabled = instance ?
+ instance->profilingEnabled() : false;
+ }
+
+ ~QQmlPixmapProfiler() {}
+
+ void startLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl);
+ }
+ }
+ void finishLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl);
+ }
+ }
+ void errorLoading(const QUrl &pixmapUrl) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl);
+ }
+ }
+ void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount);
+ }
+ }
+ void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount);
+ }
+ }
+ void setSize(const QUrl &pixmapUrl, int width, int height) {
+ if (enabled) {
+ QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height);
+ }
+ }
+
+ bool enabled;
+};
+
QT_END_NAMESPACE
#endif // QQMLPROFILERSERVICE_P_H
diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp
index f0f7f7a28d..eeab21d6ab 100644
--- a/src/qml/debugger/qv8debugservice.cpp
+++ b/src/qml/debugger/qv8debugservice.cpp
@@ -186,9 +186,14 @@ void QV8DebugService::signalEmitted(const QString &signal)
// executed in the gui thread
void QV8DebugService::init()
{
-// ### FIXME: v4
-// v8::Debug::SetMessageHandler2(DebugMessageHandler);
-// v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+#if 0 // ### FIXME: v4
+ Q_D(QV8DebugService);
+ if (!d->debugIsolate)
+ d->debugIsolate = v8::Isolate::GetCurrent();
+ v8::Debug::SetMessageHandler2(DebugMessageHandler);
+ v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+ QV4Compiler::enableV4(false);
+#endif
}
// executed in the gui thread
@@ -268,7 +273,10 @@ void QV8DebugService::messageReceived(const QByteArray &message)
void QV8DebugService::sendDebugMessage(const QString &message)
{
-// ### FIXME: v4 v8::Debug::SendCommand(message.utf16(), message.size());
+#if 0 // ### FIXME: v4
+ Q_D(QV8DebugService);
+ v8::Debug::SendCommand(message.utf16(), message.size(), 0, d->debugIsolate);
+#endif
}
void QV8DebugService::processDebugMessages()
diff --git a/src/qml/debugger/qv8debugservice_p.h b/src/qml/debugger/qv8debugservice_p.h
index 00ecf557c3..e6f05a2397 100644
--- a/src/qml/debugger/qv8debugservice_p.h
+++ b/src/qml/debugger/qv8debugservice_p.h
@@ -54,6 +54,11 @@
//
#include "qqmldebugservice_p.h"
+#ifdef Q_OS_WINCE
+# ifdef DebugBreak
+# undef DebugBreak
+# endif
+#endif
#include <private/qv8debug_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 4ce44ba46e..2198428a38 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -18,7 +18,7 @@ qhp.QtQml.indexRoot =
qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc
qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION
qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION
-qhp.QtQml.subprojects = classes examples
+qhp.QtQml.subprojects = qmltypes classes examples
qhp.QtQml.subprojects.classes.title = C++ Classes
qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes
qhp.QtQml.subprojects.classes.selectors = class fake:headerfile
@@ -26,15 +26,21 @@ qhp.QtQml.subprojects.classes.sortPages = true
qhp.QtQml.subprojects.examples.title = Examples
qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples
qhp.QtQml.subprojects.examples.selectors = fake:example
+qhp.QtQml.subprojects.qmltypes.title = QML Types
+qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types
+qhp.QtQml.subprojects.qmltypes.selectors = fake:qmlclass
+qhp.QtQml.subprojects.qmltypes.sortPages = true
tagfile = ../../../doc/qtqml/qtqml.tags
-depends += qtcore qtxmlpatterns qtgui qtquick
+depends += qtcore qtxmlpatterns qtgui qtquick qtdoc
-headerdirs += ..
+headerdirs += .. \
+ ../../imports/models
-sourcedirs += ..
+sourcedirs += .. \
+ ../../imports/models
exampledirs += ../../../examples/qml \
../ \
diff --git a/src/quick/doc/snippets/qml/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
index 4254b50e63..4254b50e63 100644
--- a/src/quick/doc/snippets/qml/visualdatagroup.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
diff --git a/src/quick/doc/snippets/qml/visualdatamodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
index 0513c5b5f2..0513c5b5f2 100644
--- a/src/quick/doc/snippets/qml/visualdatamodel.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
index da1086146c..da1086146c 100644
--- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
index 1e8cfade96..1e8cfade96 100644
--- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
index c95d9e66eb..65e2bfd4ce 100644
--- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
+++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
@@ -39,9 +39,16 @@
****************************************************************************/
//! [imports]
-import QtQuick 2.0 as Nokia
-import Ovi 1.0 as Nokia
-//! [imports]
+import QtQuick 2.0 as Project
+import QtMultimedia 5.0 as Project
+
+Project.Rectangle {
+ width: 100; height: 50
-Item {
+ Project.Audio {
+ source: "music.wav"
+ autoPlay: true
+ }
}
+//! [imports]
+
diff --git a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
index fd8301cebe..c3b85ce15a 100644
--- a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
@@ -38,10 +38,14 @@
**
****************************************************************************/
-import QtQuick 2.0
-
//![0]
-import "myscript.js" as Script
+<!DOCTYPE RCC>
+<RCC version="1.0">
+
+<qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/background.png</file>
+</qresource>
-Rectangle { color: "blue"; width: Script.calculateWidth(parent) }
+</RCC>
//![0]
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc
deleted file mode 100644
index 5e4941512b..0000000000
--- a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
-
-<qresource prefix="/">
- <file>main.qml</file>
- <file>images/background.png</file>
-</qresource>
-
-</RCC>
-
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro b/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
deleted file mode 100644
index 5aee288a6e..0000000000
--- a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-QT += qml
-
-SOURCES += main.cpp
-RESOURCES += example.qrc
diff --git a/src/qml/doc/src/cppclasses/topic.qdoc b/src/qml/doc/src/cppclasses/topic.qdoc
index 8b97048c03..7c21793cfd 100644
--- a/src/qml/doc/src/cppclasses/topic.qdoc
+++ b/src/qml/doc/src/cppclasses/topic.qdoc
@@ -29,7 +29,7 @@
\title Important C++ Classes Provided By The Qt QML Module
\brief Overview of the C++ classes provided by the Qt QML module
-The Qt QML module provides C++ classes which implement the QML framework.
+The \l{Qt QML} module provides C++ classes which implement the QML framework.
Clients can use these classes to interact with the QML run-time (for example,
by injecting data or invoking methods on objects), and to instantiate a
hierarchy of objects from a QML document. The Qt QML module provides more
@@ -88,7 +88,7 @@ properties of a QQmlContext, and how to access the context for an object.
Dynamic object instantiation and dynamic expression evaluation are both core
concepts in QML. QML documents define object types which can be instantiated
at run-time using a QQmlComponent. An instance of the QQmlComponent class can
-be created in C++ directly, or via the \l{QML:Qt::createComponent()}
+be created in C++ directly, or via the \l{QtQml2::Qt::createComponent()}
{Qt.createComponent()} function in imperative QML code. Arbitrary expressions
can be calculated in C++ via the QQmlExpression class, and such expressions
can interact directly the QML context.
@@ -113,4 +113,20 @@ engine.
See the \l{QQmlExpression} class documentation for in depth information about
how to use QQmlExpression in an application.
+\section1 Usage of the Classes within QML Applications
+
+These pages describe how to create QML applications which interact with the
+C++ classes:
+
+\list
+\li \l{qtqml-cppintegration-topic.html}{Integrating QML and C++}
+ \list
+ \li \l{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Classes to QML}
+ \li \l{qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}
+ \li \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context Properties}
+ \li \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++}
+ \li \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++}
+ \endlist
+\endlist
+
*/
diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc
index aaac43e470..1c2bced738 100644
--- a/src/qml/doc/src/cppintegration/contextproperties.qdoc
+++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc
@@ -74,7 +74,7 @@ QML code invokes a method on the object instance:
\endtable
(Note that date/time values returned from C++ to QML can be formatted through
-\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.)
+\l{QtQml2::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 type. For example, if \c ApplicationData has a signal named \c
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index ba8ad47bab..74a93436f5 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -119,12 +119,12 @@ when passed from C++ to QML and vice-versa:
\li \l enumeration
\endtable
-(Note that classes provided by the QtGui module, such as QColor, QFont,
-QQuaternion and QMatrix4x4, are only available from QML when the \l QtQuick
-module is imported.)
+\note Classes provided by the \l {Qt GUI} module, such as QColor, QFont,
+QQuaternion and QMatrix4x4, are only available from QML when the \l {Qt Quick}
+module is included.
As a convenience, many of these types can be specified in QML by string values,
-or by a related method provided by the \l {QML:Qt} object. For example, the \l
+or by a related method provided by the \l {QtQml2::Qt} object. For example, the \l
{Image::sourceSize} property is of type \l size (which automatically translates
to the QSize type) and can be specified by a string value formatted as
"width\c{x}height", or by the Qt.size() function:
diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc
index be5f26a865..995fb1bce8 100644
--- a/src/qml/doc/src/cppintegration/definetypes.qdoc
+++ b/src/qml/doc/src/cppintegration/definetypes.qdoc
@@ -40,7 +40,7 @@ as an instantiable \l{qtqml-typesystem-objecttypes.html}{QML object type} from
QML, or enabling a singleton instance of the class to be imported and used
from QML.
-Additionally, the QtQml module provides mechanisms for implementing QML-specific
+Additionally, the \l {Qt QML} module provides mechanisms for implementing QML-specific
features such as \e{attached properties} and \e{default properties} in C++.
(Note that a number of the important concepts covered in this document are
@@ -133,7 +133,7 @@ not be instantiable
should not be instantiable from QML
\endlist
-The QtQml module provides several methods for registering non-instantiable
+The \l {Qt QML} module provides several methods for registering non-instantiable
types:
\list
@@ -291,7 +291,7 @@ qmlRegisterRevision<BaseType,1>("MyTypes", 1, 1);
\endcode
This is useful when deriving from base classes provided by other authors,
-e.g. when extending classes from the QtQuick library.
+e.g. when extending classes from the Qt Quick module.
\section1 Defining QML-Specific Types and Attributes
@@ -675,19 +675,19 @@ to be declared for an item without explicitly assigning them to the
\l{Item::}{children} property.)
-\section2 Defining Visual Items with the QtQuick Module
+\section2 Defining Visual Items with the Qt Quick Module
-When building user interfaces with the QtQuick module, all QML objects that are
+When building user interfaces with the \l {Qt Quick} module, all QML objects that are
to be visually rendered must derive from the \l Item type, as it is the base
-type for all visual objects in the QtQuick module. This \l Item type is
-implemented by the QQuickItem C++ class, which is provided as part of the
-QtQuick C++ module. Therefore, this class should be subclassed when it is
+type for all visual objects in \l {Qt Quick}. This \l Item type is
+implemented by the QQuickItem C++ class, which is provided by the
+\l {Qt Quick} module. Therefore, this class should be subclassed when it is
necessary to implement a visual type in C++ that can be integrated into a
QML-based user interface.
See the QQuickItem documentation for more information. Additionally, the
\l{Writing QML Extensions with C++} tutorial demonstrates how a QQuickItem-based
-visual item can be implemented in C++ and integrated into a QtQuick-based user
+visual item can be implemented in C++ and integrated into a Qt Quick-based user
interface.
@@ -699,7 +699,7 @@ its properties have been set. For example, this may be the case if the
initialization is costly, or if the initialization should not be performed until
all property values have been initialized.
-The QtQml module provides the QQmlParserStatus to be subclass for these
+The \l {Qt QML} module provides the QQmlParserStatus to be subclass for these
purposes. It defines a number of virtual methods that are invoked invoked at
various stages during component instantiation. To receive these notifications, a
C++ class should inherit QQmlParserStatus and also notify the Qt meta system
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index 3253752e47..d0fb03a03c 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -30,7 +30,7 @@
\title Writing QML Extensions with C++
\brief tutorial about extending QML with Qt C++
-The QtQml C++ module provides a set of APIs for extending QML through
+The \l {Qt QML} 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.
@@ -39,17 +39,17 @@ 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/quick/tutorials/extending directory.
+examples/qml/tutorials/extending directory.
Tutorial chapters:
\list 1
-\li \l{quick/tutorials/extending/chapter1-basics}{Creating a New Type}
-\li \l{quick/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
-\li \l{quick/tutorials/extending/chapter3-bindings}{Property Binding}
-\li \l{quick/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
-\li \l{quick/tutorials/extending/chapter5-listproperties}{Using List Property Types}
-\li \l{quick/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
+\li \l{tutorials/extending/chapter1-basics}{Creating a New Type}
+\li \l{tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
+\li \l{tutorials/extending/chapter3-bindings}{Property Binding}
+\li \l{tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
+\li \l{tutorials/extending/chapter5-listproperties}{Using List Property Types}
+\li \l{tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
\li \l{qml-extending-tutorial7.html}{In Summary}
\endlist
@@ -104,7 +104,7 @@ this new class must:
Here is our \c PieChart class, defined in \c piechart.h:
-\snippet quick/tutorials/extending/chapter1-basics/piechart.h 0
+\snippet tutorials/extending/chapter1-basics/piechart.h 0
The class inherits from QQuickPaintedItem because we want to override
QQuickPaintedItem::paint() in perform drawing operations with the QPainter API.
@@ -120,15 +120,15 @@ 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 quick/tutorials/extending/chapter1-basics/piechart.cpp 0
+\snippet tutorials/extending/chapter1-basics/piechart.cpp 0
\dots 0
-\snippet quick/tutorials/extending/chapter1-basics/piechart.cpp 1
+\snippet 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 quick/tutorials/extending/chapter1-basics/app.qml 0
+\snippet 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
@@ -142,20 +142,20 @@ 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 quick/tutorials/extending/chapter1-basics/main.cpp 0
+\snippet tutorials/extending/chapter1-basics/main.cpp 0
This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart",
in a type namespace called "Charts", with a version of 1.0.
Lastly, we write a \c .pro project file that includes the files and the \c declarative library:
-\quotefile quick/tutorials/extending/chapter1-basics/chapter1-basics.pro
+\quotefile 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/quick/tutorials/extending/chapter1-basics directory.
+Try it yourself with the code in Qt's \c examples/qml/tutorials/extending/chapter1-basics directory.
*/
@@ -168,20 +168,20 @@ 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 quick/tutorials/extending/chapter2-methods/app.qml 0
+\snippet 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 quick/tutorials/extending/chapter2-methods/piechart.h 0
+\snippet tutorials/extending/chapter2-methods/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 1
+\snippet tutorials/extending/chapter2-methods/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 2
+\snippet tutorials/extending/chapter2-methods/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter2-methods/piechart.h 3
+\snippet 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
@@ -191,7 +191,7 @@ 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 quick/tutorials/extending/chapter2-methods/piechart.cpp 0
+\snippet 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:
@@ -200,7 +200,7 @@ disappears, and the application outputs:
The chart has been cleared
\endcode
-Try out the example yourself with the updated code in Qt's \c examples/quick/tutorials/extending/chapter2-methods directory.
+Try out the example yourself with the updated code in Qt's \c examples/qml/tutorials/extending/chapter2-methods directory.
*/
@@ -216,7 +216,7 @@ other types' 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 quick/tutorials/extending/chapter3-bindings/app.qml 0
+\snippet tutorials/extending/chapter3-bindings/app.qml 0
\image extending-tutorial-chapter3.png
@@ -231,17 +231,17 @@ 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 quick/tutorials/extending/chapter3-bindings/piechart.h 0
+\snippet tutorials/extending/chapter3-bindings/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 1
+\snippet tutorials/extending/chapter3-bindings/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 2
+\snippet tutorials/extending/chapter3-bindings/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 3
+\snippet tutorials/extending/chapter3-bindings/piechart.h 3
Then, we emit this signal in \c setPieSlice():
-\snippet quick/tutorials/extending/chapter3-bindings/piechart.cpp 0
+\snippet 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
@@ -299,43 +299,43 @@ 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 quick/tutorials/extending/chapter4-customPropertyTypes/app.qml 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/app.qml 0
Like \c PieChart, this new \c PieSlice type inherits from QQuickPaintedItem and declares
its properties with Q_PROPERTY():
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
+\snippet 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 quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
+\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3
+\snippet 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
QQuickItem::setParentItem() so that the \c PieChart knows to paint this child
item when its contents are drawn:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
+\snippet 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" type namespace, version 1.0:
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 1
\dots
-\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2
+\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 2
-Try it out with the code in Qt's \c examples/quick/tutorials/extending/chapter4-customPropertyTypes directory.
+Try it out with the code in Qt's \c examples/qml/tutorials/extending/chapter4-customPropertyTypes directory.
*/
@@ -349,7 +349,7 @@ 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 quick/tutorials/extending/chapter5-listproperties/app.qml 0
+\snippet tutorials/extending/chapter5-listproperties/app.qml 0
\image extending-tutorial-chapter5.png
@@ -360,11 +360,11 @@ 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 quick/tutorials/extending/chapter5-listproperties/piechart.h 0
+\snippet tutorials/extending/chapter5-listproperties/piechart.h 0
\dots
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 1
+\snippet tutorials/extending/chapter5-listproperties/piechart.h 1
\dots
-\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 2
+\snippet 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 QQmlListProperty works.
@@ -373,7 +373,7 @@ return a QQmlListProperty 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 quick/tutorials/extending/chapter5-listproperties/piechart.cpp 0
+\snippet 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
@@ -384,7 +384,7 @@ The \c PieSlice class has also been modified to include \c fromAngle and \c angl
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/quick/tutorials/extending/chapter5-listproperties directory.
+The complete code can be seen in the updated \c examples/qml/tutorials/extending/chapter5-listproperties directory.
*/
@@ -407,22 +407,22 @@ and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerT
Here is the \c ChartsPlugin definition in \c chartsplugin.h:
-\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.h 0
+\snippet tutorials/extending/chapter6-plugins/chartsplugin.h 0
And its implementation in \c chartsplugin.cpp:
-\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0
+\snippet 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 quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
+\quotefile tutorials/extending/chapter6-plugins/chapter6-plugins.pro
Finally, we add a \l{qtqml-modules-qmldir.html}{qmldir} file that is
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 quick/tutorials/extending/chapter6-plugins/Charts/qmldir
+\quotefile tutorials/extending/chapter6-plugins/Charts/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 using the \l{Prototyping with qmlscene}{qmlscene tool},
diff --git a/src/qml/doc/src/cppintegration/topic.qdoc b/src/qml/doc/src/cppintegration/topic.qdoc
index 48f430c919..4d12ab9d08 100644
--- a/src/qml/doc/src/cppintegration/topic.qdoc
+++ b/src/qml/doc/src/cppintegration/topic.qdoc
@@ -29,7 +29,7 @@
\title Integrating QML and C++
\brief Description of how to integrate QML and C++ code
-QML is designed to be easily extensible through C++ code. The classes in the QtQml C++ module
+QML is designed to be easily extensible through C++ code. The classes in the \l {Qt QML} module
enables QML objects to be loaded and manipulated from C++, and the nature of QML engine's
integration with Qt's \l{Meta Object System}{meta object system} enables C++ functionality to be
invoked directly from QML. This allows the development of hybrid applications which are implemented
@@ -43,7 +43,7 @@ with QML and JavaScript within \l{qtqml-documents-topic.html}{QML documents}, an
C++
\li Use and invoke some C++ functionality from QML (for example, to invoke your application logic,
use a data model implemented in C++, or call some functions in a third-party C++ library)
-\li Access functionality in the QtQml or QtQuick C++ API (for example, to dynamically generate
+\li Access functionality in the \l {Qt QML} or \l {Qt Quick} C++ API (for example, to dynamically generate
images using QQuickImageProvider)
\li Implement your own \l{qtqml-typesystem-objecttypes.html}{QML object types} from C++
\unicode{0x2014} whether for use within your own specific application, or for distribution to others
@@ -71,7 +71,7 @@ methods and signals to be accessed from QML
These are the most common methods of accessing C++ functionality from QML code; for more options and
details, see the main documentation pages that are described in the sections further below.
-Additionally, aside from the ability to access C++ functionality from QML, the Qt QML module also
+Additionally, aside from the ability to access C++ functionality from QML, the \l {Qt QML} module also
provides ways to do the reverse and manipulate QML objects from C++ code. See
\l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++} for more
details.
@@ -104,7 +104,7 @@ registered for other purposes: for example, it could be registered as a \e {Sing
single class instance to be imported by QML code, or it could be registered to enable the
enumeration values of a non-instantiable class to be accessible from QML.
-Additionally, the QtQml module provides mechanisms to define QML types that integrate with QML
+Additionally, the \l {Qt QML} module provides mechanisms to define QML types that integrate with QML
concepts like attached properties and default properties.
For more information on registering and creating custom QML types from C++, see the \l
@@ -115,7 +115,7 @@ For more information on registering and creating custom QML types from C++, see
C++ objects and values can be embedded directly into the context (or \e scope) of loaded QML objects
using \e {context properties} and \e {context objects}. This is achieved through the QQmlContext
-class provided by the QtQml module, which exposes data to the context of a QML component, allowing
+class provided by the \l {Qt QML} module, which exposes data to the context of a QML component, allowing
data to be injected from C++ into QML.
See \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context
diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc
index 9f696930d2..7da24d4092 100644
--- a/src/qml/doc/src/javascript/date.qdoc
+++ b/src/qml/doc/src/javascript/date.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype Date
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Provides date functions
The QML Date object extends the JS Date object with
@@ -223,4 +223,3 @@
}
\endcode
*/
-
diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
index 09faa61672..e54404d2fd 100644
--- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
+++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
@@ -35,15 +35,15 @@ useful to delay instantiation of objects until necessary, thereby improving
application startup time. It also allows visual objects to be dynamically
created and added to the scene in reaction to user input or other events.
-See the \l {declarative/toys/dynamicscene}{Dynamic Scene example} for a
+See the \l {QML Example - Dynamic Scene}{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()}
+either call \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} to
+dynamically create a \l Component object, or use \l{QtQml2::Qt::createQmlObject()}
{Qt.createQmlObject()} to create an object from a string of QML. Creating a
component is better if you have an existing component defined in a QML document
and you want to dynamically create instances of that component. Otherwise,
@@ -54,7 +54,7 @@ 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 in the
+\l {QtQml2::Qt::createComponent()}{Qt.createComponent()} function in the
\l {QmlGlobalQtObject}{Qt object}.
This function takes the URL of the QML file as its only argument and creates
a \l Component object from this URL.
@@ -66,7 +66,7 @@ can take one or two arguments:
\li The first is the parent for the new object. The parent can be a graphical
object (i.e. of the \l Item type) or non-graphical object (i.e. of the
\l QtObject or C++ QObject type). Only graphical objects with graphical
- parent objects will be rendered to the QtQuick visual canvas. If you wish
+ parent objects will be rendered to the \l {Qt Quick} visual canvas. If you wish
to set the parent later you can safely pass \c null to this function.
\li The second is optional and is a map of property-value pairs that define
initial any property values for the object. Property values specified by
@@ -109,11 +109,11 @@ the \c finishCreation() function and call \l {Component::createObject()}
Notice in both instances, \l {Component::createObject()}{createObject()} is
called with \c appWindow passed as the parent argument, since the dynamically
-created object is a visual (QtQuick) object. The created object will become a
+created object is a visual (Qt Quick) object. The created object will become a
child of the \c appWindow object in \c main.qml, and appear in the scene.
When using files with relative paths, the path should
-be relative to the file where \l {QML:Qt::createComponent()}
+be relative to the file where \l {QtQml2::Qt::createComponent()}
{Qt.createComponent()} is executed.
To connect signals to (or receive signals from) dynamically created objects,
@@ -127,7 +127,7 @@ It is also possible to instantiate components without blocking via the
\section2 Creating an Object from a String of QML
If the QML is not defined until runtime, you can create a QML object from
-a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+a string of QML using the \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
function, as in the following example:
\snippet qml/createQmlObject.qml 0
@@ -153,9 +153,9 @@ first, the bindings in the dynamic object will no longer work.
The actual creation context depends on how an object is created:
\list
-\li If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the
+\li If \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is used, the
creation context is the QQmlContext in which this method is called
-\li If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} is called, the
+\li If \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} is called, the
creation context is the context of the parent object passed to this method
\li If a \c {Component{}} object is defined and \l {Component::createObject()}
{createObject()} or \l {Component::incubateObject()}{incubateObject()} is
@@ -221,7 +221,7 @@ Item {
This would result in an error, since objects can only be dynamically
destroyed if they were dynamically created.
-Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
+Objects created with \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
can similarly be destroyed using \c destroy():
\snippet qml/createQmlObject.qml 0
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index a63ef617c0..3bd64ac115 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -166,6 +166,15 @@ Item {
}
\endqml
+\li The \c with statement is deprecated. Using the \c with statement will issue a warning
+at loading time and we plan on removing support for it in Qt 5.2. It is generally considered
+a language feature that is not recommended for use due reducing the readability of code and disabling
+many optimizations in the engine. It is also forbidden in ECMAScript 5 strict mode.
+
+\li JavaScript binding expressions are executed in non-strict mode. However we
+plan on changing the default for bindings in Qt 5.2 to execute always in
+ECMAScript 5 strict mode.
+
\endlist
diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc
index 800091689c..809b74ed52 100644
--- a/src/qml/doc/src/javascript/imports.qdoc
+++ b/src/qml/doc/src/javascript/imports.qdoc
@@ -71,13 +71,13 @@ parameters and return values when calling such functions from QML.
\section1 Imports Within JavaScript Resources
-In QtQuick 2.0, support has been added to allow JavaScript resources to import
+In \c {QtQuick 2.0}, support has been added to allow JavaScript resources to import
other JavaScript resources and also QML type namespaces using a variation of
the standard QML import syntax (where all of the previously described rules and
qualifications apply).
Due to the ability of a JavaScript resource to import another script or QML
-module in this fashion in QtQuick 2.0, some extra semantics are defined:
+module in this fashion in \c {QtQuick 2.0}, some extra semantics are defined:
\list
\li a script with imports will not inherit imports from the QML document which imported it (so accessing Component.errorString will fail, for example)
\li a script without imports will inherit imports from the QML document which imported it (so accessing Component.errorString will succeed, for example)
@@ -125,14 +125,14 @@ When a JavaScript file is imported, it must be imported with a qualifier. The
functions in that file are then accessible from the importing script via the
qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is
desirable to have the functions made available in the importing context without
-needing to qualify them, and in this circumstance the \l{QML:Qt::include()}
+needing to qualify them, and in this circumstance the \l{QtQml2::Qt::include()}
{Qt.include()} function may be used to include one JavaScript file from another.
This copies all functions from the other file into the current file's
namespace, but ignores all pragmas and imports defined in that file.
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()}.
+\c factorial.js using \l {QtQml2::Qt::include()}{Qt.include()}.
\table
\row
@@ -142,7 +142,7 @@ which in turn can call \c factorial() in \c factorial.js, as it has included
\li \snippet qml/integrating-javascript/includejs/factorial.js 0
\endtable
-Notice that calling \l {QML:Qt::include()}{Qt.include()} copies all functions
+Notice that calling \l {QtQml2::Qt::include()}{Qt.include()} copies 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().
diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc
index 1e7894f3d1..20fe40c86f 100644
--- a/src/qml/doc/src/javascript/number.qdoc
+++ b/src/qml/doc/src/javascript/number.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype Number
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief The Number object provides represents a number value
The QML Number object extends the JS Number object with
@@ -102,4 +102,3 @@
d = Number.fromLocaleString(german, "1.234") // d == 1234.0
\endcode
*/
-
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
index cc3004d93f..ab7d7a4ebe 100644
--- a/src/qml/doc/src/javascript/string.qdoc
+++ b/src/qml/doc/src/javascript/string.qdoc
@@ -27,7 +27,7 @@
/*!
\qmltype String
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief The String object represents a string value
The QML String object extends the JS String object with
@@ -48,4 +48,3 @@
console.log(message.arg(count))
\endcode
*/
-
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 4a4de0531c..386f9f49df 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -47,6 +47,20 @@
#include <QtQml> to use this macro.
*/
+/*!
+ \fn void qmlClearTypeRegistrations()
+ \relates QQmlEngine
+
+ Clears all stored type registrations, such as those produced with \l qmlRegisterType.
+
+ Do not call this function while a QQmlEngine exists or behavior will be undefined.
+ Any existing QQmlEngines must be deleted before calling this function. This function
+ only affects the application global cache. Delete the QQmlEngine to clear all cached
+ data relating to that engine.
+
+ #include <QtQml> to use this method.
+*/
+
/*!
\fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
@@ -222,7 +236,7 @@
Usage:
\code
- // first, define the singleton type provider function (callback).
+ // First, define the singleton type provider function (callback).
static QJSValue *example_qjsvalue_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
@@ -233,7 +247,8 @@
return example;
}
- // second, register the singleton type provider with QML by calling this function in an initialization function.
+ // Second, register the singleton type provider with QML by calling this function in an initialization function.
+ #include <QtQml>
...
qmlRegisterSingletonType("Qt.example.qjsvalueApi", 1, 0, "MyApi", example_qjsvalue_singletontype_provider);
...
@@ -299,7 +314,7 @@
Usage:
\code
- // first, define your QObject which provides the functionality.
+ // First, define your QObject which provides the functionality.
class SingletonTypeExample : public QObject
{
Q_OBJECT
@@ -325,7 +340,7 @@
int m_someProperty;
};
- // second, define the singleton type provider function (callback).
+ // Second, define the singleton type provider function (callback).
static QObject *example_qobject_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
@@ -335,7 +350,8 @@
return example;
}
- // third, register the singleton type provider with QML by calling this function in an initialization function.
+ // Third, register the singleton type provider with QML by calling this function in an initialization function.
+ #include <QtQml>
...
qmlRegisterSingletonType<SingletonTypeExample>("Qt.example.qobjectSingleton", 1, 0, "MyApi", example_qobject_singletontype_provider);
...
@@ -390,7 +406,7 @@
url must be an absolute URL, i.e. url.isRelative() == false.
Normally QML files can be loaded as types directly from other QML files, or using a qmldir file. This function allows
- registration of files to types from a C++ module, such as when the type mapping needs to be procedurally determined at startup.
+ registration of files to types from C++ code, such as when the type mapping needs to be procedurally determined at startup.
#include <QtQml> to use this function.
diff --git a/src/qml/doc/src/documents/definetypes.qdoc b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
index b9df6a4381..4e1d4a2c86 100644
--- a/src/qml/doc/src/documents/definetypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
@@ -29,7 +29,7 @@
\title Defining Object Types through QML Documents
\brief Description of how a QML document is a reusable type definition
-One of the core features of QML is that it enables QML object types to be easily defined in a lightweight manner through QML documents to suit the needs of individual QML applications. The standard QtQuick module provides various types like \l Rectangle, \l Text and \l Image for building a QML application; beyond these, you can easily define your own QML types to be reused within your application. This ability to create your own types forms the building blocks of any QML application.
+One of the core features of QML is that it enables QML object types to be easily defined in a lightweight manner through QML documents to suit the needs of individual QML applications. The standard \l {Qt Quick} module provides various types like \l Rectangle, \l Text and \l Image for building a QML application; beyond these, you can easily define your own QML types to be reused within your application. This ability to create your own types forms the building blocks of any QML application.
\section1 Defining an Object Type with a QML File
diff --git a/src/qml/doc/src/documents/networktransparency.qdoc b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
index ea46b3381e..ea46b3381e 100644
--- a/src/qml/doc/src/documents/networktransparency.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
diff --git a/src/qml/doc/src/documents/scope.qdoc b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
index 9da77a4905..9da77a4905 100644
--- a/src/qml/doc/src/documents/scope.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
diff --git a/src/qml/doc/src/documents/structure.qdoc b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
index c8176f7e0f..c8176f7e0f 100644
--- a/src/qml/doc/src/documents/structure.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
diff --git a/src/qml/doc/src/documents/topic.qdoc b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
index f8a402476c..aed89f6423 100644
--- a/src/qml/doc/src/documents/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
@@ -91,13 +91,13 @@ separation between UI definition and logic implementation.
In the following example, the client developer defines a \c Button type with
a document in a file:
-\snippet ../src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml 0
+\snippet ../quick/doc/snippets/qml/qml-extending-types/components/Button.qml 0
The \c Button type can then be used in an application:
\table
\row
-\li \snippet ../src/quick/doc/snippets/qml/qml-extending-types/components/application.qml 0
+\li \snippet ../quick/doc/snippets/qml/qml-extending-types/components/application.qml 0
\li \image button-types.png
\endtable
diff --git a/src/qml/doc/src/modules/cppplugins.qdoc b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
index af2a36c903..7ac1d400eb 100644
--- a/src/qml/doc/src/modules/cppplugins.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
@@ -68,7 +68,7 @@
as a new QML type. It provides the current time through \c hour and \c minute
properties.
- \snippet qml/plugins/plugin.cpp 0
+ \snippet plugins/plugin.cpp 0
\dots
To make this type available, we create a plugin class named \c QExampleQmlPlugin
@@ -78,7 +78,7 @@
definition to register the plugin with the Qt meta object system using a unique
identifier for the plugin.
- \snippet qml/plugins/plugin.cpp plugin
+ \snippet plugins/plugin.cpp plugin
The \c TimeModel class receives a \c{1.0} version of this plugin library, as
a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is
@@ -111,13 +111,13 @@
that is built by the project (as shown above in the \c .pro file) so both of these
need to be specified in the \c qmldir file:
- \quotefile qml/plugins/imports/TimeExample/qmldir
+ \quotefile plugins/imports/TimeExample/qmldir
Once the project is built and installed, the new \c Time component is
accessible by any QML component that imports the \c TimeExample
module
- \snippet qml/plugins/plugins.qml 0
+ \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}.
diff --git a/src/qml/doc/src/modules/identifiedmodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
index 34d4b864a8..34d4b864a8 100644
--- a/src/qml/doc/src/modules/identifiedmodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
diff --git a/src/qml/doc/src/modules/legacymodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
index 26981334b7..26981334b7 100644
--- a/src/qml/doc/src/modules/legacymodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
diff --git a/src/qml/doc/src/modules/qmldir.qdoc b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
index de3698c533..57d54e27e0 100644
--- a/src/qml/doc/src/modules/qmldir.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
@@ -223,6 +223,11 @@ cannot be used if an earlier version is imported. If the client had imported
version 1.0 of the module, they can use the \c MyButton type but \b not the
\c MyWindow type.
+A version cannot be imported if no types have been explicitly exported for that
+version. If a module provides a \c MyButton type in version 1.0 and a
+\c MyWindow type in version 1.1, you cannot import version 1.2 or version 2.0 of
+that module.
+
A type can be defined by different files in different versions. In this case,
the most closely matching version will be used when imported by clients.
For example, if a module had specified the following types via its \c qmldir
@@ -363,7 +368,7 @@ Module {
// The name of the type containing attached properties
// and methods.
- attachedType: "QDeclarativeAnimationAttached"
+ attachedType: "QQuickAnimationAttached"
// The list of exports determines how a type can be imported.
// Each string has the format "URI/Name version" and matches the
diff --git a/src/qml/doc/src/modules/topic.qdoc b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
index 597e7b7ca3..597e7b7ca3 100644
--- a/src/qml/doc/src/modules/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
diff --git a/src/qml/doc/src/qmllanguageref/qmlreference.qdoc b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
new file mode 100644
index 0000000000..0bc8f90238
--- /dev/null
+++ b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlreference.html
+\title The QML Reference
+\brief A declarative language for application development
+
+QML is a declarative language for creating highly dynamic applications. With
+QML, application building blocks such as UI components are \e declared and
+various properties set to define the application behavior. When coupled with
+JavaScript, application behavior becomes scriptable. In addition, QML heavily
+uses Qt, which allows types and other Qt features to be accessible directly from
+QML applications.
+
+This reference guide describes the features of the QML language. Many of the
+QML types in the guide originate from the \l{Qt QML} or \l{Qt Quick}
+modules.
+
+\list
+ \li \l{qtqml-syntax-basics.html}{QML Syntax Basics}
+ \list
+ \li \l{qtqml-syntax-imports.html}{Import Statements}
+ \li \l{qtqml-syntax-basics.html#object-declarations}{Object Declarations}
+ \list
+ \li \l{qtqml-syntax-basics.html#child-objects}{Child Objects}
+ \endlist
+ \li \l{qtqml-syntax-basics.html#comments}{Comments}
+ \endlist
+
+ \li \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
+ \list
+ \li \l{qtqml-syntax-objectattributes.html#the-id-attribute}{The \e id Attribute}
+ \li \l{qtqml-syntax-objectattributes.html#property-attributes}{Property Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#signal-attributes}{Signal Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#method-attributes}{Method Attributes}
+ \li \l{qtqml-syntax-objectattributes.html#attached-properties-and-attached-signal-handlers}{Attached Properties and Attached Signal Handlers}
+ \endlist
+
+ \li \l{qtqml-syntax-propertybinding.html}{Property Binding}
+
+ \li \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
+
+ \li \l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
+ \list
+ \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
+ \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
+ \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
+ \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
+ \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
+ \endlist
+
+ \li \l{qtqml-typesystem-topic.html}{The QML Type System}
+ \list
+ \li \l{qtqml-typesystem-basictypes.html}{Basic Types}
+ \li \l{qtqml-typesystem-topic.html#javascript-types}{JavaScript Types}
+ \li \l{qtqml-typesystem-objecttypes.html}{QML Object Types}
+ \list
+ \li \l{qtqml-documents-definetypes.html}{Defining Object Types from QML}
+ \li \l{qtqml-cppintegration-definetypes.html}{Defining Object Types from C++}
+ \endlist
+ \endlist
+
+ \li \l{qtqml-modules-topic.html}{QML Modules}
+ \list
+ \li \l{qtqml-modules-qmldir.html}{Specifying A QML Module}
+ \li \l{qtqml-modules-topic.html#supported-qml-module-types}{Supported QML Module Types}
+ \list
+ \li \l{qtqml-modules-identifiedmodules.html}{Identified Modules}
+ \li \l{qtqml-modules-legacymodules.html}{Legacy Modules}
+ \endlist
+ \li \l{qtqml-modules-cppplugins.html}{Providing Types and Functionality in a C++ Plugin}
+ \endlist
+
+ \li \l{qtqml-documents-topic.html}{QML Documents}
+ \list
+ \li \l{qtqml-documents-structure.html}{Structure of a QML Document}
+ \li \l{Syntax of the QML Language}
+ \li \l{qtqml-documents-definetypes.html}{Defining Object Types through QML Documents}
+ \list
+ \li \l{qtqml-documents-definetypes.html#defining-an-object-type-with-a-qml-file}{Defining an Object Type with a QML File}
+ \li \l{qtqml-documents-definetypes.html#accessible-attributes-of-custom-types}{Accessible Attributes of Custom Types}
+ \endlist
+ \li \l{qtqml-documents-networktransparency.html}{Resource Loading and Network Transparency}
+ \li \l{qtqml-documents-scope.html}{Scope and Naming Resolution}
+ \endlist
+\endlist
+
+*/
diff --git a/src/qml/doc/src/syntax/basics.qdoc b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
index d20f66d80a..cdfab3cd3f 100644
--- a/src/qml/doc/src/syntax/basics.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
@@ -89,9 +89,9 @@ Rectangle {
}
\endqml
-This declares an object of type \l Rectangle, followed by a set of curly braces that encompasses the attributes defined for that object. The \l Rectangle type is a type made available by the \l QtQuick module, and the attributes defined in this case are the values of the rectangle's \c width, \c height and \c color properties. (These are properties made available by the \l Rectangle type, as described in the \l Rectangle documentation.)
+This declares an object of type \l Rectangle, followed by a set of curly braces that encompasses the attributes defined for that object. The \l Rectangle type is a type made available by the \c QtQuick module, and the attributes defined in this case are the values of the rectangle's \c width, \c height and \c color properties. (These are properties made available by the \l Rectangle type, as described in the \l Rectangle documentation.)
-The above object can be loaded by the engine if it is part of a \l{qtqml-documents-topic.html}{QML document}. That is, if the source code is complemented with \e import statement that imports the QtQuick module (to make the \l Rectangle type available), as below:
+The above object can be loaded by the engine if it is part of a \l{qtqml-documents-topic.html}{QML document}. That is, if the source code is complemented with \e import statement that imports the \c QtQuick module (to make the \l Rectangle type available), as below:
\qml
import QtQuick 2.0
@@ -103,7 +103,7 @@ Rectangle {
}
\endqml
-When placed into a \c .qml file and loaded by the QML engine, the above code creates a \l Rectangle object using the \l Rectangle type supplied by the QtQuick module:
+When placed into a \c .qml file and loaded by the QML engine, the above code creates a \l Rectangle object using the \l Rectangle type supplied by the \c QtQuick module:
\image qtqml-syntax-basics-object-declaration.png
@@ -140,7 +140,7 @@ Rectangle {
When this code is loaded by the engine, it creates an object tree with a \l Rectangle object at the root; this object has a \l Gradient child object, which in turn has two \l GradientStop children.
Note, however, that this is a parent-child relationship in the context of the QML object tree, not
-in the context of the visual scene. The concept of a parent-child relationship in a visual scene is provided by the \l Item type from the \l QtQuick module, which is the base type for most QML types, as most QML objects are intended to be visually rendered. For example, \l Rectangle and \l Text are both \l {Item}-based types, and below, a \l Text object has been declared as a visual child of a \l Rectangle object:
+in the context of the visual scene. The concept of a parent-child relationship in a visual scene is provided by the \l Item type from the \c QtQuick module, which is the base type for most QML types, as most QML objects are intended to be visually rendered. For example, \l Rectangle and \l Text are both \l {Item}-based types, and below, a \l Text object has been declared as a visual child of a \l Rectangle object:
\qml
import QtQuick 2.0
diff --git a/src/qml/doc/src/syntax/directoryimports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
index 7a6fb58c27..7a6fb58c27 100644
--- a/src/qml/doc/src/syntax/directoryimports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
diff --git a/src/qml/doc/src/syntax/imports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
index eda7dbf006..1496a1e5c9 100644
--- a/src/qml/doc/src/syntax/imports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
@@ -144,7 +144,7 @@ the types should be imported into a particular document-local namespace. If a
namespace is specified, then any references to the types made available by the
import must be prefixed by the local namespace qualifier.
-Below, the QtQuick module is imported into the namespace "CoreItems". Now, any
+Below, the \c QtQuick module is imported into the namespace "CoreItems". Now, any
references to types from the \c QtQuick module must be prefixed with the
\c CoreItems name:
@@ -178,7 +178,7 @@ CoreItems.Rectangle {
width: 100; height: 100
MyModule.Text { text: "Hello from my custom text item!" }
- CoreItems.Text { text: "Hello from QtQuick!" }
+ CoreItems.Text { text: "Hello from Qt Quick!" }
}
\endqml
diff --git a/src/qml/doc/src/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
index f336d14b14..f336d14b14 100644
--- a/src/qml/doc/src/syntax/objectattributes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
diff --git a/src/qml/doc/src/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
index 6803901efd..6803901efd 100644
--- a/src/qml/doc/src/syntax/propertybinding.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
diff --git a/src/qml/doc/src/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
index 6c90ddcf0a..6344d16caa 100644
--- a/src/qml/doc/src/syntax/signals.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
@@ -27,7 +27,6 @@
/*!
\page qtqml-syntax-signals.html
-\ingroup qml-features
\title Signal and Handler Event System
\brief the event sytem in QML
@@ -115,7 +114,7 @@ Even though the \l MouseArea documentation does not document a signal handler na
\section2 Using the Connections Type
-In some cases it may be desirable to access a signal outside of the object that emits it. For these purposes, the QtQuick module provides the \l Connections type for connecting to signals of arbitrary objects. A \l Connections object can receive any signal from its specified \l {Connections::target}{target}.
+In some cases it may be desirable to access a signal outside of the object that emits it. For these purposes, the \c QtQuick module provides the \l Connections type for connecting to signals of arbitrary objects. A \l Connections object can receive any signal from its specified \l {Connections::target}{target}.
For example, the \c onClicked handler in the earlier example could have been received by the root \l Rectangle instead, by placing the \c onClicked handler in a \l Connections object that has its \l {Connections::target}{target} set to the \l MouseArea:
@@ -294,4 +293,3 @@ output:
*/
-
diff --git a/src/qml/doc/src/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
index 6f468d42bc..7d2d662e4e 100644
--- a/src/qml/doc/src/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
@@ -67,7 +67,7 @@ The basic types supported natively in the QML language are listed below:
\section2 Basic Types Provided By QML Modules
QML modules may extend the QML language with more basic types.
-For example, the basic types provided by the QtQuick module are listed below:
+For example, the basic types provided by the \c QtQuick module are listed below:
\annotatedlist qtquickbasictypes
Currently only QML modules which are provided by Qt may provide their
@@ -241,7 +241,7 @@ property is only invoked when the property is reassigned to a different object v
\brief a resource locator.
The \c url type refers to a resource locator (like a file name, for example). It can be either
- absolute, e.g. "http://qt.nokia.com", or relative, e.g. "pics/logo.png". A relative URL is
+ absolute, e.g. "http://qt-project.org", or relative, e.g. "pics/logo.png". A relative URL is
resolved relative to the URL of the containing component.
For example, the following assigns a valid URL to the \l {Image::source}
diff --git a/src/qml/doc/src/typesystem/objecttypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
index 9209ebe68e..9209ebe68e 100644
--- a/src/qml/doc/src/typesystem/objecttypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
diff --git a/src/qml/doc/src/typesystem/topic.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
index 76e28f7ef1..76e28f7ef1 100644
--- a/src/qml/doc/src/typesystem/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc
index 799945fa37..3def3209cc 100644
--- a/src/qml/doc/src/qmltypereference.qdoc
+++ b/src/qml/doc/src/qmltypereference.qdoc
@@ -24,20 +24,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
/*!
\qmlmodule QtQml 2
\title Qt QML QML Types
\ingroup qmlmodules
\brief List of QML types provided by the Qt QML module
-The \c QtQml module provides the definition and implementation of various
+The \l{Qt QML} module provides the definition and implementation of various
convenience types which can be used with the QML language, including some
elementary QML types which can provide the basis for further extensions to the
-QML language.
-
-The \c QtQml module provides the \c QtObject and \c Component object types
-which may be used in QML documents. These types are non-visual and provide
-building-blocks for extensions to QML.
+QML language. The \l QtObject and \l Component object types are non-visual and
+provide building-blocks for extensions to QML.
\section1 Importing QtQml
@@ -53,15 +51,20 @@ import QtQml 2.0
\endqml
Most clients will never need to use the \c QtQml import, as all of the types
-and functionality provided by the \c QtQml namespace are also provided by the
-\c QtQuick namespace which may be imported as follows:
+are also provided by the \c QtQuick namespace which may be imported as
+follows:
\qml
import QtQuick 2.0
\endqml
-See the \l{Qt Quick} module documentation for more information about the
-\c QtQuick namespace and what it provides to QML application developers.
+See the \l{Qt Quick} module documentation for more information about the \c
+QtQuick namespace and what it provides to QML application developers.
+
+The QML types for creating lists and models, such as \l ListModel and \l
+ListElement, are moved to a submodule, \c QtQml.Models. The \l{Qt QML Models QML
+Types}{Qt QML Models} page has more information.
+
The documentation for the types below applies equally to the types of the same
name provided by the \l{Qt Quick} module, as they are in fact identical.
@@ -78,82 +81,6 @@ provided:
The following \l{qtqml-typesystem-objecttypes.html}{QML object types} are
provided:
-\section2 QtObject
-
-The \c QtObject type provides a basic instantiable object which can be used in
-QML applications. It is non-visual, but may have properties, methods, signals
-and signal handlers.
-
-For example, the following QtObject has several properties, one of which has
-been assigned a \l{Property Binding}
-{binding}, and a \l{Signal and Handler Event System}{signal handler} for
-the default change signal which exists for one of its properties:
-
-\code
- import QtQuick 2.0
-
- QtObject {
- property int a: 15
- property int b: a + 22
- property int changeCount: 0
-
- onAChanged: {
- changeCount += 1;
- }
- }
-\endcode
-
-\section2 Component
-
-The \c Component type provides a basic re-usable component which allows
-instances of another type to be instantiated on-demand. It may be given an
-\c id and it has a default property which is the object type to instantiate,
-but no other properties may be added to it.
-
-For example, the following QtObject has two different \l Component
-properties, and it uses those components to dynamically construct objects at
-run-time:
-
-\code
- import QtQuick 2.0
-
- QtObject {
- id: root
- property bool which: true
-
- property Component a: Component {
- id: firstComponent
- QtObject {
- property int answer: 42
- function activate() {
- console.log("The answer is: " + answer);
- }
- }
- }
-
- property Component b: Component {
- id: secondComponent
- QtObject {
- property string message: "Hello, World!"
- function activate() {
- console.log(message);
- }
- }
- }
-
- function activateDynamicObject() {
- var o = {};
- if (which) {
- which = false;
- o = a.createObject(null); // no parent
- } else {
- which = true;
- o = b.createObject(null); // no parent
- }
- o.activate();
- }
- }
-\endcode
*/
/*!
@@ -171,7 +98,7 @@ 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()}.
+\l{QtQml2::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
When integrating with C++, note that any QDate value
\l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
@@ -202,7 +129,7 @@ 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()}.
+\l{QtQml2::Qt::formatTime()}{Qt.formatTime()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
Note that when converting historical times to and from javascript that QDateTime and the JS Date object
have different methods of calculating historical daylight savings time application. This can lead to variations of one hour
@@ -231,7 +158,7 @@ To create a \c point value, specify it as a "x,y" string:
CustomObject { myPointProperty: "0,20" }
\endqml
-Or use the \l{QML:Qt::point()}{Qt.point()} function:
+Or use the \l{QtQml2::Qt::point()}{Qt.point()} function:
\qml
CustomObject { myPointProperty: Qt.point(0, 20) }
@@ -269,7 +196,7 @@ To create a \c size value, specify it as a "width x height" string:
Image { sourceSize: "150x50" }
\endqml
-Or use the \l{QML:Qt::size()}{Qt.size()} function:
+Or use the \l{QtQml2::Qt::size()}{Qt.size()} function:
\qml
Image { sourceSize: Qt.size(150, 50) }
@@ -309,7 +236,7 @@ To create a \c rect value, specify it as a "x, y, width x height" string:
CustomObject { myRectProperty: "50,50,100x100" }
\endqml
-Or use the \l{QML:Qt::rect()}{Qt.rect()} function:
+Or use the \l{QtQml2::Qt::rect()}{Qt.rect()} function:
\qml
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
@@ -322,5 +249,3 @@ is automatically converted into a QRectF value.
\sa{QML Basic Types}
*/
-
-
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 05a33f351a..26e4867bbc 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -30,159 +30,116 @@
\title Qt QML
\brief The Qt QML module defines and implements the QML language
-\section1 Overview of the Qt QML Module
-
-The Qt QML module provides a framework for developing applications and
-libraries with the QML language. It defines and implements the language
-and engine infrastructure, and provides an API to enable application
+The Qt QML module provides a framework for developing applications and libraries
+with the \l{QML Application Developer Resources}{QML language}. It defines and implements the
+language and engine infrastructure, and provides an API to enable application
developers to extend the QML language with custom types and integrate QML code
-with JavaScript and C++.
-
-The Qt QML module provides both the \c QtQml QML module, which supplies
-\l{Qt QML QML Types}{a set of core QML types} for creating QML
-applications, and the \c QtQml C++ module, which supplies \l{Qt QML C++ Classes}{a set of C++
-APIs} for extending QML applications with custom types and integrating C++
-implementations with QML applications.
+with JavaScript and C++. The Qt QML module provides both a \l{Qt QML QML Types}
+{QML API} and a \l{Qt QML C++ Classes}{C++ API}.
-Note that the Qt QML module provides only the language and infrastructure
-for the QML, and does not provide a visual canvas or rendering engine for
-creating user interfaces. These are provided instead by the
-\l{Qt Quick} module, which provides many visual components,
-model/view support, an animation framework and much more for building user
-interfaces with QML.
+Note that while the Qt QML module provides the language and infrastructure
+for QML applications, the \l{Qt Quick} module provides many visual components,
+model-view support, an animation framework, and much more for building user
+interfaces.
For those new to QML and Qt Quick, please see
\l{qtquick-applicationdevelopers.html}{QML Application Developer Resources}
for an introduction to writing QML applications.
+\section1 Getting Started
-\section1 Qt QML Module Documentation
+To include the definitions of the module's classes, use the
+following directive:
-\list
- \li \l{qtqml-cppclasses-topic.html}{Important C++ Classes}
- \list
- \li \l{QQmlEngine}
- \li \l{QQmlContext}
- \li \l{QQmlComponent}
- \li \l{QQmlExpression}
- \endlist
-
- \li \l{qtqml-typesystem-topic.html}{The QML Type System}
- \list
- \li \l{qtqml-typesystem-basictypes.html}{Basic Types}
- \li \l{qtqml-typesystem-topic.html#javascript-types}{JavaScript Types}
- \li \l{qtqml-typesystem-objecttypes.html}{QML Object Types}
- \list
- \li \l{qtqml-documents-definetypes.html}{Defining Object Types from QML}
- \li \l{qtqml-cppintegration-definetypes.html}{Defining Object Types from C++}
- \endlist
- \endlist
-
- \li \l{qtqml-modules-topic.html}{QML Modules}
- \list
- \li \l{qtqml-modules-qmldir.html}{Specifying A QML Module}
- \li \l{qtqml-modules-topic.html#supported-qml-module-types}{Supported QML Module Types}
- \list
- \li \l{qtqml-modules-identifiedmodules.html}{Identified Modules}
- \li \l{qtqml-modules-legacymodules.html}{Legacy Modules}
- \endlist
- \li \l{qtqml-modules-cppplugins.html}{Providing Types and Functionality in a C++ Plugin}
- \endlist
-
- \li \l{qtqml-documents-topic.html}{QML Documents}
- \list
- \li \l{qtqml-documents-structure.html}{Structure of a QML Document}
- \li \l{Syntax of the QML Language}
- \li \l{qtqml-documents-definetypes.html}{Defining Object Types through QML Documents}
- \list
- \li \l{qtqml-documents-definetypes.html#defining-an-object-type-with-a-qml-file}{Defining an Object Type with a QML File}
- \li \l{qtqml-documents-definetypes.html#accessible-attributes-of-custom-types}{Accessible Attributes of Custom Types}
- \endlist
- \li \l{qtqml-documents-networktransparency.html}{Resource Loading and Network Transparency}
- \li \l{qtqml-documents-scope.html}{Scope and Naming Resolution}
- \endlist
-
- \li \l{qtqml-typereference-topic.html}{QML Types Provided by the Qt QML Module}
- \list
- \li \l{qtqml-typereference-topic.html#importing-qtqml}{Importing \c QtQml}
- \li \l{qtqml-typereference-topic.html#basic-types}{Basic Types}
- \li \l{qtqml-typereference-topic.html#object-types}{Object Types}
- \list
- \li \l{qtqml-typereference-topic.html#qtobject}{QtObject}
- \li \l{qtqml-typereference-topic.html#component}{Component}
- \endlist
- \endlist
-
- \li \l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
- \list
- \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
- \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
- \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
- \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
- \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
- \list
- \li \l{qtqml-javascript-hostenvironment.html#common-base}{Common Base}
- \li \l{qtqml-javascript-hostenvironment.html#qml-global-object}{QML Global Object}
- \li \l{qtqml-javascript-hostenvironment.html#javascript-objects-and-functions}{JavaScript Objects and Functions}
- \li \l{qtqml-javascript-hostenvironment.html#javascript-environment-restrictions}{JavaScript Environment Restrictions}
- \endlist
- \endlist
-
- \li \l{qtqml-cppintegration-topic.html}{Integrating QML and C++}
- \list
- \li \l{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Classes to QML}
- \li \l{qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}
- \li \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context Properties}
- \li \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++}
- \li \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++}
- \endlist
+\code
+#include <QtQml>
+\endcode
+
+The QML types in Qt QML are available through the \c QtQML import. To use the
+types, add the following import statement to your .qml file:
+\code
+import QtQml 2.0
+\endcode
+
+
+To link against the module, add this line to your \l qmake \c
+.pro file:
+\code
+QT += qml
+\endcode
+
+\section1 QML and QML Types
+
+The Qt QML module contains the QML framework and important QML types used in
+applications. The constructs of QML are described in the \l{The QML Reference}.
+
+In addition to the \l{QML Basic Types}, the module comes with
+various QML object types:
+\list
+\li \l Component
+\li \l QtObject
+\li \l Binding
+\li \l Connections
+\li \l Timer
\endlist
+\section2 Lists and Models
-\section1 Syntax of the QML Language
+New in Qt 5.1, the model types are moved to a submodule, \c QtQml.Models. The
+\l{Qt QML Models QML Types}{Qt QML Models} page has more information.
\list
- \li \l{qtqml-syntax-basics.html}{QML Syntax Basics}
- \list
- \li \l{qtqml-syntax-imports.html}{Import Statements}
- \li \l{qtqml-syntax-basics.html#object-declarations}{Object Declarations}
- \list
- \li \l{qtqml-syntax-basics.html#child-objects}{Child Objects}
- \endlist
- \li \l{qtqml-syntax-basics.html#comments}{Comments}
- \endlist
-
- \li \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
- \list
- \li \l{qtqml-syntax-objectattributes.html#the-id-attribute}{The \e id Attribute}
- \li \l{qtqml-syntax-objectattributes.html#property-attributes}{Property Attributes}
- \li \l{qtqml-syntax-objectattributes.html#signal-attributes}{Signal Attributes}
- \li \l{qtqml-syntax-objectattributes.html#method-attributes}{Method Attributes}
- \li \l{qtqml-syntax-objectattributes.html#attached-properties-and-attached-signal-handlers}{Attached Properties and Attached Signal Handlers}
- \endlist
-
- \li \l{qtqml-syntax-propertybinding.html}{Property Binding}
- \li \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
+\li \l DelegateModel
+\li \l DelegateModelGroup
+\li \l ListElement
+\li \l ListModel
+\li \l ObjectModel
\endlist
-\section1 Reference Documentation
+\section1 JavaScript Environment for QML Applications
+
+JavaScript expressions allow QML code to contain application logic. Qt QML
+provides the framework for running JavaScript expressions in QML and from C++.
+
+These sections are from \l{The QML Reference}.
+\l{qtqml-javascript-topic.html}{Integrating QML and JavaScript}
+ \list
+ \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML}
+ \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript}
+ \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML}
+ \li \l{qtqml-javascript-imports.html}{Importing JavaScript Resources In QML}
+ \li \l{qtqml-javascript-hostenvironment.html}{JavaScript Host Environment}
+ \endlist
+
+\section1 Integrating QML with C++ Applications
+
+The module also provides the framework for running QML applications.
+The QML framework allows QML code to contain JavaScript expressions and for
+the QML code to interact with C++ code.
-Additional Qt QML information:
\list
-\li \l{Qt QML C++ Classes} - the C++ API provided by the
- Qt QML module
-\li \l{Qt QML Release Notes} - list of changes and
- additions in the Qt QML module
+\li \l{Important C++ Classes Provided By The Qt QML Module}
+\li \l{Integrating QML and C++}
\endlist
+\section1 Guides and Other Information
+
Further information for writing QML applications:
\list
+\li \l{The QML Reference}
\li \l{QML Application Developer Resources}
- essential information for application development with QML and Qt Quick
-\li \l{Qt Quick} - documentation for the Qt Quick module, which provides a
- visual canvas, an animation framework, model/view components and more for
- building fluid user interfaces and applications with QML
+\li \l{Qt Quick} - a module which provides a set of QML types and C++ classes
+ for building user interfaces and applications with QML
+\li \l{Qt QML Release Notes} - list of changes and
+ additions in the Qt QML module
+\endlist
+
+\section2 Reference
+\list
+\li \l{Qt QML C++ Classes}{C++ Classes}
+\li \l{Qt QML QML Types}{QML Types}
\endlist
-*/
+*/
diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc
index 361f6e61ee..eece3bcaab 100644
--- a/src/qml/doc/src/whatsnew.qdoc
+++ b/src/qml/doc/src/whatsnew.qdoc
@@ -28,16 +28,37 @@
/*!
\title Qt QML Release Notes
\page qtqml-releasenotes.html
-\inqmlmodule QtQuick 2.0
-\section1 Qt QML in Qt 5
+\section1 Qt QML in Qt 5.1
+
+Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is
+a summary of the new changes:
+\list
+\li New QQmlApplicationEngine convenience class for QML applications.
+\li New Instantiatior type for generic, dynamic object creation.
+\li New properties for \l Qt.application: arguments, name, and version.
+\endlist
+
+\section2 New Submodule
+
+The \l{Qt QML Models QML Types}{Qt QML Models} is a new submodule in Qt 5.1 and
+provides several QML types for handling data with models and lists. These types
+replace types such as \l VisualItem, \l VisualDataModel, and \l VisualDataGroup.
+
+\list
+\li \l{Qt QML Models QML Types}{Models}
+\endlist
+
+The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
+
+\section1 Qt QML in Qt 5.0
The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and
implements the QML language supporting infrastructure.
-(Prior to Qt 5, this functionality was provided by the QtDeclarative module, which
-has now been replaced by the new QtQml and QtQuick C++ modules. See the
-\l {Porting QML Applications to Qt 5} for more information.)
+(Prior to Qt 5, this functionality was provided by the \l {Qt Quick 1}{QtDeclarative} module, which
+has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the
+\l {Porting QML Applications to Qt 5} page for more information.)
\section2 QML Engine
@@ -73,11 +94,11 @@ has now been replaced by the new QtQml and QtQuick C++ modules. See the
\list
\li QML now supports defining properties of value type basic types within QML documents. Supported types include
QSizeF, QPointF and QRectF as \c size, \c point and \c rect respectively.
- \li QColor is now a value type provided by the QtQuick module. The red, green, blue and alpha channels
+ \li QColor is now a value type provided by the \c QtQuick module. The red, green, blue and alpha channels
of a \l color property can be accessed via \c r, \c g, \c b and \c a properties.
\li Factory functions for various value types have been added to the \c Qt object exposed to QML.
- Some of those functions require the QtQuick module to be imported in order to return valid values.
- See the QtQuick 2.0 release notes for more information about these functions.
+ Some of those functions require the \c QtQuick module to be imported in order to return valid values.
+ See the \l {Qt Quick Release Notes} for more information about these functions.
\endlist
\li Support for sequence types QList<int>, QList<qreal>, QList<bool>, QList<QUrl>,
QList<QString> and QStringList has been improved. QObjects can define Q_PROPERTYs of
@@ -95,7 +116,7 @@ has now been replaced by the new QtQml and QtQuick C++ modules. See the
\list
\li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
-\li The \l {QML:Qt} object now provides a \l{QML:Qt::inputMethod} property to access the active
+\li The \l {QtQml2::Qt}{Qt} global object now provides an \l{QtQml2::Qt::inputMethod}{inputMethod} property to access the active
text input method for an application.
\endlist
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 577757f3c0..99f342f6f0 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -152,7 +152,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
if (a == b || !length)
return true;
- register union {
+ union {
const quint16 *w;
const quint32 *d;
quintptr value;
@@ -177,7 +177,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
// both addresses are 4-bytes aligned
// do a fast 32-bit comparison
- register const quint32 *e = sa.d + (length >> 1);
+ const quint32 *e = sa.d + (length >> 1);
for ( ; sa.d != e; ++sa.d, ++sb.d) {
if (*sa.d != *sb.d)
return false;
@@ -187,7 +187,7 @@ bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
return (length & 1) ? *sa.w == *sb.w : true;
} else {
// one of the addresses isn't 4-byte aligned but the other is
- register const quint16 *e = sa.w + length;
+ const quint16 *e = sa.w + length;
for ( ; sa.w != e; ++sa.w, ++sb.w) {
if (*sa.w != *sb.w)
return false;
diff --git a/src/qml/qml/parser/qqmljs.g b/src/qml/qml/parser/qqmljs.g
index ff4f54374b..5d279ef1a2 100644
--- a/src/qml/qml/parser/qqmljs.g
+++ b/src/qml/qml/parser/qqmljs.g
@@ -2615,6 +2615,10 @@ case $rule_number: {
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
+ if (lexer->qmlMode()) {
+ const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg));
+ }
} break;
./
diff --git a/src/qml/qml/parser/qqmljsparser.cpp b/src/qml/qml/parser/qqmljsparser.cpp
index a0fa7a4711..46b5c041d4 100644
--- a/src/qml/qml/parser/qqmljsparser.cpp
+++ b/src/qml/qml/parser/qqmljsparser.cpp
@@ -1515,6 +1515,10 @@ case 311: {
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
+ if (lexer->qmlMode()) {
+ const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg));
+ }
} break;
case 312: {
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index 680e317a4e..31904f81e2 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -51,6 +51,7 @@ SOURCES += \
$$PWD/qqmlmemoryprofiler.cpp \
$$PWD/qqmlplatform.cpp \
$$PWD/qqmlbinding.cpp \
+ $$PWD/qqmlabstracturlinterceptor.cpp \
$$PWD/qqmlapplicationengine.cpp \
$$PWD/qqmllistwrapper.cpp \
$$PWD/qqmlcontextwrapper.cpp \
@@ -127,6 +128,7 @@ HEADERS += \
$$PWD/qqmlplatform_p.h \
$$PWD/qqmlbinding_p.h \
$$PWD/qqmlextensionplugin_p.h \
+ $$PWD/qqmlabstracturlinterceptor_p.h \
$$PWD/qqmlapplicationengine_p.h \
$$PWD/qqmlapplicationengine.h \
$$PWD/qqmllistwrapper_p.h \
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h
index 7e6e0d1d36..fb0133f305 100644
--- a/src/qml/qml/qqml.h
+++ b/src/qml/qml/qqml.h
@@ -102,6 +102,8 @@ class QQmlPropertyValueInterceptor;
listName[listLen+nameLen] = '>'; \
listName[listLen+nameLen+1] = '\0';
+void Q_QML_EXPORT qmlClearTypeRegistrations();
+
template<typename T>
int qmlRegisterType()
{
@@ -417,11 +419,17 @@ class QQmlContext;
class QQmlEngine;
class QJSValue;
class QJSEngine;
-Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
-Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
-Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
-Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
-Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create);
+
+namespace QtQml {
+ // declared in namespace to avoid symbol conflicts with QtDeclarative
+ Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
+ Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
+ Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
+ Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
+ Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *,
+ const QMetaObject *, bool create);
+}
+using namespace QtQml;
template<typename T>
QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp
new file mode 100644
index 0000000000..a68d5f7489
--- /dev/null
+++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QQmlAbstractUrlInterceptor
+ \inmodule QtQml
+ \brief allows you to control QML file loading.
+
+ \note This class is in an extended validation period and still subject to change. It should be treated as private API for 5.1
+
+ QQmlAbstractUrlInterceptor is an interface which can be used to alter URLs
+ before they are used by the QML engine. This is primarily useful for altering
+ file urls into other file urls, such as selecting different graphical assets
+ for the current platform.
+
+ Relative URLs are intercepted after being resolved against the file path of the
+ current QML context. URL interception also occurs after setting the base path for
+ a loaded QML file. This means that the content loaded for that QML file uses the
+ intercepted URL, but inside the file the pre-intercepted URL is used for resolving
+ relative paths. This allows for interception of .qml file loading without needing
+ all paths (or local types) inside intercepted content to insert a different relative path.
+
+ Compared to setNetworkAccessManagerFactory, QQmlAbstractUrlInterceptor affects all URLs
+ and paths, including local files and embedded resource files. QQmlAbstractUrlInterceptor
+ is synchronous, and for asynchronous files must return a url with an asynchronous scheme
+ (such as http or a custom scheme handled by your own custom QNetworkAccessManager). You
+ can use a QQmlAbstractUrlInterceptor to change file URLs into networked URLs which are
+ handled by your own custom QNetworkAccessManager.
+
+ To implement support for a custom networked scheme, see setNetworkAccessManagerFactory.
+*/
+
+/*
+ \enum QQmlAbstractUrlInterceptor::DataType
+
+ Specifies where URL interception is taking place place.
+
+ Because QML loads qmldir files for locating types, there are two URLs involved in loading a QML type. The URL of the (possibly implicit) qmldir used for locating the type and the URL of the file which defines the type. Intercepting
+ both leads to either complex URL replacement or double URL replacements for the same file.
+
+ \value QmldirFile The URL being intercepted is for a Qmldir file. Intercepting this, but not the QmlFile, allows for swapping out entire sub trees.
+ \value JavaScriptFile The URL being intercepted is an import for a Javascript file.
+ \value QmlFile The URL being intercepted is for a Qml file. Intercepting this, but not the Qmldir file, leaves the base dir of a QML file untouched and acts like replacing the file with another file.
+ \value UrlString The URL being intercepted is a url property in a QML file, and not being used to load a file through the engine.
+
+*/
+
+/*!
+ \fn QUrl QQmlAbstractUrlInterceptor::intercept(const QUrl& url, DataType type)
+
+ A pure virtual function where you can intercept the url. The returned value is taken as the
+ new value for the url. The type of url being intercepted is given by the type variable.
+*/
diff --git a/src/qml/qml/qqmlabstracturlinterceptor_p.h b/src/qml/qml/qqmlabstracturlinterceptor_p.h
new file mode 100644
index 0000000000..186d59e301
--- /dev/null
+++ b/src/qml/qml/qqmlabstracturlinterceptor_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//Private API for 5.1 (at least)
+#ifndef QQMLABSTRACTURLINTERCEPTOR_H
+#define QQMLABSTRACTURLINTERCEPTOR_H
+
+#include <QtCore/qurl.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QML_EXPORT QQmlAbstractUrlInterceptor
+{
+ Q_FLAGS(InterceptionPoint)
+public:
+ enum DataType { //Matches QQmlDataBlob::Type
+ QmlFile = 0,
+ JavaScriptFile = 1,
+ QmldirFile = 2,
+ UrlString = 0x1000
+ };
+
+ QQmlAbstractUrlInterceptor() {}
+ virtual ~QQmlAbstractUrlInterceptor() {}
+ virtual QUrl intercept(const QUrl &path, DataType type) = 0;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index 7dc2c77922..9181dad519 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -72,6 +72,7 @@ void QQmlApplicationEnginePrivate::init()
QCoreApplication::installTranslator(qtTranslator);
translators << qtTranslator;
#endif
+ QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true));
}
void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile)
@@ -133,7 +134,8 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
case QQmlComponent::Null:
return; //These cases just wait for the next status update
}
- delete c;
+
+ c->deleteLater();
}
/*!
@@ -158,16 +160,21 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
}
\endcode
- You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as QtQuick).
+ You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as \c QtQuick).
List of configuration changes from a default QQmlEngine:
\list
\li Connecting Qt.quit() to QCoreApplication::quit()
\li Automatically loads translation files from an i18n directory adjacent to the main QML file.
+ \li Automatically sets an incubuation controller if the scene contains a QQuickWindow.
\endlist
The engine behavior can be further tweaked by using the inherited methods from QQmlEngine.
+
+ \note In the future QQmlApplicationEngine may automatically apply file selectors.
+ To ensure forwards compatibility, do not use folder names containing a '+' character in your QML file
+ structure.
*/
/*!
diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp
index 4dba670be8..d44ae16fd2 100644
--- a/src/qml/qml/qqmlcompileddata.cpp
+++ b/src/qml/qml/qqmlcompileddata.cpp
@@ -221,7 +221,6 @@ QQmlInstruction::Type QQmlCompiledData::instructionType(const QQmlInstruction *i
return QQmlInstruction::I;
FOR_EACH_QML_INSTR(QML_CHECK_INSTR_CODE)
- Q_UNREACHABLE();
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid instruction address");
return static_cast<QQmlInstruction::Type>(0);
# undef QML_CHECK_INSTR_CODE
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 07a29e5a63..dcc33a20a3 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -60,6 +60,7 @@
#include "qqmlscriptstring.h"
#include "qqmlglobal_p.h"
#include "qqmlbinding_p.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <QDebug>
#include <QPointF>
@@ -516,6 +517,10 @@ void QQmlCompiler::genLiteralAssignment(QQmlScript::Property *prop,
// Encoded dir-separators defeat QUrl processing - decode them first
string.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive);
QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
+ // Apply URL interceptor
+ if (engine->urlInterceptor())
+ u = engine->urlInterceptor()->intercept(u,
+ QQmlAbstractUrlInterceptor::UrlString);
instr.propertyIndex = prop->index;
instr.value = output->indexForUrl(u);
output->addInstruction(instr);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 06f99abc8c..382b85685a 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -203,14 +203,14 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
}
\endcode
- Note that the QtQuick 1 version is named QDeclarativeComponent.
+ Note that the \l {Qt Quick 1} version is named QDeclarativeComponent.
*/
/*!
\qmltype Component
\instantiates QQmlComponent
\ingroup qml-utility-elements
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Encapsulates a QML component definition
Components are reusable, encapsulated QML types with well-defined interfaces.
@@ -226,7 +226,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
\snippet qml/component.qml 0
- Notice that while a \l Rectangle by itself would be automatically
+ Notice that while a \l Rectangle by itself would be automatically
rendered and displayed, this is not the case for the above rectangle
because it is defined inside a \c Component. The component encapsulates the
QML types within, as if they were defined in a separate QML
@@ -246,7 +246,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
to specify how each list item is to be displayed.
\c Component objects can also be created dynamically using
- \l{QML:Qt::createComponent()}{Qt.createComponent()}.
+ \l{QtQml2::Qt::createComponent()}{Qt.createComponent()}.
\section2 Creation Context
@@ -312,12 +312,12 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
}
\endqml
- \sa QtQml
+ \sa {Qt QML}
*/
/*!
\enum QQmlComponent::Status
-
+
Specifies the loading status of the QQmlComponent.
\value Null This QQmlComponent has no data. Call loadUrl() or setData() to add QML content.
@@ -382,8 +382,8 @@ void QQmlComponentPrivate::clear()
typeData->release();
typeData = 0;
}
-
- if (cc) {
+
+ if (cc) {
cc->release();
cc = 0;
}
@@ -558,12 +558,12 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QUrl &url, CompilationMod
}
/*!
- Create a QQmlComponent from the given \a fileName and give it the specified
+ Create a QQmlComponent from the given \a fileName and give it the specified
\a parent and \a engine.
\sa loadUrl()
*/
-QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
+QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
QObject *parent)
: QObject(*(new QQmlComponentPrivate), parent)
{
@@ -617,7 +617,7 @@ void QQmlComponent::setData(const QByteArray &data, const QUrl &url)
d->url = url;
QQmlTypeData *typeData = QQmlEnginePrivate::get(d->engine)->typeLoader.getType(data, url);
-
+
if (typeData->isCompleteOrError()) {
d->fromTypeData(typeData);
} else {
@@ -780,10 +780,15 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent)
/*!
Create an object instance from this component. Returns 0 if creation
failed. \a context specifies the context within which to create the object
- instance.
+ instance.
If \a context is 0 (the default), it will create the instance in the
engine' s \l {QQmlEngine::rootContext()}{root context}.
+
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::create(QQmlContext *context)
{
@@ -801,28 +806,31 @@ QObject *QQmlComponent::create(QQmlContext *context)
/*!
This method provides advanced control over component instance creation.
- In general, programmers should use QQmlComponent::create() to create a
+ In general, programmers should use QQmlComponent::create() to create a
component.
Create an object instance from this component. Returns 0 if creation
failed. \a publicContext specifies the context within which to create the object
- instance.
+ instance.
When QQmlComponent constructs an instance, it occurs in three steps:
\list 1
\li The object hierarchy is created, and constant values are assigned.
\li Property bindings are evaluated for the first time.
\li If applicable, QQmlParserStatus::componentComplete() is called on objects.
- \endlist
+ \endlist
QQmlComponent::beginCreate() differs from QQmlComponent::create() in that it
- only performs step 1. QQmlComponent::completeCreate() must be called to
+ only performs step 1. QQmlComponent::completeCreate() must be called to
complete steps 2 and 3.
This breaking point is sometimes useful when using attached properties to
communicate information to an instantiated component, as it allows their
initial values to be configured before property bindings take effect.
- \sa completeCreate()
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa completeCreate(), QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::beginCreate(QQmlContext *publicContext)
{
@@ -950,7 +958,7 @@ void QQmlComponentPrivate::complete(QQmlEnginePrivate *enginePriv, ConstructionS
/*!
This method provides advanced control over component instance creation.
- In general, programmers should use QQmlComponent::create() to create a
+ In general, programmers should use QQmlComponent::create() to create a
component.
This function completes the component creation begun with QQmlComponent::beginCreate()
@@ -1044,7 +1052,7 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context,
{
Q_D(QQmlComponent);
- if (!context)
+ if (!context)
context = d->engine->rootContext();
QQmlContextData *contextData = QQmlContextData::get(context);
@@ -1122,7 +1130,7 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
needParent = true;
}
}
- if (needParent)
+ if (needParent)
qWarning("QQmlComponent: Created graphical object was not "
"placed in the graphics scene.");
}
@@ -1140,15 +1148,15 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
which were not created in QML.
If you wish to create an object without setting a parent, specify \c null for
- the \a parent value. Note that if the returned object is to be displayed, you
- must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent}
+ the \a parent value. Note that if the returned object is to be displayed, you
+ must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent}
property, or else the object will not be visible.
If a \a parent is not provided to createObject(), a reference to the returned object must be held so that
it is not destroyed by the garbage collector. This is true regardless of whether \l{Item::parent} is set afterwards,
since setting the Item parent does not change object ownership; only the graphical parent is changed.
- As of QtQuick 1.1, this method accepts an optional \a properties argument that specifies a
+ As of \c {QtQuick 1.1}, this method accepts an optional \a properties argument that specifies a
map of initial property values for the created object. These values are applied before object
creation is finalized. This is more efficient than setting property values after object creation,
particularly where large sets of property values are defined, and also allows property bindings
@@ -1236,17 +1244,16 @@ void QQmlComponent::createObject(QQmlV4Function *args)
/*!
\qmlmethod object Component::incubateObject(Item parent, object properties, enumeration mode)
- Creates an incubator for instance of this component. Incubators allow new component
+ Creates an incubator for instance of this component. Incubators allow new component
instances to be instantiated asynchronously and not cause freezes in the UI.
- The \a parent argument specifies the parent the created instance will have. Omitting the
+ The \a parent argument specifies the parent the created instance will have. Omitting the
parameter or passing null will create an object with no parent. In this case, a reference
- to the created object must be maintained by the application or the object will eventually
- be garbage collected.
+ to the created object must be held so that it is not destroyed by the garbage collector.
The \a properties argument is specified as a map of property-value items which will be
- set on the created object during its construction. \a mode may be Qt.Synchronous or
- Qt.Asynchronous and controls whether the instance is created synchronously or asynchronously.
+ set on the created object during its construction. \a mode may be Qt.Synchronous or
+ Qt.Asynchronous and controls whether the instance is created synchronously or asynchronously.
The default is asynchronously. In some circumstances, even if Qt.Synchronous is specified,
the incubator may create the object asynchronously. This happens if the component calling
incubateObject() is itself being created asynchronously.
@@ -1329,7 +1336,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
}
QQmlComponentExtension *e = componentExtension(args->engine());
-
+
QV4::ExecutionEngine *v4 = QV8Engine::getV4(args->engine());
QmlIncubatorObject *r = new (v4->memoryManager) QmlIncubatorObject(args->engine(), mode);
r->prototype = e->incubationProto.value().asObject();
@@ -1462,7 +1469,7 @@ void QmlIncubatorObject::setInitialState(QObject *o)
f.asFunctionObject()->call(QV4::Value::fromObject(v4->globalObject), args, 2);
}
}
-
+
void QmlIncubatorObject::destroy(Managed *that)
{
QmlIncubatorObject *o = that->as<QmlIncubatorObject>();
diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h
index 3c27e795c6..ae416dcb1c 100644
--- a/src/qml/qml/qqmlcomponentattached_p.h
+++ b/src/qml/qml/qqmlcomponentattached_p.h
@@ -43,12 +43,13 @@
#define QQMLCOMPONENTATTACHED_P_H
#include <QtQml/qqml.h>
+#include <private/qtqmlglobal_p.h>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QQmlComponentAttached : public QObject
+class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject
{
Q_OBJECT
public:
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index efe586eec1..daa115b952 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -48,6 +48,7 @@
#include "qqmlengine_p.h"
#include "qqmlengine.h"
#include "qqmlinfo.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <qjsengine.h>
#include <QtCore/qvarlengtharray.h>
@@ -429,6 +430,7 @@ QUrl QQmlContextData::resolvedUrl(const QUrl &src)
{
QQmlContextData *ctxt = this;
+ QUrl resolved;
if (src.isRelative() && !src.isEmpty()) {
if (ctxt) {
while(ctxt) {
@@ -439,14 +441,20 @@ QUrl QQmlContextData::resolvedUrl(const QUrl &src)
}
if (ctxt)
- return ctxt->url.resolved(src);
+ resolved = ctxt->url.resolved(src);
else if (engine)
- return engine->baseUrl().resolved(src);
+ resolved = engine->baseUrl().resolved(src);
}
- return QUrl();
} else {
- return src;
+ resolved = src;
}
+
+ if (resolved.isEmpty()) //relative but no ctxt
+ return resolved;
+
+ if (engine && engine->urlInterceptor())
+ resolved = engine->urlInterceptor()->intercept(resolved, QQmlAbstractUrlInterceptor::UrlString);
+ return resolved;
}
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 038badae22..baf00adec4 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -149,7 +149,7 @@ private:
Flags m_flags;
friend class QQmlCompiler;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags)
#if 0
#define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 7ab783c577..76d03f011e 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -83,7 +83,7 @@ public:
hasTaintedV8Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
hasVMEMetaObject(false), parentFrozen(false), notifyList(0), context(0), outerContext(0),
bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
- lineNumber(0), columnNumber(0), compiledData(0), deferredIdx(0), jsEngineId(0),
+ lineNumber(0), columnNumber(0), compiledData(0), deferredData(0), jsEngineId(0),
propertyCache(0), guards(0), extendedData(0) {
init();
}
@@ -174,8 +174,13 @@ public:
quint16 lineNumber;
quint16 columnNumber;
+ struct DeferredData {
+ unsigned int deferredIdx;
+ QQmlCompiledData *compiledData;//Not always the same as the other compiledData
+ QQmlContextData *context;//Could be either context or outerContext
+ };
QQmlCompiledData *compiledData;
- unsigned int deferredIdx;
+ DeferredData *deferredData;
quint32 jsEngineId; // id of the engine that cerated the jsWrapper
QV4::WeakValue jsWrapper;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 26f3ea9b56..be1c28c62b 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -66,6 +66,7 @@
#include <private/qv8debugservice_p.h>
#include <private/qdebugmessageservice_p.h>
#include "qqmlincubator.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <private/qv8profilerservice_p.h>
#include <private/qqmlboundsignal_p.h>
@@ -120,7 +121,7 @@ void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor)
/*!
\qmltype QtObject
\instantiates QObject
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\ingroup qml-utility-elements
\brief A basic QML type
@@ -274,8 +275,9 @@ QQmlImageProviderBase::~QQmlImageProviderBase()
/*!
\qmltype Qt
- \instantiates QQmlEnginePrivate
- \ingroup qml-utility-elements
+\inqmlmodule QtQml 2
+\instantiates QQmlEnginePrivate
+\ingroup qml-utility-elements
\brief The QML global Qt object provides useful enums and functions from Qt.
\keyword QmlGlobalQtObject
@@ -314,7 +316,7 @@ when the property has one of the following types:
\li \c size - use \l{Qt::size()}{Qt.size()}
\endlist
-If the QtQuick module has been imported, the following helper functions for
+If the \c QtQuick module has been imported, the following helper functions for
creating objects of specific data types are also available for clients to use:
\list
\li \c color - use \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()}, \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()}
@@ -509,7 +511,7 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e)
outputWarningsToStdErr(true),
cleanup(0), erroredBindings(0), inProgressCreations(0),
workerScriptEngine(0), activeVME(0),
- networkAccessManager(0), networkAccessManagerFactory(0),
+ networkAccessManager(0), networkAccessManagerFactory(0), urlInterceptor(0),
scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1),
incubatorCount(0), incubationController(0), mutex(QMutex::Recursive)
{
@@ -721,17 +723,17 @@ void QQmlData::flushPendingBindingImpl(int coreIndex)
}
}
+bool QQmlEnginePrivate::baseModulesUninitialized = true;
void QQmlEnginePrivate::init()
{
Q_Q(QQmlEngine);
- static bool firstTime = true;
- if (firstTime) {
+ if (baseModulesUninitialized) {
qmlRegisterType<QQmlComponent>("QML", 1, 0, "Component"); // required for the Compiler.
registerBaseTypes("QtQml", 2, 0); // import which provides language building blocks.
QQmlData::init();
- firstTime = false;
+ baseModulesUninitialized = false;
}
qRegisterMetaType<QVariant>();
@@ -800,7 +802,7 @@ QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine()
In this case, the Text item will be created in the engine's
\l {QQmlEngine::rootContext()}{root context}.
- Note that the QtQuick 1 version is called QDeclarativeEngine.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeEngine.
\sa QQmlComponent, QQmlContext
*/
@@ -831,6 +833,8 @@ QQmlEngine::QQmlEngine(QQmlEnginePrivate &dd, QObject *parent)
Any QQmlContext's created on this engine will be
invalidated, but not destroyed (unless they are parented to the
QQmlEngine object).
+
+ See QJSEngine docs for details on cleaning up the JS engine.
*/
QQmlEngine::~QQmlEngine()
{
@@ -923,6 +927,35 @@ QQmlContext *QQmlEngine::rootContext() const
}
/*!
+ \internal
+ This API is private for 5.1
+
+ Sets the \a urlInterceptor to be used when resolving URLs in QML.
+ This also applies to URLs used for loading script files and QML types.
+ This should not be modifed while the engine is loading files, or URL
+ selection may be inconsistent.
+*/
+void QQmlEngine::setUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor)
+{
+ Q_D(QQmlEngine);
+ d->urlInterceptor = urlInterceptor;
+}
+
+/*!
+ \internal
+ This API is private for 5.1
+
+ Returns the current QQmlAbstractUrlInterceptor. It must not be modified outside
+ the GUI thread.
+*/
+QQmlAbstractUrlInterceptor *QQmlEngine::urlInterceptor() const
+{
+ Q_D(const QQmlEngine);
+ return d->urlInterceptor;
+}
+
+
+/*!
Sets the \a factory to use for creating QNetworkAccessManager(s).
QNetworkAccessManager is used for all network access by QML. By
@@ -1032,7 +1065,7 @@ QQmlImageProviderBase *QQmlEngine::imageProvider(const QString &providerId) cons
{
Q_D(const QQmlEngine);
QMutexLocker locker(&d->mutex);
- return d->imageProviders.value(providerId).data();
+ return d->imageProviders.value(providerId.toLower()).data();
}
/*!
@@ -1044,7 +1077,7 @@ void QQmlEngine::removeImageProvider(const QString &providerId)
{
Q_D(QQmlEngine);
QMutexLocker locker(&d->mutex);
- d->imageProviders.take(providerId);
+ d->imageProviders.take(providerId.toLower());
}
/*!
@@ -1246,11 +1279,13 @@ void QQmlEnginePrivate::doDeleteInEngineThread()
delete d;
}
-Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
+namespace QtQml {
+
+void qmlExecuteDeferred(QObject *object)
{
QQmlData *data = QQmlData::get(object);
- if (data && data->compiledData && data->deferredIdx) {
+ if (data && data->deferredData) {
QQmlObjectCreatingProfiler prof;
if (prof.enabled) {
QQmlType *type = QQmlMetaType::qmlType(object->metaObject());
@@ -1265,8 +1300,9 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
QQmlComponentPrivate::beginDeferred(ep, object, &state);
// Release the reference for the deferral action (we still have one from construction)
- data->compiledData->release();
- data->compiledData = 0;
+ data->deferredData->compiledData->release();
+ delete data->deferredData;
+ data->deferredData = 0;
QQmlComponentPrivate::complete(ep, &state);
}
@@ -1319,6 +1355,41 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+} // namespace QtQml
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
+
+Q_QML_EXPORT void qmlExecuteDeferred(QObject *obj)
+{
+ QtQml::qmlExecuteDeferred(obj);
+}
+
+Q_QML_EXPORT QQmlContext *qmlContext(const QObject *obj)
+{
+ return QtQml::qmlContext(obj);
+}
+
+Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *obj)
+{
+ return QtQml::qmlEngine(obj);
+}
+
+Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int id, const QObject *obj, bool create)
+{
+ return QtQml::qmlAttachedPropertiesObjectById(id, obj, create);
+}
+
+Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
+ const QMetaObject *attachedMetaObject,
+ bool create)
+{
+ return QtQml::qmlAttachedPropertiesObject(idCache, object, attachedMetaObject, create);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
+
QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)
{
#ifndef QQML_NO_DEBUG_PROTOCOL
@@ -1472,6 +1543,12 @@ void QQmlData::destroyed(QObject *object)
compiledData = 0;
}
+ if (deferredData) {
+ deferredData->compiledData->release();
+ delete deferredData;
+ deferredData = 0;
+ }
+
QQmlAbstractBoundSignal *signalHandler = signalHandlers;
while (signalHandler) {
if (signalHandler->isEvaluating()) {
@@ -2150,7 +2227,7 @@ bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */)
QFileInfo info(fileName);
const QString absolute = info.absoluteFilePath();
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
const QString canonical = info.canonicalFilePath();
#elif defined(Q_OS_WIN)
wchar_t buffer[1024];
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h
index 45826a4a67..ab25e06235 100644
--- a/src/qml/qml/qqmlengine.h
+++ b/src/qml/qml/qqmlengine.h
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
+class QQmlAbstractUrlInterceptor;
class Q_QML_EXPORT QQmlImageProviderBase
{
@@ -119,6 +120,9 @@ public:
QNetworkAccessManager *networkAccessManager() const;
+ void setUrlInterceptor(QQmlAbstractUrlInterceptor* urlInterceptor);
+ QQmlAbstractUrlInterceptor* urlInterceptor() const;
+
void addImageProvider(const QString &id, QQmlImageProviderBase *);
QQmlImageProviderBase *imageProvider(const QString &id) const;
void removeImageProvider(const QString &id);
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 62e4ee9e5d..b300dcc791 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -125,6 +125,9 @@ public:
~QQmlEnginePrivate();
void init();
+ // No mutex protecting baseModulesUninitialized, because use outside QQmlEngine
+ // is just qmlClearTypeRegistrations (which can't be called while an engine exists)
+ static bool baseModulesUninitialized;
class PropertyCapture {
public:
@@ -171,6 +174,8 @@ public:
QHash<QString,QSharedPointer<QQmlImageProviderBase> > imageProviders;
+ QQmlAbstractUrlInterceptor* urlInterceptor;
+
int scarceResourcesRefCount;
void referenceScarceResources();
void dereferenceScarceResources();
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 88129b7240..0c8e46bd8d 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
^
\endcode
- Note that the QtQuick 1 version is named QDeclarativeError
+ Note that the \l {Qt Quick 1} version is named QDeclarativeError
\sa QQuickView::errors(), QQmlComponent::errors()
*/
@@ -84,10 +84,11 @@ public:
QString description;
quint16 line;
quint16 column;
+ QObject *object;
};
QQmlErrorPrivate::QQmlErrorPrivate()
-: line(0), column(0)
+: line(0), column(0), object()
{
}
@@ -122,6 +123,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other)
d->description = other.d->description;
d->line = other.d->line;
d->column = other.d->column;
+ d->object = other.d->object;
}
return *this;
}
@@ -215,6 +217,27 @@ void QQmlError::setColumn(int column)
}
/*!
+ Returns the nearest object where this error occurred.
+ Exceptions in bound property expressions set this to the object
+ to which the property belongs. It will be 0 for all
+ other exceptions.
+ */
+QObject *QQmlError::object() const
+{
+ if (d) return d->object;
+ else return 0;
+}
+
+/*!
+ Sets the nearest \a object where this error occurred.
+ */
+void QQmlError::setObject(QObject *object)
+{
+ if (!d) d = new QQmlErrorPrivate;
+ d->object = object;
+}
+
+/*!
Returns the error as a human readable string.
*/
QString QQmlError::toString() const
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index feb13d68d7..e69b3c15ba 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -69,6 +69,8 @@ public:
void setLine(int);
int column() const;
void setColumn(int);
+ QObject *object() const;
+ void setObject(QObject *);
QString toString() const;
private:
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index da66477a03..ddebf02c6c 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -122,7 +122,7 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr,
int result = expr->evaluate().toInt(); // result = 400
\endcode
- Note that the QtQuick 1 version is called QDeclarativeExpression.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeExpression.
*/
/*!
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index edef5a91cd..f77b176404 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE
QQmlExtensionPlugin is a plugin interface that makes it possible to
create QML extensions that can be loaded dynamically into QML applications.
- These extensions allow custom QML types to be made available to the QML engine.
-
+ These extensions allow custom QML types to be made available to the QML engine.
+
To write a QML extension plugin:
-
+
\list
\li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types
using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro
@@ -74,10 +74,10 @@ QT_BEGIN_NAMESPACE
\section1 An example
Suppose there is a new \c TimeModel C++ class that should be made available
- as a new QML element. It provides the current time through \c hour and \c minute
+ as a new QML element. It provides the current time through \c hour and \c minute
properties, like this:
- \snippet qml/plugins/plugin.cpp 0
+ \snippet plugins/plugin.cpp 0
\dots
To make this class available as a QML type, create a plugin that registers
@@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE
module will be named \c TimeExample (as defined in the project
file further below).
- \snippet qml/plugins/plugin.cpp plugin
+ \snippet plugins/plugin.cpp plugin
- This registers the \c TimeModel class with the 1.0 version of this
- plugin library, as a QML type called \c Time. The Q_ASSERT statement
+ This registers the \c TimeModel class with the 1.0 version of this
+ plugin library, as a QML type called \c Time. The Q_ASSERT statement
ensures the module is imported correctly by any QML components that use this plugin.
- The project file defines the project as a plugin library and specifies
+ The project file defines the project as a plugin library and specifies
it should be built into the \c imports/TimeExample directory:
\code
@@ -102,26 +102,26 @@ QT_BEGIN_NAMESPACE
DESTDIR = imports/TimeExample
TARGET = qmlqtimeexampleplugin
...
- \endcode
+ \endcode
Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory
that describes the plugin. This directory includes a \c Clock.qml file that
should be bundled with the plugin, so it needs to be specified in the \c qmldir
file:
- \quotefile qml/plugins/imports/TimeExample/qmldir
+ \quotefile plugins/imports/TimeExample/qmldir
- Once the project is built and installed, the new \c Time element can be
+ Once the project is built and installed, the new \c Time element can be
used by any QML component that imports the \c TimeExample module:
- \snippet qml/plugins/plugins.qml 0
+ \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}.
The \l {Writing QML Extensions with C++} tutorial also contains a chapter
on creating QML plugins.
- Note that the QtQuick 1 version is called QDeclarativeExtensionPlugin.
+ Note that the \l {Qt Quick 1} version is called QDeclarativeExtensionPlugin.
\sa QQmlEngine::importPlugin(), {How to Create Qt Plugins}
*/
@@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE
plugin.
The \a uri is an identifier for the plugin generated by the QML engine
- based on the name and path of the extension's plugin library.
+ based on the name and path of the extension's plugin library.
*/
/*!
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index c9eec4c23b..0c9e685a07 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -317,7 +317,7 @@ class QQmlApplicationPrivate;
class Q_QML_PRIVATE_EXPORT QQmlApplication : public QObject
{
- //Application level logic, subclassed by QtQuick if available via QQmlGuiProvider
+ //Application level logic, subclassed by Qt Quick if available via QQmlGuiProvider
Q_OBJECT
Q_PROPERTY(QStringList arguments READ args CONSTANT)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
@@ -344,8 +344,8 @@ protected:
QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=0);
private:
- Q_DISABLE_COPY(QQmlApplication);
- Q_DECLARE_PRIVATE(QQmlApplication);
+ Q_DISABLE_COPY(QQmlApplication)
+ Q_DECLARE_PRIVATE(QQmlApplication)
};
class QQmlApplicationPrivate : public QObjectPrivate
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index f793ca9604..50b2c8af0d 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -163,6 +163,14 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa
typedef QMap<QString, QString> StringStringMap;
Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
+void qmlClearEnginePlugins()
+{
+ foreach (const QString &s, qmlEnginePluginsWithRegisteredTypes()->values()) {
+ QPluginLoader loader(s);
+ loader.unload(); // ### Always returns false, worth doing?
+ }
+ qmlEnginePluginsWithRegisteredTypes()->clear();
+}
class QQmlImportNamespace
{
@@ -1455,7 +1463,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
const QString &qmldirPath, const QString &qmldirPluginPath,
const QString &baseName)
{
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName,
QStringList()
# ifdef QT_DEBUG
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index 140ca6695e..06b50c09e9 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -182,6 +182,8 @@ private:
QQmlEngine *engine;
};
+void qmlClearEnginePlugins();// For internal use by qmlClearRegisteredProperties
+
QT_END_NAMESPACE
#endif // QQMLIMPORT_P_H
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 66670e2658..32f0eeef36 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -165,6 +165,8 @@ QQmlInfo::~QQmlInfo()
}
}
+namespace QtQml {
+
QQmlInfo qmlInfo(const QObject *me)
{
QQmlInfoPrivate *d = new QQmlInfoPrivate;
@@ -188,5 +190,27 @@ QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
return QQmlInfo(d);
}
+} // namespace QtQml
+
+#if QT_DEPRECATED_SINCE(5, 1)
+
+// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
+
+QQmlInfo qmlInfo(const QObject *me)
+{
+ return QtQml::qmlInfo(me);
+}
+
+QQmlInfo qmlInfo(const QObject *me, const QQmlError &error)
+{
+ return QtQml::qmlInfo(me, error);
+}
+
+QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
+{
+ return QtQml::qmlInfo(me, errors);
+}
+
+#endif // QT_DEPRECATED_SINCE(5, 1)
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h
index 16fca9428e..56ac788624 100644
--- a/src/qml/qml/qqmlinfo.h
+++ b/src/qml/qml/qqmlinfo.h
@@ -48,6 +48,15 @@
QT_BEGIN_NAMESPACE
+class QQmlInfo;
+
+namespace QtQml {
+ // declared in namespace to avoid symbol conflicts with QtDeclarative
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
+ Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+}
+using namespace QtQml;
class QQmlInfoPrivate;
class Q_QML_EXPORT QQmlInfo : public QDebug
@@ -82,18 +91,14 @@ public:
#endif
private:
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
- friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QQmlError &error);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QList<QQmlError> &errors);
QQmlInfo(QQmlInfoPrivate *);
QQmlInfoPrivate *d;
};
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
-Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
-
QT_END_NAMESPACE
#endif // QQMLINFO_H
diff --git a/src/qml/qml/qqmlinstruction.cpp b/src/qml/qml/qqmlinstruction.cpp
index c5a4e5d15c..626140d99d 100644
--- a/src/qml/qml/qqmlinstruction.cpp
+++ b/src/qml/qml/qqmlinstruction.cpp
@@ -58,7 +58,7 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
case QQmlInstruction::DeferInit:
- qWarning().nospace() << idx << "\t\t" << "DEFER_INIT\t\t" << instr->deferInit.bindingsSize << "\t" << instr->deferInit.parserStatusSize;
+ qWarning().nospace() << idx << "\t\t" << "DEFER_INIT\t\t" << instr->deferInit.bindingsSize << "\t" << instr->deferInit.parserStatusSize << "\t" << instr->deferInit.objectStackSize << "\t" << instr->deferInit.listStackSize;
break;
case QQmlInstruction::Done:
qWarning().nospace() << idx << "\t\t" << "DONE";
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 2be4c57db4..3b3227cbbb 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -78,6 +78,11 @@ void QQmlDelayedError::setErrorDescription(const QString &description)
m_error.setDescription(description);
}
+void QQmlDelayedError::setErrorObject(QObject *object)
+{
+ m_error.setObject(object);
+}
+
void QQmlDelayedError::setError(const QV4::Exception &e)
{
m_error.setDescription(e.value().toQString());
@@ -340,6 +345,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope,
error.setLine(line);
if (error.url().isEmpty())
error.setUrl(QUrl::fromLocalFile(filename));
+ error.setObject(scope);
ep->warning(error);
return QV4::PersistentValue();
}
@@ -374,6 +380,7 @@ QV4::PersistentValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt,
error.setLine(line);
if (error.url().isEmpty())
error.setUrl(QUrl::fromLocalFile(filename));
+ error.setObject(scope);
ep->warning(error);
return QV4::PersistentValue();
}
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index 77f8304e95..2e674b214a 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -82,6 +82,7 @@ public:
void setErrorLocation(const QUrl &url, quint16 line, quint16 column);
void setErrorDescription(const QString &description);
+ void setErrorObject(QObject *object);
void setError(const QV4::Exception &e);
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index e6913f01a8..91c9bc2416 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -112,7 +112,7 @@ Attempting to add objects of the incorrect type to a list property will fail.
Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure
that it does not request an out of range element using the count() method before calling at().
-The QtQuick 1 version of this class is named QDeclarativeListReference.
+The \l {Qt Quick 1} version of this class is named QDeclarativeListReference.
*/
/*!
@@ -369,7 +369,7 @@ Q_PROPERTY(QQmlListProperty<Fruit> fruit READ fruit);
QML list properties are typesafe - in this case \c {Fruit} is a QObject type that
\c {Apple}, \c {Orange} and \c {Banana} all derive from.
-The QtQuick 1 version of this class is named QDeclarativeListProperty.
+The \l {Qt Quick 1} version of this class is named QDeclarativeListProperty.
\note QQmlListProperty can only be used for lists of QObject-derived object pointers.
*/
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 32e717ed72..58ef5d0930 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -708,13 +708,13 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
/*!
\qmltype Locale
\instantiates QQmlLocale
- \inqmlmodule QtQuick 2
+ \inqmlmodule QtQml 2
\brief Provides locale specific properties and formatted data
- The Locale object may only be created via the \l{QML:Qt::locale()}{Qt.locale()} function.
+ The Locale object may only be created via the \l{QtQml2::Qt::locale()}{Qt.locale()} function.
It cannot be created directly.
- The \l{QML:Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the
+ The \l{QtQml2::Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the
locale with the specified name, which has the format
"language[_territory][.codeset][@modifier]" or "C".
@@ -751,7 +751,7 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
}
\endcode
- QtQuick Locale's data is based on Common Locale Data Repository v1.8.1.
+ Qt Quick Locale's data is based on Common Locale Data Repository v1.8.1.
\target FormatType
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index dbb397462f..b7138e01b3 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -46,6 +46,7 @@
#include <private/qqmlcustomparser_p.h>
#include <private/qqmlguard_p.h>
#include <private/qhashedstring_p.h>
+#include <private/qqmlimport_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
@@ -585,16 +586,18 @@ void QQmlTypePrivate::init() const
while(mo) {
QQmlType *t = metaTypeData()->metaObjectToType.value(mo);
if (t) {
- if (t->d->extraData.cd->extFunc) {
- QMetaObjectBuilder builder;
- clone(builder, t->d->extraData.cd->extMetaObject, t->d->baseMetaObject, baseMetaObject);
- builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
- QMetaObject *mmo = builder.toMetaObject();
- mmo->d.superdata = baseMetaObject;
- if (!metaObjects.isEmpty())
- metaObjects.last().metaObject->d.superdata = mmo;
- QQmlProxyMetaObject::ProxyData data = { mmo, t->d->extraData.cd->extFunc, 0, 0 };
- metaObjects << data;
+ if (t->d->regType == QQmlType::CppType) {
+ if (t->d->extraData.cd->extFunc) {
+ QMetaObjectBuilder builder;
+ clone(builder, t->d->extraData.cd->extMetaObject, t->d->baseMetaObject, baseMetaObject);
+ builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
+ QMetaObject *mmo = builder.toMetaObject();
+ mmo->d.superdata = baseMetaObject;
+ if (!metaObjects.isEmpty())
+ metaObjects.last().metaObject->d.superdata = mmo;
+ QQmlProxyMetaObject::ProxyData data = { mmo, t->d->extraData.cd->extFunc, 0, 0 };
+ metaObjects << data;
+ }
}
}
mo = mo->d.superdata;
@@ -1069,6 +1072,29 @@ QQmlType *QQmlTypeModuleVersion::type(const QHashedV4String &name) const
else return 0;
}
+void qmlClearTypeRegistrations() // Declared in qqml.h
+{
+ //Only cleans global static, assumed no running engine
+ QWriteLocker lock(metaTypeDataLock());
+ QQmlMetaTypeData *data = metaTypeData();
+
+ for (int i = 0; i < data->types.count(); ++i)
+ delete data->types.at(i);
+
+ QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin();
+ for (; i != data->uriToModule.constEnd(); ++i)
+ delete *i;
+
+ data->types.clear();
+ data->idToType.clear();
+ data->nameToType.clear();
+ data->urlToType.clear();
+ data->metaObjectToType.clear();
+ data->uriToModule.clear();
+
+ QQmlEnginePrivate::baseModulesUninitialized = true; //So the engine re-registers its types
+ qmlClearEnginePlugins();
+}
int registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent)
{
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 5f3d115d5f..26fba2b2fc 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -231,6 +231,7 @@ private:
friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &);
friend int registerInterface(const QQmlPrivate::RegisterInterface &);
friend int registerCompositeType(const QQmlPrivate::RegisterCompositeType &);
+ friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlType(int, const QQmlPrivate::RegisterInterface &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterSingletonType &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterType &);
@@ -259,6 +260,7 @@ private:
//Used by register functions and creates the QQmlTypeModule for them
friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data);
friend struct QQmlMetaTypeData;
+ friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlTypeModule();
~QQmlTypeModule();
diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
index 156c341158..b0271b11f2 100644
--- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
+++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
For more information about signals and threads, see
\l {Threads and QObjects} and \l {Signals and Slots Across Threads}.
- The QtQuick 1 version of this class is named QDeclarativeNetworkAccessManagerFactory.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeNetworkAccessManagerFactory.
\sa {qml/networkaccessmanagerfactory}{NetworkAccessManagerFactory example}
*/
diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp
index 452a8d7eb8..41b7d962ce 100644
--- a/src/qml/qml/qqmlparserstatus.cpp
+++ b/src/qml/qml/qqmlparserstatus.cpp
@@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- The QtQuick 1.0 version of this class is named QDeclarativeParserStatus.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeParserStatus.
*/
/*! \internal */
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 570435ae81..b5b11d2c6a 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -253,7 +253,7 @@ namespace QQmlPrivate
};
struct RegisterCompositeType {
- const QUrl &url;
+ QUrl url;
const char *uri;
int versionMajor;
int versionMinor;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index cb3866a0dc..d1ecfdc52d 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -113,7 +113,7 @@ property.write(24);
qWarning() << "Pixel size should now be 24:" << property.read().toInt();
\endcode
-The QtQuick 1 version of this class was named QDeclarativeProperty.
+The \l {Qt Quick 1} version of this class was named QDeclarativeProperty.
*/
/*!
@@ -1531,6 +1531,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
// we explicitly disallow this case to avoid confusion. Users can still store one
// in an array in a var property if they need to, but the common case is user error.
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
@@ -1546,6 +1547,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QV4::FunctionObject *f = result.asFunctionObject();
if (f && f->bindingKeyFlag) {
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
writeValueProperty(object, core, QVariant::fromValue(
@@ -1558,12 +1560,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
else
errorStr += QLatin1String(QMetaType::typeName(type));
expression->delayedError()->setErrorDescription(errorStr);
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (QV4::FunctionObject *f = result.asFunctionObject()) {
if (f->bindingKeyFlag)
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
else
expression->delayedError()->setErrorDescription(QLatin1String("Unable to assign a function to a property of any type other than var."));
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (!writeValueProperty(object, core, value, context, flags)) {
@@ -1596,6 +1600,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QLatin1String(valueType) +
QLatin1String(" to ") +
QLatin1String(propertyType));
+ expression->delayedError()->setErrorObject(object);
return false;
}
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 7846081a4a..08005f1df2 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1318,25 +1318,10 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
Q_ASSERT(metaObject);
QQmlPropertyData rv;
- {
- const QMetaObject *cmo = metaObject;
- const QByteArray propertyName = property.toUtf8();
- while (cmo) {
- int idx = cmo->indexOfProperty(propertyName);
- if (idx != -1) {
- QMetaProperty p = cmo->property(idx);
- if (p.isScriptable()) {
- rv.load(p);
- return rv;
- } else {
- while (cmo && cmo->propertyOffset() >= idx)
- cmo = cmo->superClass();
- }
- } else {
- cmo = 0;
- }
- }
- }
+
+ /* It's important to check the method list before checking for properties;
+ * otherwise, if the meta object is dynamic, a property will be created even
+ * if not found and it might obscure a method having the same name. */
//Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
@@ -1358,6 +1343,31 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
}
}
+ {
+ const QMetaObject *cmo = metaObject;
+ const QByteArray propertyName = property.toUtf8();
+ while (cmo) {
+ int idx = cmo->indexOfProperty(propertyName);
+ if (idx != -1) {
+ QMetaProperty p = cmo->property(idx);
+ if (p.isScriptable()) {
+ rv.load(p);
+ return rv;
+ } else {
+ bool changed = false;
+ while (cmo && cmo->propertyOffset() >= idx) {
+ cmo = cmo->superClass();
+ changed = true;
+ }
+ /* If the "cmo" variable didn't change, set it to 0 to
+ * avoid running into an infinite loop */
+ if (!changed) cmo = 0;
+ }
+ } else {
+ cmo = 0;
+ }
+ }
+ }
return rv;
}
@@ -1396,7 +1406,8 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, const T &name,
if (cache) {
rv = cache->property(name, obj, context);
- } else {
+ }
+ if (!rv) {
local = qQmlPropertyCacheCreate(obj->metaObject(), qQmlPropertyCacheToString(name));
if (local.isValid())
rv = &local;
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 80c7ebf66a..737b39c199 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -215,7 +215,7 @@ private:
friend class QQmlPropertyCache;
quint32 flags;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags)
class QQmlPropertyData : public QQmlPropertyRawData
{
diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp
index c24891f6d6..7e3a23b489 100644
--- a/src/qml/qml/qqmlscript.cpp
+++ b/src/qml/qml/qqmlscript.cpp
@@ -1317,13 +1317,15 @@ bool QQmlScript::Parser::parse(const QString &qmlcode, const QByteArray & /* pre
QQmlJS::Parser parser(&data->engine);
- if (! parser.parse() || !_errors.isEmpty()) {
+ if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) {
// Extract errors from the parser
foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) {
- if (m.isWarning())
+ if (m.isWarning()) {
+ qWarning("%s:%d : %s", qPrintable(_scriptFile), m.loc.startLine, qPrintable(m.message));
continue;
+ }
QQmlError error;
error.setUrl(url);
diff --git a/src/qml/qml/qqmlscript_p.h b/src/qml/qml/qqmlscript_p.h
index 54e7a67b65..250c71d6ac 100644
--- a/src/qml/qml/qqmlscript_p.h
+++ b/src/qml/qml/qqmlscript_p.h
@@ -512,7 +512,7 @@ public:
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas)
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index c91fc06c22..022083c596 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qqmltypeloader_p.h"
+#include "qqmlabstracturlinterceptor_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
@@ -250,6 +251,23 @@ QQmlDataBlob::~QQmlDataBlob()
}
/*!
+ Sets the manager, and does stuff like selection which needs access to the manager.
+ Must be called before loading can occur.
+*/
+void QQmlDataBlob::startLoading(QQmlDataLoader *manager)
+{
+ Q_ASSERT(status() == QQmlDataBlob::Null);
+ Q_ASSERT(m_manager == 0);
+ m_data.setStatus(QQmlDataBlob::Loading);
+ m_manager = manager;
+
+ //Set here because we need to get the engine from the manager
+ if (manager && manager->engine() && manager->engine()->urlInterceptor())
+ m_url = manager->engine()->urlInterceptor()->intercept(m_url,
+ (QQmlAbstractUrlInterceptor::DataType)m_type);
+}
+
+/*!
Returns the type provided to the constructor.
*/
QQmlDataBlob::Type QQmlDataBlob::type() const
@@ -892,12 +910,7 @@ void QQmlDataLoader::load(QQmlDataBlob *blob, Mode mode)
qWarning("QQmlDataLoader::load(%s): %s thread", qPrintable(blob->m_url.toString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
-
- Q_ASSERT(blob->status() == QQmlDataBlob::Null);
- Q_ASSERT(blob->m_manager == 0);
-
- blob->m_data.setStatus(QQmlDataBlob::Loading);
- blob->m_manager = this;
+ blob->startLoading(this);
if (m_thread->isThisThread()) {
unlock();
@@ -930,11 +943,7 @@ void QQmlDataLoader::loadWithStaticData(QQmlDataBlob *blob, const QByteArray &da
m_thread->isThisThread()?"Compile":"Engine");
#endif
- Q_ASSERT(blob->status() == QQmlDataBlob::Null);
- Q_ASSERT(blob->m_manager == 0);
-
- blob->m_data.setStatus(QQmlDataBlob::Loading);
- blob->m_manager = this;
+ blob->startLoading(this);
if (m_thread->isThisThread()) {
unlock();
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index ee6773b8e7..88bca702db 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -67,6 +67,7 @@
#include <private/qqmldirparser_p.h>
#include <private/qqmlbundle_p.h>
#include <private/qflagpointer_p.h>
+#include <private/qqmlabstracturlinterceptor_p.h>
#include <private/qv4value_p.h>
#include <private/qv4script_p.h>
@@ -94,15 +95,17 @@ public:
Error // Error
};
- enum Type {
- QmlFile,
- JavaScriptFile,
- QmldirFile
+ enum Type { //Matched in QQmlAbstractUrlInterceptor
+ QmlFile = QQmlAbstractUrlInterceptor::QmlFile,
+ JavaScriptFile = QQmlAbstractUrlInterceptor::JavaScriptFile,
+ QmldirFile = QQmlAbstractUrlInterceptor::QmldirFile
};
QQmlDataBlob(const QUrl &, Type);
virtual ~QQmlDataBlob();
+ void startLoading(QQmlDataLoader* manager);
+
Type type() const;
Status status() const;
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 309275777e..cde16e885d 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -47,6 +47,7 @@
#include <private/qmetaobjectbuilder_p.h>
#include "qqmldata_p.h"
#include "qqml.h"
+#include "qqmlinfo.h"
#include "qqmlcustomparser_p.h"
#include "qqmlengine.h"
#include "qqmlcontext.h"
@@ -91,6 +92,8 @@ using namespace QQmlVMETypes;
goto exceptionExit; \
}
+bool QQmlVME::s_enableComponentComplete = true;
+
void QQmlVME::init(QQmlContextData *ctxt, QQmlCompiledData *comp, int start,
QQmlContextData *creation)
{
@@ -132,12 +135,12 @@ bool QQmlVME::initDeferred(QObject *object)
{
QQmlData *data = QQmlData::get(object);
- if (!data || !data->context || !data->compiledData)
+ if (!data || !data->deferredData)
return false;
- QQmlContextData *ctxt = data->context;
- QQmlCompiledData *comp = data->compiledData;
- int start = data->deferredIdx;
+ QQmlContextData *ctxt = data->deferredData->context;
+ QQmlCompiledData *comp = data->deferredData->compiledData;
+ int start = data->deferredData->deferredIdx;
State initState;
initState.flags = State::Deferred;
@@ -949,10 +952,19 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
if (instr.deferCount) {
QObject *target = objects.top();
QQmlData *data = QQmlData::get(target, true);
- data->compiledData = COMP;
- data->compiledData->addref(); // Keep this data referenced until we're initialized
- data->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData();
- Q_ASSERT(data->deferredIdx != 0);
+ if (data->deferredData) {
+ //This rare case still won't always work right
+ qmlInfo(target) << "Setting deferred property across multiple components may not work";
+ delete data->deferredData;
+ }
+ data->deferredData = new QQmlData::DeferredData;
+ //If we're in a CreateQML here, data->compiledData could be reset later
+ data->deferredData->compiledData = COMP;
+ data->deferredData->context = CTXT;
+ // Keep this data referenced until we're initialized
+ data->deferredData->compiledData->addref();
+ data->deferredData->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData();
+ Q_ASSERT(data->deferredData->deferredIdx != 0);
INSTRUCTIONSTREAM += instr.deferCount;
}
QML_END_INSTR(Defer)
@@ -1243,7 +1255,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
bindValues.deallocate();
}
- if (!QQmlEnginePrivate::designerMode()) { // the qml designer does the component complete later
+ if (componentCompleteEnabled()) { // the qml designer does the component complete later
QQmlTrace trace("VME Component Complete");
while (!parserStatus.isEmpty()) {
QQmlParserStatus *status = parserStatus.pop();
@@ -1291,7 +1303,8 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
Q_ASSERT(d);
Q_ASSERT(d->context);
a->add(&d->context->componentAttached);
- emit a->completed();
+ if (componentCompleteEnabled())
+ emit a->completed();
if (watcher.hasRecursed() || interrupt.shouldInterrupt())
return 0;
@@ -1307,6 +1320,21 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
return rv;
}
+void QQmlVME::enableComponentComplete()
+{
+ s_enableComponentComplete = true;
+}
+
+void QQmlVME::disableComponentComplete()
+{
+ s_enableComponentComplete = false;
+}
+
+bool QQmlVME::componentCompleteEnabled()
+{
+ return s_enableComponentComplete;
+}
+
void QQmlVME::blank(QFiniteStack<QQmlAbstractBinding *> &bs)
{
for (int ii = 0; ii < bs.count(); ++ii) {
@@ -1368,7 +1396,7 @@ bool QQmlVMEGuard::isOK() const
return false;
for (int ii = 0; ii < m_contextCount; ++ii)
- if (m_contexts[ii].isNull())
+ if (m_contexts[ii].isNull() || !m_contexts[ii]->engine)
return false;
return true;
diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h
index 863a7a3c6b..750076f277 100644
--- a/src/qml/qml/qqmlvme_p.h
+++ b/src/qml/qml/qqmlvme_p.h
@@ -139,6 +139,10 @@ public:
QObject *execute(QList<QQmlError> *errors, const Interrupt & = Interrupt());
QQmlContextData *complete(const Interrupt & = Interrupt());
+ static void enableComponentComplete();
+ static void disableComponentComplete();
+ static bool componentCompleteEnabled();
+
private:
friend class QQmlVMEGuard;
@@ -178,6 +182,8 @@ private:
static void blank(QFiniteStack<QQmlParserStatus *> &);
static void blank(QFiniteStack<QQmlAbstractBinding *> &);
+
+ static bool s_enableComponentComplete;
};
// Used to check that a QQmlVME that is interrupted mid-execution
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 46f9237727..162f3dbd22 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1046,6 +1046,7 @@ private:
int m_status;
QString m_statusText;
QNetworkRequest m_request;
+ QStringList m_addedHeaders;
QQmlGuard<QNetworkReply> m_network;
void destroyNetwork();
@@ -1100,6 +1101,7 @@ Value QQmlXMLHttpRequest::open(const Value &me, const QString &method,
m_method = method;
m_url = url;
m_state = Opened;
+ m_addedHeaders.clear();
dispatchCallback(me);
return Value::undefinedValue();
}
@@ -1108,10 +1110,11 @@ void QQmlXMLHttpRequest::addHeader(const QString &name, const QString &value)
{
QByteArray utfname = name.toUtf8();
- if (m_request.hasRawHeader(utfname)) {
+ if (m_addedHeaders.contains(name, Qt::CaseInsensitive)) {
m_request.setRawHeader(utfname, m_request.rawHeader(utfname) + ',' + value.toUtf8());
} else {
m_request.setRawHeader(utfname, value.toUtf8());
+ m_addedHeaders.append(name);
}
}
diff --git a/src/qml/qml/v4/qv4jsonobject_p.h b/src/qml/qml/v4/qv4jsonobject_p.h
index 4225f4c4ae..465539e504 100644
--- a/src/qml/qml/v4/qv4jsonobject_p.h
+++ b/src/qml/qml/v4/qv4jsonobject_p.h
@@ -74,6 +74,7 @@ private:
static QJsonValue toJsonValue(const QV4::Value &value, V4ObjectSet &visitedObjects);
static QJsonObject toJsonObject(QV4::Object *o, V4ObjectSet &visitedObjects);
static QJsonArray toJsonArray(QV4::ArrayObject *a, V4ObjectSet &visitedObjects);
+
};
}
diff --git a/src/qml/qml/v4/qv4qobjectwrapper.cpp b/src/qml/qml/v4/qv4qobjectwrapper.cpp
index 42b057c48d..a267c4a894 100644
--- a/src/qml/qml/v4/qv4qobjectwrapper.cpp
+++ b/src/qml/qml/v4/qv4qobjectwrapper.cpp
@@ -266,10 +266,12 @@ QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlCont
QQmlData *ddata = QQmlData::get(m_object, false);
if (!ddata)
return 0;
+ QQmlPropertyData *result = 0;
if (ddata && ddata->propertyCache)
- return ddata->propertyCache->property(propertystring, m_object, qmlContext);
- else
- return QQmlPropertyCache::property(engine->v8Engine->engine(), m_object, propertystring, qmlContext, *local);
+ result = ddata->propertyCache->property(propertystring, m_object, qmlContext);
+ if (!result)
+ result = QQmlPropertyCache::property(engine->v8Engine->engine(), m_object, propertystring, qmlContext, *local);
+ return result;
}
Value QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty, bool includeImports)
@@ -1078,7 +1080,7 @@ static QV4::Value CallMethod(QObject *object, int index, int returnType, int arg
Returns the match score for converting \a actual to be of type \a conversionType. A
zero score means "perfect match" whereas a higher score is worse.
- The conversion table is copied out of the QtScript callQtMethod() function.
+ The conversion table is copied out of the \l QScript::callQtMethod() function.
*/
static int MatchScore(const QV4::Value &actual, int conversionType)
{
diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp
index 24d46277e9..13281875e6 100644
--- a/src/qml/qml/v8/qjsengine.cpp
+++ b/src/qml/qml/v8/qjsengine.cpp
@@ -198,6 +198,10 @@ QJSEngine::QJSEngine(QJSEnginePrivate &dd, QObject *parent)
/*!
Destroys this QJSEngine.
+
+ Garbage is not collected from the persistent JS heap during QJSEngine
+ destruction. If you need all memory freed, call collectGarbage manually
+ right before destroying the QJSEngine.
*/
QJSEngine::~QJSEngine()
{
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 7c7ac124f0..97736355d4 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -612,7 +612,7 @@ to \c format.
The \a date parameter may be a JavaScript \c Date object, a \l{date}{date}
property, a QDate, or QDateTime value. The \a format parameter may be any of
the possible format values as described for
-\l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+\l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a date is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
@@ -655,7 +655,7 @@ Returns a string representation of \c time, optionally formatted according to
The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime
value. The \a format parameter may be any of the possible format values as
-described for \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}.
+described for \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a time is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
@@ -773,7 +773,7 @@ For example, if the following date/time value was specified:
\endcode
This \a dateTime value could be passed to \c Qt.formatDateTime(),
-\l {QML:Qt::formatDate()}{Qt.formatDate()} or \l {QML:Qt::formatTime()}{Qt.formatTime()}
+\l {QtQml2::Qt::formatDate()}{Qt.formatDate()} or \l {QtQml2::Qt::formatTime()}{Qt.formatTime()}
with the \a format values below to produce the following results:
\table
@@ -934,7 +934,7 @@ Example (where \c parentItem is the id of an existing QML item):
\snippet qml/createQmlObject.qml 0
-In the case of an error, a QtScript Error object is thrown. This object has an additional property,
+In the case of an error, a \l {Qt Script} Error object is thrown. This object has an additional property,
\c qmlErrors, which is an array of the errors encountered.
Each object in this array has the members \c lineNumber, \c columnNumber, \c fileName and \c message.
For example, if the above snippet had misspelled color as 'colro' then the array would contain an object like the following:
@@ -942,7 +942,7 @@ For example, if the above snippet had misspelled color as 'colro' then the array
Note that this function returns immediately, and therefore may not work if
the \a qml string loads new components (that is, external QML files that have not yet been loaded).
-If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead.
+If this is the case, consider using \l{QtQml2::Qt::createComponent()}{Qt.createComponent()} instead.
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
*/
@@ -1070,7 +1070,7 @@ For example:
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
To create a QML object from an arbitrary string of QML (instead of a file),
-use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
+use \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
Value QtObject::method_createComponent(SimpleCallContext *ctx)
{
@@ -1243,9 +1243,9 @@ DEFINE_MANAGED_VTABLE(BindingFunction);
\snippet qml/qtBinding.4.qml 0
- Note: in QtQuick 1.x, all function assignment was treated as
+ \note In \l {Qt Quick 1}, all function assignment was treated as
binding assignment, so the Qt.binding() function is new in
- QtQuick 2.0.
+ \l {Qt Quick}{Qt Quick 2}.
\since QtQuick 2.0
*/
@@ -1613,7 +1613,7 @@ void QV4::GlobalExtensions::init(QQmlEngine *qmlEngine, Object *globalObject)
Example:
\snippet qml/qsTranslate.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTranslate(SimpleCallContext *ctx)
{
@@ -1669,7 +1669,7 @@ Value GlobalExtensions::method_qsTranslate(SimpleCallContext *ctx)
Example:
\snippet qml/qtTranslateNoOp.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTranslateNoOp(SimpleCallContext *ctx)
{
@@ -1693,7 +1693,7 @@ Value GlobalExtensions::method_qsTranslateNoOp(SimpleCallContext *ctx)
Example:
\snippet qml/qsTr.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTr(SimpleCallContext *ctx)
{
@@ -1747,7 +1747,7 @@ Value GlobalExtensions::method_qsTr(SimpleCallContext *ctx)
Example:
\snippet qml/qtTrNoOp.qml 0
- \sa {Localization And Internationalization Support In Qt Quick}
+ \sa {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrNoOp(SimpleCallContext *ctx)
{
@@ -1784,7 +1784,7 @@ Value GlobalExtensions::method_qsTrNoOp(SimpleCallContext *ctx)
Creating binary translation (QM) files suitable for use with this function requires passing
the \c -idbased option to the \c lrelease tool.
- \sa QT_TRID_NOOP, {Localization And Internationalization Support In Qt Quick}
+ \sa QT_TRID_NOOP, {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrId(SimpleCallContext *ctx)
{
@@ -1816,7 +1816,7 @@ Value GlobalExtensions::method_qsTrId(SimpleCallContext *ctx)
Example:
\snippet qml/qtTrIdNoOp.qml 0
- \sa qsTrId(), {Localization And Internationalization Support In Qt Quick}
+ \sa qsTrId(), {Internationalization and Localization with Qt Quick}
*/
Value GlobalExtensions::method_qsTrIdNoOp(SimpleCallContext *ctx)
{
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index fcb3079891..4c4e541e11 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -139,7 +139,7 @@ public:
If the binding target or binding property is changed, the bound value is
immediately pushed onto the new target.
- \sa QtQml
+ \sa {Qt QML}
*/
QQmlBind::QQmlBind(QObject *parent)
: QObject(*(new QQmlBindPrivate), parent)
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 286933e557..93df0842fe 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -126,7 +126,7 @@ public:
}
\endqml
- \sa QtQml
+ \sa {Qt QML}
*/
QQmlConnections::QQmlConnections(QObject *parent) :
QObject(*(new QQmlConnectionsPrivate), parent)
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index aa665e4283..afd2a49155 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -144,8 +144,9 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The VisualDataModel type encapsulates a model and the delegate that will
be instantiated for items in a model.
- This type is provided by QtQuick 2 for compatibility reasons. The same implementation
- is now primarily available as DelegateModel in the QtQml.Models module.
+ This type is provided by the \l{Qt QML} module due to compatibility reasons.
+ The same implementation is now primarily available as DelegateModel in the
+ \l{Qt QML Models QML Types}{Qt QML Models} module.
\sa {QtQml.Models2::DelegateModel}
*/
@@ -158,9 +159,6 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The DelegateModel type encapsulates a model and the delegate that will
be instantiated for items in the model.
- This element is also available as DelegateModel in the QtQuick module. For full details,
- see the \l DelegateModel documentation.
-
It is usually not necessary to create a DelegateModel.
However, it can be useful for manipulating and accessing the \l modelIndex
when a QAbstractItemModel subclass is used as the
@@ -170,7 +168,10 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The example below illustrates using a DelegateModel with a ListView.
- \snippet qml/visualdatamodel.qml 0
+ \snippet delegatemodel/visualdatamodel.qml 0
+
+ \note This type is also available as \l VisualDataModel in the \l{Qt QML}
+ module due to compatibility reasons.
*/
QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt)
@@ -243,6 +244,8 @@ QQmlDelegateModel::~QQmlDelegateModel()
cacheItem->objectRef = 0;
if (!cacheItem->isReferenced())
delete cacheItem;
+ else if (cacheItem->incubationTask)
+ cacheItem->incubationTask->vdm = 0;
}
}
@@ -408,10 +411,10 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate)
the new directory's contents.
\c main.cpp:
- \snippet qml/visualdatamodel_rootindex/main.cpp 0
+ \snippet delegatemodel/visualdatamodel_rootindex/main.cpp 0
\c view.qml:
- \snippet qml/visualdatamodel_rootindex/view.qml 0
+ \snippet delegatemodel/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
@@ -615,7 +618,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at(
The following example illustrates using groups to select items in a model.
- \snippet qml/visualdatagroup.qml 0
+ \snippet delegatemodel/visualdatagroup.qml 0
*/
QQmlListProperty<QQmlDelegateModelGroup> QQmlDelegateModel::groups()
@@ -791,9 +794,28 @@ void QQmlDelegateModelPrivate::emitDestroyingPackage(QQuickPackage *package)
QQmlDelegateModelGroupPrivate::get(m_groups[i])->destroyingPackage(package);
}
+static bool isDoneIncubating(QQmlIncubator::Status status)
+{
+ return status == QQmlIncubator::Ready || status == QQmlIncubator::Error;
+}
+
void QQDMIncubationTask::statusChanged(Status status)
{
- vdm->incubatorStatusChanged(this, status);
+ if (vdm) {
+ vdm->incubatorStatusChanged(this, status);
+ } else if (isDoneIncubating(status)) {
+ Q_ASSERT(incubating);
+ // The model was deleted from under our feet, cleanup ourselves
+ if (incubating->object) {
+ delete incubating->object;
+
+ incubating->object = 0;
+ incubating->contextData->destroy();
+ incubating->contextData = 0;
+ }
+ incubating->scriptRef = 0;
+ incubating->deleteLater();
+ }
}
void QQmlDelegateModelPrivate::releaseIncubator(QQDMIncubationTask *incubationTask)
@@ -821,7 +843,7 @@ void QQmlDelegateModelPrivate::removeCacheItem(QQmlDelegateModelItem *cacheItem)
void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incubationTask, QQmlIncubator::Status status)
{
Q_Q(QQmlDelegateModel);
- if (status != QQmlIncubator::Ready && status != QQmlIncubator::Error)
+ if (!isDoneIncubating(status))
return;
QQmlDelegateModelItem *cacheItem = incubationTask->incubating;
@@ -830,10 +852,12 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba
releaseIncubator(incubationTask);
if (status == QQmlIncubator::Ready) {
+ cacheItem->referenceObject();
if (QQuickPackage *package = qmlobject_cast<QQuickPackage *>(cacheItem->object))
emitCreatedPackage(incubationTask, package);
else
emitCreatedItem(incubationTask, cacheItem->object);
+ cacheItem->releaseObject();
} else if (status == QQmlIncubator::Error) {
qmlInfo(q, m_delegate->errors()) << "Error creating delegate";
}
@@ -846,8 +870,10 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba
delete cacheItem->object;
cacheItem->object = 0;
cacheItem->scriptRef -= 1;
- cacheItem->contextData->destroy();
+ if (cacheItem->contextData)
+ cacheItem->contextData->destroy();
cacheItem->contextData = 0;
+
if (!cacheItem->isReferenced()) {
removeCacheItem(cacheItem);
delete cacheItem;
@@ -945,7 +971,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo
// Remove the temporary reference count.
cacheItem->scriptRef -= 1;
- if (cacheItem->object)
+ if (cacheItem->object && (!cacheItem->incubationTask || isDoneIncubating(cacheItem->incubationTask->status())))
return cacheItem->object;
cacheItem->releaseObject();
@@ -960,7 +986,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo
/*
If asynchronous is true or the component is being loaded asynchronously due
to an ancestor being loaded asynchronously, item() may return 0. In this
- case itemCreated() will be emitted when the item is available. The item
+ case createdItem() will be emitted when the item is available. The item
at this stage does not have any references, so item() must be called again
to ensure a reference is held. Any call to item() which returns a valid item
must be matched by a call to release() in order to destroy the item.
@@ -1168,8 +1194,8 @@ void QQmlDelegateModelPrivate::itemsInserted(
cacheIndex = insert.cacheIndex + insert.count;
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, inserted);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, inserted);
}
void QQmlDelegateModelPrivate::itemsInserted(const QVector<Compositor::Insert> &inserts)
@@ -1193,8 +1219,9 @@ void QQmlDelegateModel::_q_itemsInserted(int index, int count)
d->m_count += count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index)
item->setModelIndex(item->modelIndex() + count);
}
@@ -1285,8 +1312,8 @@ void QQmlDelegateModelPrivate::itemsRemoved(
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, removed);
}
void QQmlDelegateModelPrivate::itemsRemoved(const QVector<Compositor::Remove> &removes)
@@ -1308,9 +1335,9 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count)
return;
d->m_count -= count;
-
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index + count)
item->setModelIndex(item->modelIndex() - count);
else if (item->modelIndex() >= index)
@@ -1356,8 +1383,9 @@ void QQmlDelegateModel::_q_itemsMoved(int from, int to, int count)
const int maximum = qMax(from, to) + count;
const int difference = from > to ? count : -count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= from && item->modelIndex() < from + count)
item->setModelIndex(item->modelIndex() - from + to);
else if (item->modelIndex() >= minimum && item->modelIndex() < maximum)
@@ -1413,8 +1441,9 @@ void QQmlDelegateModel::_q_modelReset()
if (d->m_complete) {
d->m_count = d->m_adaptorModel.count();
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() != -1)
item->setModelIndex(-1);
}
@@ -1773,8 +1802,12 @@ QQmlDelegateModelItem::~QQmlDelegateModelItem()
Q_ASSERT(objectRef == 0);
Q_ASSERT(!object);
- if (incubationTask && metaType->model)
- QQmlDelegateModelPrivate::get(metaType->model)->releaseIncubator(incubationTask);
+ if (incubationTask) {
+ if (metaType->model)
+ QQmlDelegateModelPrivate::get(metaType->model)->releaseIncubator(incubationTask);
+ else
+ delete incubationTask;
+ }
metaType->release();
@@ -2149,14 +2182,31 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
}
/*!
- \qmltype DelegateModelGroup
+ \qmltype VisualDataGroup
\instantiates QQmlDelegateModelGroup
\inqmlmodule QtQuick 2
\ingroup qtquick-models
\brief Encapsulates a filtered set of visual data items
- The DelegateModelGroup type provides a means to address the model data of a DelegateModel's
- delegate items, as well as sort and filter these delegate items.
+ The VisualDataGroup type provides a means to address the model data of a
+ model's delegate items, as well as sort and filter these delegate items.
+
+ This type is provided by the \l{Qt QML} module due to compatibility reasons.
+ The same implementation is now primarily available as \l DelegateModelGroup
+ in the \l{Qt QML Models QML Types}{Qt QML Models} module.
+
+ \sa {QtQml.Models2::DelegateModelGroup}
+*/
+/*!
+ \qmltype DelegateModelGroup
+ \instantiates QQmlDelegateModelGroup
+ \inqmlmodule QtQml.Models 2
+ \ingroup qtquick-models
+ \brief Encapsulates a filtered set of visual data items
+
+ The DelegateModelGroup type provides a means to address the model data of a
+ DelegateModel's delegate items, as well as sort and filter these delegate
+ items.
The initial set of instantiable delegate items in a DelegateModel is represented
by its \l {QtQml.Models2::DelegateModel::items}{items} group, which normally directly reflects
@@ -2180,24 +2230,11 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
type or to cherry-pick specific items that should be instantiated irregardless of whether
they're currently within a view's visible area.
- \sa {QML Dynamic View Ordering Tutorial}
-*/
-/*!
- \qmltype DelegateModelGroup
- \instantiates QQmlDelegateModelGroup
- \inqmlmodule QtQml.Models 2
- \brief Encapsulates a filtered set of visual data items
-
- The DelegateModelGroup type provides a means to address the model data of a DelegateModel's
- delegate items, as well as sort and filter these delegate items.
-
- This element is also available as DelegateModelGroup in the QtQuick module. For full details,
- see the \l DelegateModelGroup documentation.
+ \note This type is also available as \l VisualDataGroup in the \l{Qt QML}
+ module due to compatibility reasons.
- \sa {QtQuick::DelegateModelGroup}
+ \sa {QML Dynamic View Ordering Tutorial}
*/
-
-
QQmlDelegateModelGroup::QQmlDelegateModelGroup(QObject *parent)
: QObject(*new QQmlDelegateModelGroupPrivate, parent)
{
@@ -3222,4 +3259,3 @@ QV4::Value QQmlDelegateModelEngineData::array(
}
QT_END_NAMESPACE
-
diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp
index a2a1fa23ad..234494e088 100644
--- a/src/qml/types/qqmlinstantiator.cpp
+++ b/src/qml/types/qqmlinstantiator.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
QQmlInstantiatorPrivate::QQmlInstantiatorPrivate()
: componentComplete(true)
+ , effectiveReset(false)
, active(true)
, async(false)
, ownModel(false)
@@ -124,7 +125,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
{
Q_Q(QQmlInstantiator);
- if (componentComplete)
+ if (!componentComplete || effectiveReset)
return;
if (reset) {
@@ -162,7 +163,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
objects = objects.mid(0, index) + movedObjects + objects.mid(index);
} else for (int i = 0; i < insert.count; ++i) {
int modelIndex = index + i;
- QObject* obj = instanceModel->object(i, async);
+ QObject* obj = instanceModel->object(modelIndex, async);
if (obj)
_q_createdItem(modelIndex, obj);
}
@@ -378,8 +379,11 @@ void QQmlInstantiator::setModel(const QVariant &v)
if (!d->ownModel)
d->makeModel();
- if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel *>(d->instanceModel))
+ if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel *>(d->instanceModel)) {
+ d->effectiveReset = true;
dataModel->setModel(v);
+ d->effectiveReset = false;
+ }
}
if (d->instanceModel != prevModel) {
diff --git a/src/qml/types/qqmlinstantiator_p_p.h b/src/qml/types/qqmlinstantiator_p_p.h
index 79459299dc..a7d6905a7e 100644
--- a/src/qml/types/qqmlinstantiator_p_p.h
+++ b/src/qml/types/qqmlinstantiator_p_p.h
@@ -75,10 +75,11 @@ public:
void _q_createdItem(int, QObject *);
void _q_modelUpdated(const QQmlChangeSet &, bool);
- bool componentComplete;
- bool active;
- bool async;
- bool ownModel;
+ bool componentComplete:1;
+ bool effectiveReset:1;
+ bool active:1;
+ bool async:1;
+ bool ownModel:1;
QVariant model;
QQmlInstanceModel *instanceModel;
QQmlComponent *delegate;
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 8e1821092b..5091e46499 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1412,22 +1412,12 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru
\qmltype ListModel
\instantiates QQmlListModel
\inqmlmodule QtQml.Models 2
- \brief Defines a free-form list data source
-
- The ListModel is a simple container of ListElement definitions, each containing data roles.
- The contents can be defined dynamically, or explicitly in QML.
-
- This type is also available in the QtQuick 2 import. For full documentation, see \l QtQuick2::ListModel
-*/
-/*!
- \qmltype ListModel
- \instantiates QQmlListModel
- \inqmlmodule QtQuick 2
- \brief Defines a free-form list data source
\ingroup qtquick-models
+ \brief Defines a free-form list data source
- The ListModel is a simple container of ListElement definitions, each containing data roles.
- The contents can be defined dynamically, or explicitly in QML.
+ The ListModel is a simple container of ListElement definitions, each
+ containing data roles. The contents can be defined dynamically, or
+ explicitly in QML.
The number of elements in the model can be obtained from its \l count property.
A number of familiar methods are also provided to manipulate the contents of the
@@ -1509,7 +1499,7 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru
handler. You must call sync() or else the changes made to the list from the external
thread will not be reflected in the list model in the main thread.
- \sa {qml-data-models}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, QtQml
+ \sa {qml-data-models}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, {Qt QML}
*/
QQmlListModel::QQmlListModel(QObject *parent)
@@ -1787,7 +1777,7 @@ QHash<int, QByteArray> QQmlListModel::roleNames() const
}
/*!
- \qmlproperty bool QtQml2::ListModel::dynamicRoles
+ \qmlproperty bool ListModel::dynamicRoles
By default, the type of a role is fixed the first time
the role is used. For example, if you create a role called
@@ -1833,7 +1823,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles)
}
/*!
- \qmlproperty int QtQml2::ListModel::count
+ \qmlproperty int ListModel::count
The number of data entries in the model.
*/
int QQmlListModel::count() const
@@ -2516,16 +2506,6 @@ bool QQmlListModelParser::definesEmptyList(const QString &s)
\instantiates QQmlListElement
\inqmlmodule QtQml.Models 2
\brief Defines a data item in a ListModel
-
- List elements are defined inside ListModel definitions, and represent items in a list.
-
- This type is also available in the QtQuick 2 import. For full documentation, see \l QtQuick2::ListElement
-*/
-/*!
- \qmltype ListElement
- \instantiates QQmlListElement
- \inqmlmodule QtQuick 2
- \brief Defines a data item in a ListModel
\ingroup qtquick-models
List elements are defined inside ListModel definitions, and represent items in a
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 5cee6a0251..48cd248c32 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -229,6 +229,9 @@ private:
QStringHash<Role *> roleHash;
};
+/*!
+\internal
+*/
class ListElement
{
public:
@@ -292,6 +295,9 @@ private:
friend class ListModel;
};
+/*!
+\internal
+*/
class ListModel
{
public:
@@ -375,4 +381,3 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(ListModel *);
#endif // QQUICKLISTMODEL_P_P_H
-
diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp
index 7f7bf92fa3..f2a7477c1b 100644
--- a/src/qml/types/qqmlobjectmodel.cpp
+++ b/src/qml/types/qqmlobjectmodel.cpp
@@ -176,7 +176,7 @@ public:
as a model.
This element is now primarily available as ObjectModel in the QtQml.Models module.
- VisualItemModel continues to be provided, with the same implementation, in QtQuick for
+ VisualItemModel continues to be provided, with the same implementation, in \c QtQuick for
compatibility reasons.
For full details about the type, see the \l ObjectModel documentation.
@@ -266,4 +266,3 @@ QQmlObjectModelAttached *QQmlObjectModel::qmlAttachedProperties(QObject *obj)
}
QT_END_NAMESPACE
-
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index e885524b27..bdb8a4bc15 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -73,7 +73,8 @@ QT_BEGIN_NAMESPACE
\snippet quick/views/package/view.qml 0
- \sa {quick/views/package}{Package example}, {quick/demos/photoviewer}{Photo Viewer example}, QtQml
+ \sa {quick/views/package}{Package example}, {quick/demos/photoviewer}{Photo
+ Viewer example}, {Qt QML}
*/
/*!
diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro
index a65ef94da9..10e1ce0275 100644
--- a/src/qmldevtools/qmldevtools.pro
+++ b/src/qmldevtools/qmldevtools.pro
@@ -3,9 +3,10 @@ TARGET = QtQmlDevTools
QT = core
CONFIG += static no_module_headers internal_module
-MODULE_PRIVATE_INCLUDES = \
+MODULE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE \
- \$\$QT_MODULE_INCLUDE_BASE/QtQml \
+ \$\$QT_MODULE_INCLUDE_BASE/QtQml
+MODULE_PRIVATE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION \
\$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION/QtQml
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 1dc0e3fecb..2db68bad16 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -344,7 +344,7 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
rootobj.setWindowShown(true);
if (!rootobj.hasQuit && rootobj.hasTestCase())
eventLoop.exec();
- // view->hide(); Causes a crash in Qt3D due to deletion of the GL context, see QTBUG-27696
+ // view->hide(); Causes a crash in Qt 3D due to deletion of the GL context, see QTBUG-27696
}
}
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp
index 7f75857fe4..2dd041b968 100644
--- a/src/quick/designer/designersupport.cpp
+++ b/src/quick/designer/designersupport.cpp
@@ -51,6 +51,8 @@
#include <QtQuick/private/qquickstategroup_p.h>
#include <QtGui/QImage>
#include <private/qqmlvme_p.h>
+#include <private/qqmlcomponentattached_p.h>
+#include <private/qqmldata_p.h>
#include "designerwindowmanager_p.h"
@@ -375,6 +377,17 @@ void DesignerSupport::resetAnchor(QQuickItem *item, const QString &name)
}
}
+void DesignerSupport::emitComponentCompleteSignalForAttachedProperty(QQuickItem *item)
+{
+ QQmlData *data = QQmlData::get(item);
+ if (data && data->context) {
+ QQmlComponentAttached *componentAttached = data->context->componentAttached;
+ if (componentAttached) {
+ emit componentAttached->completed();
+ }
+ }
+}
+
QList<QObject*> DesignerSupport::statesForItem(QQuickItem *item)
{
QList<QObject*> objectList;
@@ -437,6 +450,16 @@ void DesignerSupport::activateDesignerMode()
QQmlEnginePrivate::activateDesignerMode();
}
+void DesignerSupport::disableComponentComplete()
+{
+ QQmlVME::disableComponentComplete();
+}
+
+void DesignerSupport::enableComponentComplete()
+{
+ QQmlVME::enableComponentComplete();
+}
+
void DesignerSupport::createOpenGLContext(QQuickWindow *window)
{
DesignerWindowManager::createOpenGLContext(window);
diff --git a/src/quick/designer/designersupport.h b/src/quick/designer/designersupport.h
index c93cffa7fa..5139a65645 100644
--- a/src/quick/designer/designersupport.h
+++ b/src/quick/designer/designersupport.h
@@ -125,6 +125,7 @@ public:
static QQuickItem *anchorCenterInTargetItem(QQuickItem *item);
static QPair<QString, QObject*> anchorLineTarget(QQuickItem *item, const QString &name, QQmlContext *context);
static void resetAnchor(QQuickItem *item, const QString &name);
+ static void emitComponentCompleteSignalForAttachedProperty(QQuickItem *item);
static QList<QObject*> statesForItem(QQuickItem *item);
@@ -145,6 +146,9 @@ public:
static void activateDesignerWindowManager();
static void activateDesignerMode();
+ static void disableComponentComplete();
+ static void enableComponentComplete();
+
static void createOpenGLContext(QQuickWindow *window);
static void polishItems(QQuickWindow *window);
diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h
index 02aacf06bd..3bbd0c2825 100644
--- a/src/quick/designer/designerwindowmanager_p.h
+++ b/src/quick/designer/designerwindowmanager_p.h
@@ -67,7 +67,7 @@ class QSGContext;
class QAnimationDriver;
class QOpenGLContext;
-class DesignerWindowManager : public QObject, public QSGRenderLoop
+class DesignerWindowManager : public QSGRenderLoop
{
Q_OBJECT
public:
diff --git a/src/quick/doc/images/particles/fuzzydot.png b/src/quick/doc/images/particles/fuzzydot.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/src/quick/doc/images/particles/fuzzydot.png
Binary files differ
diff --git a/src/quick/doc/images/particles/glowdot.png b/src/quick/doc/images/particles/glowdot.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/src/quick/doc/images/particles/glowdot.png
Binary files differ
diff --git a/src/quick/doc/images/particles/star.png b/src/quick/doc/images/particles/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/src/quick/doc/images/particles/star.png
Binary files differ
diff --git a/src/quick/doc/images/qml-extending-types.png b/src/quick/doc/images/qml-extending-types.png
deleted file mode 100644
index 6990d7c190..0000000000
--- a/src/quick/doc/images/qml-extending-types.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-animation.png b/src/quick/doc/images/qml-uses-animation.png
deleted file mode 100644
index b54361260c..0000000000
--- a/src/quick/doc/images/qml-uses-animation.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-integratingjs.png b/src/quick/doc/images/qml-uses-integratingjs.png
deleted file mode 100644
index 3bb0d8aadf..0000000000
--- a/src/quick/doc/images/qml-uses-integratingjs.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-anchors.png b/src/quick/doc/images/qml-uses-layouts-anchors.png
deleted file mode 100644
index 769597cf52..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-anchors.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-direct.png b/src/quick/doc/images/qml-uses-layouts-direct.png
deleted file mode 100644
index 0682da36f8..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-direct.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-layouts-positioners.png b/src/quick/doc/images/qml-uses-layouts-positioners.png
deleted file mode 100644
index ebdd9c58dd..0000000000
--- a/src/quick/doc/images/qml-uses-layouts-positioners.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-styling-text.png b/src/quick/doc/images/qml-uses-styling-text.png
deleted file mode 100644
index af2518a9e8..0000000000
--- a/src/quick/doc/images/qml-uses-styling-text.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-styling.png b/src/quick/doc/images/qml-uses-styling.png
deleted file mode 100644
index a6bf68e783..0000000000
--- a/src/quick/doc/images/qml-uses-styling.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-text.png b/src/quick/doc/images/qml-uses-text.png
deleted file mode 100644
index 6b3d88cb3f..0000000000
--- a/src/quick/doc/images/qml-uses-text.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-userinput.png b/src/quick/doc/images/qml-uses-userinput.png
deleted file mode 100644
index 2793e8d1d7..0000000000
--- a/src/quick/doc/images/qml-uses-userinput.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-opacity.png b/src/quick/doc/images/qml-uses-visual-opacity.png
deleted file mode 100644
index ab238deb54..0000000000
--- a/src/quick/doc/images/qml-uses-visual-opacity.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-rectangles.png b/src/quick/doc/images/qml-uses-visual-rectangles.png
deleted file mode 100644
index acf7cb160a..0000000000
--- a/src/quick/doc/images/qml-uses-visual-rectangles.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/images/qml-uses-visual-transforms.png b/src/quick/doc/images/qml-uses-visual-transforms.png
deleted file mode 100644
index d89fc75256..0000000000
--- a/src/quick/doc/images/qml-uses-visual-transforms.png
+++ /dev/null
Binary files differ
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index d9b4e03818..30861d9b2e 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtquick/qtquick.tags
-depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist
+depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs
headerdirs += ..
@@ -58,3 +58,8 @@ sourcedirs += ../../imports
#add plugins directory because of dependencies
headerdirs += ../../plugins
sourcedirs += ../../plugins
+
+#exclude certain directories
+excludedirs += ../../imports/dialogs \
+ ../../imports/models \
+ ../../../examples/quick/dialogs
diff --git a/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml b/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml
deleted file mode 100644
index bbb40a77ee..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/dotproperties.qml
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.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/src/quick/doc/snippets/qml/codingconventions/javascript.qml b/src/quick/doc/snippets/qml/codingconventions/javascript.qml
deleted file mode 100644
index 72c954f699..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/javascript.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.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/src/quick/doc/snippets/qml/codingconventions/lists.qml b/src/quick/doc/snippets/qml/codingconventions/lists.qml
deleted file mode 100644
index c45129187e..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/lists.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.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/src/quick/doc/snippets/qml/codingconventions/myscript.js b/src/quick/doc/snippets/qml/codingconventions/myscript.js
deleted file mode 100644
index cfa646250b..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/myscript.js
+++ /dev/null
@@ -1,9 +0,0 @@
-function calculateWidth(parent)
-{
- var w = parent.width / 3
- // ...
- // more javascript code
- // ...
- console.debug(w)
- return w
-}
diff --git a/src/quick/doc/snippets/qml/codingconventions/photo.qml b/src/quick/doc/snippets/qml/codingconventions/photo.qml
deleted file mode 100644
index 5260f87127..0000000000
--- a/src/quick/doc/snippets/qml/codingconventions/photo.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.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/src/qml/doc/snippets/qml/colors.qml b/src/quick/doc/snippets/qml/colors.qml
index 2885f13c81..473df711bd 100644
--- a/src/qml/doc/snippets/qml/colors.qml
+++ b/src/quick/doc/snippets/qml/colors.qml
@@ -42,7 +42,7 @@ import QtQuick 2.0
Rectangle {
width: 160; height: 250
-
+
Image {
width: 160; height: 200
source: "pics/checker.svg"
diff --git a/src/quick/doc/snippets/qml/text/onLinkActivated.qml b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
index 9bb4d3a0bb..7a44dcc557 100644
--- a/src/quick/doc/snippets/qml/text/onLinkActivated.qml
+++ b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
@@ -45,7 +45,7 @@ Rectangle {
//![0]
Text {
textFormat: Text.RichText
- text: "The main website is at <a href=\"http://qt.nokia.com\">Nokia Qt DF</a>."
+ text: "See the <a href=\"http://qt-project.org\">Qt Project website</a>."
onLinkActivated: console.log(link + " link activated")
}
//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/Button.qml b/src/quick/doc/snippets/qml/usecases/Button.qml
deleted file mode 100644
index 6c4c0f7cd3..0000000000
--- a/src/quick/doc/snippets/qml/usecases/Button.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Rectangle {
- id: container
- // The caption property is an alias to the text of the Text element, so Button users can set the text
- property alias caption: txt.text
- // The clicked signal is emitted whenever the button is clicked, so Button users can respond
- signal clicked
-
- // The button is set to have rounded corners and a thin black border
- radius: 4
- border.width: 1
- // This button has a fixed size, but it could resize based on the text
- width: 160
- height: 40
-
- // A SystemPalette is used to get colors from the system settings for the background
- SystemPalette { id: sysPalette }
-
- gradient: Gradient {
-
- // The top gradient is darker when 'pressed', all colors come from the system palette
- GradientStop { position: 0.0; color: ma.pressed ? sysPalette.dark : sysPalette.light }
-
- GradientStop { position: 1.0; color: sysPalette.button }
- }
-
- Text {
- id: txt
- // This is the default value of the text, but most Button users will set their own with the caption property
- text: "Button"
- font.bold: true
- font.pixelSize: 16
- anchors.centerIn: parent
- }
-
- MouseArea {
- id: ma
- anchors.fill: parent
- // This re-emits the clicked signal on the root item, so that Button users can respond to it
- onClicked: container.clicked()
- }
-}
-
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/animations.qml b/src/quick/doc/snippets/qml/usecases/animations.qml
deleted file mode 100644
index 1887acf901..0000000000
--- a/src/quick/doc/snippets/qml/usecases/animations.qml
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Column {
- //![states]
-
- Item {
- id: container
- width: 320
- height: 120
-
- Rectangle {
- id: rect
- color: "red"
- width: 120
- height: 120
-
- MouseArea {
- anchors.fill: parent
- onClicked: container.state == 'other' ? container.state = '' : container.state = 'other'
- }
- }
- states: [
- // This adds a second state to the container where the rectangle is farther to the right
-
- State { name: "other"
-
- PropertyChanges {
- target: rect
- x: 200
- }
- }
- ]
- transitions: [
- // This adds a transition that defaults to applying to all state changes
-
- Transition {
-
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { properties: "x,y" }
- }
- ]
- }
- //![states]
- //![behave]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- color: "green"
- width: 120
- height: 120
-
- // This is the behavior, and it applies a NumberAnimation to any attempt to set the x property
- Behavior on x {
-
- NumberAnimation {
- //This specifies how long the animation takes
- duration: 600
- //This selects an easing curve to interpolate with, the default is Easing.Linear
- easing.type: Easing.OutBounce
- }
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: parent.x == 0 ? parent.x = 200 : parent.x = 0
- }
- }
- }
- //![behave]
- //![constant]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- color: "blue"
- width: 120
- height: 120
-
- // By setting this SequentialAnimation on x, it and animations within it will automatically animate
- // the x property of this element
- SequentialAnimation on x {
- id: xAnim
- // Animations on properties start running by default
- running: false
- loops: Animation.Infinite // The animation is set to loop indefinitely
- NumberAnimation { from: 0; to: 200; duration: 500; easing.type: Easing.InOutQuad }
- NumberAnimation { from: 200; to: 0; duration: 500; easing.type: Easing.InOutQuad }
- PauseAnimation { duration: 250 } // This puts a bit of time between the loop
- }
-
- MouseArea {
- anchors.fill: parent
- // The animation starts running when you click within the rectangle
- onClicked: xAnim.running = true
- }
- }
- }
- //![constant]
-
- //![scripted]
- Item {
- width: 320
- height: 120
-
- Rectangle {
- id: rectangle
- color: "yellow"
- width: 120
- height: 120
-
- MouseArea {
- anchors.fill: parent
- // The animation starts running when you click within the rectange
- onClicked: anim.running = true;
- }
- }
-
- // This animation specifically targets the Rectangle's properties to animate
- SequentialAnimation {
- id: anim
- // Animations on their own are not running by default
- // The default number of loops is one, restart the animation to see it again
-
- NumberAnimation { target: rectangle; property: "x"; from: 0; to: 200; duration: 500 }
-
- NumberAnimation { target: rectangle; property: "x"; from: 200; to: 0; duration: 500 }
- }
- }
- //![scripted]
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml b/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml
deleted file mode 100644
index 24758d4e09..0000000000
--- a/src/quick/doc/snippets/qml/usecases/integratingjs-inline.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
- id: container
- width: 320
- height: 480
-
- function randomNumber() {
- return Math.random() * 360;
- }
-
- function getNumber() {
- return container.randomNumber();
- }
-
- MouseArea {
- anchors.fill: parent
- // This line uses the JS function from the item
- onClicked: rectangle.rotation = container.getNumber();
- }
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- id: rectangle
- anchors.centerIn: parent
- width: 160
- height: 160
- color: "green"
- Behavior on rotation { RotationAnimation { direction: RotationAnimation.Clockwise } }
- }
-
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/integratingjs.qml b/src/quick/doc/snippets/qml/usecases/integratingjs.qml
deleted file mode 100644
index 9e7ed2a35b..0000000000
--- a/src/quick/doc/snippets/qml/usecases/integratingjs.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-import "myscript.js" as Logic
-
-Item {
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- MouseArea {
- anchors.fill: parent
- // This line uses the JS function from the separate JS file
- onClicked: rectangle.rotation = Logic.getRandom(rectangle.rotation);
- }
-
- Rectangle {
- id: rectangle
- anchors.centerIn: parent
- width: 160
- height: 160
- color: "green"
- Behavior on rotation { RotationAnimation { direction: RotationAnimation.Clockwise } }
- }
-
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/layouts.qml b/src/quick/doc/snippets/qml/usecases/layouts.qml
deleted file mode 100644
index e9483d2b9b..0000000000
--- a/src/quick/doc/snippets/qml/usecases/layouts.qml
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-//![import]
-
-Column {
-
-//![direct]
-Item {
- width: 100; height: 100
-
- Rectangle {
- // Manually positioned at 20,20
- x: 20
- y: 20
- width: 80
- height: 80
- color: "red"
- }
-}
-//![direct]
-
-//![anchors]
-Item {
- width: 200; height: 200
-
- Rectangle {
- // Anchored to 20px off the top right corner of the parent
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.margins: 20 // Sets all margins at once
-
- width: 80
- height: 80
- color: "orange"
- }
-
- Rectangle {
- // Anchored to 20px off the top center corner of the parent.
- // Notice the different group property syntax for 'anchors' compared to
- // the previous Rectangle. Both are valid.
- anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 20 }
-
- width: 80
- height: 80
- color: "green"
- }
-}
-//![anchors]
-
-//![positioners]
-Item {
- width: 300; height: 100
-
- Row { // The "Row" type lays out its child items in a horizontal line
- spacing: 20 // Places 20px of space between items
-
- Rectangle { width: 80; height: 80; color: "red" }
- Rectangle { width: 80; height: 80; color: "green" }
- Rectangle { width: 80; height: 80; color: "blue" }
- }
-}
-//![positioners]
-
-Item {
- width: 300; height: 400
-
- Rectangle {
- id: middleRect
- //This Rectangle has its y animated, for the others to follow
- x: 120
- y: 220
- SequentialAnimation on y {
- loops: -1
- NumberAnimation { from: 220; to: 380; easing.type: Easing.InOutQuad; duration: 1200 }
- NumberAnimation { from: 380; to: 220; easing.type: Easing.InOutQuad; duration: 1200 }
- }
- width: 80
- height: 80
- color: "green"
- }
- Rectangle {
- // x,y bound to the position of middleRect
- x: middleRect.x - 100
- y: middleRect.y
- width: 80
- height: 80
- color: "red"
- }
-
- Rectangle {
- // Anchored to the position of middleRect
- anchors.left: middleRect.right
- anchors.leftMargin: 20
- anchors.verticalCenter: middleRect.verticalCenter
- width: 80
- height: 80
- color: "blue"
- }
-}
-
-}
diff --git a/src/quick/doc/snippets/qml/usecases/myscript.js b/src/quick/doc/snippets/qml/usecases/myscript.js
deleted file mode 100644
index 84b0c801a2..0000000000
--- a/src/quick/doc/snippets/qml/usecases/myscript.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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]
-// myscript.js
-function getRandom(previousValue) {
- return Math.floor(previousValue + Math.random() * 90) % 360;
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/styling.qml b/src/quick/doc/snippets/qml/usecases/styling.qml
deleted file mode 100644
index b46b9e3d55..0000000000
--- a/src/quick/doc/snippets/qml/usecases/styling.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Column {
- width: childrenRect.width
- anchors.centerIn: parent
- spacing: 8
- // Each of these is a Button as styled in Button.qml
- Button { caption: "Eeny"; onClicked: console.log("Eeny");}
- Button { caption: "Meeny"; onClicked: console.log("Meeny");}
- Button { caption: "Miny"; onClicked: console.log("Miny");}
- Button { caption: "Mo"; onClicked: console.log("Mo");}
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/text.qml b/src/quick/doc/snippets/qml/usecases/text.qml
deleted file mode 100644
index c7adc12763..0000000000
--- a/src/quick/doc/snippets/qml/usecases/text.qml
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
- id: root
- width: 480
- height: 320
-
- Rectangle {
- color: "#272822"
- width: 480
- height: 320
- }
-
- Column {
- spacing: 20
-
- Text {
- text: 'I am the very model of a modern major general!'
-
- // color can be set on the entire element with this property
- color: "yellow"
-
- }
-
- Text {
- // For text to wrap, a width has to be explicitly provided
- width: root.width
-
- // This setting makes the text wrap at word boundaries when it goes past the width of the Text object
- wrapMode: Text.WordWrap
-
- // You can use \ to escape quotation marks, or to add new lines (\n). Use \\ to get a \ in the string
- text: 'I am the very model of a modern major general. I\'ve information vegetable, animal and mineral. I know the kings of england and I quote the fights historical; from Marathon to Waterloo in order categorical.'
-
- // color can be set on the entire element with this property
- color: "white"
-
- }
-
- Text {
- text: 'I am the very model of a modern major general!'
-
- // color can be set on the entire element with this property
- color: "yellow"
-
- // font properties can be set effciently on the whole string at once
- font { family: 'Courier'; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
-
- }
-
- Text {
- // HTML like markup can also be used
- text: '<font color="white">I am the <b>very</b> model of a modern <i>major general</i>!</font>'
-
- // This could also be written font { pointSize: 14 }. Both syntaxes are valid.
- font.pointSize: 14
-
- // StyledText format supports fewer tags, but is more efficient than RichText
- textFormat: Text.StyledText
-
- }
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/userinput-keys.qml b/src/quick/doc/snippets/qml/usecases/userinput-keys.qml
deleted file mode 100644
index 73b42b2f59..0000000000
--- a/src/quick/doc/snippets/qml/usecases/userinput-keys.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
- id: root
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- id: rectangle
- x: 40
- y: 20
- width: 120
- height: 120
- color: "red"
-
- focus: true
- Keys.onUpPressed: rectangle.y -= 10
- Keys.onDownPressed: rectangle.y += 10
- Keys.onLeftPressed: rectangle.x += 10
- Keys.onRightPressed: rectangle.x -= 10
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual-rects.qml b/src/quick/doc/snippets/qml/usecases/visual-rects.qml
deleted file mode 100644
index 16cfd7bae5..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual-rects.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- // This element displays a rectangle with a gradient and a border
- Rectangle {
- x: 160
- y: 20
- width: 100
- height: 100
- radius: 8 // This gives rounded corners to the Rectangle
- gradient: Gradient { // This sets a vertical gradient fill
- GradientStop { position: 0.0; color: "aqua" }
- GradientStop { position: 1.0; color: "teal" }
- }
- border { width: 3; color: "white" } // This sets a 3px wide black border to be drawn
- }
-
- // This rectangle is a plain color with no border
- Rectangle {
- x: 40
- y: 20
- width: 100
- height: 100
- color: "red"
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual-transforms.qml b/src/quick/doc/snippets/qml/usecases/visual-transforms.qml
deleted file mode 100644
index 924f4b79ff..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual-transforms.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- Rectangle {
- rotation: 45 // This rotates the Rectangle by 45 degrees
- x: 20
- y: 160
- width: 100
- height: 100
- color: "blue"
- }
- Rectangle {
- scale: 0.8 // This scales the Rectangle down to 80% size
- x: 160
- y: 160
- width: 100
- height: 100
- color: "green"
- }
-}
-//![0]
diff --git a/src/quick/doc/snippets/qml/usecases/visual.qml b/src/quick/doc/snippets/qml/usecases/visual.qml
deleted file mode 100644
index fe381136cb..0000000000
--- a/src/quick/doc/snippets/qml/usecases/visual.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia Plc 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 2.0
-
-Item {
-
- width: 320
- height: 480
-
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
- }
-
- //![image]
- // This element displays an image. Because the source is online, it may take some time to fetch
- Image {
- x: 40
- y: 20
- width: 61
- height: 73
- source: "http://codereview.qt-project.org/static/logo_qt.png"
- }
- //![image]
-}
-//![0]
diff --git a/src/qml/doc/snippets/qml/xmlrole.qml b/src/quick/doc/snippets/qml/xmlrole.qml
index 0f75135da2..0f75135da2 100644
--- a/src/qml/doc/snippets/qml/xmlrole.qml
+++ b/src/quick/doc/snippets/qml/xmlrole.qml
diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc
index 966233c371..80a0173f32 100644
--- a/src/quick/doc/src/advtutorial.qdoc
+++ b/src/quick/doc/src/advtutorial.qdoc
@@ -27,7 +27,6 @@
/*!
\page qml-advtutorial.html tutorial
-\inqmlmodule QtQuick 2
\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
@@ -65,7 +64,6 @@ directory.
/*!
\page qml-advtutorial1.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial
@@ -83,7 +81,7 @@ To begin with, we create our Same Game application with a main screen like this:
This is defined by the main application file, \c samegame.qml, which looks like this:
-\snippet quick/tutorials/samegame/samegame1/samegame.qml 0
+\snippet 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.
@@ -101,7 +99,7 @@ The \c Button item in the code above is defined in a separate component file nam
To create a functional button, we use the QML types \l Text and \l MouseArea inside a \l Rectangle.
Here is the \c Button.qml code:
-\snippet quick/tutorials/samegame/samegame1/Button.qml 0
+\snippet 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
@@ -111,7 +109,7 @@ 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 quick/tutorials/samegame/samegame1/Block.qml 0
+\snippet 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.
@@ -135,7 +133,6 @@ types to get started. Next, we will populate the game canvas with some blocks.
/*!
\page qml-advtutorial2.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 2 - Populating the Game Canvas
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
@@ -156,7 +153,7 @@ 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 quick/tutorials/samegame/samegame2/samegame.js 0
+\snippet 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.
@@ -168,7 +165,7 @@ and moves the new block to its position on the game canvas. This involves severa
\list
-\li \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to
+\li \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is called to
generate a type from \c Block.qml. If the component is ready,
we can call \c createObject() to create an instance of the \c Block
item.
@@ -192,14 +189,14 @@ 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{QML Modules}{module}:
-\snippet quick/tutorials/samegame/samegame2/samegame.qml 2
+\snippet 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 quick/tutorials/samegame/samegame2/samegame.qml 1
+\snippet 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:
@@ -211,7 +208,6 @@ Now, we have a screen of blocks, and we can begin to add the game mechanics.
/*!
\page qml-advtutorial3.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 3 - Implementing the Game Logic
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 2 - Populating the Game Canvas
@@ -241,7 +237,7 @@ As this is a tutorial about QML, not game design, we will only discuss \c handle
To make it easier for the JavaScript code to interface with the QML types, 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 quick/tutorials/samegame/samegame3/samegame.qml 1
+\snippet 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
@@ -251,7 +247,7 @@ 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 quick/tutorials/samegame/samegame3/samegame.js 1
+\snippet 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.
@@ -259,17 +255,17 @@ Note that if \c score was a global variable in the \c{samegame.js} file you woul
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 quick/tutorials/samegame/samegame3/samegame.js 2
+\snippet 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 type 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 quick/tutorials/samegame/samegame3/Dialog.qml 0
+\snippet tutorials/samegame/samegame3/Dialog.qml 0
And this is how it is used in the main \c samegame.qml file:
-\snippet quick/tutorials/samegame/samegame3/samegame.qml 2
+\snippet 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.
@@ -278,7 +274,7 @@ We give the dialog a \l {Item::z}{z} value of 100 to ensure it is displayed on t
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 quick/tutorials/samegame/samegame3/Block.qml 0
+\snippet tutorials/samegame/samegame3/Block.qml 0
\section2 A working game
@@ -290,7 +286,7 @@ Here is a screenshot of what has been accomplished so far:
This is what \c samegame.qml looks like now:
-\snippet quick/tutorials/samegame/samegame3/samegame.qml 0
+\snippet 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
@@ -300,7 +296,6 @@ until the next chapter - where your application becomes alive!
/*!
\page qml-advtutorial4.html
-\inqmlmodule QtQuick 2
\title QML Advanced Tutorial 4 - Finishing Touches
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 3 - Implementing the Game Logic
@@ -324,7 +319,7 @@ In \c BoomBlock.qml, we apply a \l SpringAnimation behavior to the \c x and \c y
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 quick/tutorials/samegame/samegame4/content/BoomBlock.qml 1
+\snippet 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.
@@ -341,7 +336,7 @@ animate the opacity value so that it gradually fades in and out, instead of abru
visible and invisible. To do this, we'll apply a \l Behavior on the \c opacity property of the \c Image
type in \c BoomBlock.qml:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 2
+\snippet 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,
@@ -367,14 +362,14 @@ To fade out, we set \c dying to true instead of setting opacity to 0 when a bloc
Finally, we'll add a cool-looking particle effect to the blocks when they are destroyed. To do this, we first add a \l ParticleSystem in
\c BoomBlock.qml, like so:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 3
+\snippet 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 emitRate 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 type. The code for the states now look
like this:
-\snippet quick/tutorials/samegame/samegame4/content/BoomBlock.qml 4
+\snippet 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:
@@ -391,32 +386,32 @@ To do this, we will show a dialog when the game is over to request the player's
This requires a few changes to \c Dialog.qml. In addition to a \c Text type, it now has a
\c TextInput child item for receiving keyboard text input:
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 0
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 0
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 2
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 2
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 3
+\snippet 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 types can retrieve the text entered by the user through an \c inputText property:
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 0
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 1
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 0
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 1
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/Dialog.qml 3
+\snippet tutorials/samegame/samegame4/content/Dialog.qml 3
Now the dialog can be used in \c samegame.qml:
-\snippet quick/tutorials/samegame/samegame4/samegame.qml 0
+\snippet 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 quick/tutorials/samegame/samegame4/content/samegame.js 3
+\snippet tutorials/samegame/samegame4/content/samegame.js 3
\dots 4
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 4
+\snippet tutorials/samegame/samegame4/content/samegame.js 4
\section3 Storing high scores offline
@@ -424,7 +419,7 @@ Now we need to implement the functionality to actually save the High Scores tabl
Here is the \c saveHighScore() function in \c samegame.js:
-\snippet quick/tutorials/samegame/samegame4/content/samegame.js 2
+\snippet 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.
@@ -443,7 +438,7 @@ 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 quick/tutorials/samegame/samegame4/content/samegame.js 1
+\snippet 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
diff --git a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc b/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc
deleted file mode 100644
index c1b5a937a0..0000000000
--- a/src/quick/doc/src/appdevguide/applicationdevelopers.qdoc
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-applicationdevelopers.html
-\title QML Application Developer Resources
-\brief Essential documentation for QML application developers
-
-QML is a declarative language that allows user interfaces to be described in
-terms of their visual components and how they interact and relate with one
-another. It is a highly readable language that was designed to enable
-components to be interconnected in a dynamic manner, and it allows components
-to be easily reused and customized within a user interface. Using the
-\c QtQuick module, designers and developers can easily build fluid animated
-user interfaces in QML, and have the option of connecting these user
-interfaces to any back-end C++ libraries.
-
-This page links to all the information you need to start developing
-applications with \l{Qt QML}{QML} and \l{Qt Quick}.
-
-\section2 Other QML modules
-
-Qt Quick only provides basic visual types, much of Qt's functionality is exposed to QML
-through other modules. If you require the functionality of those modules, you should browse
-their QML documentation. Qt Essentials modules exposing QML types include:
-
-\list
-\li \l QtMultimedia for playing and managing multimedia content and cameras.
-\li \l QtWebkit for rendering web content.
-\endlist
-
-\section1 Quick Start
-
-\list
-\li \l{qtquick-quickstart-basics.html}{QML Basics}
- \list
- \li \l{qtquick-quickstart-basics.html#creating-a-qml-document}{Creating a QML Document}
- \li \l{qtquick-quickstart-basics.html#loading-and-displaying-the-qml-document}{Loading and Displaying the QML Document}
- \endlist
-\li \l{qtquick-quickstart-essentials.html}{QML Essentials}
- \list
- \li \l{qtquick-quickstart-essentials.html#handling-user-input}{Handling User Input}
- \li \l{qtquick-quickstart-essentials.html#property-bindings}{Property Bindings}
- \li \l{qtquick-quickstart-essentials.html#animations}{Animations}
- \li \l{qtquick-quickstart-essentials.html#defining-custom-qml-types-for-re-use}{Defining Custom QML Types for Re-use}
- \endlist
-\endlist
-
-\section1 Code Samples and Demos
-
-To learn more about uses of QML code, there are several code samples which show
-how QML types are used. In addition, there are several demos which show how
-QML code is used in applications.
-
-\list
-\li \l{Qt Quick Code Samples}
-\li \l{QML Demos}
-\endlist
-\section1 Features And Use-Case Solutions
-
-\list
-\li \l{qtquick-usecase-visual.html}{Visual types in QML}
-\li \l{qtquick-usecase-userinput.html}{Responding to User Input in QML}
-\li \l{qtquick-usecase-animations.html}{Animations in QML}
-\li \l{qtquick-usecase-text.html}{Displaying Text in QML}
-\li \l{qtquick-usecase-layouts.html}{Layouts in QML}
-\li \l{qtquick-usecase-styling.html}{Style and Theme Support}
-\li \l{qtquick-usecase-integratingjs.html}{Integrating JavaScript in QML}
-\endlist
-
-
-\section1 In-Depth Documentation
-
-\section2 What is QML?
-
-QML is a user interface specification and programming language.
-It allows developers and designers alike to create highly performant, fluidly
-animated and visually appealing applications. QML offers a highly readable,
-declarative, JSON-like syntax with support for imperative JavaScript
-expressions combined with dynamic property bindings.
-
-The QML language and engine infrastructure is provided by the \l {Qt QML} module.
-For in-depth information about the QML language, please see the
-\l{Qt QML} module documentation.
-
-\section2 What is Qt Quick?
-
-Qt Quick is the standard library of types and functionality for QML. It
-includes visual types, interactive types, animations, models and views,
-particle effects and shader effects. A QML application developer can get
-access to all of that functionality with a single import statement.
-
-The \c QtQuick QML library is provided by the \l{Qt Quick} module.
-For in-depth information about the various QML types and other functionality
-provided by Qt Quick, please see the \l{Qt Quick} module documentation.
-
-\section1 Advanced Application Development Topics
-
-\list
-\li \l{qtquick-deployment.html}{Deploying QML Applications}
-\li \l{qtquick-performance.html}{Performance Considerations and Suggestions}
-\li \l{qtquick-internationalization.html}{Internationalization and Localization}
-\li Testing and Debugging
- \list
- \li \l{qtquick-qmlscene.html}{Prototyping with qmlscene}
- \li \l{qtquick-debugging.html}{Debugging QML Applications}
- \li \l{qtquick-qtquicktest.html}{Qt Quick Test: QML Unit Testing Framework}
- \endlist
-\li \l{qml-codingconventions.html}{QML Coding Conventions}
-\li \l{qtquick-glossary.html}{Glossary of Terms}
-\endlist
-
-\section1 Release Notes and Porting Guides
-
-\list
-\li \l{Qt QML Release Notes}
-\li \l{Qt Quick Release Notes}
-\li \l{Porting QML Applications to Qt 5}
-\endlist
-
-*/
diff --git a/src/quick/doc/src/appdevguide/codingconventions.qdoc b/src/quick/doc/src/appdevguide/codingconventions.qdoc
deleted file mode 100644
index 385c00d2a6..0000000000
--- a/src/quick/doc/src/appdevguide/codingconventions.qdoc
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qml-codingconventions.html
-\title QML Coding Conventions
-\brief code style convention
-
-This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow.
-
-\section1 QML Object Declarations
-
-Throughout our documentation and examples, \l{QML Object Attributes}{QML object attributes} are always structured in the following order:
-
-\list
-\li id
-\li property declarations
-\li signal declarations
-\li JavaScript functions
-\li object properties
-\li child objects
-\li states
-\li 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 qml/codingconventions/photo.qml 0
-
-
-\section1 Grouped Properties
-
-If using multiple properties from a group of properties,
-consider using \e {group notation} instead of \e {dot notation} if it
-improves readability.
-
-For example, this:
-
-\snippet qml/codingconventions/dotproperties.qml 0
-
-could be written like this:
-
-\snippet qml/codingconventions/dotproperties.qml 1
-
-
-\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 qml/codingconventions/lists.qml 0
-
-we will write this:
-
-\snippet qml/codingconventions/lists.qml 1
-
-
-\section1 JavaScript Code
-
-If the script is a single expression, we recommend writing it inline:
-
-\snippet qml/codingconventions/javascript.qml 0
-
-If the script is only a couple of lines long, we generally use a block:
-
-\snippet qml/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 qml/codingconventions/javascript.qml 2
-
-For long scripts, we will put the functions in their own JavaScript file and import it like this:
-
-\snippet qml/codingconventions/javascript-imports.qml 0
-
-*/
diff --git a/src/quick/doc/src/appdevguide/debugging.qdoc b/src/quick/doc/src/appdevguide/debugging.qdoc
deleted file mode 100644
index 94ce13459c..0000000000
--- a/src/quick/doc/src/appdevguide/debugging.qdoc
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-debugging.html
-\ingroup qtquick-tools
-\title Debugging QML Applications
-\brief debugging tools in QML
-
-\section1 Console API
-
-\section2 Log
-
-\c console.log, console.debug, console.info, console.warn and console.error can be used to print
-debugging information to the console. For example:
-
-\code
-function f(a, b) {
- console.log("a is ", a, "b is ", b);
-}
-\endcode
-
-The output is generated using the qDebug, qWarning, qCritical methods in C++
-(see also http://doc.qt.nokia.com/latest/debug.html#warning-and-debugging-messages).
-
-Setting the environment variable QML_CONSOLE_EXTENDED also prints the source
-code location of the call.
-
-\section2 Assert
-
-\c console.assert tests that an expression is true. If not, it will write an optional message
-to the console and print the stack trace.
-
-\code
-function f() {
- var x = 12
- console.assert(x == 12, "This will pass");
- console.assert(x > 12, "This will fail");
-}
-\endcode
-
-\section2 Timer
-
-\c console.time and console.timeEnd log the time (in milliseconds) that was spent between
-the calls. Both take a string argument that identifies the measurement. For example:
-
-\code
-function f() {
- console.time("wholeFunction");
- console.time("firstPart");
- // first part
- console.timeEnd("firstPart");
- // second part
- console.timeEnd("wholeFunction");
-}
-\endcode
-
-\section2 Trace
-
-\c console.trace prints the stack trace of JavaScript execution at the point where
-it was called. The stack trace info contains function name, file name, line number
-and column number. The stack trace is limited to last 10 stack frames.
-
-\section2 Count
-
-\c console.count prints the current number of times a particular piece of code has been executed,
-along with a message. That is,
-
-\code
-function f() {
- console.count("f called");
-}
-\endcode
-
-will print \c{f called: 1}, \c{f called: 2} ... whenever \c{f()} is executed.
-
-\section2 Profile
-
-\c console.profile turns on the QML and JavaScript profilers. Nested calls are not
-supported and a warning will be printed to the console.
-
-\c console.profileEnd turns off the QML and JavaScript profilers. Calling this function
-without a previous call to console.profile will print a warning to the console. A
-profiling client should have been attached before this call to receive and store the
-profiling data. For example:
-
-\code
-function f() {
- console.profile();
- //Call some function that needs to be profiled.
- //Ensure that a client is attached before ending
- //the profiling session.
- console.profileEnd();
-}
-\endcode
-
-\section2 Exception
-
-\c console.exception prints an error message together with the stack trace of JavaScript
-execution at the point where it is called.
-
-\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 2.0
-
-Rectangle { width: 100; height: 100 }
-\endqml
-
-If you set \c {QML_IMPORT_TRACE=1} before running the \l{qtquick-qmlscene.html}
-{QML Scene} (or your QML C++ application), you will see output similar to this:
-
-\code
-QQmlImportDatabase::addImportPath "/qt-sdk/imports"
-QQmlImportDatabase::addImportPath "/qt-sdk/bin/QMLViewer.app/Contents/MacOS"
-QQmlImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
-QQmlImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
-QQmlImportDatabase::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/src/quick/doc/src/appdevguide/deployment.qdoc b/src/quick/doc/src/appdevguide/deployment.qdoc
deleted file mode 100644
index 1c8bd20c4d..0000000000
--- a/src/quick/doc/src/appdevguide/deployment.qdoc
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-deployment.html
-\title Deploying QML Applications
-\brief process of deploying QML applications
-
-
-
-QML documents are loaded and executed by the QML runtime. This includes the
-Declarative UI engine along with the built-in QML types and plugin modules,
-and it also provides access to third-party QML types 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 QQuickView
-or a QQmlEngine, as described below. In addition, the Declarative UI
-package includes the qmlscene 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
-QQmlEngine by either:
-
-\list
-\li Loading the QML file through a QQuickView instance, or
-\li Creating a QQmlEngine instance and loading QML files with QQmlComponent
-\endlist
-
-
-\section2 Deploying with QQuickView
-
-QQuickView is a QWindow-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 2.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 <QGuiApplication>
- #include <QQuickView>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QQuickView view;
- view.setSource(QUrl::fromLocalFile("application.qml"));
- view.show();
-
- return app.exec();
- }
-\endcode
-
-This creates a QWindow-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 += quick
- SOURCES += main.cpp
-\endcode
-
-
-\section2 Creating a QQmlEngine directly
-
-If \c application.qml does not have any graphical components, or if it is
-preferred to avoid QQuickView for other reasons, the QQmlEngine
-can be constructed directly instead. In this case, \c application.qml is
-loaded as a QQmlComponent instance rather than placed into a view:
-
-\code
- #include <QGuiApplication>
- #include <QQmlEngine>
- #include <QQmlContext>
- #include <QQmlComponent>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QQmlEngine engine;
- QQmlContext *objectContext = new QQmlContext(engine.rootContext());
-
- QQmlComponent component(&engine, "application.qml");
- QObject *object = component.create(objectContext);
-
- // ... delete object and objectContext when necessary
-
- return app.exec();
- }
-\endcode
-
-QGuiApplication can be replaced by a QCoreApplication in the code above in case you are not
-using any graphical items from Qt Quick. This allows using QML as a language without any
-dependencies to the Qt Gui module.
-
-See \l{qtqml-cppintegration-data.html}{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Types to QML}
-for more information about using QQmlEngine, QQmlContext and QQmlComponent, as well
-as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}.
-
-
-
-\section1 Developing and Prototyping with QML Scene
-
-The Declarative UI package includes a QML runtime tool,
-\l{qtquick-qmlscene.html}{qmlscene}, 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.
-
-
-
-\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
-\li Create a \c .qrc \l {The Qt Resource System}{resource collection file} that lists resource
- files in XML format
-\li 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 ../src/qml/doc/snippets/qml/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 ../src/qml/doc/snippets/qml/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 ../src/qml/doc/snippets/qml/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 ../src/qml/doc/snippets/qml/qtbinding/resources/resources.pro
-
-See \l {The Qt Resource System} for more information.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/glossary.qdoc b/src/quick/doc/src/appdevguide/glossary.qdoc
deleted file mode 100644
index 2ece38256f..0000000000
--- a/src/quick/doc/src/appdevguide/glossary.qdoc
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-glossary.html
-\title Qt Quick Glossary Of Terms
-\brief Glossary of terms used in the documentation for QML and QtQuick
-
-\section1 Common Terms
-
-\table
- \header
- \li Term
- \li Definition
-
- \row
- \li QML
- \li The language in which QML applications are written. The language
- architecture and engine are implemented by the Qt QML module.
-
- \row
- \li Qt Quick
- \li The standard library of types and functionality for the
- QML language, which is provided by the Qt Quick module,
- and may be accessed with "import QtQuick 2.0"
-
- \row
- \li Type
- \li In QML, a \e type may refer to either a
- \l{qtqml-typesystem-topic.html}{Basic Type} or a
- \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}.
-
- The QML language provides a number of built in
- (\l{qtqml-typesystem-basictypes.html}{basic types}), and the
- QtQuick module provides various \l{qtquick-qmltypereference.html}
- {Qt Quick types} for building QML applications. Types can also be
- provided by third-party developers through
- (\l{qtqml-modules-topic.html}{modules}) or by the application
- developer in the application itself through
- \l{qtqml-documents-definetypes.html}{QML Documents}.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Basic Type
- \li A \l{qtqml-typesystem-topic.html}{basic type} is a simple type
- such as \c int, \c string and \c bool. Unlike
- \l{qtqml-typesystem-topic.html#qml-object-types}{object types},
- an object cannot be instantiated from a basic type; for example,
- it is not possible to create an \c int object with properties,
- methods, signals and so on.
-
- Basic types are built into the QML language, whereas object types
- cannot be used unless the appropriate
- \l{qtqml-modules-topic.html}{module} is imported.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Object Type
- \li A \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}
- is a type that can be instantiated by the QML engine.
-
- A QML type can be defined either by a document in a .qml file
- beginning with a capital letter, or by a QObject-based C++ class.
-
- See \l{qtqml-typesystem-topic.html}{The QML Type System}
- for more details.
-
- \row
- \li Object
- \li A QML object is an instance of a
- \l{qtqml-typesystem-topic.html#qml-object-types}{QML Object Type}.
-
- Such objects are created by the engine when it processes
- \l{qtqml-syntax-basics.html#object-declarations}{object declarations},
- which specify the objects to be created and the attributes that are to
- be defined for each object.
-
- Additionally, objects can be dynamically created at runtime through
- Component.createObject() and Qt.createQmlObject().
-
- See also \l{#lazy-instantiation}{Lazy Instantiation}.
-
- \row
- \li Component
- \li A component is a template from which a QML object or object
- tree is created. It is produced when a document is loaded by
- the QML engine. Once it has been loaded, it can be used to
- instantiate the object or object tree that it represents.
-
- Additionally, the \l Component type is a special type that can
- can be used to declare a component inline within a document.
- Component objects can also be dynamically created through
- Qt.createComponent() to dynamically create QML objects.
-
- \row
- \li Document
- \li A \l{qtqml-documents-topic.html}{QML Document} is a self
- contained piece of QML source code that begins with one or more
- import statements and contains a single top-level object
- declaration. A document may reside in a .qml file or a text string.
-
- If it is placed in a .qml file whose name begins with a capital
- letter, the file is recognized by the engine as a definition of
- a QML type. The top-level object declaration encapsulates the
- object tree that will be instantiated by the type.
-
- \row
- \li Property
- \li A property is an attribute of an object type that has a name and
- an associated value; this value can be read (and in most cases, also
- written to) externally.
-
- An object can have one or more properties. Some properties
- are associated with the canvas (e.g., x, y, width, height,
- and opacity) while others may be data specific to that type
- (e.g., the "text" property of the \l Text type).
-
- See \l{qtqml-syntax-objectattributes.html}{QML Object Attributes}
- for more details.
-
- \row
- \li Binding
- \li A binding is a JavaScript expression which is "bound" to a
- property. The value of the property at any point in time
- will be the value returned by evaluating that expression.
-
- See \l{qtqml-syntax-propertybinding.html}{Property Binding}
- for more details.
-
- \row
- \li Signal
- \li A signal is a notification from a QML object. When an object emits
- a signal, other objects can receive and process this signal through
- a \l{Signal Attributes}{signal handler}.
-
- Most properties of QML objects
- have a change signal, and also an associated change signal handler
- which may be defined by clients to implement functionality. For
- example, the "onClicked()" handler of an instance of the MouseArea
- type might be defined in an application to cause a sound to be
- played.
-
- See \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
- for more details.
-
- \row
- \li Signal Handler
- \li A signal handler is the expression (or function) which is triggered
- by a signal. It is also known as a "slot" in C++.
-
- See \l{qtqml-syntax-signals.html}{Signal and Handler Event System}
- for more details.
-
- \row
- \target lazy-instantiation
- \li Lazy Instantiation
- \li Object instances can be instantiated "lazily" at run-time,
- to avoid performing unnecessary work until needed. Qt Quick
- provides the \l Loader type to make lazy instantiation more
- convenient.
-\endtable
-
-\section1 Indexed Alphabetically
-
-*/
diff --git a/src/quick/doc/src/appdevguide/internationalization.qdoc b/src/quick/doc/src/appdevguide/internationalization.qdoc
deleted file mode 100644
index 9c3e9d9cfb..0000000000
--- a/src/quick/doc/src/appdevguide/internationalization.qdoc
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-internationalization.html howto
-\ingroup qml-features
-\title Internationalization and Localization with Qt Quick
-\brief Following these steps, you can write your Qt Quick application so it can be localized for multiple languages
-
-\section1 Internationalizing your Application
-
-The following sections describe various aspects of internationalizing your QML
-source code. If you follow these guides for all the user interface components in
-your application, it becomes possible to localize every aspect of your
-application for different languages and local cultural conventions such as the
-way dates and numbers are formatted.
-
-\section2 1. Use qsTr() for all Literal User Interface Strings
-
-Strings in QML can be marked for translation using the qsTr(), qsTranslate(),
-qsTrId(), QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRID_NOOP() functions. The
-most common way of marking strings is with the qsTr() function. For example:
-
-\code
-Text {
- id: txt1;
- text: qsTr("Back");
-}
-\endcode
-
-This code makes "Back" a key entry in the translation files. At runtime, the
-translation system looks up the keyword "Back" and then gets the corresponding
-translation value for the current system locale. The result is returned to the
-\c text property and the user interface will show the appropriate translation of
-"Back" for the current locale.
-
-
-\section2 2. Add Context for the Translator
-
-User interface strings are often short so you need to help the person
-translating the text understand the context of the text. You can add context
-information in the source code as extra descriptive text before the string to be
-translated. These extra descriptions are included in the .ts translation files
-delivered to the translator.
-
-\note The .ts files are XML files with the source texts and a place for the
-translated text. The updated .ts files are converted into binary translation
-files and included as part of the final application.
-
-In the following code snippet, the text on the \c {//:} line is the main comment
-for the translator.
-
-The text on the \c{//~} line is optional extra information. The first word of
-the text is used as an additional identifier in the XML element in the .ts file
-so make sure the first word is not part of the sentence. For example, the
-comment "Context Not related to that" is converted to "<extra-Context>Not
-related to that" in the .ts file.
-
-\code
-Text {
- id: txt1;
- // This user interface string is only used here
- //: The back of the object, not the front
- //~ Context Not related to back-stepping
- text: qsTr("Back");
-}
-\endcode
-
-\section2 3. Disambiguate Identical Texts
-
-The translation system consolidates the user interface text strings into unique
-items. This consolidation saves the person doing the translation work having to
-translate the same text multiple times. However, in some cases, the text is
-identical but has a different meaning. For example, in English, "back" means
-take a step backward and also means the part of an object opposite to the front.
-You need to tell the translation system about these two separate meanings so the
-translator can create two separate translations.
-
-Differentiate between identical texts by adding some id text as the second
-parameter of the qsTr() function.
-
-In the following code snippet, the \c {not front} text is an id to differentiate
-this "Back" text from the backstepping "Back" text:
-
-\code
-Text {
- id: txt1;
- // This user interface string is used only here
- //: The back of the object, not the front
- //~ Context Not related to back-stepping
- text: qsTr("Back", "not front");
-}
-\endcode
-
-\section2 4. Use \c %x to Insert Parameters into a String
-
-Different languages put words together in different orders so it is not a good
-idea to create sentences by concatenating words and data. Instead, use \c % to
-insert parameters into strings. For example, the following snippet has a string
-with two number parameters \c %1 and \c %2. These parameters are inserted with
-the \c .arg() functions.
-
-\code
-Text {
- text: qsTr("File %1 of %2").arg(counter).arg(total)
-}
-\endcode
-
-%1 refers to the first parameter and \c %2 refers to the second parameter so this
-code produces output like: "File 2 of 3".
-
-\section2 5. Use %Lx so Numbers are Localized
-
-If you include the \c %L modifier when you specify a parameter, the number is
-localized according to the current regional settings. For example, in the
-following code snippet, \c %L1 means to format the first parameters according to
-the number formatting conventions of the currently selected locale (geographical
-region):
-
-\code
-Text {
- text: qsTr("%L1").arg(total)
-}
-\endcode
-
-Then, with the above code, if \c total is the number "4321.56" (four thousand
-three hundred and twenty one point fifty six); with English regional settings,
-(locale) the output is "4,321.56"; with German regional settings, the output is
-"4.321,56".
-
-\section2 6. Internationalize Dates, Times and Currencies
-
-There are no special in-string modifiers for formatting dates and times.
-Instead, you need to query the current locale (geographical region) and use the
-methods of \l {QtQuick2::Date}{Date} to format the string.
-
-\c Qt.locale() returns a \l {QtQuick2::Locale}{Locale} object which contains all
-kinds of information about the locale. In particular, the \l
-{QtQuick2::Locale::name}{Locale.name} property contains the language and country
-information for the current locale. You can use the value as is, or you can
-parse it to determine the appropriate content for the current locale.
-
-The following snippet gets the current date and time with Date(), then converts
-that to a string for the current locale. Then it inserts the date string into
-the %1 parameter for the appropriate translation.
-
-\code
-Text {
- text: qsTr("Date %1").arg(Date().toLocaleString(Qt.locale()))
-}
-\endcode
-
-To make sure currency numbers are localized, use the \l
-{QtQuick2::Number}{Number} type. This type has similar functions as the Date
-type for converting numbers into localized currency strings.
-
-\section2 7. Use QT_TR_NOOP() for Translatable Data Text Strings
-
-If the user changes the system language without a reboot, depending on the
-system, the strings in arrays and list models and other data structures might
-not be refreshed automatically. To force the texts to be refreshed when they are
-displayed in the user interface, you need declare the strings with the
-QT_TR_NOOP() macro. Then, when you populate the objects for display, you need to
-explicitly retrieve the translation for each text. For example:
-
-\code
-ListModel {
- id: myListModel;
- ListElement {
- //: Capital city of Finland
- name: QT_TR_NOOP("Helsinki");
- }
- }
-
-...
-
-Text {
- text: qsTr(myListModel.get(0).name); // get the translation of the name property in element 0
- }
-\endcode
-
-
-\section2 8. Use Locale to Extend Localization Features
-
-If you want different graphics or audio for different geographical regions, you
-can use Qt.locale() to get the current locale. Then you choose appropriate
-graphics or audio for that locale.
-
-The following code snippet shows how you could select an appropriate icon
-that represents the language of the current locale.
-
-\code
-Component.onCompleted: {
- switch (Qt.locale().name.substring(0,2)) {
- case "en": // show the English-language icon
- languageIcon = "../images/language-icon_en.png";
- break;
- case "fi": // show the Finnish language icon
- languageIcon = "../images/language-icon_fi.png";
- break;
- default: // show a default language icon
- languageIcon = "../images/language-icon_default.png";
- }
-}
-\endcode
-
-\section1 Localizing your Application
-
-Qt Quick applications use the same underlying localization system as Qt C++
-applications (lupdate, lrelease and .ts files). You use the same tools as
-described in the \l {Qt Linguist Manual: Release Manager}{Qt Linguist Manual}.
-You can even have user interface strings in C++ and QML source in the same
-application. The system will create a single combined translation file and the
-strings are accessible from QML and C++.
-
-\section2 Use a Conditional to Hide QML Source From the Compiler
-
-The \c lupdate tool extracts user interface strings from your application.
-lupdate reads your application's .pro file to identify which source files
-contain texts to be translated. This means your source files must be listed in
-the \c SOURCES or \c HEADERS entry in the .pro file. If your files are not
-listed the texts in them will not be found.
-
-However, the SOURCES variable is intended for C++ source files. If you list QML
-or JavaScript source files there, the compiler tries to build them as though
-they are C++ files. As a workaround, you can use an \c lupdate_only{...}
-conditional statement so the \c lupdate tool sees the .qml files but the C++
-compiler ignores them.
-
-For example, the following .pro file snippet specifies two .qml files in
-the application.
-
-\code
-lupdate_only{
-SOURCES = main.qml \
- MainPage.qml
-}
-\endcode
-
-
-You can also specify the .qml source files with a wildcard match. The
-search is not recursive so you need to specify each directory where there are
-user interface strings in the source code:
-
-\code
-lupdate_only{
-SOURCES = *.qml \
- *.js \
- content/*.qml \
- content/*.js
-}
-\endcode
-
-See the \l {Qt Linguist Manual} for more details about Qt localization.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/performance.qdoc b/src/quick/doc/src/appdevguide/performance.qdoc
deleted file mode 100644
index 28217e06d6..0000000000
--- a/src/quick/doc/src/appdevguide/performance.qdoc
+++ /dev/null
@@ -1,1143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-performance.html
-\title Performance Considerations And Suggestions
-\brief Discussion of performance-related tradeoffs and best-practices
-
-\section1 Timing Considerations
-
-As an application developer, you must strive to allow the rendering engine
-to achieve a consistent 60 frames-per-second refresh rate. 60 FPS means
-that there is approximately 16 milliseconds between each frame in which
-processing can be done, which includes the processing required to upload
-the draw primitives to the graphics hardware.
-
-In practice, this means that the application developer should use asynchronous,
-event driven programming wherever possible, should use worker threads to do
-significant processing, should never manually spin the event loop, and should
-never spend more than a couple of milliseconds per frame within blocking functions.
-Failure to do so will result in skipped frames, which has a drastic effect on the
-user experience.
-
-\note A pattern which is tempting, but should \e never be used, is creating your
-own QEventLoop or calling QCoreApplication::processEvents() in order to avoid
-blocking within a C++ code block invoked from QML. This is dangerous because
-when an event loop is entered in a signal handler or binding, the QML engine
-continues to run other bindings, animations, transitions, etc. Those bindings
-can then cause side effects which, for example, destroy the hierarchy containing
-your event loop.
-
-\section1 Profiling
-
-The most important tip is: use the QML profiler included with Qt Creator. Knowing
-where time is spent in an application will allow you to focus on problem areas which
-actually exist, rather than problem areas which potentially exist. See the Qt Creator
-manual for more information on how to use the QML profiling tool.
-
-Determining which bindings are being run the most often, or which functions your
-application is spending the most time in, will allow you to decide whether you need
-to optimize the problem areas, or redesign some implementation details of your
-application so that the performance is improved. Attempting to optimize code without
-profiling is likely to result in very minor rather than significant performance
-improvements.
-
-\section1 JavaScript Code
-
-Most QML applications will have a large amount of JavaScript code in them, in the
-form of dynamic functions, signal handlers, and property binding expressions.
-This is not generally a problem (in fact, due to some optimizations in the QML engine
-(bindings compiler, etc) it can for some use-cases be faster than calling a C++ function)
-however care must be taken to ensure that unnecessary processing isn't triggered
-accidentally.
-
-\section2 Bindings
-
-There are two types of bindings in QML: optimized and non-optimized bindings.
-It is a good idea to keep binding expressions as simple as possible, since the
-QML engine makes use of an optimized binding expression evaluator which can
-evaluate simple binding expressions without needing to switch into a full
-JavaScript execution environment. These optimized bindings are evaluated far
-more efficiently than more complex (non-optimized) bindings. The basic
-requirement for optimization of bindings is that the type information of every
-symbol accessed must be known at compile time.
-
-Things to avoid in binding expressions to maximize optimizability:
-\list
- \li declaring intermediate JavaScript variables
- \li accessing "var" properties
- \li calling JavaScript functions
- \li constructing closures or defining functions within the binding expression
- \li accessing properties outside of the immediate evaluation scope
- \li writing to other properties as side effects
-\endlist
-
-The QML_COMPILER_STATS environment variable may be set when running a QML application
-to print statistics about how many bindings were able to be optimized.
-
-Bindings are quickest when they know the type of objects and properties they are working
-with. This means that non-final property lookup in a binding expression can be slower
-in some cases, where it is possible that the type of the property being looked up has
-been changed (for example, by a derived type).
-
-The immediate evaluation scope can be summarized by saying that it contains:
-\list
- \li the properties of the expression scope object (for binding expressions, this is
- the object to which the property binding belongs)
- \li ids of any objects in the component
- \li the properties of the root item in the component
-\endlist
-
-Ids of objects from other components and properties of any such objects, as
-well as symbols defined in or included from a JavaScript import, are not in the
-immediate evaluation scope, and thus bindings which access any of those things
-will not be optimized.
-
-Note that if a binding cannot be optimized by the QML engine's optimized binding
-expression evaluator, and thus must be evaluated by the full JavaScript environment,
-some of the tips listed above will no longer apply. For example, it can sometimes be
-beneficial to cache the result of property resolution in an intermediate JavaScript
-variable, in a very complex binding. Upcoming sections have more information on these
-sorts of optimizations.
-
-\section2 Type-Conversion
-
-One major cost of using JavaScript is that in most cases when a property from a QML
-type is accessed, a JavaScript object with an external resource containing the
-underlying C++ data (or a reference to it) is created. In most cases, this is fairly
-inexpensive, but in others it can be quite expensive. One example of where it is
-expensive is assigning a C++ QVariantMap Q_PROPERTY to a QML "variant" property.
-Lists can also be expensive, although sequences of specific types (QList of int,
-qreal, bool, QString, and QUrl) should be inexpensive; other list types involve an
-expensive conversion cost (creating a new JavaScript Array, and adding new types
-one by one, with per-type conversion from C++ type instance to JavaScript value).
-
-Converting between some basic property types (such as "string" and "url" properties)
-can also be expensive. Using the closest matching property type will avoid unnecessary
-conversion.
-
-If you must expose a QVariantMap to QML, use a "var" property rather than a "variant"
-property. In general, "property var" should be considered to be superior to
-"property variant" for every use-case in QtQuick 2.0 (note that "property variant"
-is marked as obsolete in the QtQuick 2.0 documentation), as it allows a true JavaScript
-reference to be stored (which can reduce the number of conversions required in certain
-expressions).
-
-\section2 Resolving Properties
-
-Property resolution takes time. While in some cases the result of a lookup can be
-cached and reused, it is always best to avoid doing unnecessary work altogether, if
-possible.
-
-In the following example, we have a block of code which is run often (in this case, it
-is the contents of an explicit loop; but it could be a commonly-evaluated binding expression,
-for example) and in it, we resolve the object with the "rect" id and its "color" property
-multiple times:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- printValue("red", rect.color.r);
- printValue("green", rect.color.g);
- printValue("blue", rect.color.b);
- printValue("alpha", rect.color.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-We could instead resolve the common base just once in the block:
-
-\qml
-// good.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- var rectColor = rect.color; // resolve the common base.
- printValue("red", rectColor.r);
- printValue("green", rectColor.g);
- printValue("blue", rectColor.b);
- printValue("alpha", rectColor.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-Just this simple change results in a significant performance improvement.
-Note that the code above can be improved even further (since the property
-being looked up never changes during the loop processing), by hoisting the
-property resolution out of the loop, as follows:
-
-\qml
-// better.qml
-import QtQuick 2.0
-
-Item {
- width: 400
- height: 200
- Rectangle {
- id: rect
- anchors.fill: parent
- color: "blue"
- }
-
- function printValue(which, value) {
- console.log(which + " = " + value);
- }
-
- Component.onCompleted: {
- var t0 = new Date();
- var rectColor = rect.color; // resolve the common base outside the tight loop.
- for (var i = 0; i < 1000; ++i) {
- printValue("red", rectColor.r);
- printValue("green", rectColor.g);
- printValue("blue", rectColor.b);
- printValue("alpha", rectColor.a);
- }
- var t1 = new Date();
- console.log("Took: " + (t1.valueOf() - t0.valueOf()) + " milliseconds for 1000 iterations");
- }
-}
-\endqml
-
-\section2 Property Bindings
-
-A property binding expression will be re-evaluated if any of the properties
-it references are changed. As such, binding expressions should be kept as
-simple as possible.
-
-If you have a loop where you do some processing, but only the final result
-of the processing is important, it is often better to update a temporary
-accumulator which you afterwards assign to the property you need to update,
-rather than incrementally updating the property itself, in order to avoid
-triggering re-evaluation of binding expressions during the intermediate
-stages of accumulation.
-
-The following contrived example illustrates this point:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-
-Item {
- id: root
- width: 200
- height: 200
- property int accumulatedValue: 0
-
- Text {
- anchors.fill: parent
- text: root.accumulatedValue.toString()
- onTextChanged: console.log("text binding re-evaluated")
- }
-
- Component.onCompleted: {
- var someData = [ 1, 2, 3, 4, 5, 20 ];
- for (var i = 0; i < someData.length; ++i) {
- accumulatedValue = accumulatedValue + someData[i];
- }
- }
-}
-\endqml
-
-The loop in the onCompleted handler causes the "text" property binding to
-be re-evaluated six times (which then results in any other property bindings
-which rely on the text value, as well as the onTextChanged signal handler,
-to be re-evaluated each time, and lays out the text for display each time).
-This is clearly unnecessary in this case, since we really only care about
-the final value of the accumulation.
-
-It could be rewritten as follows:
-
-\qml
-// good.qml
-import QtQuick 2.0
-
-Item {
- id: root
- width: 200
- height: 200
- property int accumulatedValue: 0
-
- Text {
- anchors.fill: parent
- text: root.accumulatedValue.toString()
- onTextChanged: console.log("text binding re-evaluated")
- }
-
- Component.onCompleted: {
- var someData = [ 1, 2, 3, 4, 5, 20 ];
- var temp = accumulatedValue;
- for (var i = 0; i < someData.length; ++i) {
- temp = temp + someData[i];
- }
- accumulatedValue = temp;
- }
-}
-\endqml
-
-\section2 Sequence tips
-
-As mentioned earlier, some sequence types are fast (eg, QList<int>, QList<qreal>,
-QList<bool>, QList<QString>, QStringList and QList<QUrl>) while others will be
-much slower. Aside from using these types wherever possible instead of slower types,
-there are some other performance-related semantics you need to be aware of to achieve
-the best performance.
-
-Firstly, there are two different implementations for sequence types: one for where
-the sequence is a Q_PROPERTY of a QObject (we'll call this a reference sequence),
-and another for where the sequence is returned from a Q_INVOKABLE function of a
-QObject (we'll call this a copy sequence).
-
-A reference sequence is read and written via QMetaObject::property() and thus is read
-and written as a QVariant. This means that changing the value of any element in the
-sequence from JavaScript will result in three steps occurring: the complete sequence
-will be read from the QObject (as a QVariant, but then cast to a sequence of the correct
-type); the element at the specified index will be changed in that sequence; and the
-complete sequence will be written back to the QObject (as a QVariant).
-
-A copy sequence is far simpler as the actual sequence is stored in the JavaScript
-object's resource data, so no read/modify/write cycle occurs (instead, the resource
-data is modified directly).
-
-Therefore, writes to elements of a reference sequence will be much slower than writes
-to elements of a copy sequence. In fact, writing to a single element of an N-element
-reference sequence is equivalent in cost to assigning a N-element copy sequence to that
-reference sequence, so you're usually better off modifying a temporary copy sequence
-and then assigning the result to a reference sequence, during computation.
-
-Assume the existence (and prior registration into the "Qt.example 1.0" namespace) of the
-following C++ type:
-
-\code
-class SequenceTypeExample : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY (QList<qreal> qrealListProperty READ qrealListProperty WRITE setQrealListProperty NOTIFY qrealListPropertyChanged)
-
-public:
- SequenceTypeExample() : QQuickItem() { m_list << 1.1 << 2.2 << 3.3; }
- ~SequenceTypeExample() {}
-
- QList<qreal> qrealListProperty() const { return m_list; }
- void setQrealListProperty(const QList<qreal> &list) { m_list = list; emit qrealListPropertyChanged(); }
-
-signals:
- void qrealListPropertyChanged();
-
-private:
- QList<qreal> m_list;
-};
-\endcode
-
-The following example writes to elements of a reference sequence in a
-tight loop, resulting in bad performance:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
- width: 200
- height: 200
-
- Component.onCompleted: {
- var t0 = new Date();
- qrealListProperty.length = 100;
- for (var i = 0; i < 500; ++i) {
- for (var j = 0; j < 100; ++j) {
- qrealListProperty[j] = j;
- }
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-The QObject property read and write in the inner loop caused by the
-\c{"qrealListProperty[j] = j"} expression makes this code very suboptimal. Instead,
-something functionally equivalent but much faster would be:
-
-\qml
-// good.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
- width: 200
- height: 200
-
- Component.onCompleted: {
- var t0 = new Date();
- var someData = [1.1, 2.2, 3.3]
- someData.length = 100;
- for (var i = 0; i < 500; ++i) {
- for (var j = 0; j < 100; ++j) {
- someData[j] = j;
- }
- qrealListProperty = someData;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-Secondly, a change signal for the property is emitted if any element in it changes.
-If you have many bindings to a particular element in a sequence property, it is better
-to create a dynamic property which is bound to that element, and use that dynamic
-property as the symbol in the binding expressions instead of the sequence element,
-as it will only cause re-evaluation of bindings if its value changes.
-
-This is an unusual use-case which most clients should never hit, but is worth being
-aware of, in case you find yourself doing something like this:
-
-\qml
-// bad.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
-
- property int firstBinding: qrealListProperty[1] + 10;
- property int secondBinding: qrealListProperty[1] + 20;
- property int thirdBinding: qrealListProperty[1] + 30;
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- qrealListProperty[2] = i;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-Note that even though only the element at index 2 is modified in the loop, the three
-bindings will all be re-evaluated since the granularity of the change signal is that
-the entire property has changed. As such, adding an intermediate binding can
-sometimes be beneficial:
-
-\qml
-// good.qml
-import QtQuick 2.0
-import Qt.example 1.0
-
-SequenceTypeExample {
- id: root
-
- property int intermediateBinding: qrealListProperty[1]
- property int firstBinding: intermediateBinding + 10;
- property int secondBinding: intermediateBinding + 20;
- property int thirdBinding: intermediateBinding + 30;
-
- Component.onCompleted: {
- var t0 = new Date();
- for (var i = 0; i < 1000; ++i) {
- qrealListProperty[2] = i;
- }
- var t1 = new Date();
- console.log("elapsed: " + (t1.valueOf() - t0.valueOf()) + " milliseconds");
- }
-}
-\endqml
-
-In the above example, only the intermediate binding will be re-evaluated each time,
-resulting in a significant performance increase.
-
-\section2 Value-Type tips
-
-Value-type properties (font, color, vector3d, etc) have similar QObject property
-and change notification semantics to sequence type properties. As such, the tips
-given above for sequences are also applicable for value-type properties. While
-they are usually less of a problem with value-types (since the number of
-sub-properties of a value-type is usually far less than the number of elements
-in a sequence), any increase in the number of bindings being re-evaluated needlessly
-will have a negative impact on performance.
-
-\section2 Other JavaScript Objects
-
-Different JavaScript engines provide different optimizations. The JavaScript engine
-which QtQuick 2 uses is optimized for object instantiation and property lookup, but
-the optimizations which it provides relies on certain criteria. If your application
-does not meet the criteria, the JavaScript engine falls back to a "slow-path" mode
-with much worse performance. As such, always try to ensure you meet the following
-criteria:
-
-\list
-\li Avoid using eval() if at all possible
-\li Do not delete properties of objects
-\endlist
-
-\section1 Common Interface Elements
-
-\section2 Text Elements
-
-Calculating text layouts can be a slow operation. Consider using the \c PlainText
-format instead of \c StyledText wherever possible, as this reduces the amount of work
-required of the layout engine. If you cannot use \c PlainText (as you need to embed
-images, or use tags to specify ranges of characters to have certain formatting (bold,
-italic, etc) as opposed to the entire text) then you should use \c StyledText.
-
-You should only use \c AutoText if the text might be (but probably isn't)
-\c StyledText as this mode will incur a parsing cost. The \c RichText mode should
-not be used, as \c StyledText provides almost all of its features at a fraction of
-its cost.
-
-\section2 Images
-
-Images are a vital part of any user interface. Unfortunately, they are also a big
-source of problems due to the time it takes to load them, the amount of memory they
-consume, and the way in which they are used.
-
-\section3 Asynchronous Loading
-
-Images are often quite large, and so it is wise to ensure that loading an image doesn't
-block the UI thread. Set the "asynchronous" property of the QML Image element to
-\c true to enable asynchronous loading of images from the local file system (remote
-images are always loaded asynchronously) where this would not result in a negative impact
-upon the aesthetics of the user interface.
-
-Image elements with the "asynchronous" property set to \c true will load images in
-a low-priority worker thread.
-
-\section3 Explicit Source Size
-
-If your application loads a large image but displays it in a small-sized element, set
-the "sourceSize" property to the size of the element being rendered to ensure that the
-smaller-scaled version of the image is kept in memory, rather than the large one.
-
-Beware that changing the sourceSize will cause the image to be reloaded.
-
-\section3 Avoid Run-time Composition
-
-Also remember that you can avoid doing composition work at run-time by providing the
-pre-composed image resource with your application (e.g., providing elements with shadow
-effects).
-
-\section2 Position Elements With Anchors
-
-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
-
-Positioning with bindings (by assigning binding expressions to the x, y, width
-and height properties of visual objects, rather than using anchors) is
-relatively slow, although it allows maximum flexibility.
-
-If the layout is not dynamic, the most performant way to specify the layout is
-via static initialization of the x, y, width and height properties. Item
-coordinates are always relative to their parent, so if you wanted to be a fixed
-offset from your parent's 0,0 coordinate you should not use anchors. In the
-following example the child Rectangle objects are in the same place, but the
-anchors code shown is not as resource efficient as the code which
-uses fixed positioning via static initialization:
-
-\code
-Rectangle {
- width: 60
- height: 60
- Rectangle {
- id: fixedPositioning
- x: 20
- y: 20
- width: 20
- height: 20
- }
- Rectangle {
- id: anchorPositioning
- anchors.fill: parent
- anchors.margins: 20
- }
-}
-\endcode
-
-\section1 Models and Views
-
-Most applications will have at least one model feeding data to a view. There are
-some semantics which application developers need to be aware of, in order to achieve
-maximal performance.
-
-\section2 Custom C++ Models
-
-It is often desirable to write your own custom model in C++ for use with a view in
-QML. While the optimal implementation of any such model will depend heavily on the
-use-case it must fulfil, some general guidelines are as follows:
-
-\list
-\li Be as asynchronous as possible
-\li Do all processing in a (low priority) worker thread
-\li Batch up backend operations so that (potentially slow) I/O and IPC is minimized
-\li Use a sliding slice window to cache results, whose parameters are determined with the help of profiling
-\endlist
-
-It is important to note that using a low-priority worker thread is recommended to
-minimise the risk of starving the GUI thread (which could result in worse perceived
-performance). Also, remember that synchronization and locking mechanisms can be a
-significant cause of slow performance, and so care should be taken to avoid
-unnecessary locking.
-
-\section2 ListModel
-
-QML provides a ListModel element which can be used to feed data to a ListView.
-It should suffice for most use-cases and be relatively performant so long as
-it is used correctly.
-
-\section3 Populate Within A Worker Thread
-
-ListModel elements can be populated in a (low priority) worker thread in JavaScript. The
-developer must explicitly call "sync()" on the ListModel from within the WorkerScript to
-have the changes synchronized to the main thread. See the WorkerScript documentation
-for more information.
-
-Please note that using a WorkerScript element will result in a separate JavaScript engine
-being created (as the JavaScript engine is per-thread). This will result in increased
-memory usage. Multiple WorkerScript elements will all use the same worker thread, however,
-so the memory impact of using a second or third WorkerScript element is negligible once
-an application already uses one.
-
-\section3 Don't Use Dynamic Roles
-
-The ListModel element in QtQuick 2.0 is much more performant than in QtQuick 1.0. The
-performance improvements mainly come from assumptions about the type of roles within each
-element in a given model - if the type doesn't change, the caching performance improves
-dramatically. If the type can change dynamically from element to element, this optimization
-becomes impossible, and the performance of the model will be an order of magnitude worse.
-
-Therefore, dynamic typing is disabled by default; the developer must specifically set
-the boolean "dynamicRoles" property of the model to enable dynamic typing (and suffer
-the attendant performance degradation). We recommend that you do not use dynamic typing
-if it is possible to redesign your application to avoid it.
-
-\section2 Views
-
-View delegates should be kept as simple as possible. Have just enough QML in the delegate
-to display the necessary information. Any additional functionality which is not immediately
-required (e.g., if it displays more information when clicked) should not be created until
-needed (see the upcoming section on lazy initialization).
-
-The following list is a good summary of things to keep in mind when designing a delegate:
-\list
-\li The fewer elements that are in a delegate, the faster they can be created, and thus
- the faster the view can be scrolled.
-\li Keep the number of bindings in a delegate to a minimum; in particular, use anchors
- rather than bindings for relative positioning within a delegate.
-\li Avoid using ShaderEffect elements within delegates.
-\li Never enable clipping on a delegate.
-\endlist
-
-You may set the \c cacheBuffer property of a view to allow asynchronous creation and
-buffering of delegates outside of the visible area. Utilizing a \c cacheBuffer is
-recommended for view delegates that are non-trivial and unlikely to be created within a
-single frame.
-
-Be mindful that a \c cacheBuffer keeps additional delegates in-memory and therefore the
-value derived from utilizing the \c cacheBuffer must be balanced against additional memory
-usage. Developers should use benchmarking to find the best value for their use-case, since
-the increased memory pressure caused by utilizing a \c cacheBuffer can, in some rare cases,
-cause reduced frame rate when scrolling.
-
-\section1 Visual Effects
-
-QtQuick 2 includes several features which allow developers and designers to create
-exceptionally appealing user interfaces. Fluidity and dynamic transitions as well
-as visual effects can be used to great effect in an application, but some care must
-be taken when using some of the features in QML as they can have performance implications.
-
-\section2 Animations
-
-In general, animating a property will cause any bindings which reference that property
-to be re-evaluated. Usually, this is what is desired but in other cases it may be better
-to disable the binding prior to performing the animation, and then reassign the binding
-once the animation has completed.
-
-Avoid running JavaScript during animation. For example, running a complex JavaScript
-expression for each frame of an x property animation should be avoided.
-
-Developers should be especially careful using script animations, as these are run in the main
-thread (and therefore can cause frames to be skipped if they take too long to complete).
-
-\section2 Particles
-
-The QtQuick 2.0 Particles module allows beautiful particle effects to be integrated
-seamlessly into user interfaces. However every platform has different graphics hardware
-capabilities, and the Particles module is unable to limit parameters to what your hardware
-can gracefully support. The more particles you attempt to render (and the larger they are),
-the faster your graphics hardware will need to be in order to render at 60 FPS. Affecting
-more particles requires a faster CPU. It is therefore important to test all
-particle effects on your target platform carefully, to calibrate the number and size of
-particles you can render at 60 FPS.
-
-It should be noted that a particle system can be disabled when not in use
-(e.g., on a non-visible element) to avoid doing unnecessary simulation.
-
-See the \l{Particle System Performance Guide} for more in-depth information.
-
-\section2 Shaders
-
-Shaders written in GLSL allow for complex transformations and visual effects to be written,
-however they should be used with care. Using a ShaderEffectSource causes a scene to
-prerendered into an FBO before it can be drawn. This extra overhead is quite expensive.
-
-A ShaderEffect element can imply a ShaderEffectSource (and the indirect rendering costs
-associated with that) and also involves uploading a vertex and fragment shader program
-(which is then compiled into a GLSL shader). Each fragment shader runs once for every
-pixel of the scene, and so these should be kept as simple as possible.
-
-\section1 Controlling Element Lifetime
-
-By partitioning an application into simple, modular components, each contained in a single
-QML file, you can achieve faster application startup time and better control over memory
-usage, and reduce the number of active-but-invisible elements in your application.
-
-\section2 Lazy Initialization
-
-The QML engine does some tricky things to try to ensure that loading and initialization of
-components doesn't cause frames to be skipped, however there is no better way to reduce
-startup time than to avoid doing work you don't need to do, and delaying the work until
-it is necessary. This may be achieved by using either \l Loader or creating components
-\l {qtqml-javascript-dynamicobjects.html}{dynamically}.
-
-\section3 Using Loader
-
-The Loader is an element which allows dynamic loading and unloading of components.
-
-\list
-\li Using the "active" property of a Loader, initialization can be delayed until required.
-\li Using the overloaded version of the "setSource()" function, initial property values can
- be supplied.
-\li Setting the Loader \l {Loader::asynchronous}{asynchronous} property to true may also
- improve fluidity while a component is instantiated.
-\endlist
-
-\section3 Using Dynamic Creation
-
-Developers can use the Qt.createComponent() function to create a component dynamically at
-runtime from within JavaScript, and then call createObject() to instantiate it. Depending
-on the ownership semantics specified in the call, the developer may have to delete the
-created object manually. See \l{qtqml-javascript-dynamicobjects.html}
-{Dynamic Object Management in QML} for more information.
-
-\section2 Destroy Unused Elements
-
-Elements which are invisible because they are a child of a non-visible element (e.g., the
-second tab in a tab-widget, while the first tab is shown) should be initialized lazily in
-most cases, and deleted when no longer in use, to avoid the ongoing cost of leaving them
-active (e.g., rendering, animations, property binding evaluation, etc).
-
-An item loaded with a Loader element may be released by resetting the "source" or
-"sourceComponent" property of the Loader, while other items may be explicitly
-released by calling destroy() on them. In some cases, it may be necessary to
-leave the item active, in which case it should be made invisible at the very least.
-
-See the upcoming section on Rendering for more information on active but invisible elements.
-
-\section1 Rendering
-
-The scene graph used for rendering in QtQuick 2.0 allows highly dynamic, animated user
-interfaces to be rendered fluidly at 60 FPS. There are some things which can
-dramatically decrease rendering performance, however, and developers should be careful
-to avoid these pitfalls wherever possible.
-
-\section2 Clipping
-
-Clipping is disabled by default, and should only be enabled when required.
-
-Clipping is a visual effect, NOT an optimization. It increases (rather than reduces)
-complexity for the renderer. If clipping is enabled, an item will clip its own painting,
-as well as the painting of its children, to its bounding rectangle. This stops the renderer
-from being able to reorder the drawing order of elements freely, resulting in a sub-optimal
-best-case scene graph traversal.
-
-Clipping inside a delegate is especially bad and should be avoided at all costs.
-
-\section2 Over-drawing and Invisible Elements
-
-If you have elements which are totally covered by other (opaque) elements, it is best to
-set their "visible" property to \c false or they will be needlessly drawn.
-
-Similarly, elements which are invisible (e.g., the second tab in a tab widget, while the
-first tab is shown) but need to be initialized at startup time (e.g., if the cost of
-instantiating the second tab takes too long to be able to do it only when the tab is
-activated), should have their "visible" property set to \c false, in order to avoid the
-cost of drawing them (although as previously explained, they will still incur the cost of
-any animations or bindings evaluation since they are still active).
-
-\section2 Manual Layouts
-
-The scene graph renderer is able to batch up certain operations to minimise the number of
-OpenGL state changes required. However, this optimization is only possible for the
-built-in layout elements provided by QtQuick 2.0, and cannot be applied to manual layouts.
-
-Therefore, application developers should use the Row, Column, Grid, GridView and ListView
-elements instead of manual layouts wherever possible.
-
-\section1 Memory Allocation And Collection
-
-The amount of memory which will be allocated by an application and the way in which that
-memory will be allocated are very important considerations. Aside from the obvious
-concerns about out-of-memory conditions on memory-constrained devices, allocating memory
-on the heap is a fairly computationally expensive operation, and certain allocation
-strategies can result in increased fragmentation of data across pages. JavaScript uses
-a managed memory heap which is automatically garbage collected, and this provides some
-advantages but also has some important implications.
-
-An application written in QML uses memory from both the C++ heap and an automatically
-managed JavaScript heap. The application developer needs to be aware of the subtleties
-of each in order to maximise performance.
-
-\section2 Tips For QML Application Developers
-
-The tips and suggestions contained in this section are guidelines only, and may not be
-applicable in all circumstances. Be sure to benchmark and analyse your application
-carefully using empirical metrics, in order to make the best decisions possible.
-
-\section3 Instantiate and initialize components lazily
-
-If your application consists of multiple views (for example, multiple tabs) but only
-one is required at any one time, you can use lazy instantiation to minimize the
-amount of memory you need to have allocated at any given time. See the prior section
-on \l{Lazy Initialization} for more information.
-
-\section3 Destroy unused objects
-
-If you lazily instantiate components, or dynamically create objects during a JavaScript
-expression, it is often better to manually \c{destroy()} them rather than waiting for
-automatic garbage collection to do so. See the prior section on
-\l{Controlling Element Lifetime} for more information.
-
-\section3 Don't manually invoke the garbage collector
-
-In most cases, it is not wise to manually invoke the garbage collector, as it will block
-the GUI thread for a substantial period of time. This can result in skipped frames and
-jerky animations, which should be avoided at all costs.
-
-There are some cases where manually invoking the garbage collector is acceptable (and
-this is explained in greater detail in an upcoming section), but in most cases, invoking
-the garbage collector is unnecessary and counter-productive.
-
-\section3 Avoid complex bindings
-
-Aside from the reduced performance of complex bindings (for example, due to having to
-enter the JavaScript execution context to perform evaluation), they also take up more
-memory both on the C++ heap and the JavaScript heap than bindings which can be
-evaluated by QML's optimized binding expression evaluator.
-
-\section3 Avoid defining multiple identical implicit types
-
-If a QML element has a custom property defined in QML, it becomes its own implicit type.
-This is explained in greater detail in an upcoming section. If multiple identical
-implicit types are defined inline in a component, some memory will be wasted. In that
-situation it is usually better to explicitly define a new component which can then be
-reused.
-
-Defining a custom property can often be a beneficial performance optimization (for
-example, to reduce the number of bindings which are required or re-evaluated), or it
-can improve the modularity and maintainability of a component. In those cases, using
-custom properties is encouraged; however, the new type should, if it is used more than
-once, be split into its own component (.qml file) in order to conserve memory.
-
-\section3 Re-use existing components
-
-If you are considering defining a new component, it's worth double checking that such a
-component doesn't already exist in the component set for your platform. Otherwise, you
-will be forcing the QML engine to generate and store type-data for a type which is
-essentially a duplicate of another pre-existing and potentially already loaded component.
-
-\section3 Use singleton types instead of pragma library scripts
-
-If you are using a pragma library script to store application-wide instance data,
-consider using a QObject singleton type instead. This should result in better performance,
-and will result in less JavaScript heap memory being used.
-
-\section2 Memory Allocation in a QML Application
-
-The memory usage of a QML application may be split into two parts: its C++ heap usage,
-and its JavaScript heap usage. Some of the memory allocated in each will be unavoidable,
-as it is allocated by the QML engine or the JavaScript engine, while the rest is
-dependent upon decisions made by the application developer.
-
-The C++ heap will contain:
-\list
- \li the fixed and unavoidable overhead of the QML engine (implementation data
- structures, context information, and so on)
- \li per-component compiled data and type information, including per-type property
- metadata, which is generated by the QML engine depending on which modules are
- imported by the application and which components the application loads
- \li per-object C++ data (including property values) plus a per-element metaobject
- hierarchy, depending on which components the application instantiates
- \li any data which is allocated specifically by QML imports (libraries)
-\endlist
-
-The JavaScript heap will contain:
-\list
- \li the fixed and unavoidable overhead of the JavaScript engine itself (including
- built-in JavaScript types)
- \li the fixed and unavoidable overhead of our JavaScript integration (constructor
- functions for loaded types, function templates, and so on)
- \li per-type layout information and other internal type-data generated by the JavaScript
- engine at runtime, for each type (see note below, regarding types)
- \li per-object JavaScript data ("var" properties, JavaScript functions and signal
- handlers, and non-optimized binding expressions)
- \li variables allocated during expression evaluation
-\endlist
-
-Furthermore, there will be one JavaScript heap allocated for use in the main thread, and
-optionally one other JavaScript heap allocated for use in the WorkerScript thread. If an
-application does not use a WorkerScript element, that overhead will not be incurred. The
-JavaScript heap can be several megabytes in size, and so applications written for
-memory-constrained devices may be best served to avoid using the WorkerScript element
-despite its usefulness in populating list models asynchronously.
-
-Note that both the QML engine and the JavaScript engine will automatically generate their
-own caches of type-data about observed types. Every component loaded by an application
-is a distinct (explicit) type, and every element (component instance) which defines its
-own custom properties in QML is an implicit type. Any element (instance of a component)
-which does not define any custom properties is considered by the JavaScript and QML engines
-to be of the type explicitly defined by the component, rather than its own implicit type.
-
-Consider the following example:
-\qml
-import QtQuick 2.0
-
-Item {
- id: root
-
- Rectangle {
- id: r0
- color: "red"
- }
-
- Rectangle {
- id: r1
- color: "blue"
- width: 50
- }
-
- Rectangle {
- id: r2
- property int customProperty: 5
- }
-
- Rectangle {
- id: r3
- property string customProperty: "hello"
- }
-
- Rectangle {
- id: r4
- property string customProperty: "hello"
- }
-}
-\endqml
-
-In the previous example, the rectangles \c r0 and \c r1 do not have any custom properties,
-and thus the JavaScript and QML engines consider them both to be of the same type. That
-is, \c r0 and \c r1 are both considered to be of the explicitly defined \c Rectangle type.
-The rectangles \c r2, \c r3 and \c r4 each have custom properties and are each considered
-to be different (implicit) types. Note that \c r3 and \c r4 are each considered to be of
-different types, even though they have identical property information, simply because the
-custom property was not declared in the component which they are instances of.
-
-If \c r3 and \c r4 were both instances of a \c RectangleWithString component, and that
-component definition included the declaration of a string property named \c customProperty,
-then \c r3 and \c r4 would be considered to be the same type (that is, they would be
-instances of the \c RectangleWithString type, rather than defining their own implicit type).
-
-\section2 In-Depth Memory Allocation Considerations
-
-Whenever making decisions regarding memory allocation or performance trade-offs, it is
-important to keep in mind the impact of CPU-cache performance, operating system paging,
-and JavaScript engine garbage collection. Potential solutions should be benchmarked
-carefully in order to ensure that the best one is selected.
-
-No set of general guidelines can replace a solid understanding of the underlying
-principles of computer science combined with a practical knowledge of the implementation
-details of the platform for which the application developer is developing. Furthermore,
-no amount of theoretical calculation can replace a good set of benchmarks and analysis
-tools when making trade-off decisions.
-
-\section3 Fragmentation
-
-Fragmentation is a C++ development issue. If the application developer is not defining
-any C++ types or plugins, they may safely ignore this section.
-
-Over time, an application will allocate large portions of memory, write data to that
-memory, and subsequently free some portions of that memory once it has finished using
-some of the data. This can result in "free" memory being located in non-contiguous
-chunks, which cannot be returned to the operating system for other applications to use.
-It also has an impact on the caching and access characteristics of the application, as
-the "living" data may be spread across many different pages of physical memory. This
-in turn could force the operating system to swap which can cause filesystem I/O - which
-is, comparatively speaking, an extremely slow operation.
-
-Fragmentation can be avoided by utilizing pool allocators (and other contiguous memory
-allocators), by reducing the amount of memory which is allocated at any one time by
-carefully managing object lifetimes, by periodically cleansing and rebuilding caches,
-or by utilizing a memory-managed runtime with garbage collection (such as JavaScript).
-
-\section3 Garbage Collection
-
-JavaScript provides garbage collection. Memory which is allocated on the JavaScript
-heap (as opposed to the C++ heap) is owned by the JavaScript engine. The engine will
-periodically collect all unreferenced data on the JavaScript heap, and if fragmentation
-becomes an issue, it will compact its heap by moving all "living" data into a contiguous
-region of memory (allowing the freed memory to be returned to the operating system).
-
-\section4 Implications of Garbage Collection
-
-Garbage collection has advantages and disadvantages. It ensures that fragmentation is
-less of an issue, and it means that manually managing object lifetime is less important.
-However, it also means that a potentially long-lasting operation may be initiated by the
-JavaScript engine at a time which is out of the application developer's control. Unless
-JavaScript heap usage is considered carefully by the application developer, the frequency
-and duration of garbage collection may have a negative impact upon the application
-experience.
-
-\section4 Manually Invoking the Garbage Collector
-
-An application written in QML will (most likely) require garbage collection to be
-performed at some stage. While garbage collection will be automatically triggered by
-the JavaScript engine when the amount of available free memory is low, it is occasionally
-better if the application developer makes decisions about when to invoke the garbage
-collector manually (although usually this is not the case).
-
-The application developer is likely to have the best understanding of when an application
-is going to be idle for substantial periods of time. If a QML application uses a lot
-of JavaScript heap memory, causing regular and disruptive garbage collection cycles
-during particularly performance-sensitive tasks (for example, list scrolling, animations,
-and so forth), the application developer may be well served to manually invoke the
-garbage collector during periods of zero activity. Idle periods are ideal for performing
-garbage collection since the user will not notice any degradation of user experience
-(skipped frames, jerky animations, and so on) which would result from invoking the garbage
-collector while activity is occurring.
-
-The garbage collector may be invoked manually by calling \c{gc()} within JavaScript.
-This will cause a comprehensive collection and compaction cycle to be performed, which
-may take from between a few hundred to more than a thousand milliseconds to complete, and
-so should be avoided if at all possible.
-
-\section3 Memory vs Performance Trade-offs
-
-In some situations, it is possible to trade-off increased memory usage for decreased
-processing time. For example, caching the result of a symbol lookup used in a tight loop
-to a temporary variable in a JavaScript expression will result in a significant performance
-improvement when evaluating that expression, but it involves allocating a temporary variable.
-In some cases, these trade-offs are sensible (such as the case above, which is almost always
-sensible), but in other cases it may be better to allow processing to take slightly longer
-in order to avoid increasing the memory pressure on the system.
-
-In some cases, the impact of increased memory pressure can be extreme. In some situations,
-trading off memory usage for an assumed performance gain can result in increased page-thrash
-or cache-thrash, causing a huge reduction in performance. It is always necessary to benchmark
-the impact of trade-offs carefully in order to determine which solution is best in a given
-situation.
-
-For in-depth information on cache performance and memory-time trade-offs, please see
-Ulrich Drepper's excellent article "What Every Programmer Should Know About Memory"
-(available at http://ftp.linux.org.ua/pub/docs/developer/general/cpumemory.pdf as at 18th
-April 2012), and for information on C++-specific optimizations, please see Agner Fog's
-excellent manuals on optimizing C++ applications (available at
-http://www.agner.org/optimize/ as at 18th April 2012).
-
-*/
diff --git a/src/quick/doc/src/appdevguide/porting.qdoc b/src/quick/doc/src/appdevguide/porting.qdoc
deleted file mode 100644
index 907f7403b9..0000000000
--- a/src/quick/doc/src/appdevguide/porting.qdoc
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtquick-porting-qt5.html
-\title Porting QML Applications to Qt 5
-\brief Lists the Qt 5.0 changes that affect the existing QML applications
-
-When porting QML-related code from Qt 4.8 to Qt 5, application developers should be aware that
-the QML infrastructure has undergone considerable changes in Qt 5. The sections below describe
-these changes and the impact they have on your existing code.
-
-This article describes the changes that affect your existing code. If you are
-interested in the summary of all new features in Qt 5 for QML application development, see
-\l{Qt QML Release Notes} and \l{Qt Quick Release Notes}.
-
-\section1 QML Language changes
-
-There are very few changes in the QML language which affect the porting of existing Qt 4.8 QML code to Qt 5. These are:
-
-\list
-\li Individual file imports no longer work (e.g. import "MyType.qml"). Import the containing directory instead.
-\li Relative file paths in JavaScript files are now resolved relative to the location of the JavaScript file instead of the QML file that imported it.
-\endlist
-
-\section1 QtQuick Module
-
-The QtQuick module has been updated to version 2.0. All QML applications should update their import
-statements to use the new version:
-
-\qml
-import QtQuick 2.0
-\endqml
-
-
-\section2 Property and Method Changes
-
-\list
-\li ListView's \c highlightMoveSpeed and \c highlightResizeSpeed properties have been renamed to
-\l{ListView::}{highlightMoveVelocity} and \l{ListView::}{highlightResizeVelocity}, respectively.
-\li TextInput and TextEdit's \c openSoftwareInputPanel() and \c closeSoftwareInputPanel() methods
-have been removed. Use the new Qt.inputMethod property and call Qt.inputMethod.show()
-Qt.inputMethod.hide() to show and hide the virtual keyboard.
-\endlist
-
-\section2 Type and API Changes
-
-\list
-\li XmlListModel has moved into its own module, QtQuick.XmlListModel. Any code that uses the
-XmlListModel and XmlRole types must import \e {QtQuick.XmlListModel} instead.
-\li The local storage API that enables SQL support has been moved from the \l {QML Global Object}
-into a \c QtQuick.LocalStorage singleton type. Any code that requires the local storage API must import
-\e {QtQuick.LocalStorage} instead. See the \l {QtQuick.LocalStorage 2}{QtQuick.LocalStorage} documentation
-for examples.
-\li The \c LayoutItem type has been removed from the \c QtQuick module as it was specific to the
-Graphics View framework backend used in QtQuick 1.
-\endlist
-
-\section2 Behavioral Changes
-
-QtQuick 2.0 includes a number of behavioral changes and you should thoroughly test your applications after
-porting. These changes will not necessarily lead to run-time errors, but may break certain assumptions in your code.
-Below are the prominent changes to be aware of when porting your applications.
-
-Item opacity and visibility:
-
-\list
-\li The input handling details of \l{Item::}{opacity} and \l{Item::}{visible} have changed. An opacity of zero no
- longer affects input handling, where previously it stopped mouse input. A visibility of false no longer affects
- keyboard input, but still stops mouse input. The new \l{Item::}{enabled} property stops mouse and keyboard input, but does not affect how or whether
- the item is rendered. A workaround for applying the old behavior in most cases is to bind enabled to
- \tt {(visible && opacity > 0.0)}.
-\li Previously, if an item was in a positioner (i.e. a \l Row, \l Column, \l Grid and \l Flow)
- and the item's \c opacity changed to 0, or its \c visible value became \c false, the positioner
- would remove the item from its layout and collapse the space for that item. In QtQuick 2.0, this
- now only happens when an item's \c visible is \c false; the item opacity no longer affects whether
- the item is laid out. (This is consistent with the existing behavior of ListView and GridView).
-\endlist
-
-Text:
-
-\list
-\li The TextEdit::textFormat property now defaults to \c PlainText instead of \c AutoText.
-\li When Text::textFormat is set to \c Text.AutoText format, the text object will automatically
- switch to \c Text.StyledText instead of \c Text.RichText.
-\endlist
-
-Other:
-
-\list
-\li Modifying the Image::sourceSize now fits the image to the size, maintaining aspect
- ratio.
-\li For ListView and GridView, the \c cacheBuffer property now has a non-zero default and
- delegates in the cache buffer are created asynchronously. Also, using a \c RightToLeft layout
- now also reverses the \c preferredHighlightBegin and \c preferredHighlightEnd.
-\li For \l Loader, the \c sourceChanged and \c sourceComponentChanged signals are now only emitted
- when their respective properties change value. (Previously \l Loader emitted both of these signals
- when either of the relevant properties had changed.)
-\endlist
-
-
-\section2 Changes to experimental Qt.labs modules
-
-\list
-\li The \c Qt.labs.particles module has been removed. It is replaced by the fully-fledged \l
-QtQuick.particles module which is an enormous improvement on its predecessor.
-\li The \c Qt.labs.shaders module has been removed as the \c ShaderEffectItem and \l
-ShaderEffectSource types from this module have been moved into the \l QtQuick module. Note the \c
-ShaderEffectItem type has been renamed to \l ShaderEffect.
-\endlist
-
-
-\section1 C++ code
-
-In Qt 5, all QML applications are rendered with an OpenGL scenegraph architecture rather than the
-Graphics View framework used in Qt 4. Due to the scale of this architectural change, the C++ API has
-been extensively restructured and the \c QtDeclarative module has been deprecated in favour of two
-new modules: \l QtQml, which implements the QML engine and language infrastructure, and \l QtQuick,
-which implements the visual canvas and scenegraph backend.
-
-All classes that were previously in the \c QtDeclarative module have been moved into the \l QtQml
-and \l QtQuick modules, and their class names have been changed to reflect their new module
-locations. The class name changes are as follows:
-
-\table
-\header
- \li QtQml
- \li QtQuick
-\row
- \li
- \list
- \li QDeclarativeComponent -> QQmlComponent
- \li QDeclarativeContext -> QQmlContext
- \li QDeclarativeEngine -> QQmlEngine
- \li QDeclarativeError -> QQmlError
- \li QDeclarativeExpression -> QQmlExpression
- \li QDeclarativeExtensionPlugin -> QQmlExtensionPlugin
- \li QDeclarativeInfo -> QQmlInfo
- \li QDeclarativeListReference -> QQmlListReference
- \li QDeclarativeNetworkAccessManagerFactory -> QQmlNetworkAccessManagerFactory
- \li QDeclarativeParserStatus -> QQmlParserStatus
- \li QDeclarativeProperty -> QQmlProperty
- \li QDeclarativePropertyMap -> QQmlPropertyMap
- \li QDeclarativePropertyValueSource -> QQmlPropertyValueSource
- \li QDeclarativeScriptString -> QQmlScriptString
- \endlist
- \li
- \list
- \li QDeclarativeItem -> QQuickItem
- \li QDeclarativeView -> QQuickView
- \li QDeclarativeImageProvider -> QQuickImageProvider
- \endlist
-\endtable
-
-To use the new \c QtQml* and \c QtQuick* classes in Qt 5, link against the approprate module from
-your qmake \c .pro file. For example the following will link against both the QtQml and QtQuick
-modules:
-
-\code
-QT += qml quick
-\endcode
-
-Required header files can then be included:
-
-\code
-#include <QtQml/QQmlEngine>
-#include <QtQuick/QQuickView>
-\endcode
-
-(The \c QtDeclarative module is still available to developers as the \l QtQuick1 module, as
-discussed in \l{Using the QtDeclarative module in Qt 5}{below}. However, it should not be used for
-new applications.)
-
-
-\section3 QDeclarativeItem and QDeclarativeView
-
-When porting to QQuickItem, note that QDeclarativeItem inherited from QGraphicsItem; in contrast,
-QQuickItem inherits directly from QObject, and any QGraphicsItem-specific functionality is no longer
-available. In particular, QQuickItem does not have a \c paint() method for performing custom
-rendering through the QPainter API. Instead, in Qt 5, custom rendering should be performed through
-the new \c QSG* classes to take full advantage of the scene graph. See the \l {Qt Quick Scene Graph}
-documentation details on using these classes.
-
-Alternatively, the QQuickPaintedItem provides a \c paint() method and can be used as
-a convenient way to port QDeclarativeItem-based classes that use the QPainter API. Note this method
-is less performant than using the \c QSG* classes.
-
-When porting from QDeclarativeView to QQuickView, note that QDeclarativeItem inherited from
-QGraphicsView. In contrast, QQuickView inherits from QQuickWindow and uses the QWindow
-infrastructure introduced in Qt 5; any QGraphicsView-specific functionality is no longer available.
-
-
-\section3 qmlscene Utility
-
-The \c qmlviewer tool provided for prototyping and testing QML applications in Qt 4.x has been
-replaced with the \c qmlscene tool which integrates with the new scenegraph features in Qt 5.
-
-
-\section2 QML plugins
-
-All QML plugins should extend QQmlExtensionPlugin in Qt 5.
-
-Additionally, plugins should use the new Qt plugin infrastructure introduced in Qt 5. QML plugins no
-longer require the Q_EXPORT_PLUGIN2() macro. Instead, they should use the Q_PLUGIN_METADATA() macro
-within the plugin class declaration.
-
-See the updated \l {qtqml-modules-cppplugins.html}{Creating C++ Plugins For QML} documentation for
-an overview of creating QML plugins in Qt 5.
-
-
-\section2 QtDeclarative module in Qt 5
-
-For the purposes of porting older applications, the \c QtDeclarative module is still available in Qt
-5 but has been renamed to \c QtQuick1. Applications that required QtQuick 1 specific API (e.g.
-QDeclarativeView or QDeclarativeItem and the Graphics View integration) can use this module. Note
-that new applications should use the new \l QtQml and \l QtQuick modules instead.
-
-To use the \c QtQuick1 module, add “quick1” module to your qmake \c .pro file:
-
-\code
-QT += quick1
-\endcode
-
-Required header files can be included from the QtQuick 1 module:
-
-\code
-#include <QtQuick1/QDeclarativeView>
-#include <QtQuick1/QDeclarativeItem>
-\endcode
-
-*/
diff --git a/src/quick/doc/src/appdevguide/qmlscene.qdoc b/src/quick/doc/src/appdevguide/qmlscene.qdoc
deleted file mode 100644
index a749b48c04..0000000000
--- a/src/quick/doc/src/appdevguide/qmlscene.qdoc
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtquick-qmlscene.html
- \ingroup qtquick-tools
- \title Prototyping with qmlscene
- \ingroup qttools
- \brief Utility to test and load QML files
-
- Qt 5 includes \c qmlscene, a utility to load QML documents.
- The \c{qmlscene} utility enables viewing your QML document even before the
- application is complete. This utility also provides the following
- additional features that are useful while developing QML applications:
- \list
- \li View the QML document in a maximized window.
- \li View the QML document in full-screen mode.
- \li Make the window transparent.
- \li Disable multi-sampling (anti-aliasing).
- \li Do not detect the version of the .qml file.
- \li Run all animations in slow motion.
- \li Resize the window to the size of the root item.
- \li Add the list of import paths.
- \li Add a named bundle.
- \li Use a translation file to set the language.
- \endlist
-
- The \c qmlscene utility is meant to be used for testing your QML
- applications, and not as a launcher in a production environment.
- To launch a QML application in a production environment, develop a custom
- C++ application or bundle the QML file in a module. See \l {Deploying QML
- applications} for more information.
-
- To load a .qml file, run the tool and select the file to be opened, or
- provide the file path on the command prompt:
-
- \code
- qmlscene myqmlfile.qml
- \endcode
-
- To see the configuration options, run \c qmlscene 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{QML Plugin Example}{QML plugin example}
- creates a C++ plugin identified with the namespace, \c TimeExample.
- To load the plugin, you must run \c qmlscene with the \c{-I} flag from the
- example's base directory:
-
- \code
- qmlscene -I imports plugins.qml
- \endcode
-
- This adds the current directory to the import path so that \c qmlscene will
- find the plugin in the \c imports directory.
-
- \note By default, the current directory is included in the import search
- path, but modules in a namespace such as \c TimeExample are not found
- unless the path is explicitly added.
-
- \section1 Loading Test Data
-
- Often, QML applications are prototyped with test data that is later
- replaced by real data sources from C++ plugins. The \c qmlscene utility
- assists in this aspect by loading test data into the application context.
- It looks for a directory named \c {dummydata} in the same directory as
- the target QML file, and loads the .qml files in that directory as QML
- objects and bind them to the root context as properties named after the files.
-
- For example, the following QML document refers to a \c lottoNumbers
- property which does not exist within the document:
-
- \qml
- import QtQuick 2.0
-
- ListView {
- width: 200; height: 300
- model: lottoNumbers
- delegate: Text { text: number }
- }
- \endqml
-
- If within the document's directory, there is a \c{dummydata} directory
- which contains a \c lottoNumbers.qml file like this:
-
- \qml
- import QtQuick 2.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 \c dummydata. The following
- document refers to a \c clock.time property:
-
- \qml
- import QtQuick 2.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 2.0
- QtObject { property int time: 54321 }
- \endqml
-
- To replace this with real data, bind the real data object to
- the root context in C++ using QQmlContext::setContextProperty(). This is
- detailed in \l{Integrating QML and C++}.
-
-*/
-
diff --git a/src/quick/doc/src/appdevguide/qtquicktest.qdoc b/src/quick/doc/src/appdevguide/qtquicktest.qdoc
deleted file mode 100644
index 6d434279e6..0000000000
--- a/src/quick/doc/src/appdevguide/qtquicktest.qdoc
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtquick-qtquicktest.html
- \inqmlmodule QtQuick 2
- \title Qt Quick Test Reference Documentation
- \brief unit testing framework for QML
-
- \section1 Introduction
-
- QtQuickTest is a unit test framework for QML applications.
- Test cases are written as JavaScript functions within a TestCase
- type:
-
- \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 types 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
-
- It is also possible to run a single file using the \c{-input} option.
- For example:
-
- \code
- tst_example -input data/test.qml
- \endcode
-
- \code
- tst_example -input <full_path>/test.qml
- \endcode
-
- \note Specifying the full path to the qml test file is for example
- needed for shadow builds.
-
- If your test case needs QML imports, then you can add them as
- \c{-import} options to 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
-
- The \c{-functions} command-line option will return a list of the current
- tests functions. It is possible to run a single test function using the name
- of the test function as an argument. For example:
-
- \code
- tst_example Test_Name::function1
- \endcode
-
- The \c{-help} command-line option will return all the options available.
-
- \code
- tst_example -help
- \endcode
-*/
diff --git a/src/quick/doc/src/appdevguide/quickstart/basics.qdoc b/src/quick/doc/src/appdevguide/quickstart/basics.qdoc
deleted file mode 100644
index 15f3c2f5ff..0000000000
--- a/src/quick/doc/src/appdevguide/quickstart/basics.qdoc
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-quickstart-basics.html
-\title Quick Start Guide - QML Basics
-\brief Basic QML application development examples
-
-\section1 Creating a QML Document
-
-A QML document defines a hierarchy of objects with a highly-readable,
-structured layout. Every QML document consists of two parts: an imports
-section and an object declaration section. The types and functionality most
-common to user interfaces are provided in the \c{QtQuick}
-import.
-
-\section2 Importing and Using the QtQuick Module
-
-To use the \l{Qt Quick} module, a QML document needs to
-import it. The import syntax looks like this:
-
-\qml
-import QtQuick 2.0
-\endqml
-
-The types and functionality that \l{Qt Quick} provides can now
-be used in the QML document!
-
-\section2 Defining an Object Hierarchy
-
-The object declaration in a QML document defines what will be displayed in the
-visual scene. \l{Qt Quick} provides the basic building blocks
-for all user interfaces, including objects to display images and text, and to
-handle user input.
-
-A simple object declaration might be a colored rectangle with some text centered
-in it:
-
-\qml
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-}
-\endqml
-
-This defines an object hierarchy with a root \l Rectangle object
-which has a child \l Text object. The \c parent of the \l Text object is
-automatically set to the \l Rectangle, and similarly, the \l Text object is
-added to the \c children property of the \l Rectangle object, by QML.
-
-\section2 Putting it Together
-
-The \l Rectangle and \l Text types used in the above example are both provided
-by the \c{QtQuick} import. Putting the import and object declaration
-together, we get a complete QML document:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-}
-\endqml
-
-If we save that document as "HelloWorld.qml" we can load and display it.
-
-\section1 Loading and Displaying the QML Document
-
-To display the graphical scene defined by the QML document, it may be loaded
-with the \l{Prototyping with qmlscene}{qmlscene} tool. The
-\l{Prototyping with qmlscene}{qmlscene} tool should be installed into the
-Qt installation directory. Assuming that the Qt binaries are installed into
-or are available in the system executable path, you can display the QML
-document with the following command:
-
-\code
-qmlscene HelloWorld.qml
-\endcode
-
-You should see the text "Hello, World!" in the center of a red rectangle.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc b/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc
deleted file mode 100644
index d7a9ec3cdb..0000000000
--- a/src/quick/doc/src/appdevguide/quickstart/essentials.qdoc
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-quickstart-essentials.html
-\title Quick Start Guide - QML Essentials
-\brief Essential QML application development examples
-
-\section1 Handling User Input
-
-One of the great advantages of using QML to define a user interface is that it
-allows the user interface designer to define how the application should react
-to events with simple JavaScript expressions. In QML, we refer to those events
-as \l{Signal and Handler Event System}{signals} and such signals can be handled
-with \l{qml-signals-and-handlers}{signal handlers}.
-
-For example, consider the following example:
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: parent.color = "blue"
- }
-}
-\endqml
-
-This example can be saved as "ClickableHelloWorld.qml" and run with qmlscene.
-Whenever the user clicks anywhere in the window, the rectangle will change
-from red to blue. Note that the \l MouseArea type also emits the clicked
-signal for touch events, so this code will also work on a mobile device.
-
-Keyboard user input can be similarly handled with a simple expression:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 200
- height: 100
- color: "red"
-
- Text {
- anchors.centerIn: parent
- text: "Hello, World!"
- }
-
- focus: true
- Keys.onPressed: {
- if (event.key == Qt.Key_Return) {
- color = "blue";
- event.accepted = true;
- }
- }
-}
-\endqml
-
-By accepting focus, the color can be changed to blue whenever the return key
-is pressed.
-
-\section1 Property Bindings
-
-Objects and their properties form the basis of a graphical interface defined
-in a QML document. The QML language allows properties to be bound to each
-other in various ways, enabling highly dynamic user interfaces.
-
-In the following example, the geometry of each child \l Rectangle is bound to
-that of the parent \l Rectangle. If the geometry of the parent \l Rectangle
-were to change, the geometry of each child \l Rectangle would automatically
-update due to the property bindings.
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- width: 400
- height: 200
-
- Rectangle {
- width: parent.width / 2
- height: parent.height
- }
-
- Rectangle {
- width: parent.width / 2
- height: parent.height
- x: parent.width / 2
- }
-}
-\endqml
-
-\section1 Animations
-
-Properties can also be dynamically updated via animations. The \c QtQuick
-import provides various animation types which can be used to animate changes
-to a property's value. In the following example, a property is animated which
-then gets displayed in a \l Text area:
-
-\qml
-import QtQuick 2.0
-
-Rectangle {
- color: "lightgray"
- width: 200
- height: 200
-
- property int animatedValue: 0
- SequentialAnimation on animatedValue {
- loops: Animation.Infinite
- PropertyAnimation { to: 150; duration: 1000 }
- PropertyAnimation { to: 0; duration: 1000 }
- }
-
- Text {
- anchors.centerIn: parent
- text: animatedValue
- }
-}
-\endqml
-
-The value being displayed will vary from 0 to 150 periodically.
-
-\section1 Defining Custom QML Types for Re-use
-
-One of the most important concepts in QML is that of type re-use. An
-application will probably have multiple visual types which are all similar
-(for example, multiple push buttons), and QML allows these sort of things to
-be defined as re-usable, custom types, to minimize code duplication and
-maximize readability.
-
-For example, imagine that the developer defines a new \c Button type in the
-\c Button.qml file:
-
-\snippet qml/qml-extending-types/components/Button.qml 0
-
-That type may now be re-used multiple times in the application, as follows:
-
-\table
-\row
-\li \snippet qml/qml-extending-types/components/application.qml 0
-\li \image qml-extending-types.png
-\endtable
-
-
-In this way, modular user interface types can be built up and re-used within
-an application.
-
-See \l {QML Object Attributes}
-for more details on how to develop your own reusable components.
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/animations.qdoc b/src/quick/doc/src/appdevguide/usecases/animations.qdoc
deleted file mode 100644
index b237849caf..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/animations.qdoc
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-animations.html
-\title Usecase - Animations In QML
-\brief Example of how to include animations in QML applications
-
-QtQuick provides the ability to animate properties. Animating properties allows property values to move through
-intermediate values instead of immediately changing to the target value. To animate the position of an item, you can
-animate the properties that controle the item's position, x and y for example, so that the item's position
-changes each frame on the way to the target position.
-
-\section1 Fluid UIs
-
-QML was designed to facilitate the creation of fluid UIs. These are user interfaces where the UI components animate instead of appearing, disappearing, or jumping abruptly. Qt Quick provides two simple ways to have UI
-components move with animation instead of instantly appearing at their new location.
-
-\section2 States and Transitions
-
-Qt Quick allows you to declare various UI states in \l State objects. These states are comprised of property changes from a
-base state, and can be a useful way of organizing your UI logic. Transitions are objects you can associate with an item
-to define how its properties will animate when they change due to a state change.
-
-States and transitions for an item can be declared with the \l Item::states and \l Item::transitions properties.
-States are declared inside the states list property of an item, usually the root item of the component. Transitions
-defined on the same item are used to animate the changes in the state. Here is an example.
-
-\snippet qml/usecases/animations.qml states
-
-\section2 Animating Property Changes.
-
-Behaviors can be used to specify an animation for a property to use when it changes. This is then applied to all
-changes, regardless of their source. The following example animates a button moving around the
-screen using behaviors.
-
-\snippet qml/usecases/animations.qml behave
-
-\section1 Other Animations
-
-Not all animations have to be tied to a specific property or state. You can also create animations more generally, and
-specify target items and properties inside the animation. Here are some examples of different ways to do this:
-
-\snippet qml/usecases/animations.qml constant
-\snippet qml/usecases/animations.qml scripted
-\image qml-uses-animation.png
-
-More information about animations can be found on the \l{Important Concepts in Qt Quick - States, Transitions and
-Animations} page.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc b/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc
deleted file mode 100644
index 4bad4a4033..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/integratingjs.qdoc
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-integratingjs.html
-\title Use Case - Integrating JavaScript in QML
-\brief Example of how to integrate JavaScript code in QML applications
-
-JavaScript code can be easily integrated into QML to provide UI logic, imperative control, or other benefits.
-
-\section1 Using JavaScript Expressions for Property Values
-
-JavaScript expressions can be used in QML as bindings. For example
-\code
-Item {
- width: Math.random()
- height: width < 100 ? 100 : (width + 50) / 2
-}
-\endcode
-
-Note that function calls, like Math.random(), will not be revaluated unless their arguments
-change. So binding to Math.random() will be one random number and not revaluated, but if the width is changed in some
-other manner, the height binding will be reevaluated to take that into account.
-
-\section1 Adding JavaScript Functions in QML
-
-JavaScript functions can be declared on QML items, like in the below example. This allows you to call the method
-using the item id.
-
-\snippet qml/usecases/integratingjs-inline.qml 0
-
-\section1 Using JavaScript files
-
-JavaScript files can be used for abstracting out logic from QML files. To do this, first place your functions inside a
-.js file like in the example shown.
-
-\snippet qml/usecases/myscript.js 0
-
-Then import the file into any .qml file that needs to use the functions, like the example QML file below.
-
-\snippet qml/usecases/integratingjs.qml 0
-
-\image qml-uses-integratingjs.png
-
-For further details on the JavaScript engine used by QML, as well as the difference from browser JS, see the full
-documentation on \c {Using JavaScript Expressions with QML}.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc b/src/quick/doc/src/appdevguide/usecases/layouts.qdoc
deleted file mode 100644
index e8e35a93e7..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/layouts.qdoc
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-layouts.html
-\title Use Case - Layouts In QML
-\brief Example of how to create layouts for visual components in a QML application
-
-There are several ways to position items in QML.
-
-Below is a brief overview. For more details, see \l {Important Concepts In Qt Quick - Positioning}.
-
-\section1 Manual Positioning
-
-Items can be placed at specific x,y coordinates on the screen by setting their x,y properties. This will
-setup their position relative to the top left corner of their parent, according to the
-\l {Concepts - Visual Coordinates in Qt Quick}{visual coordinate system} rules.
-
-Combined with using \l{Property Binding}{bindings} instead of constant valudes for these properties, relative positioning is also easily
-accomplished by setting the x and y coordinates to the appropriate bindings.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml direct
-
-\image qml-uses-layouts-direct.png
-
-
-\section1 Anchors
-
-The \c Item type provides the abilitiy to anchor to other \l Item types. There are six anchor lines for each item: \e left,
-\e right, \e{vertical center}, \e top, \e bottom and \e{horizontal center}. The three vertical anchor lines can be anchored to any of
-the three vertical anchor lines of another item, and the three horizontal anchor lines can be anchored to the
-horizontal anchor lines of another item.
-
-For full details, see \l {Positioning with Anchors} and the documentation of the \l{Item::anchors.top}{anchors property}.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml anchors
-
-\image qml-uses-layouts-anchors.png
-
-
-\section1 Positioners
-
-For the common case of wanting to position a set of types in a regular pattern, Qt Quick provides some positioner
-types. Items placed in a positioner are automatically positioned in some way; for example, a \l Row positions items to be
-horizontally adjacent (forming a row).
-
-For full details see \l {Item Layouts} and the documentation for \l{qtquick-qmltypereference.html#positioning}{the positioner types}.
-
-\snippet qml/usecases/layouts.qml import
-\snippet qml/usecases/layouts.qml positioners
-
-\image qml-uses-layouts-positioners.png
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/styling.qdoc b/src/quick/doc/src/appdevguide/usecases/styling.qdoc
deleted file mode 100644
index 68b8d0302c..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/styling.qdoc
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-styling.html
-\title Use Case - Style And Theme Support
-\brief Example of how to style user interface components in QML
-
-The types provided in the QtQuick module are not complete user interface components on their own. A common use case is to
-develop a set of custom styled user interface components out of the types in the QtQuick module. This is easily
-accomplished by creating your own reusable components.
-
-With the reusable components approach, you define your own type with the appearance you want to have in your
-application and style that type directly. You then use that type in your application instead of the unstyled type. For
-example, you could create a MyText.qml which is a Text type with certain properties set by default, and use MyText
-instead of Text elsewhere in your application.
-
-\section1 Example Themed Text
-\section2 Button Definition
-\snippet qml/usecases/MyText.qml 0
-\section2 Using the Text
-\snippet qml/usecases/styling-text.qml texts
-\image qml-uses-styling-text.png
-
-Because the root item in MyText.qml is a Text item it will behave as a
-Text item, and the properties can be overriden in specific uses. However, the properties will be set to the values
-specified in MyText when the item is first generated, thus applying your style by default.
-
-For pre-styled user interface components, see the \c{Qt Components} add-on which provides a set of components.
-For accessing the system theme, see the \l{SystemPalette} type documentation.
-
-\section1 Example Themed Button
-\section2 Button Definition
-\snippet qml/usecases/Button.qml 0
-\section2 Using the Button
-\snippet qml/usecases/styling.qml 0
-\image qml-uses-styling.png
-
-For more examples of creating custom UI components in QML, see the tutorials.
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/text.qdoc b/src/quick/doc/src/appdevguide/usecases/text.qdoc
deleted file mode 100644
index d0b8901170..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/text.qdoc
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-text.html
-\title Use Case - Displaying Text In QML
-\brief Example of how to display text in QML
-To display text the Text type is provided by the QtQuick module. For related uses, the \l{TextInput} and
-\l{TextEdit} types provide editable text controls. For full HTML markup, see the \c{QtWebkit} module.
-
-\section1 Displaying and Formatting Text
-
-To display text in QML, create a Text item and set the text property to the text you wish to display. The Text item
-will now display that text.
-
-Several properties can be set on the Text item to style the entire block of text. These include color, font family,
-font size, bold and italic. For a full list of properties, consult the \l{Text} type documentation.
-
-Rich text like markup can be used to selectively style specific sections of text with a Text item. Set \l
-Text::textFormat to Text.StyledText to use this functionality. More details are available in the documentation of the
-\l{Text} type.
-
-\section1 Laying out Text
-
-By default, Text will display the text as a single line unless it contains embedded newlines. To wrap the line, set the
-wrapMode property and give the text an explicit width for it to wrap to. If the width or height is not explicitly set,
-reading these properties will return the parameters of the bounding rect of the text (if you have explicitly set width
-or height, you can still use paintedWidth and paintedHeight). With these parameters in mind, the Text can be positioned
-like any other Item.
-
-\section1 Example Code
-\snippet qml/usecases/text.qml 0
-\image qml-uses-text.png
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/userinput.qdoc b/src/quick/doc/src/appdevguide/usecases/userinput.qdoc
deleted file mode 100644
index 1e20f9d275..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/userinput.qdoc
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-userinput.html
-\title Use Case - Responding To User Input in QML
-\brief Example of how to accept user input and respond to it in a QML application
-
-\section1 Supported Types of User Input
-
-The \l QtQuick module provides support for the most common types of user input,
-including mouse and touch events, text input and key-press events. Other
-modules provide support for other types of user input (for example, the
-\l QtSensors module provides support for shake-gestures in QML applications).
-
-This article covers how to handle basic user input; for further information
-about motion-gesture support, please see the \l QtSensors documentation. For
-information about audio-visual input, please see the \l QtMultimedia documentation.
-
-\section2 Mouse and Touch Events
-
-The \l MouseArea type allows mouse and touch events to be handled in a QML
-application. A \l MouseArea can be combined with either an \l Image or a
-\l Rectangle and \l Text object to implement a simple button.
-
-\snippet qml/usecases/userinput.qml 0
-
-For more advanced use cases requiring multiple touch points, please read the
-documentation for the \l MultiPointTouchArea type and the \l PinchArea type.
-
-Note that some types have their own built in input handling. For example,
-\l Flickable responds to mouse dragging, mouse wheel scrolling, touch dragging,
-and touch flicking by default.
-
-\section2 Keyboard and Button Events
-
-Button and key presses, from buttons on a device, a keypad, or a keyboard,
-can all be handled using the \l Keys attached property. This attached property
-is available on all \l Item derived types, and works with the \l Item::focus property
-to determine which type receives the key event. For simple key handling, you can set the focus
-to true on a single \l Item and do all your key handling there.
-
-\snippet qml/usecases/userinput-keys.qml 0
-
-For text input the \l QtQuick module provides several built-in types.
-In particular, the \l TextInput and \l TextEdit types allow for single-line
-entry and multi-line editing respectively.
-
-Here is all you need to get a working TextInput:
-
-\code
-import QtQuick 2.0
-
-TextInput {
- focus: true
- text: "Initial Text"
-}
-\endcode
-
-*/
diff --git a/src/quick/doc/src/appdevguide/usecases/visual.qdoc b/src/quick/doc/src/appdevguide/usecases/visual.qdoc
deleted file mode 100644
index a022b185fe..0000000000
--- a/src/quick/doc/src/appdevguide/usecases/visual.qdoc
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** 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. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\page qtquick-usecase-visual.html
-\title Use Case - Visual Elements In QML
-\brief Example of how to display visual item types in a QML application
-
-\section1 The Rectangle Type
-
-For the most basic of visuals, QtQuick provides a \l Rectangle type to draw rectangles. These rectangles can be colored with a
-color or a vertical gradient. The \l Rectangle type can also draw borders on the rectangle.
-
-For drawing custom shapes beyond rectangles, see the \l Canvas type or display
-a pre-rendered image using the \l Image type.
-
-\snippet qml/usecases/visual-rects.qml 0
-\image qml-uses-visual-rectangles.png
-
-\section1 The Image Type
-
-QtQuick provides an \l Image type which may be used to display images. The
-\l Image type has a \l source property whose value can be a remote or local
-URL, or the URL of an image file embedded in a compiled resource file.
-
-\snippet qml/usecases/visual.qml image
-
-For more complex images there are other types similar to \l Image.
-\l BorderImage draws an image with grid scaling, suitable for images used as
-borders. \l AnimatedImage plays animated .gif and .mng images. \l AnimatedSprite
-and \l SpriteSequence play animations comprised of multiple frames stored adjacently
-in a non animated image format.
-
-For displaying video files and camera data, see the \l QtMultimedia module.
-
-\section1 Shared Visual Properties
-
-All visual items provided by the QtQuick are based on the Item type, which provides a common set of attributes for
-visual items, including opacity and transform attributes.
-
-\section2 Opacity and Visibility
-
-The QML object types provided by Qt Quick have built-in support for \l{Item::opacity}{opacity}.
-Opacity can be animated to allow smooth transitions to or from a transparent
-state. Visibility can also be managed with the \l{Item::visible}{visible} property more efficiently,
-but at the cost of not being able to animate it.
-
-\snippet qml/usecases/visual-opacity.qml 0
-\image qml-uses-visual-opacity.png
-
-\section2 Transforms
-
-Qt Quick types have built-in support for transformations. If you wish to have your
-visual content rotated or scaled, you can set the \l Item::rotation or \l Item::scale
-property. These can also be animated.
-
-\snippet qml/usecases/visual-transforms.qml 0
-\image qml-uses-visual-transforms.png
-
-For more complex transformations, see the \l Item::transform property.
-
-*/
diff --git a/src/quick/doc/src/concepts/convenience/topic.qdoc b/src/quick/doc/src/concepts/convenience/topic.qdoc
index 113b4952a6..1a6feeaa61 100644
--- a/src/quick/doc/src/concepts/convenience/topic.qdoc
+++ b/src/quick/doc/src/concepts/convenience/topic.qdoc
@@ -66,7 +66,7 @@ required (or when it becomes available).
\section1 Dynamic Signal Connections
QML supports dynamic signal connections through a signal's \c{connect()}
-method. The QtQuick module provides the convenience \l Connections type which
+method. The \l {Qt Quick} module provides the convenience \l Connections type which
allows setting up a signal connection involving an object which isn't part of
the static object hierarchy. It also allows the connection to be dynamically
retargeted at runtime, which allows an application to process different signal
diff --git a/src/quick/doc/src/concepts/effects/particles.qdoc b/src/quick/doc/src/concepts/effects/particles.qdoc
index 708e8d2740..ec49c6df43 100644
--- a/src/quick/doc/src/concepts/effects/particles.qdoc
+++ b/src/quick/doc/src/concepts/effects/particles.qdoc
@@ -44,7 +44,6 @@
/*!
\page qtquick-effects-particles.html
- \inqmlmodule QtQuick.Particles 2.0
\title Using the Qt Quick Particle System
Documentation for all Particle System types can be found on the \l{QtQuick.Particles 2}{QtQuick.Particles} module page.
@@ -132,7 +131,6 @@
/*!
\page qtquick-particles-performance.html
- \inqmlmodule QtQuick 2.0
\title Particle System Performance Guide
The performance of the particle system scales with the number of particles it is maintaining. After prototyping the desired
diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc
index 7ee98a533b..805a423002 100644
--- a/src/quick/doc/src/concepts/effects/sprites.qdoc
+++ b/src/quick/doc/src/concepts/effects/sprites.qdoc
@@ -27,7 +27,6 @@
/*!
\ingroup qtquick-images-sprites
-\ingroup qml-features
\page qtquick-effects-sprites.html
\title Sprite Animations
\brief Sprite-based animations with flexible transitioning
@@ -36,7 +35,7 @@
\section1 Sprite Engine
-The QtQuick sprite engine is a stochastic state machine combined with the ability
+The \l {Qt Quick} sprite engine is a stochastic state machine combined with the ability
to chop up images containing multiple frames of an animation.
\section2 State Machine
diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc
index 1c73c9b5ba..827f6d85c8 100644
--- a/src/quick/doc/src/concepts/input/focus.qdoc
+++ b/src/quick/doc/src/concepts/input/focus.qdoc
@@ -27,14 +27,13 @@
/*!
\page qtquick-input-focus.html
-\ingroup qml-features
\title Keyboard Focus in Qt Quick
\brief handling keyboard focus
When a key is pressed or released, a key event is generated and delivered to the
focused Qt Quick \l Item. To facilitate the construction of reusable components
-and to address some of the cases unique to fluid user interfaces, the Qt Quick items add aged
-\e scope based extension to Qt's traditional keyboard focus model.
+and to address some of the cases unique to fluid user interfaces, the Qt Quick items add a
+scope based extension to Qt's traditional keyboard focus model.
\tableofcontents
@@ -43,17 +42,16 @@ and to address some of the cases unique to fluid user interfaces, the Qt Quick i
When the user presses or releases a key, the following occurs:
\list 1
\li Qt receives the key action and generates a key event.
-\li If the Qt widget containing the \l QQuickView has focus, the key event
-is delivered to it. Otherwise, regular Qt key handling continues.
-\li 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.
-\li 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.
+\li If a \l QQuickWindow is the active window, the key event
+is delivered to it.
+\li The key event is delivered by the scene to the \l Item with
+\e {active focus}. If no item has active focus, the key event is ignored.
+\li If the \l QQuickItem with active focus accepts the key event, propagation
+stops. Otherwise the event is send to the Item's parent until
+the event is accepted, or the root item is reached.
If the \c {Rectangle} type 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
+the event will not be propagated further. Pressing the \c B key the event will propagate to the root
item and thus subsequently be ignored.
\snippet qml/focus/rectangle.qml simple key event
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index 7b8d66f2a6..28bbbf1cca 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -28,7 +28,7 @@
/*!
\page qtquick-modelviewsdata-cppmodels.html
\title Using C++ Models with Qt Quick Views
-\brief using QtQuick views with models defined in C++
+\brief using Qt Quick views with models defined in C++
\section1 Data Provided In A Custom C++ Model
@@ -49,12 +49,12 @@ 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 quick/models/stringlistmodel/view.qml 0
+\snippet models/stringlistmodel/view.qml 0
A Qt application can load this QML document and set the value of \c myModel
to a QStringList:
-\snippet quick/models/stringlistmodel/main.cpp 0
+\snippet models/stringlistmodel/main.cpp 0
The complete source code for this example is available in
\l {quick/modelviews/stringlistmodel}{examples/quick/modelviews/stringlistmodel}
@@ -74,11 +74,11 @@ The following application creates a \c DataObject class with
Q_PROPERTY values that will be accessible as named roles when a
QList<DataObject*> is exposed to QML:
-\snippet quick/models/objectlistmodel/dataobject.h 0
+\snippet models/objectlistmodel/dataobject.h 0
\dots 4
-\snippet quick/models/objectlistmodel/dataobject.h 1
+\snippet models/objectlistmodel/dataobject.h 1
\codeline
-\snippet quick/models/objectlistmodel/main.cpp 0
+\snippet models/objectlistmodel/main.cpp 0
\dots
The QObject* is available as the \c modelData property. As a convenience,
@@ -86,7 +86,7 @@ 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 quick/models/objectlistmodel/view.qml 0
+\snippet models/objectlistmodel/view.qml 0
Note the use of \c color property with qualifier.
The properties of the object are not replicated in the \c model
@@ -130,21 +130,21 @@ which exposes the \e type and \e sizes roles. It reimplements
QAbstractItemModel::roleNames() to expose the role names, so that they can be
accessed via QML:
-\snippet quick/models/abstractitemmodel/model.h 0
+\snippet models/abstractitemmodel/model.h 0
\dots
-\snippet quick/models/abstractitemmodel/model.h 1
+\snippet models/abstractitemmodel/model.h 1
\dots
-\snippet quick/models/abstractitemmodel/model.h 2
+\snippet models/abstractitemmodel/model.h 2
\codeline
-\snippet quick/models/abstractitemmodel/model.cpp 0
+\snippet models/abstractitemmodel/model.cpp 0
\codeline
-\snippet quick/models/abstractitemmodel/main.cpp 0
+\snippet models/abstractitemmodel/main.cpp 0
\dots
This model is displayed by a ListView delegate that accesses the \e type and \e size
roles:
-\snippet quick/models/abstractitemmodel/view.qml 0
+\snippet models/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
diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc
index 9165c2f6df..35be2f6235 100644
--- a/src/quick/doc/src/concepts/positioning/layouts.qdoc
+++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc
@@ -28,10 +28,9 @@
/*!
\ingroup qtquick-positioners
\page qtquick-positioning-layouts.html
-\ingroup qml-features
-\title Item Layouts
+\title Item Positioners
-Positioner items are container items that manage the positions and sizes of
+Positioner items are container items that manage the positions 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.
@@ -39,6 +38,10 @@ except that they are also containers in their own right.
Positioners make it easier to work with many items when they need
to be arranged in a regular layout.
+\l{Qt Quick Layouts} can also be used to arrange Qt Quick items in a user interface.
+They manage both the positions and the sizes of items on a declarative user interface,
+and are well suited for resizable user interfaces.
+
\section1 Positioners
A set of standard positioners are provided in the basic set of Qt Quick
diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
index 7052de3b49..bc67594960 100644
--- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
+++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
@@ -27,7 +27,6 @@
/*!
\page qtquick-positioning-righttoleft.html
-\ingroup qml-features
\title Right-to-left User Interfaces
\brief switching text flow and layout
\section1 Overview
@@ -139,7 +138,7 @@ The painting of these icons can be mirrored with a dedicated \c mirror property
\section1 Default layout direction
-The \l {QML:Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the
+The \l {QtQml2::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.
diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc
index 25fc6eaab7..bae6a7f71b 100644
--- a/src/quick/doc/src/concepts/positioning/topic.qdoc
+++ b/src/quick/doc/src/concepts/positioning/topic.qdoc
@@ -34,7 +34,7 @@ Visual items in QML can be positioned in a variety of ways. The most important
positioning-related concept is that of anchoring, a form of relative
positioning where items can be anchored (or attached) to each other at certain
boundaries. Other positioning concepts include absolute positioning,
-positioning with coordinate bindings, and layouts.
+positioning with coordinate bindings, positioners, and layouts.
\section1 Manual Positioning
@@ -134,21 +134,20 @@ positioning, whereas a "contaminated" anchor layout is one which uses both
anchoring and bindings (either on position-related [x,y] properties or on
dimension-related [width,height] properties) to determine the position.
-\section1 Layouts
-
-Qt Quick also provides some built-in layout items. For many use cases, the
-best layout to use is a simple grid, row, or column, and Qt Quick provides
-items which will layout children in these formations in the most efficient
-manner possible.
+\section1 Positioners
-There are many well-known layouts which work well in user-interfaces, such as
-grids and lists, rows and columns. Qt Quick supports these sort of pre-defined
-layouts, which can often be more performant to draw than anchor or
-binding-based layouts. See the documentation on
-\l{qtquick-positioning-layouts.html}{layout types} for more
-information about utilizing pre-defined layouts.
+Qt Quick also provides some built-in positioner items. For many use cases, the best
+positioner to use is a simple grid, row, or column, and Qt Quick provides items which
+will position children in these formations in the most efficient manner possible.
+See the documentation on \l{qtquick-positioning-layouts.html}{item positioners types}
+for more information about utilizing pre-defined positioners.
+\section1 Layouts
+From Qt 5.1, the module \l {Qt Quick Layouts} can also be used to arrange Qt Quick
+items in a user interface. Unlike positioners, the types in Qt Quick Layouts manage
+both the positions and sizes of items in a declarative interface. They are well
+suited for resizable user interfaces.
\section1 Right-To-Left Support
diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc
index daa14a6973..fad09b396b 100644
--- a/src/quick/doc/src/dynamicview-tutorial.qdoc
+++ b/src/quick/doc/src/dynamicview-tutorial.qdoc
@@ -27,7 +27,6 @@
/*!
\page qml-dynamicview-tutorial.html tutorial
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial
\brief A tutorial describing how to re-arrange items in a QML ListView
\nextpage QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
@@ -51,7 +50,6 @@ directory.
/*!
\page qml-dynamicview-tutorial1.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial
@@ -64,12 +62,12 @@ delegate which provides a template for constructing items in the view.
The code for the ListView and delegate looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 0
The model is defined in a separate QML file which looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview1/PetsModel.qml 0
-\snippet quick/tutorials/dynamicview/dynamicview1/PetsModel.qml 1
+\snippet tutorials/dynamicview/dynamicview1/PetsModel.qml 0
+\snippet tutorials/dynamicview/dynamicview1/PetsModel.qml 1
\section2 Walkthrough
@@ -79,16 +77,15 @@ is the template from which each item in the ListView is constructed.
The \c name, \c age, \c type, and \c size variables referenced in the delegate are sourced from
the model data. The names correspond to roles defined in the model.
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 1
The second part of the application is the ListView itself to which we bind the model and delegate.
-\snippet quick/tutorials/dynamicview/dynamicview1/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview1/dynamicview.qml 2
*/
/*!
\page qml-dynamicview-tutorial2.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 2 - Dragging View Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 1 - A Simple ListView and Delegate
@@ -100,7 +97,7 @@ Now that we have a visible list of items we want to be able to interact with the
by extending the delegate so the visible content can be dragged up and down the screen. The
updated delegate looks like this:
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 0
\section2 Walkthrough
@@ -109,8 +106,8 @@ for mouse events and will allow us to drag the delegate's content item. It also
a container for the content item which is important as a delegate's root item is positioned by
the view and cannot be moved by other means.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 2
Dragging the content item is enabled by binding it to the MouseArea's
\l {QtQuick2::MouseArea::drag.target}{drag.target} property. Because we still want the view to be
@@ -120,20 +117,19 @@ timeout has expired it is interpreted as moving the list and if it moves after i
dragging an item. To make it more obvious to the user when an item can be dragged we'll change the
background color of the content item when the timeout has expired.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 3
The other thing we'll need to do before an item can be dragged is to unset any anchors on the
content item so it can be freely moved around. We do this in a state change that is triggered
when the delegate item is held, at the same time we can reparent the content item to the root item
so that is above other items in the stacking order and isn't obscured as it is dragged around.
-\snippet quick/tutorials/dynamicview/dynamicview2/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview2/dynamicview.qml 4
*/
/*!
\page qml-dynamicview-tutorial3.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 3 - Moving Dragged Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 2 - Dragging View Items
@@ -145,10 +141,10 @@ The next step in our application to move items within the list as they're dragge
can re-order the list. To achieve this we introduce three new types to our application;
VisualDataModel, \l Drag and DropArea.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 0
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 2
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 5
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 5
\section2 Walkthrough
@@ -156,7 +152,7 @@ In order to re-order the view we need to determine when one item has been dragge
the Drag attached property we can generate events that are sent to the scene graph whenever the item
it is attached to moves.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 1
Drag events are only sent while the active property is true, so in this example the first event
would be sent when the delegate was held with additional event sents when dragging. The
@@ -167,7 +163,7 @@ Then we use a DropArea in each view item to determine when the hot spot of the d
intersects another item, when a drag enters one of these DropAreas we can move the dragged item
to the index of the item it was dragged over.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 3
To move the items within the view we use a VisualDataModel. The VisualDataModel type is used by
the view types to instantiate delegate items from model data and when constructed explicitly can
@@ -181,13 +177,12 @@ To utilize a VisualDataModel with a ListView we bind it to the \l {QtQuick2::Lis
property of the view and bind the \l {QtQuick2::VisualDataModel::model}{model} and
\l {QtQuick2::VisualDataModel::delegate}{delegate} to the VisualDataModel.
-\snippet quick/tutorials/dynamicview/dynamicview3/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 4
*/
/*!
\page qml-dynamicview-tutorial4.html
-\inqmlmodule QtQuick 2
\title QML Dynamic View Ordering Tutorial 4 - Sorting Items
\contentspage QML Dynamic View Ordering Tutorial
\previouspage QML Dynamic View Ordering Tutorial 3 - Moving Dragged Items
@@ -198,7 +193,7 @@ Drag and drop isn't the only way items in a view can be re-ordered, using a Visu
also possible to sort items based on model data. To do that we extend our VisualDataModel instance
like this:
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 0
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 0
\section2 Walkthrough
@@ -209,8 +204,8 @@ we want items to first be added to an unsorted group from where we can transfer
position in the items group. To do that we clear includeByDefault on the items group and set it on
a new group name 'unsorted'.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 1
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 2
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 1
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 2
We sort the items by first finding the position in the items group to insert the first unsorted
item and then transfer the item to the items group before moving it to the pre-determined index and
@@ -221,19 +216,19 @@ with the \l {QtQuick2::VisualDataModel::get} {get} function. Through the model
handle we can access the same model data that is available in a delegate instance of that item and
compare against other items to determine relative position.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 3
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 3
The lessThan argument to the sort function is a comparsion function which will determine the order
of the list. In this example it can be one of the following:
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 4
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 4
A sort is triggered whenever new items are added to the unsorted VisualDataGroup which we are
notified of by the \l {QtQuick2::VisualDataGroup::onChanged}{onChanged} handler. If no sort
function is currently selected we simply transfer all items from the unsorted group to the items
group, otherwise we call sort with the selected sort function.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 5
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 5
Finally when the selected sort order changes we can trigger a full re-sort of the list by moving
all items from the items group to the unsorted group, which will trigger the
@@ -241,6 +236,6 @@ all items from the items group to the unsorted group, which will trigger the
items group in correct order. Note that the \l {QtQuick2::VisualDataGroup::onChanged}{onChanged}
handler will not be invoked recursively so there's no issue with it being invoked during a sort.
-\snippet quick/tutorials/dynamicview/dynamicview4/dynamicview.qml 6
+\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 6
*/
diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc
index aad8cfc3c4..ddca973496 100644
--- a/src/quick/doc/src/examples.qdoc
+++ b/src/quick/doc/src/examples.qdoc
@@ -33,16 +33,18 @@
\ingroup all-examples
\ingroup qtquick
\target qtquick-samples
-\inqmlmodule QtQuick 2
These are code samples that show how to use various aspects of Qt Quick. Larger
compound interfaces are grouped as applications as they demonstrate more Qt
Quick features.
+Here is a list of fully-functional demo applications.
To run the sample applications, open them in Qt Creator or use the included
\l {Prototyping with qmlscene}{qmlscene} tool.
-Some of these code samples have a corresponding \l{qtquick-tutorials}{tutorial}.
+\annotatedlist{qtquickdemos}
+
+Some of these code samples below have a corresponding \l{qtquick-tutorials}{tutorial}.
The Qt Quick features are covered in the \l {qtquick-overviews}{main page}.
This set of code samples are part of the collection of \l{Qt Examples}.
@@ -131,7 +133,7 @@ code using the \l{Qt QML} module.
\li \l{external: Qt Mobility QML Plugins}{QML Plugins}
\li \l{external: Qt Quick Components for Symbian}{Symbian Components}
\li MeeGo Components
- \li \l{QtWebKit QML Module}
+ \li \l{Qt WebKit QML Types}
\endlist
\enddiv
\div {class="threecolumn_piece"}
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index 14f0151a3b..6863758455 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -36,19 +36,19 @@ interfaces and applications with QML. This page lists every QML type provided
by this module, organized according to category and purpose.
-\section1 Importing QtQuick
+\section1 Importing \c QtQuick
-The types provided by the QtQuick module are only available in a QML document
+The types provided by the \l {Qt Quick} module are only available in a QML document
if that document imports the \c QtQuick namespace.
-The current version of the QtQuick module is version 2.0, and thus it may be
+The current version of the \c QtQuick module is version 2.0, and thus it may be
imported via the following statement:
\qml
import QtQuick 2.0
\endqml
-See the QtQuick module documentation for more
+See the \l {Qt Quick} module documentation for more
information about the concepts which are central to \c QtQuick.
\section2 Submodules
@@ -56,14 +56,20 @@ information about the concepts which are central to \c QtQuick.
Qt Quick includes several submodules which contain additional types.
\list
- \li \l{QtQuick.XmlListModel 2}{XML List Model} - contains types
+ \li \l{Qt Quick XmlListModel QML Types}{XML List Model} - contains types
for creating models from XML data
- \li \l{QtQuick.LocalStorage 2}{Local Storage} - a submodule
+ \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule
containing a JavaScript interface for an SQLite database
- \li \l{QtQuick.Particles 2}{Particles} - provides a particle
+ \li \l{Qt Quick Particles QML Types}{Particles} - provides a particle
system for QML applications
- \li \l{QtQuick.Window 2}{Window} - contains types for creating
+ \li \l{Qt Quick Window QML Types}{Window} - contains types for creating
top-level windows and accessing screen information
+ \li \l{Qt Quick Dialogs QML Types}{Dialogs} - contains types for creating and
+ interacting with system dialogs
+ \li \l{Qt Quick Controls QML Types}{Controls} - provides a set of reusable
+ UI components
+ \li \l{Qt Quick Layouts QML Types}{Layouts} - contains types that are used
+ to arrange items in the user interface
\endlist
\section1 Basic Types
@@ -72,15 +78,15 @@ There are a number of basic types that are
\l{qtqml-typesystem-basictypes.html#basic-types-provided-by-the-qml-language}
{supported by default in the QML language}.
-In addition, the QtQuick module provides the following basic types:
+In addition, the \c QtQuick module provides the following basic types:
\annotatedlist qtquickbasictypes
\section1 Object Types
-All of the object types provided by QtQuick are based on the \l{Item} type,
-which itself derives from \l{QML::QtObject}. \l{qtqml-typereference-topic.html#object-types}
+All of the object types provided by \c QtQuick are based on the \l{Item} type,
+which itself derives from \l{QtQml2::QtObject}{QtObject}. \l{qtqml-typereference-topic.html#object-types}
{QML object types} provided by the Qt QML module
-(such as \l{QML::QtObject} and \l{QML::Component}) are also available when
+(such as \l{QtQml2::QtObject}{QtObject} and \l{QtQml2::Component}{Component}) are also available when
you import \c QtQuick.
\section2 Visual Types
@@ -228,13 +234,26 @@ Animation paths
\section2 Model/View Types And Data Storage And Access
-Models And Model Data
+QML Lists and Models
+
+The \l{Qt QML Models QML Types}{Qt QML Models} submodule provides the types for
+structuring data with models and lists.
+\list
+\li \l ListModel - Defines a list of data
+\li \l ListElement - Defines a data item in a \l ListModel
+\endlist
+
+These QML types are part of Qt Quick for backwards compatibility, but for
+newer applications, \l{Qt QML Models QML Types}{Qt QML Models} provides
+the same functionality.
\list
-\li \l {QtQuick2::ListModel}{ListModel} - Defines a list of data
-\li \l {QtQuick2::ListElement}{ListElement} - Defines a data item in a \l {QtQuick2::ListModel}{ListModel}
\li \l {VisualItemModel} - Contains items that already defines its own visual delegate
\li \l {VisualDataModel} - Encapsulates a model and a delegate
-\li \l {VisualDataGroup} -Encapsulates a filtered set of visual data items
+\li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items
+\endlist
+
+XML Lists
+\list
\li \l {XmlListModel} - Specifies a model using XPath expressions
\li \l {XmlRole} - Specifies a role for an \l {XmlListModel}
\endlist
@@ -259,7 +278,7 @@ Data Storage
\li \l {ShaderEffect} - Allows GLSL shaders to be used as graphical effects
\li \l {ShaderEffectSource} - Usable as a texture in ShaderEffect
\li \l {GridMesh} - Generates a grid mesh of vertices for use by ShaderEffect
-\li The \l{QtQuick.Particles 2} module provides a set of Particle System types for QtQuick 2
+\li The \l{QtQuick.Particles 2} module provides a set of Particle System types for Qt Quick 2
\endlist
\section2 Convenience Types
@@ -286,14 +305,14 @@ Data Storage
/*!
\qmlmodule QtQuick 2
-\brief The QtQuick 2 module provides graphical primitives for use in QML.
+\brief The \c {QtQuick 2} module provides graphical primitives for use in QML.
-The QtQuick 2 module provides graphical primitive types. They can be used with the following import
+The \c {QtQuick 2} module provides graphical primitive types. They can be used with the following import
\code
import QtQuick 2.1
\endcode
-For a more detailed listing of types in the \c QtQuick 2 import, see the \l{Qt Quick QML Types} page.
+For a more detailed listing of types in the \c {QtQuick 2} import, see the \l{Qt Quick QML Types} page.
For more details about the module itself, see the \l{Qt Quick} module page.
*/
@@ -311,9 +330,9 @@ For more details about the module itself, see the \l{Qt Quick} module page.
\li By a hexadecimal triplet or quad in 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".
- \li Using 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.
+ \li Using the \l{QtQml2::Qt::rgba()}{Qt.rgba()}, \l{QtQml2::Qt::hsla()}{Qt.hsla()},
+ \l{QtQml2::Qt::darker()}{Qt.darker()}, \l{QtQml2::Qt::lighter()}{Qt.lighter()} or
+ \l{QtQml2::Qt::tint()}{Qt.tint()} functions.
\endlist
Example:
@@ -335,7 +354,7 @@ For more details about the module itself, see the \l{Qt Quick} module page.
}
\endqml
- To test color values for equality, use the \l{QML:Qt::colorEqual()}{Qt.colorEqual()}
+ To test color values for equality, use the \l{QtQml2::Qt::colorEqual()}{Qt.colorEqual()}
function. This allows colors to be accurately compared whether they are in property
form or in any of the acceptable string specification forms.
@@ -576,7 +595,7 @@ console.log(c + " " + d); // false true
Rotation { angle: 60; axis: "0,1,0" }
\endqml
- or with the \l{QML:Qt::vector3d()}{Qt.vector3d()} function:
+ or with the \l{QtQml2::Qt::vector3d()}{Qt.vector3d()} function:
\qml
Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index 1944129392..deb6aa164c 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -38,17 +38,18 @@ provides a visual canvas and includes types for creating and animating
visual components, receiving user input, creating data models and views
and delayed object instantiation.
-The Qt Quick module provides both the \c QtQuick QML module, which supplies
-\l{Qt Quick QML Types}{a set of QML types} for creating user
-interfaces with the QML language, and the \c QtQuick C++ module, which supplies
-\l{Qt Quick C++ Classes}{a set of C++ APIs} for integrating with user interfaces and
-applications built with QML and the \c QtQuick QML module.
+The Qt Quick module provides both a \l{Qt Quick QML Types}{QML API} which supplies
+QML types for creating user interfaces with the QML language, and a
+\l{Qt Quick C++ Classes}{C++ API} for extending QML applications with C++ code.
+
+\note From Qt 5.1, a set of Qt Quick based UI controls is available to
+create user interfaces. Please see \l{Qt Quick Controls}
+for more information.
For those new to QML and Qt Quick, please see
\l{QML Application Developer Resources}
for an introduction to writing QML applications.
-
\section1 Important Concepts in Qt Quick
Qt Quick provides everything needed to create a rich application with a fluid
@@ -75,7 +76,7 @@ of the \l{qtquick-quickstart-basics.html}{QML Basics} and
\l{qtquick-quickstart-essentials.html}{QML Essentials} from the
\l{qtquick-applicationdevelopers.html}{QML Application Developer Resources}.
-To find out more about using the QML language, see the \l{Qt QML Module Documentation}.
+To find out more about using the QML language, see the \l{Qt QML} module documentation.
\section1 Qt Quick Module Documentation
@@ -124,6 +125,8 @@ Additional Qt Quick information:
system for Qt Quick
\li \l{QtQuick.Window 2}{Window} - contains types for creating
top-level windows and accessing screen information
+ \li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and
+ interacting with system dialogs
\endlist
\li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick
\li \l{Qt Quick Code Samples} - list of all Qt Quick examples
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index b1f2304529..bd07c9a98d 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -27,13 +27,12 @@
/*!
\page qml-tutorial.html
-\inqmlmodule QtQuick 2
\title QML Tutorial
\brief An introduction to the basic concepts and features of QML.
\previouspage Introduction to the QML Language
\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;
+This tutorial gives an introduction to QML, the declarative 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
@@ -55,7 +54,6 @@ Tutorial chapters:
/*!
\page qml-tutorial1.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 1 - Basic Types
\contentspage QML Tutorial
\previouspage QML Tutorial
@@ -68,7 +66,7 @@ The picture below is a screenshot of this program.
Here is the QML code for the application:
-\snippet quick/tutorials/helloworld/tutorial1.qml 0
+\snippet tutorials/helloworld/tutorial1.qml 0
\section1 Walkthrough
@@ -77,11 +75,11 @@ Here is the QML code for the application:
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 quick/tutorials/helloworld/tutorial1.qml 3
+\snippet tutorials/helloworld/tutorial1.qml 3
\section2 Rectangle Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 1
+\snippet tutorials/helloworld/tutorial1.qml 1
We declare a root object 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".
@@ -90,7 +88,7 @@ The \l{Rectangle} type contains many other properties (such as \c x and \c y), b
\section2 Text Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 2
+\snippet tutorials/helloworld/tutorial1.qml 2
We add a \l Text type as a child of the root Rectangle type that displays the text 'Hello world!'.
@@ -114,7 +112,6 @@ qmlscene tutorials/helloworld/tutorial1.qml
/*!
\page qml-tutorial2.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 2 - QML Components
\contentspage QML Tutorial
\previouspage QML Tutorial 1 - Basic Types
@@ -133,37 +130,37 @@ The component's filename must always start with a capital letter.
Here is the QML code for \c Cell.qml:
-\snippet quick/tutorials/helloworld/Cell.qml 0
+\snippet tutorials/helloworld/Cell.qml 0
\section1 Walkthrough
\section2 The Cell Component
-\snippet quick/tutorials/helloworld/Cell.qml 1
+\snippet tutorials/helloworld/Cell.qml 1
The root type of our component is an \l Item with the \c id \e container.
An \l Item is the most basic visual type in QML and is often used as a container for other types.
-\snippet quick/tutorials/helloworld/Cell.qml 4
+\snippet 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 in QML}).
-\snippet quick/tutorials/helloworld/Cell.qml 5
+\snippet 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 quick/tutorials/helloworld/Cell.qml 2
+\snippet 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 a visual type.
In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}).
-\snippet quick/tutorials/helloworld/Cell.qml 3
+\snippet tutorials/helloworld/Cell.qml 3
In order to change the color of the text when clicking on a cell, we create a \l MouseArea type with
the same size as its parent.
@@ -175,11 +172,11 @@ When this signal is triggered we want to emit our own \e clicked signal with the
In our main QML file, we use our \c Cell component to create the color picker:
-\snippet quick/tutorials/helloworld/tutorial2.qml 0
+\snippet tutorials/helloworld/tutorial2.qml 0
We create the color picker by putting 6 cells with different colors in a grid.
-\snippet quick/tutorials/helloworld/tutorial2.qml 1
+\snippet 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 Attributes}).
@@ -187,7 +184,6 @@ We can react to any signal of our component through a property of the name \e 'o
/*!
\page qml-tutorial3.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 3 - States and Transitions
\contentspage QML Tutorial
\previouspage QML Tutorial 2 - QML Components
@@ -200,11 +196,11 @@ We want our text to move to the bottom of the screen, rotate and become red when
Here is the QML code:
-\snippet quick/tutorials/helloworld/tutorial3.qml 0
+\snippet tutorials/helloworld/tutorial3.qml 0
\section1 Walkthrough
-\snippet quick/tutorials/helloworld/tutorial3.qml 2
+\snippet tutorials/helloworld/tutorial3.qml 2
First, we create a new \e down state for our text type.
This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.
@@ -213,7 +209,7 @@ The \e down state includes a set of property changes from our implicit \e {defau
(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 quick/tutorials/helloworld/tutorial3.qml 3
+\snippet 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.
diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc
index 3959a1b5eb..973d41dca2 100644
--- a/src/quick/doc/src/whatsnew.qdoc
+++ b/src/quick/doc/src/whatsnew.qdoc
@@ -28,15 +28,51 @@
/*!
\title Qt Quick Release Notes
\page qtquick-releasenotes.html
-\inqmlmodule QtQuick 2.0
-\section1 Qt 5.0 - QtQuick C++ Module
+\section1 Qt Quick in Qt 5.1
-The QtQuick C++ module is new in Qt 5. It provides the visual canvas and scenegraph back-end
-as well as the QtQuick QML module for QML application development.
+\l{Qt Quick} 2.1 is new in Qt 5.1. This is a summary of improvements and new
+features introduced by the new import and new classes in Qt 5.1:
+\list
+\li New threaded render loop for Mac, Linux, and Embedded.
+\li New render loop for windows for smoother animations.
+\li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight,
+ maximumWidth, maximumHeight, visibility, contentOrientation, and opacity.
+\li New \l Item property: activeFocusOnTab.
+\li New \l Grid properties: horizontalAlignment, verticalAlignment, and
+ effectiveHorizontalAlignment.
+\li New \l TextEdit properties: selectByKeyboard and textDocument
+\li A \l Window declared inside another Window or \l Item will automatically be
+ transient for (centered upon) the outer window.
+\li These types are now part of \l{Qt QML}:
+ \list
+ \li \l {VisualItemModel}
+ \li \l {VisualDataModel} - Encapsulates a model and a delegate
+ \li \l {VisualDataGroup}
+ \endlist
+ These types are kept due to compatibility reasons and are replaced by the
+ \l{Qt QML Models QML Types}{Qt QML Models} types.
+ \endlist
+\endlist
+
+\section2 New Submodules
+
+In Qt 5.1, there are several new modules which extend Qt Quick functionalities.
+\list
+\li \l{Qt Quick Dialogs} - contains types for creating and interacting with system dialogs
+\li \l{Qt Quick Controls} - provides a set of reusable UI components
+\li \l{Qt Quick Layouts} - contains types that are used to arrange items in the user interface
+\endlist
+
+The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
+
+\section1 Qt Quick in Qt 5.0
+
+The \l {Qt Quick} module is new in Qt 5. It provides the visual canvas and scenegraph back-end
+as well as the \c QtQuick QML module for QML application development.
-As of Qt 5, the QtQuick module is based on an OpenGL scenegraph. Many of the classes in
-the QtQuick module have been ported from the \c QtDeclarative module from Qt 4.8 to use
+As of Qt 5, the \l {Qt Quick} module is based on an OpenGL scenegraph. Many of the classes in
+the \l {Qt Quick} module have been ported from the \l {Qt Quick 1}{QtDeclarative} module from Qt 4.8 to use
the scenegraph architecture; these classes have been renamed to use a \c QQuick* prefix.
(See the \l {Porting QML Applications to Qt 5} for porting information.)
@@ -77,10 +113,10 @@ Custom rendering can be performed on the scenegraph using the following new clas
\section1 Qt 5.0 - QtQuick QML Module
-The QtQuick 2.0 QML module is a major update.
+The \c {QtQuick 2.0} QML module is a major update.
-Below are the additions in QtQuick 2.0. For a list of behavioral changes which may affect
-applications ported from QtQuick 1.x, see the \l {Porting QML Applications to Qt 5}.
+Below are the additions in \c {QtQuick 2.0}. For a list of behavioral changes which may affect
+applications ported from \c {QtQuick 1.x}, see the \l {Porting QML Applications to Qt 5}.
\section2 Visual types, Graphical Effects and Sprites
@@ -345,11 +381,11 @@ the window loses focus.
\section2 Property types
Support for various math and geometry-related value types, including QVector2D, QVector3D, QVector4D,
-QMatrix4x4 and QQuaternion, as well as QColor and QFont, are now provided by QtQuick. Properties of
+QMatrix4x4 and QQuaternion, as well as QColor and QFont, are now provided by \l {Qt Quick}. Properties of
these types can be declared in QML documents via the property syntax where the type name is \c vector2d,
\c vector3d, \c vector4d, \c matrix4x4, \c quaternion, \c color and \c font respectively.
-QtQuick also provides implementation for the various value type factory or utility functions of the
+\l {Qt Quick} also provides implementation for the various value type factory or utility functions of the
\c Qt object which return or operate on values of the above types. The functions are:
\table
\header
@@ -386,8 +422,8 @@ QtQuick also provides implementation for the various value type factory or utili
\endtable
The \c Qt.rgba(), \c Qt.hsla(), \c Qt.tint(), \c Qt.lighter(), \c Qt.darker()
-and \c Qt.fontFamilies() functions already existed in \c QtDeclarative prior
-to QtQuick 2.0; the other functions are all new in QtQuick 2.0.
+and \c Qt.fontFamilies() functions already existed in \l {Qt Quick 1}{QtDeclarative} prior
+to \l {Qt Quick}{Qt Quick 2}; the other functions are all new in \l {Qt Quick}{Qt Quick 2}.
\section1 Qt 5.0 - Additional QML Modules
@@ -406,7 +442,7 @@ documentation for comprehensive details.
\section2 QtQuick.XmlListModel
-This new module contains XmlListModel and associated types, which were previously in the QtQuick
+This new module contains XmlListModel and associated types, which were previously in the \c QtQuick
module. See the \l{QtQuick.XmlListModel 2}{QtQuick.XmlListModel} documentation for details.
\section2 QtQuick.LocalStorage
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index e7546535a1..9c4cef1fe1 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -175,7 +175,6 @@ public:
uint hasTileSize :1;
uint hasCanvasWindow :1;
uint available :1;
- uint contextInitialized :1;
QQuickCanvasItem::RenderTarget renderTarget;
QQuickCanvasItem::RenderStrategy renderStrategy;
QString contextType;
@@ -193,7 +192,6 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate()
, hasTileSize(false)
, hasCanvasWindow(false)
, available(false)
- , contextInitialized(false)
, renderTarget(QQuickCanvasItem::Image)
, renderStrategy(QQuickCanvasItem::Cooperative)
{
@@ -272,7 +270,7 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
requires the pixel data to be exchanged between the system memory and the
graphic card, which is significantly more expensive. Rendering may also be
synchronized with the V-sync signal (to avoid
- \l{en.wikipedia.org/wiki/Screen_tearing}{screen tearing}) which will further
+ \l{http://en.wikipedia.org/wiki/Screen_tearing}{screen tearing}) which will further
impact pixel operations with \c Canvas.FrambufferObject render target.
\section1 Tips for Porting Existing HTML5 Canvas applications
@@ -343,7 +341,7 @@ void QQuickCanvasItem::setContextType(const QString &contextType)
if (contextType.compare(d->contextType, Qt::CaseInsensitive) == 0)
return;
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas already initialized with a different context type";
return;
}
@@ -368,7 +366,7 @@ void QQuickCanvasItem::setContextType(const QString &contextType)
QQmlV4Handle QQuickCanvasItem::context() const
{
Q_D(const QQuickCanvasItem);
- if (d->contextInitialized)
+ if (d->context)
return QQmlV4Handle(d->context->v4value());
return QQmlV4Handle(QV4::Value::nullValue());
@@ -402,7 +400,7 @@ void QQuickCanvasItem::setCanvasSize(const QSizeF & size)
d->canvasSize = size;
emit canvasSizeChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -437,7 +435,7 @@ void QQuickCanvasItem::setTileSize(const QSize & size)
emit tileSizeChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -470,7 +468,7 @@ void QQuickCanvasItem::setCanvasWindow(const QRectF& rect)
d->hasCanvasWindow = true;
emit canvasWindowChanged();
- if (d->contextInitialized)
+ if (d->context)
polish();
}
}
@@ -502,7 +500,7 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target)
{
Q_D(QQuickCanvasItem);
if (d->renderTarget != target) {
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas:renderTarget not changeble once context is active.";
return;
}
@@ -546,7 +544,7 @@ void QQuickCanvasItem::setRenderStrategy(QQuickCanvasItem::RenderStrategy strate
{
Q_D(QQuickCanvasItem);
if (d->renderStrategy != strategy) {
- if (d->contextInitialized) {
+ if (d->context) {
qmlInfo(this) << "Canvas:renderStrategy not changeable once context is active.";
return;
}
@@ -651,7 +649,7 @@ void QQuickCanvasItem::updatePolish()
Q_D(QQuickCanvasItem);
- if (d->contextInitialized)
+ if (d->context && d->renderStrategy != QQuickCanvasItem::Cooperative)
d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
if (d->animationCallbacks.size() > 0 && isVisible()) {
@@ -676,7 +674,7 @@ void QQuickCanvasItem::updatePolish()
}
}
- if (d->contextInitialized) {
+ if (d->context) {
if (d->renderStrategy == QQuickCanvasItem::Cooperative)
update();
else
@@ -688,8 +686,10 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
{
Q_D(QQuickCanvasItem);
- if (!d->contextInitialized)
+ if (!d->context || d->canvasWindow.size().isEmpty()) {
+ delete oldNode;
return 0;
+ }
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode*>(oldNode);
if (!node)
@@ -700,10 +700,13 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
else
node->setFiltering(QSGTexture::Nearest);
- if (d->renderStrategy == QQuickCanvasItem::Cooperative)
+ if (d->renderStrategy == QQuickCanvasItem::Cooperative) {
+ d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
d->context->flush();
+ }
node->setTexture(d->context->texture());
+ node->markDirty(QSGNode::DirtyMaterial);
node->setRect(QRectF(QPoint(0, 0), d->canvasWindow.size()));
return node;
}
@@ -763,7 +766,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
/*!
\qmlmethod long QtQuick2::Canvas::requestAnimationFrame(callback)
- This function schedules callback to be invoked before composing the QtQuick
+ This function schedules callback to be invoked before composing the Qt Quick
scene.
*/
@@ -970,7 +973,7 @@ bool QQuickCanvasItem::isImageLoaded(const QUrl& url) const
QImage QQuickCanvasItem::toImage(const QRectF& rect) const
{
Q_D(const QQuickCanvasItem);
- if (d->contextInitialized) {
+ if (d->context) {
if (rect.isEmpty())
return d->context->toImage(canvasWindow());
else
@@ -1026,7 +1029,7 @@ void QQuickCanvasItem::delayedCreate()
{
Q_D(QQuickCanvasItem);
- if (!d->contextInitialized && !d->contextType.isNull())
+ if (!d->context && !d->contextType.isNull())
createContext(d->contextType);
requestPaint();
@@ -1055,7 +1058,6 @@ void QQuickCanvasItem::initializeContext(QQuickCanvasContext *context, const QVa
d->context = context;
d->context->init(this, args);
d->context->setV8Engine(QQmlEnginePrivate::getV8Engine(qmlEngine(this)));
- d->contextInitialized = true;
connect(d->context, SIGNAL(textureChanged()), SLOT(update()));
connect(d->context, SIGNAL(textureChanged()), SIGNAL(painted()));
emit contextChanged();
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 5011fd45f2..c9ee426565 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -210,9 +210,11 @@ QFont qt_font_from_string(const QString& fontString) {
font.setBold(true);
else if (token.endsWith(QStringLiteral("px"))) {
QString number = token;
- number.remove(QStringLiteral("px"));
- //font.setPointSizeF(number.trimmed().toFloat());
- font.setPixelSize(number.trimmed().toInt());
+ number.remove(QLatin1String("px"));
+ bool ok = false;
+ float pixelSize = number.trimmed().toFloat(&ok);
+ if (ok)
+ font.setPixelSize(int(pixelSize));
} else
font.setFamily(token);
}
@@ -426,50 +428,86 @@ DEFINE_MANAGED_VTABLE(QQuickContext2DStyle);
QImage qt_image_convolute_filter(const QImage& src, const QVector<qreal>& weights, int radius = 0)
{
- int sides = radius ? radius : qRound(qSqrt(weights.size()));
- int half = qFloor(sides/2);
+ // weights 3x3 => delta 1
+ int delta = radius ? radius : qFloor(qSqrt(weights.size()) / qreal(2));
+ int filterDim = 2 * delta + 1;
QImage dst = QImage(src.size(), src.format());
+
int w = src.width();
int h = src.height();
- for (int y = 0; y < dst.height(); ++y) {
- QRgb *dr = (QRgb*)dst.scanLine(y);
- for (int x = 0; x < dst.width(); ++x) {
- unsigned char* dRgb = ((unsigned char*)&dr[x]);
- unsigned char red=0, green=0, blue=0, alpha=0;
- int sy = y;
- int sx = x;
-
- for (int cy=0; cy<sides; cy++) {
- for (int cx=0; cx<sides; cx++) {
- int scy = sy + cy - half;
- int scx = sx + cx - half;
- if (scy >= 0 && scy < w && scx >= 0 && scx < h) {
- const QRgb *sr = (const QRgb*)(src.constScanLine(scy));
- const unsigned char* sRgb = ((const unsigned char*)&sr[scx]);
- qreal wt = radius ? weights[0] : weights[cy*sides+cx];
- red += sRgb[0] * wt;
- green += sRgb[1] * wt;
- blue += sRgb[2] * wt;
- alpha += sRgb[3] * wt;
- }
- }
- }
- dRgb[0] = red;
- dRgb[1] = green;
- dRgb[2] = blue;
- dRgb[3] = alpha;
- }
+
+ const QRgb *sr = (const QRgb *)(src.constBits());
+ int srcStride = src.bytesPerLine() / 4;
+
+ QRgb *dr = (QRgb*)dst.bits();
+ int dstStride = dst.bytesPerLine() / 4;
+
+ for (int y = 0; y < h; ++y) {
+ for (int x = 0; x < w; ++x) {
+ int red = 0;
+ int green = 0;
+ int blue = 0;
+ int alpha = 0;
+
+ qreal redF = 0;
+ qreal greenF = 0;
+ qreal blueF = 0;
+ qreal alphaF = 0;
+
+ int sy = y;
+ int sx = x;
+
+ for (int cy = 0; cy < filterDim; ++cy) {
+ int scy = sy + cy - delta;
+
+ if (scy < 0 || scy >= h)
+ continue;
+
+ const QRgb *sry = sr + scy * srcStride;
+
+ for (int cx = 0; cx < filterDim; ++cx) {
+ int scx = sx + cx - delta;
+
+ if (scx < 0 || scx >= w)
+ continue;
+
+ const QRgb col = sry[scx];
+
+ if (radius) {
+ red += qRed(col);
+ green += qGreen(col);
+ blue += qBlue(col);
+ alpha += qAlpha(col);
+ } else {
+ qreal wt = weights[cy * filterDim + cx];
+
+ redF += qRed(col) * wt;
+ greenF += qGreen(col) * wt;
+ blueF += qBlue(col) * wt;
+ alphaF += qAlpha(col) * wt;
+ }
+ }
+ }
+
+ if (radius)
+ dr[x] = qRgba(qRound(red * weights[0]), qRound(green * weights[0]), qRound(blue * weights[0]), qRound(alpha * weights[0]));
+ else
+ dr[x] = qRgba(qRound(redF), qRound(greenF), qRound(blueF), qRound(alphaF));
+ }
+
+ dr += dstStride;
}
+
return dst;
}
void qt_image_boxblur(QImage& image, int radius, bool quality)
{
int passes = quality? 3: 1;
- for (int i=0; i < passes; i++) {
- image = qt_image_convolute_filter(image, QVector<qreal>() << 1.0/(radius * radius * 1.0), radius);
- }
+ int filterSize = 2 * radius + 1;
+ for (int i = 0; i < passes; ++i)
+ image = qt_image_convolute_filter(image, QVector<qreal>() << 1.0 / (filterSize * filterSize), radius);
}
static QPainter::CompositionMode qt_composite_mode_from_string(const QString &compositeOperator)
@@ -644,7 +682,7 @@ static QV4::Value qt_create_image_data(qreal w, qreal h, QV8Engine* engine, cons
pixelData->image = QImage(w, h, QImage::Format_ARGB32);
pixelData->image.fill(0x00000000);
} else {
- Q_ASSERT(image.width() == w && image.height() == h);
+ Q_ASSERT(image.width() == int(w) && image.height() == int(h));
pixelData->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32);
}
@@ -2525,7 +2563,11 @@ QV4::Value QQuickJSContext2DPrototype::method_drawImage(QV4::SimpleCallContext *
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
} else {
- V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
+ QUrl url(ctx->arguments[0].toQString());
+ if (url.isValid())
+ pixmap = r->context->createPixmap(url);
+ else
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
} else {
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
@@ -2790,7 +2832,7 @@ QV4::Value QQuickJSContext2DPrototype::method_createImageData(QV4::SimpleCallCon
}
/*!
- \qmlmethod CanvasImageData QtQuick2::Canvas::getImageData(real sx, real sy, real sw, real sh)
+ \qmlmethod CanvasImageData QtQuick2::Context2D::getImageData(real sx, real sy, real sw, real sh)
Returns an CanvasImageData object containing the image data for the given rectangle of the canvas.
*/
QV4::Value QQuickJSContext2DPrototype::method_getImageData(QV4::SimpleCallContext *ctx)
@@ -3488,7 +3530,6 @@ QPainterPath QQuickContext2D::createTextGlyphs(qreal x, qreal y, const QString&
QPainterPath textPath;
textPath.addText(x - xoffset, y - yoffset+metrics.ascent(), state.font, text);
- textPath = state.matrix.map(textPath);
return textPath;
}
@@ -3662,7 +3703,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds)
if (m_texture->thread() == QThread::currentThread())
m_texture->grabImage(bounds);
else if (m_renderStrategy == QQuickCanvasItem::Cooperative) {
- qWarning() << "Pixel read back is not support in Cooperative mode, please try Theaded or Immediate mode";
+ qWarning() << "Pixel readback is not supported in Cooperative mode, please try Threaded or Immediate mode";
return QImage();
} else {
QMetaObject::invokeMethod(m_texture,
@@ -3775,7 +3816,6 @@ void QQuickContext2D::pushState()
void QQuickContext2D::reset()
{
QQuickContext2D::State newState;
- newState.matrix = QTransform();
m_path = QPainterPath();
@@ -3787,28 +3827,6 @@ void QQuickContext2D::reset()
newState.clipPath = defaultClipPath;
newState.clipPath.setFillRule(Qt::WindingFill);
- newState.strokeStyle = QColor("#000000");
- newState.fillStyle = QColor("#000000");
- newState.fillPatternRepeatX = false;
- newState.fillPatternRepeatY = false;
- newState.strokePatternRepeatX = false;
- newState.strokePatternRepeatY = false;
- newState.invertibleCTM = true;
- newState.fillRule = Qt::WindingFill;
- newState.globalAlpha = 1.0;
- newState.lineWidth = 1;
- newState.lineCap = Qt::FlatCap;
- newState.lineJoin = Qt::MiterJoin;
- newState.miterLimit = 10;
- newState.shadowOffsetX = 0;
- newState.shadowOffsetY = 0;
- newState.shadowBlur = 0;
- newState.shadowColor = qRgba(0, 0, 0, 0);
- newState.globalCompositeOperation = QPainter::CompositionMode_SourceOver;
- newState.font = QFont(QStringLiteral("sans-serif"), 10);
- newState.textAlign = QQuickContext2D::Start;
- newState.textBaseline = QQuickContext2D::Alphabetic;
-
m_stateStack.clear();
m_stateStack.push(newState);
popState();
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index 0fe8bc6db2..8164108bd3 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -131,10 +131,11 @@ public:
, shadowBlur(0)
, shadowColor(qRgba(0, 0, 0, 0))
, globalCompositeOperation(QPainter::CompositionMode_SourceOver)
- , font(QFont(QLatin1String("sans-serif"), 10))
+ , font(QFont(QLatin1String("sans-serif")))
, textAlign(QQuickContext2D::Start)
, textBaseline(QQuickContext2D::Alphabetic)
{
+ font.setPixelSize(10);
}
QTransform matrix;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index 7c5841810b..d433efcb69 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -54,86 +54,136 @@ QT_BEGIN_NAMESPACE
void qt_image_boxblur(QImage& image, int radius, bool quality);
-static QImage makeShadowImage(const QImage& image, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
-{
- QImage shadowImg(image.width() + blur + qAbs(offsetX),
- image.height() + blur + qAbs(offsetY),
- QImage::Format_ARGB32_Premultiplied);
- shadowImg.fill(0);
- QPainter tmpPainter(&shadowImg);
- tmpPainter.setCompositionMode(QPainter::CompositionMode_Source);
- qreal shadowX = offsetX > 0? offsetX : 0;
- qreal shadowY = offsetY > 0? offsetY : 0;
-
- tmpPainter.drawImage(shadowX, shadowY, image);
- tmpPainter.end();
-
- if (blur > 0)
- qt_image_boxblur(shadowImg, blur/2, true);
-
- // blacken the image with shadow color...
- tmpPainter.begin(&shadowImg);
- tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
- tmpPainter.fillRect(shadowImg.rect(), color);
- tmpPainter.end();
- return shadowImg;
-}
+namespace {
+ class ShadowImageMaker
+ {
+ public:
+ virtual ~ShadowImageMaker() {}
-static void fillRectShadow(QPainter* p, QRectF shadowRect, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
-{
- QRectF r = shadowRect;
- r.moveTo(0, 0);
+ void paintShapeAndShadow(QPainter *p, qreal offsetX, qreal offsetY, qreal blur, const QColor &color)
+ {
+ QRectF bounds = boundingRect().translated(offsetX, offsetY).adjusted(-2*blur, -2*blur, 2*blur, 2*blur);
+ QRect boundsAligned = bounds.toAlignedRect();
+
+ QImage shadowImage(boundsAligned.size(), QImage::Format_ARGB32_Premultiplied);
+ shadowImage.fill(0);
+
+ QPainter shadowPainter(&shadowImage);
+ shadowPainter.setRenderHints(p->renderHints());
+ shadowPainter.translate(offsetX - boundsAligned.left(), offsetY - boundsAligned.top());
+ paint(&shadowPainter);
+ shadowPainter.end();
+
+ if (blur > 0)
+ qt_image_boxblur(shadowImage, qMax(1, qRound(blur / 2)), true);
+
+ // blacken the image with shadow color...
+ shadowPainter.begin(&shadowImage);
+ shadowPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+ shadowPainter.fillRect(shadowImage.rect(), color);
+ shadowPainter.end();
+
+ p->drawImage(boundsAligned.topLeft(), shadowImage);
+ paint(p);
+ }
- QImage shadowImage(r.size().width() + 1, r.size().height() + 1, QImage::Format_ARGB32_Premultiplied);
- QPainter tp;
- tp.begin(&shadowImage);
- tp.fillRect(r, p->brush());
- tp.end();
- shadowImage = makeShadowImage(shadowImage, offsetX, offsetY, blur, color);
+ virtual void paint(QPainter *p) const = 0;
+ virtual QRectF boundingRect() const = 0;
+ };
- qreal dx = shadowRect.left() + (offsetX < 0? offsetX:0);
- qreal dy = shadowRect.top() + (offsetY < 0? offsetY:0);
+ class FillRectShadow : public ShadowImageMaker
+ {
+ public:
+ FillRectShadow(const QRectF &rect, const QBrush &brush)
+ : m_rect(rect.normalized())
+ , m_brush(brush)
+ {
+ }
+
+ void paint(QPainter *p) const { p->fillRect(m_rect, m_brush); }
+ QRectF boundingRect() const { return m_rect; }
- p->drawImage(dx, dy, shadowImage);
- p->fillRect(shadowRect, p->brush());
+ private:
+ QRectF m_rect;
+ QBrush m_brush;
+ };
+
+ class FillPathShadow : public ShadowImageMaker
+ {
+ public:
+ FillPathShadow(const QPainterPath &path, const QBrush &brush)
+ : m_path(path)
+ , m_brush(brush)
+ {
+ }
+
+ void paint(QPainter *p) const { p->fillPath(m_path, m_brush); }
+ QRectF boundingRect() const { return m_path.boundingRect(); }
+
+ private:
+ QPainterPath m_path;
+ QBrush m_brush;
+ };
+
+ class StrokePathShadow : public ShadowImageMaker
+ {
+ public:
+ StrokePathShadow(const QPainterPath &path, const QPen &pen)
+ : m_path(path)
+ , m_pen(pen)
+ {
+ }
+
+ void paint(QPainter *p) const { p->strokePath(m_path, m_pen); }
+
+ QRectF boundingRect() const
+ {
+ qreal d = qMax(qreal(1), m_pen.widthF());
+ return m_path.boundingRect().adjusted(-d, -d, d, d);
+ }
+
+ private:
+ QPainterPath m_path;
+ QPen m_pen;
+ };
+
+ class DrawImageShadow : public ShadowImageMaker
+ {
+ public:
+ DrawImageShadow(const QImage &image, const QPointF &offset)
+ : m_image(image)
+ , m_offset(offset)
+ {
+ }
+
+ void paint(QPainter *p) const { p->drawImage(m_offset, m_image); }
+
+ QRectF boundingRect() const { return QRectF(m_image.rect()).translated(m_offset); }
+
+ private:
+ QImage m_image;
+ QPointF m_offset;
+ };
+}
+
+static void fillRectShadow(QPainter* p, QRectF shadowRect, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
+{
+ FillRectShadow shadowMaker(shadowRect, p->brush());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
static void fillShadowPath(QPainter* p, const QPainterPath& path, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
{
- QRectF r = path.boundingRect();
- QImage img(r.size().width() + r.left() + 1,
- r.size().height() + r.top() + 1,
- QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- QPainter tp(&img);
- tp.fillPath(path.translated(0, 0), p->brush());
- tp.end();
-
- QImage shadowImage = makeShadowImage(img, offsetX, offsetY, blur, color);
- qreal dx = r.left() + (offsetX < 0? offsetX:0);
- qreal dy = r.top() + (offsetY < 0? offsetY:0);
-
- p->drawImage(dx, dy, shadowImage);
- p->fillPath(path, p->brush());
+ FillPathShadow shadowMaker(path, p->brush());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
static void strokeShadowPath(QPainter* p, const QPainterPath& path, qreal offsetX, qreal offsetY, qreal blur, const QColor& color)
{
- QRectF r = path.boundingRect();
- QImage img(r.size().width() + r.left() + 1,
- r.size().height() + r.top() + 1,
- QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- QPainter tp(&img);
- tp.strokePath(path, p->pen());
- tp.end();
-
- QImage shadowImage = makeShadowImage(img, offsetX, offsetY, blur, color);
- qreal dx = r.left() + (offsetX < 0? offsetX:0);
- qreal dy = r.top() + (offsetY < 0? offsetY:0);
- p->drawImage(dx, dy, shadowImage);
- p->strokePath(path, p->pen());
+ StrokePathShadow shadowMaker(path, p->pen());
+ shadowMaker.paintShapeAndShadow(p, offsetX, offsetY, blur, color);
}
+
static inline void drawRepeatPattern(QPainter* p, const QImage& image, const QRectF& rect, const bool repeatX, const bool repeatY)
{
// Patterns must be painted so that the top left of the first image is anchored at
@@ -259,15 +309,16 @@ static void qt_drawImage(QPainter *p, QQuickContext2D::State& state, QImage imag
if (sw != dw || sh != dh)
image = image.scaled(dw, dh);
- if (shadow) {
- QImage shadow = makeShadowImage(image, state.shadowOffsetX, state.shadowOffsetY, state.shadowBlur, state.shadowColor);
- qreal shadow_dx = dx + (state.shadowOffsetX < 0? state.shadowOffsetY:0);
- qreal shadow_dy = dy + (state.shadowOffsetX < 0? state.shadowOffsetY:0);
- p->drawImage(shadow_dx, shadow_dy, shadow);
- }
//Strange OpenGL painting behavior here, without beginNativePainting/endNativePainting, only the first image is painted.
p->beginNativePainting();
- p->drawImage(dx, dy, image);
+
+ if (shadow) {
+ DrawImageShadow shadowMaker(image, QPointF(dx, dy));
+ shadowMaker.paintShapeAndShadow(p, state.shadowOffsetX, state.shadowOffsetY, state.shadowBlur, state.shadowColor);
+ } else {
+ p->drawImage(dx, dy, image);
+ }
+
p->endNativePainting();
}
@@ -295,12 +346,9 @@ void QQuickContext2DCommandBuffer::replay(QPainter* p, QQuickContext2D::State& s
case QQuickContext2D::ClearRect:
{
QPainter::CompositionMode cm = p->compositionMode();
- qreal alpha = p->opacity();
- p->setCompositionMode(QPainter::CompositionMode_Source);
- p->setOpacity(0);
- p->fillRect(takeRect(), QColor(qRgba(0, 0, 0, 0)));
+ p->setCompositionMode(QPainter::CompositionMode_Clear);
+ p->fillRect(takeRect(), Qt::white);
p->setCompositionMode(cm);
- p->setOpacity(alpha);
break;
}
case QQuickContext2D::FillRect:
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index 729e32e564..84ab5bb8fb 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -586,6 +586,7 @@ QQuickCanvasItem::RenderTarget QQuickContext2DImageTexture::renderTarget() const
void QQuickContext2DImageTexture::bind()
{
imageTexture()->bind();
+ updateBindOptions();
}
bool QQuickContext2DImageTexture::updateTexture()
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 0a0fac307c..2025db4fc8 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -156,6 +156,9 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
if (!parent->property("value").isNull()) {
connect(parent, SIGNAL(valueChanged()), this, SLOT(valueChanged()));
}
+ if (!parent->property("cursorPosition").isNull()) {
+ connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
+ }
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 2124356a70..131b379a07 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -142,6 +142,10 @@ public Q_SLOTS:
QAccessibleValueChangeEvent ev(parent(), parent()->property("value"));
QAccessible::updateAccessibility(&ev);
}
+ void cursorPositionChanged() {
+ QAccessibleTextCursorEvent ev(parent(), parent()->property("cursorPosition").toInt());
+ QAccessible::updateAccessibility(&ev);
+ }
Q_SIGNALS:
void roleChanged();
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 55b3e569ef..e828899204 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -114,13 +114,13 @@ public:
\ingroup qtquick-input
\brief For specifying drag and drop events for moved Items
- Using the Drag attached property any Item can made a source of drag and drop
+ Using the Drag attached property any Item can be made a source of drag and drop
events within a scene.
- When a drag is \l active on an item any change in that items position will
- generate a drag events that will be sent to any DropArea that intersects
- the with new position of the item. Other items which implement drag and
- drop event handlers can also receive these events.
+ When a drag is \l active on an item any change in that item's position will
+ generate a drag event that will be sent to any DropArea that intersects
+ with the new position of the item. Other items which implement drag and
+ drop event handlers can also receive these events.
The following snippet shows how an item can be dragged with a MouseArea.
However, dragging is not limited to mouse drags, anything that can move an item
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index f930835bee..659e606ef9 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -400,7 +400,7 @@ QStringList QQuickDropEvent::keys() const
*/
/*!
- \qmlproperty real QtQuick2::DragEvent::accepted
+ \qmlproperty bool QtQuick2::DragEvent::accepted
This property holds whether the drag event was accepted by a handler.
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 469ae9d0e4..6f1b152ad3 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -93,7 +93,7 @@ private:
QKeyEvent event;
};
-// used in QtLocation
+// used in Qt Location
class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject
{
Q_OBJECT
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index ff56bcaa0e..e6b39d5380 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -423,12 +423,16 @@ void QQuickFlickablePrivate::fixupX_callback(void *data)
void QQuickFlickablePrivate::fixupX()
{
Q_Q(QQuickFlickable);
+ if (!q->isComponentComplete())
+ return; //Do not fixup from initialization values
fixup(hData, q->minXExtent(), q->maxXExtent());
}
void QQuickFlickablePrivate::fixupY()
{
Q_Q(QQuickFlickable);
+ if (!q->isComponentComplete())
+ return; //Do not fixup from initialization values
fixup(vData, q->minYExtent(), q->maxYExtent());
}
@@ -913,6 +917,18 @@ void QQuickFlickable::setFlickableDirection(FlickableDirection direction)
}
}
+/*!
+ \qmlproperty bool QtQuick2::Flickable::pixelAligned
+
+ This property sets the alignment of \l contentX and \l contentY to
+ pixels (\c true) or subpixels (\c false).
+
+ Enable pixelAligned to optimize for still content or moving content with
+ high constrast edges, such as one-pixel-wide lines, text or vector graphics.
+ Disable pixelAligned when optimizing for animation quality.
+
+ The default is \c false.
+*/
bool QQuickFlickable::pixelAligned() const
{
Q_D(const QQuickFlickable);
@@ -2265,7 +2281,11 @@ bool QQuickFlickablePrivate::isViewMoving() const
within the timeout, both the press and release will be delivered.
Note that for nested Flickables with pressDelay set, the pressDelay of
- outer Flickables is overridden by the innermost Flickable.
+ outer Flickables is overridden by the innermost Flickable. If the drag
+ exceeds the platform drag threshold, the press event will be delivered
+ regardless of this property.
+
+ \sa QStyleHints
*/
int QQuickFlickable::pressDelay() const
{
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index 513a26e747..0186029fa0 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -101,7 +101,7 @@ public:
AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal))
: move(fp, func)
, transitionToBounds(0)
- , viewSize(-1), startMargin(0), endMargin(0)
+ , viewSize(-1), lastPos(0), startMargin(0), endMargin(0)
, origin(0)
, transitionTo(0)
, continuousFlickVelocity(0), velocityTime(), vTime(0)
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index e40d21b498..bc71a1c064 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -2564,6 +2564,22 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
\b Note: methods should only be called after the Component has completed.
*/
+
+/*!
+ \qmlmethod QtQuick2::GridView::forceLayout()
+
+ Responding to changes in the model is usually batched to happen only once
+ per frame. This means that inside script blocks it is possible for the
+ underlying model to have changed, but the GridView has not caught up yet.
+
+ This method forces the GridView to immediately respond to any outstanding
+ changes in the model.
+
+ \since QtQuick 2.1
+
+ \b Note: methods should only be called after the Component has completed.
+*/
+
QQuickGridViewAttached *QQuickGridView::qmlAttachedProperties(QObject *obj)
{
return new QQuickGridViewAttached(obj);
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 9403b7967e..6fe4b39974 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -233,6 +233,8 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.Tile
+ horizontalAlignment: Image.AlignLeft
+ verticalAlignment: Image.AlignTop
source: "qtlogo.png"
}
\endqml
@@ -244,6 +246,7 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.TileVertically
+ verticalAlignment: Image.AlignTop
source: "qtlogo.png"
}
\endqml
@@ -255,6 +258,7 @@ void QQuickImagePrivate::setImage(const QImage &image)
Image {
width: 120; height: 120
fillMode: Image.TileHorizontally
+ verticalAlignment: Image.AlignLeft
source: "qtlogo.png"
}
\endqml
@@ -460,7 +464,7 @@ qreal QQuickImage::paintedHeight() const
\qmlproperty enumeration QtQuick2::Image::horizontalAlignment
\qmlproperty enumeration QtQuick2::Image::verticalAlignment
- Sets the horizontal and vertical alignment of the image. By default, the image is top-left aligned.
+ Sets the horizontal and vertical alignment of the image. By default, the image is center aligned.
The valid values for \c horizontalAlignment are \c Image.AlignLeft, \c Image.AlignRight and \c Image.AlignHCenter.
The valid values for \c verticalAlignment are \c Image.AlignTop, \c Image.AlignBottom
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4ce9b15921..d0417c80f3 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -58,6 +58,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qnumeric.h>
+#include <QtGui/qpa/qplatformtheme.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmlengine_p.h>
@@ -1365,7 +1366,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj)
\brief Property used to mirror layout behavior
The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors},
- \l{Item Layouts}{positioner} types (such as \l Row and \l Grid)
+ \l{Item Positioners}{positioner} types (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 types like \l Grid and \l Row reverse the
horizontal layout of child items.
@@ -1405,7 +1406,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj)
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{Item Layouts}{positioner} types
+ and right anchors become left. For \l{Item Positioners}{positioner} types
(such as \l Row and \l Grid) and view types (such as \l {GridView}{GridView} and \l {ListView}{ListView})
this also mirrors the horizontal layout direction of the item.
@@ -1573,7 +1574,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
/*!
\class QQuickItem
- \brief The QQuickItem class provides the most basic of all visual items in QtQuick.
+ \brief The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
\inmodule QtQuick
All visual items in Qt Quick inherit from QQuickItem. Although a QQuickItem
@@ -2037,6 +2038,44 @@ QQuickItem::~QQuickItem()
/*!
\internal
+*/
+bool QQuickItemPrivate::qt_tab_all_widgets()
+{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool();
+ return true;
+}
+
+/*!
+ \internal
+*/
+bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item)
+{
+ bool result = true;
+
+ if (!item->window())
+ return false;
+
+ if (item == item->window()->contentItem())
+ return true;
+
+#ifndef QT_NO_ACCESSIBILITY
+ result = false;
+ if (QObject *acc = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false)) {
+ int role = acc->property("role").toInt();
+ if (role == QAccessible::EditableText
+ || role == QAccessible::Table
+ || role == QAccessible::List
+ || role == QAccessible::SpinBox)
+ result = true;
+ }
+#endif
+
+ return result;
+}
+
+/*!
+ \internal
\brief QQuickItemPrivate::focusNextPrev focuses the next/prev item in the tab-focus-chain
\param item The item that currently has the focus
\param forward The direction
@@ -2047,8 +2086,21 @@ QQuickItem::~QQuickItem()
*/
bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
{
+ QQuickItem *next = QQuickItemPrivate::nextPrevItemInTabFocusChain(item, forward);
+
+ if (next == item)
+ return false;
+
+ next->forceActiveFocus(forward ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+
+ return true;
+}
+
+QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, bool forward)
+{
Q_ASSERT(item);
- Q_ASSERT(item->activeFocusOnTab());
+
+ bool all = QQuickItemPrivate::qt_tab_all_widgets();
QQuickItem *from = 0;
if (forward) {
@@ -2060,6 +2112,10 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
from = item->parentItem();
}
bool skip = false;
+ const QQuickItem * const contentItem = item->window()->contentItem();
+ const QQuickItem * const originalItem = item;
+ QQuickItem * startItem = item;
+ QQuickItem * firstFromItem = from;
QQuickItem *current = item;
do {
skip = false;
@@ -2110,16 +2166,29 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward)
skip = true;
}
}
-
from = last;
- } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible());
-
- if (current == item)
- return false;
-
- current->forceActiveFocus(forward ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+ if (current == startItem && from == firstFromItem) {
+ // wrapped around, avoid endless loops
+ if (originalItem == contentItem) {
+#ifdef FOCUS_DEBUG
+ qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem";
+#endif
+ return item->window()->contentItem();
+ } else {
+#ifdef FOCUS_DEBUG
+ qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem;
+#endif
+ return startItem;
+ }
+ }
+ if (!firstFromItem) { //start from root
+ startItem = current;
+ firstFromItem = from;
+ }
+ } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible()
+ || !(all || QQuickItemPrivate::canAcceptTabFocus(current)));
- return true;
+ return current;
}
/*!
@@ -2255,7 +2324,8 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
}
}
- d->resolveLayoutMirror();
+ if (d->parentItem)
+ d->resolveLayoutMirror();
d->itemChange(ItemParentHasChanged, d->parentItem);
@@ -2341,13 +2411,16 @@ void QQuickItem::stackAfter(const QQuickItem *sibling)
QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
+/*! \fn void QQuickItem::windowChanged(QQuickWindow *window)
+ This signal is emitted when the item's \a window changes.
+*/
+
/*!
Returns the window in which this item is rendered.
- The item does not have a window until it has been assigned into a scene. To
- get notification about this, reimplement the itemChange() function and
- listen for the ItemSceneChange change. The itemChange() function is called
- both when the item is entered into a scene and when it is removed from a scene.
+ The item does not have a window until it has been assigned into a scene. The
+ \l windowChanged signal provides a notification both when the item is entered
+ into a scene and when it is removed from a scene.
*/
QQuickWindow *QQuickItem::window() const
{
@@ -2498,8 +2571,7 @@ void QQuickItemPrivate::derefWindow()
if (c->cursorItem == q)
c->cursorItem = 0;
#endif
- if ( hoverEnabled )
- c->hoverItems.removeAll(q);
+ c->hoverItems.removeAll(q);
if (itemNodeInstance)
c->cleanup(itemNodeInstance);
if (!parentItem)
@@ -2688,9 +2760,26 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o)
} else {
if (o->inherits("QGraphicsItem"))
qWarning("Cannot add a QtQuick 1.0 item (%s) into a QtQuick 2.0 scene!", o->metaObject()->className());
+ else {
+ QQuickWindow *thisWindow = qmlobject_cast<QQuickWindow *>(o);
+ QQuickItem *item = that;
+ QQuickWindow *itemWindow = that->window();
+ while (!itemWindow && item && item->parentItem()) {
+ item = item->parentItem();
+ itemWindow = item->window();
+ }
+
+ if (thisWindow) {
+ if (itemWindow)
+ thisWindow->setTransientParent(itemWindow);
+ else
+ QObject::connect(item, SIGNAL(windowChanged(QQuickWindow*)),
+ thisWindow, SLOT(setTransientParent_helper(QQuickWindow*)));
+ }
+ o->setParent(that);
+ }
- // XXX todo - do we really want this behavior?
- o->setParent(that);
+ resources_append(prop, o);
}
}
@@ -2768,30 +2857,38 @@ void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *property)
QObject *QQuickItemPrivate::resources_at(QQmlListProperty<QObject> *prop, int index)
{
- const QObjectList children = prop->object->children();
- if (index < children.count())
- return children.at(index);
- else
- return 0;
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
+ return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.value(index) : 0;
}
-void QQuickItemPrivate::resources_append(QQmlListProperty<QObject> *prop, QObject *o)
+void QQuickItemPrivate::resources_append(QQmlListProperty<QObject> *prop, QObject *object)
{
- // XXX todo - do we really want this behavior?
- o->setParent(prop->object);
+ QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object);
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem);
+ if (!quickItemPrivate->extra.value().resourcesList.contains(object)) {
+ quickItemPrivate->extra.value().resourcesList.append(object);
+ qmlobject_connect(object, QObject, SIGNAL(destroyed(QObject*)),
+ quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*)));
+ }
}
int QQuickItemPrivate::resources_count(QQmlListProperty<QObject> *prop)
{
- return prop->object->children().count();
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
+ return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.count() : 0;
}
void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop)
{
- // XXX todo - do we really want this behavior?
- const QObjectList children = prop->object->children();
- for (int index = 0; index < children.count(); index++)
- children.at(index)->setParent(0);
+ QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object);
+ QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem);
+ if (quickItemPrivate->extra.isAllocated()) {//If extra is not allocated resources is empty.
+ foreach (QObject *object, quickItemPrivate->extra->resourcesList) {
+ qmlobject_disconnect(object, QObject, SIGNAL(destroyed(QObject*)),
+ quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*)));
+ }
+ quickItemPrivate->extra->resourcesList.clear();
+ }
}
QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, int index)
@@ -2938,6 +3035,12 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
p->dirty(QQuickItemPrivate::Transform);
}
+void QQuickItemPrivate::_q_resourceObjectDeleted(QObject *object)
+{
+ if (extra.isAllocated() && extra->resourcesList.contains(object))
+ extra->resourcesList.removeAll(object);
+}
+
/*!
\qmlproperty AnchorLine QtQuick2::Item::anchors.top
\qmlproperty AnchorLine QtQuick2::Item::anchors.bottom
@@ -3917,6 +4020,28 @@ void QQuickItem::forceActiveFocus(Qt::FocusReason reason)
}
/*!
+ \qmlmethod QtQuick2::Item::nextItemInFocusChain(bool forward)
+
+ \since QtQuick 2.1
+
+ Returns the item in the focus chain which is next to this item.
+ If \a forward is \c true, or not supplied, it is the next item in
+ the forwards direction. If \a forward is \c false, it is the next
+ item in the backwards direction.
+*/
+/*!
+ Returns the item in the focus chain which is next to this item.
+ If \a forward is \c true, or not supplied, it is the next item in
+ the forwards direction. If \a forward is \c false, it is the next
+ item in the backwards direction.
+*/
+
+QQuickItem *QQuickItem::nextItemInFocusChain(bool forward)
+{
+ return QQuickItemPrivate::nextPrevItemInTabFocusChain(this, forward);
+}
+
+/*!
\qmlmethod QtQuick2::Item::childAt(real x, real y)
Returns the first visible child item found at point (\a x, \a y) within
@@ -4280,7 +4405,8 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e)
return;
//only care about KeyPress now
- if (q->activeFocusOnTab() && e->type() == QEvent::KeyPress) {
+ if ((q == q->window()->contentItem() || q->activeFocusOnTab())
+ && e->type() == QEvent::KeyPress) {
bool res = false;
if (!(e->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier?
if (e->key() == Qt::Key_Backtab
@@ -4417,11 +4543,18 @@ void QQuickItemPrivate::deliverDragEvent(QEvent *e)
\a value contains extra information relating to the change, when
applicable.
+
+ If you re-implement this method in a subclass, be sure to call
+ \code
+ QQuickItem::itemChange(change, value);
+ \endcode
+ typically at the end of your implementation, to ensure the
+ \l windowChanged signal will be emitted.
*/
void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
{
- Q_UNUSED(change);
- Q_UNUSED(value);
+ if (change == ItemSceneChange)
+ emit windowChanged(value.window);
}
#ifndef QT_NO_IM
@@ -5489,7 +5622,7 @@ void QQuickItem::setActiveFocusOnTab(bool activeFocusOnTab)
return;
if (window()) {
- if ((this == window()->activeFocusItem()) && !activeFocusOnTab) {
+ if ((this == window()->activeFocusItem()) && this != window()->contentItem() && !activeFocusOnTab) {
qWarning("QQuickItem: Cannot set activeFocusOnTab to false once item is the active focus item.");
return;
}
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 4c99a6a9c5..6ad121fffa 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -324,6 +324,7 @@ public:
Q_INVOKABLE void mapToItem(QQmlV4Function*) const;
Q_INVOKABLE void forceActiveFocus();
Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason);
+ Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true);
Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const;
#ifndef QT_NO_IM
@@ -355,6 +356,7 @@ Q_SIGNALS:
void smoothChanged(bool);
void antialiasingChanged(bool);
void clipChanged(bool);
+ Q_REVISION(1) void windowChanged(QQuickWindow* window);
// XXX todo
void childrenChanged();
@@ -430,6 +432,8 @@ protected:
QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = 0);
private:
+ Q_PRIVATE_SLOT(d_func(), void _q_resourceObjectDeleted(QObject *))
+
friend class QQuickWindow;
friend class QQuickWindowPrivate;
friend class QSGRenderer;
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 4bd9d82c20..0ffc092a83 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -128,7 +128,7 @@ void QQuickContents::calcGeometry(QQuickItem *changed)
class QQuickTransformPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QQuickTransform);
+ Q_DECLARE_PUBLIC(QQuickTransform)
public:
static QQuickTransformPrivate* get(QQuickTransform *transform) { return transform->d_func(); }
@@ -293,6 +293,8 @@ public:
static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, int);
static void transform_clear(QQmlListProperty<QQuickTransform> *list);
+ void _q_resourceObjectDeleted(QObject *);
+
enum ChangeType {
Geometry = 0x01,
SiblingOrder = 0x02,
@@ -363,6 +365,8 @@ public:
Qt::MouseButtons acceptedMouseButtons;
QQuickItem::TransformOrigin origin:5;
+
+ QObjectList resourcesList;
};
QLazilyAllocated<ExtraData> extra;
@@ -485,6 +489,10 @@ public:
void itemToParentTransform(QTransform &) const;
static bool focusNextPrev(QQuickItem *item, bool forward);
+ static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item, bool forward);
+
+ static bool qt_tab_all_widgets(); //todo: move to QGuiApplication?
+ static bool canAcceptTabFocus(QQuickItem *item);
qreal x;
qreal y;
@@ -886,7 +894,7 @@ QSGNode *QQuickItemPrivate::childContainerNode()
return groupNode;
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes)
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 741583a95d..6f1edc718a 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -167,6 +167,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickKeyEvent>();
qmlRegisterType<QQuickMouseEvent>();
qmlRegisterType<QQuickWheelEvent>();
+ qmlRegisterType<QQuickCloseEvent>();
qmlRegisterType<QQuickTransform>();
qmlRegisterType<QQuickPathElement>();
qmlRegisterType<QQuickCurve>();
@@ -230,7 +231,13 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickItem, 1>(uri, 2, 1,"Item");
qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid");
+ qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
+ qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView");
+ qmlRegisterType<QQuickGridView, 1>(uri, 2, 1, "GridView");
qmlRegisterType<QQuickTextEdit, 1>(uri, 2, 1, "TextEdit");
+
+ qmlRegisterType<QQuickText, 2>(uri, 2, 2, "Text");
+ qmlRegisterType<QQuickTextEdit, 2>(uri, 2, 2, "TextEdit");
}
void QQuickItemsModule::defineModule()
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 72f892178f..a6dabee7ba 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -249,7 +249,6 @@ QQuickItemView::~QQuickItemView()
QQuickItem *QQuickItemView::currentItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->currentItem ? d->currentItem->item : 0;
}
@@ -379,14 +378,12 @@ int QQuickItemView::count() const
Q_D(const QQuickItemView);
if (!d->model)
return 0;
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->model->count();
}
int QQuickItemView::currentIndex() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->currentIndex;
}
@@ -496,7 +493,6 @@ QQmlComponent *QQuickItemView::header() const
QQuickItem *QQuickItemView::headerItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->header ? d->header->item : 0;
}
@@ -532,7 +528,6 @@ QQmlComponent *QQuickItemView::footer() const
QQuickItem *QQuickItemView::footerItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->footer ? d->footer->item : 0;
}
@@ -559,7 +554,6 @@ void QQuickItemView::setFooter(QQmlComponent *footerComponent)
QQmlComponent *QQuickItemView::highlight() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->highlightComponent;
}
@@ -579,7 +573,6 @@ void QQuickItemView::setHighlight(QQmlComponent *highlightComponent)
QQuickItem *QQuickItemView::highlightItem() const
{
Q_D(const QQuickItemView);
- const_cast<QQuickItemViewPrivate*>(d)->applyPendingChanges();
return d->highlight ? d->highlight->item : 0;
}
@@ -965,6 +958,12 @@ QQuickItem *QQuickItemView::itemAt(qreal x, qreal y) const
return 0;
}
+void QQuickItemView::forceLayout()
+{
+ Q_D(QQuickItemView);
+ d->applyPendingChanges();
+}
+
void QQuickItemViewPrivate::applyPendingChanges()
{
Q_Q(QQuickItemView);
@@ -2205,7 +2204,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, bool asynchronous)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickItemView::tr("Delegate must be of Item type");
}
}
inRequest = false;
@@ -2260,8 +2259,10 @@ void QQuickItemView::destroyingItem(QObject *object)
{
Q_D(QQuickItemView);
QQuickItem* item = qmlobject_cast<QQuickItem*>(object);
- item->setParentItem(0);
- d->unrequestedItems.remove(item);
+ if (item) {
+ item->setParentItem(0);
+ d->unrequestedItems.remove(item);
+ }
}
bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index b0f910680a..d7812bcdad 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -202,6 +202,7 @@ public:
Q_INVOKABLE QQuickItem *itemAt(qreal x, qreal y) const;
Q_INVOKABLE void positionViewAtBeginning();
Q_INVOKABLE void positionViewAtEnd();
+ Q_REVISION(1) Q_INVOKABLE void forceLayout();
virtual void setContentX(qreal pos);
virtual void setContentY(qreal pos);
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 53dc715469..4d42c9ece1 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1659,7 +1659,7 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
A ListView displays data from models created from built-in QML types like ListModel
and XmlListModel, or custom model classes defined in C++ that inherit from
- QAbstractListModel.
+ QAbstractItemModel or 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
@@ -2185,7 +2185,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
each section.
- \snippet quick/views/listview/sections.qml 0
+ \snippet views/listview/sections.qml 0
\image qml-listview-sections-example.png
@@ -3108,6 +3108,21 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
\b Note: methods should only be called after the Component has completed.
*/
+/*!
+ \qmlmethod QtQuick2::ListView::forceLayout()
+
+ Responding to changes in the model is usually batched to happen only once
+ per frame. This means that inside script blocks it is possible for the
+ underlying model to have changed, but the ListView has not caught up yet.
+
+ This method forces the ListView to immediately respond to any outstanding
+ changes in the model.
+
+ \since QtQuick 2.1
+
+ \b Note: methods should only be called after the Component has completed.
+*/
+
QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
{
return new QQuickListViewAttached(obj);
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index af766ac294..8f4dc0bd17 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -264,7 +264,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
\c event.accepted to \c true so that the event is not propagated to the
parent \l Rectangle.
- Since QtQuick 2.0 Loader can also load non-visual components.
+ Since \c {QtQuick 2.0}, Loader can also load non-visual components.
\section2 Using a Loader within a view delegate
@@ -376,7 +376,7 @@ void QQuickLoader::setActive(bool newVal)
\qmlproperty url QtQuick2::Loader::source
This property holds the URL of the QML component to instantiate.
- Since QtQuick 2.0 Loader is able to load any type of object; it
+ Since \c {QtQuick 2.0}, Loader is able to load any type of object; it
is not restricted to Item types.
To unload the currently loaded object, set this property to an empty string,
@@ -451,7 +451,7 @@ void QQuickLoader::loadFromSource()
To unload the currently loaded object, set this property to an empty string
or \c undefined.
- Since QtQuick 2.0 Loader is able to load any type of object; it
+ Since \c {QtQuick 2.0}, Loader is able to load any type of object; it
is not restricted to Item types.
\sa source, progress
@@ -903,7 +903,7 @@ void QQuickLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
\qmlproperty object QtQuick2::Loader::item
This property holds the top-level object that is currently loaded.
- Since QtQuick 2.0 Loader can load any object type.
+ Since \c {QtQuick 2.0}, Loader can load any object type.
*/
QObject *QQuickLoader::item() const
{
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index ad0a265035..a8786585da 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -773,11 +773,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
// ### we should skip this if these signals aren't used
// ### can GV handle this for us?
- const bool isInside = contains(d->lastPos);
- if (d->hovered && !isInside)
- setHovered(false);
- else if (!d->hovered && isInside)
- setHovered(true);
+ setHovered(contains(d->lastPos));
#ifndef QT_NO_DRAGANDDROP
if (d->drag && d->drag->target()) {
@@ -958,7 +954,8 @@ void QQuickMouseArea::ungrabMouse()
emit canceled();
emit pressedChanged();
emit pressedButtonsChanged();
- if (d->hovered) {
+
+ if (d->hovered && !isUnderMouse()) {
d->hovered = false;
emit hoveredChanged();
}
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index ad15167b10..fa32f32b65 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -123,7 +123,7 @@ private:
class QQuickMouseAreaPrivate;
class QQuickWheelEvent;
-// used in QtLocation
+// used in Qt Location
class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
{
Q_OBJECT
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 384c1c7ac8..d6b00cee14 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -47,6 +47,7 @@
#include <QMouseEvent>
#include <math.h>
#include <QDebug>
+#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE
@@ -322,6 +323,7 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
: QQuickItem(parent),
+ _currentWindow(0),
_minimumTouchPoints(0),
_maximumTouchPoints(INT_MAX),
_stealMouse(false)
@@ -331,6 +333,9 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
if (qmlVisualTouchDebugging()) {
setFlag(QQuickItem::ItemHasContents);
}
+#ifdef Q_OS_MAC
+ connect(this, &QQuickItem::windowChanged, this, &QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow);
+#endif
}
QQuickMultiPointTouchArea::~QQuickMultiPointTouchArea()
@@ -542,6 +547,29 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p)
_pressedTouchPoints.append(dtp);
}
+void QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow(QWindow *window)
+{
+#ifdef Q_OS_MAC
+ // Resolve function for enabling touch events from the (cocoa) platform plugin.
+ typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
+ RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
+ QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
+ if (!registerTouchWindow)
+ return; // Not necessarily an error, Qt migh be using a different platform plugin.
+
+ // Disable touch on the old window, enable on the new window.
+ if (_currentWindow)
+ registerTouchWindow(_currentWindow, false);
+ if (window)
+ registerTouchWindow(window, true);
+ // Save the current window, setTouchEventsEnabledForWindow will be called
+ // with a null window on disable.
+ _currentWindow = window;
+#else // Q_OS_MAC
+ Q_UNUSED(window)
+#endif
+}
+
void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype)
{
int id = _touchPrototypes.count();
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index e2ae5ed24e..afe7d4b77b 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -251,6 +251,9 @@ protected:
void grabGesture();
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+protected slots:
+ void setTouchEventsEnabledForWindow(QWindow *window);
+
private:
void ungrab();
QMap<int,QQuickTouchPoint*> _touchPrototypes; //TouchPoints defined in QML
@@ -258,6 +261,7 @@ private:
QList<QObject*> _releasedTouchPoints;
QList<QObject*> _pressedTouchPoints;
QList<QObject*> _movedTouchPoints;
+ QWindow *_currentWindow;
int _minimumTouchPoints;
int _maximumTouchPoints;
bool _stealMouse;
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e9aa6985fc..7798641fcd 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -159,7 +159,7 @@ QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type");
}
}
} else {
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 0e47b61319..434eaa8723 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -45,6 +45,7 @@
#include <QtGui/qevent.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
+#include <qpa/qplatformnativeinterface.h>
#include <float.h>
#include <math.h>
@@ -246,11 +247,15 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
QQuickPinchArea::QQuickPinchArea(QQuickItem *parent)
: QQuickItem(*(new QQuickPinchAreaPrivate), parent)
+ , _currentWindow(0)
{
Q_D(QQuickPinchArea);
d->init();
setAcceptedMouseButtons(Qt::LeftButton);
setFiltersChildMouseEvents(true);
+#ifdef Q_OS_MAC
+ connect(this, &QQuickItem::windowChanged, this, &QQuickPinchArea::setTouchEventsEnabledForWindow);
+#endif
}
QQuickPinchArea::~QQuickPinchArea()
@@ -539,6 +544,29 @@ QQuickPinch *QQuickPinchArea::pinch()
return d->pinch;
}
+void QQuickPinchArea::setTouchEventsEnabledForWindow(QWindow *window)
+{
+#ifdef Q_OS_MAC
+ // Resolve function for enabling touch events from the (cocoa) platform plugin.
+ typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
+ RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
+ QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
+ if (!registerTouchWindow)
+ return; // Not necessarily an error, Qt migh be using a different platform plugin.
+
+ // Disable touch on the old window, enable on the new window.
+ if (_currentWindow)
+ registerTouchWindow(_currentWindow, false);
+ if (window)
+ registerTouchWindow(window, true);
+ // Save the current window, setTouchEventsEnabledForWindow will be called
+ // with a null window on disable.
+ _currentWindow = window;
+#else // Q_OS_MAC
+ Q_UNUSED(window)
+#endif
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h
index 4fc77d7f9c..60c2dc742e 100644
--- a/src/quick/items/qquickpincharea_p.h
+++ b/src/quick/items/qquickpincharea_p.h
@@ -283,12 +283,16 @@ protected:
const QRectF &oldGeometry);
virtual void itemChange(ItemChange change, const ItemChangeData& value);
+private slots:
+ void setTouchEventsEnabledForWindow(QWindow *window);
+
private:
void updatePinch();
void handlePress();
void handleRelease();
private:
+ QWindow *_currentWindow;
Q_DISABLE_COPY(QQuickPinchArea)
Q_DECLARE_PRIVATE(QQuickPinchArea)
};
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index 4a74c0bfba..b07a38cdaf 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -452,7 +452,6 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp
QQuickPositionerAttached *prevLastProperty = 0;
QQuickPositionerAttached *lastProperty = 0;
- int visibleItemIndex = 0;
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
if (!child.item)
@@ -468,28 +467,47 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp
property = static_cast<QQuickPositionerAttached *>(qmlAttachedPropertiesObject<QQuickBasePositioner>(child.item, false));
}
- if (child.isVisible) {
- if (property) {
- property->setIndex(visibleItemIndex);
- property->setIsFirstItem(visibleItemIndex == 0);
+ if (property) {
+ property->setIndex(ii);
+ property->setIsFirstItem(ii == 0);
- if (property->isLastItem())
+ if (property->isLastItem()) {
+ if (prevLastProperty)
+ prevLastProperty->setIsLastItem(false); // there can be only one last property
prevLastProperty = property;
}
-
- lastProperty = property;
- ++visibleItemIndex;
- } else if (property) {
- property->setIndex(-1);
- property->setIsFirstItem(false);
- property->setIsLastItem(false);
}
+
+ lastProperty = property;
}
if (prevLastProperty && prevLastProperty != lastProperty)
prevLastProperty->setIsLastItem(false);
if (lastProperty)
lastProperty->setIsLastItem(true);
+
+ // clear attached properties for unpositioned items
+ for (int ii = 0; ii < unpositionedItems.count(); ++ii) {
+ const PositionedItem &child = unpositionedItems.at(ii);
+ if (!child.item)
+ continue;
+
+ QQuickPositionerAttached *property = 0;
+
+ if (specificProperty) {
+ if (specificPropertyOwner == child.item) {
+ property = specificProperty;
+ }
+ } else {
+ property = static_cast<QQuickPositionerAttached *>(qmlAttachedPropertiesObject<QQuickBasePositioner>(child.item, false));
+ }
+
+ if (property) {
+ property->setIndex(-1);
+ property->setIsFirstItem(false);
+ property->setIsLastItem(false);
+ }
+ }
}
/*!
@@ -608,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
more information about its position within the Column.
For more information on using Column and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
\section1 Using Transitions
@@ -626,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
\image verticalpositioner_transition.gif
- \sa Row, Grid, Flow, Positioner, {qml/positioners}{Positioners example}
+ \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::populate
@@ -639,7 +657,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::add
@@ -661,7 +679,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Column::move
@@ -682,11 +700,11 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{Qt Quick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Column::spacing
@@ -777,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors()
more information about its position within the Row.
For more information on using Row and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Column, Grid, Flow, Positioner, {qml/positioners}{Positioners example}
+ \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::populate
@@ -793,7 +811,7 @@ void QQuickColumn::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::add
@@ -815,7 +833,7 @@ void QQuickColumn::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Row::move
@@ -836,11 +854,11 @@ void QQuickColumn::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Row::spacing
@@ -869,7 +887,7 @@ QQuickRow::QQuickRow(QQuickItem *parent)
the right anchor remains to the right of the row.
\endlist
- \sa Grid::layoutDirection, Flow::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Grid::layoutDirection, Flow::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickRow::layoutDirection() const
@@ -1010,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors()
or anchor itself with any of the \l {Item::anchors}{anchor} properties.
For more information on using Grid and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Flow, Row, Column, Positioner, {qml/positioners}{Positioners example}
+ \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::populate
@@ -1026,7 +1044,7 @@ void QQuickRow::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::add
@@ -1048,7 +1066,7 @@ void QQuickRow::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Grid::move
@@ -1069,11 +1087,11 @@ void QQuickRow::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty qreal QtQuick2::Grid::spacing
@@ -1230,7 +1248,7 @@ void QQuickGrid::setColumnSpacing(const qreal columnSpacing)
\l Grid::flow property.
\endlist
- \sa Flow::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Flow::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickGrid::layoutDirection() const
{
@@ -1552,9 +1570,9 @@ void QQuickGrid::reportConflictingAnchors()
or anchor itself with any of the \l {Item::anchors}{anchor} properties.
For more information on using Flow and other related positioner-types, see
- \l{Item Layouts}.
+ \l{Item Positioners}.
- \sa Column, Row, Grid, Positioner, {qml/positioners}{Positioners example}
+ \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::populate
@@ -1567,7 +1585,7 @@ void QQuickGrid::reportConflictingAnchors()
the item that is being added. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \sa add, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::add
@@ -1589,7 +1607,7 @@ void QQuickGrid::reportConflictingAnchors()
\note This transition is not applied to the items that already part of the positioner
at the time of its creation. In this case, the \l populate transition is applied instead.
- \sa populate, ViewTransition, {declarative/positioners}{Positioners example}
+ \sa populate, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty Transition QtQuick2::Flow::move
@@ -1610,11 +1628,11 @@ void QQuickGrid::reportConflictingAnchors()
cases, these lists will be empty. See the \l ViewTransition documentation for more details
and examples on using these transitions.
- \note In QtQuick 1, this transition was applied to all items that were part of the
- positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the
+ \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the
+ positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the
\l populate transition to these items instead.
- \sa add, ViewTransition, {qml/positioners}{Positioners example}
+ \sa add, ViewTransition, {Qt Quick Examples - Positioners}
*/
/*!
\qmlproperty real QtQuick2::Flow::spacing
@@ -1692,7 +1710,7 @@ void QQuickFlow::setFlow(Flow flow)
\l Flow::flow property.
\endlist
- \sa Grid::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example}
+ \sa Grid::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left}
*/
Qt::LayoutDirection QQuickFlow::layoutDirection() const
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 3c3bd8897b..c9f37930e2 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -302,7 +302,7 @@ int QQuickRectanglePrivate::doUpdateSlotIdx = -1;
\clearfloat
\section1 Performance
- Using the \l antialiasing property improves the appearance of a rounded rectangle at
+ Using the \l Item::antialiasing 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.
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 35e37d1246..d92b3b43d8 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -217,7 +217,7 @@ void QQuickRepeater::setModel(const QVariant &model)
d->model = new QQmlDelegateModel(qmlContext(this));
d->ownModel = true;
if (isComponentComplete())
- static_cast<QQmlDelegateModel *>(d->model)->componentComplete();
+ static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
}
if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model))
dataModel->setModel(model);
@@ -329,7 +329,7 @@ void QQuickRepeater::componentComplete()
{
Q_D(QQuickRepeater);
if (d->model && d->ownModel)
- static_cast<QQmlDelegateModel *>(d->model)->componentComplete();
+ static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
QQuickItem::componentComplete();
regenerate();
if (d->model && d->model->count())
@@ -351,11 +351,12 @@ void QQuickRepeater::clear()
if (d->model) {
for (int i = 0; i < d->deletables.count(); ++i) {
- QQuickItem *item = d->deletables.at(i);
- if (complete)
- emit itemRemoved(i, item);
- item->setParentItem(0);
- d->model->release(item);
+ if (QQuickItem *item = d->deletables.at(i)) {
+ if (complete)
+ emit itemRemoved(i, item);
+ item->setParentItem(0);
+ d->model->release(item);
+ }
}
}
d->deletables.clear();
@@ -395,7 +396,7 @@ void QQuickRepeaterPrivate::createItems()
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << q->tr("Delegate must be of Item type");
+ qmlInfo(delegate ? delegate : q) << QQuickRepeater::tr("Delegate must be of Item type");
}
}
createFrom = ii;
diff --git a/src/quick/items/qquickrepeater_p_p.h b/src/quick/items/qquickrepeater_p_p.h
index f220eb4fcb..a642f6479a 100644
--- a/src/quick/items/qquickrepeater_p_p.h
+++ b/src/quick/items/qquickrepeater_p_p.h
@@ -73,7 +73,7 @@ public:
private:
void createItems();
- QQmlInstanceModel *model;
+ QPointer<QQmlInstanceModel> model;
QVariant dataSource;
QQmlGuard<QObject> dataSourceAsObject;
bool ownModel : 1;
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 33a831acad..80080d8b88 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
To use this type, you will need to import the module with the following line:
\code
- import QtQuick.Window 2.0
+ import QtQuick.Window 2.1
\endcode
It is a separate import in order to allow you to have a QML environment
without access to window system features.
@@ -80,6 +80,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \qmlattachedproperty String QtQuick.Window2::Screen::name
+ \readonly
+ \since Qt 5.1
+
+ The name of the screen.
+*/
+/*!
\qmlattachedproperty int QtQuick.Window2::Screen::width
\readonly
@@ -92,6 +99,43 @@ QT_BEGIN_NAMESPACE
This contains the height of the screen in pixels.
*/
/*!
+ \qmlattachedproperty int QtQuick.Window2::Screen::desktopAvailableWidth
+ \readonly
+ \since Qt 5.1
+
+ This contains the available width of the collection of screens which make
+ up the virtual desktop, in pixels, excluding window manager reserved areas
+ such as task bars and system menus. If you want to position a Window at
+ the right of the desktop, you can bind to it like this:
+
+ \qml
+ x: Screen.desktopAvailableWidth - width
+ \endqml
+*/
+/*!
+ \qmlattachedproperty int QtQuick.Window2::Screen::desktopAvailableHeight
+ \readonly
+ \since Qt 5.1
+
+ This contains the available height of the collection of screens which make
+ up the virtual desktop, in pixels, excluding window manager reserved areas
+ such as task bars and system menus. If you want to position a Window at
+ the bottom of the desktop, you can bind to it like this:
+
+ \qml
+ y: Screen.desktopAvailableHeight - height
+ \endqml
+*/
+/*!
+ \qmlattachedproperty real QtQuick.Window2::Screen::logicalPixelDensity
+ \readonly
+ \since Qt 5.1
+
+ The number of logical pixels per millimeter. Logical pixels are the
+ usual units in QML; on some systems they may be different than physical
+ pixels.
+*/
+/*!
\qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::primaryOrientation
\readonly
@@ -147,6 +191,13 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
}
}
+QString QQuickScreenAttached::name() const
+{
+ if (!m_screen)
+ return QString();
+ return m_screen->name();
+}
+
int QQuickScreenAttached::width() const
{
if (!m_screen)
@@ -161,6 +212,27 @@ int QQuickScreenAttached::height() const
return m_screen->size().height();
}
+int QQuickScreenAttached::desktopAvailableWidth() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->availableVirtualSize().width();
+}
+
+int QQuickScreenAttached::desktopAvailableHeight() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->availableVirtualSize().height();
+}
+
+qreal QQuickScreenAttached::logicalPixelDensity() const
+{
+ if (!m_screen)
+ return 0.0;
+ return m_screen->logicalDotsPerInch() / 25.4;
+}
+
Qt::ScreenOrientation QQuickScreenAttached::primaryOrientation() const
{
if (!m_screen)
@@ -209,12 +281,16 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
emit widthChanged();
emit heightChanged();
}
-
+ if (!oldScreen || screen->name() != oldScreen->name())
+ emit nameChanged();
if (!oldScreen || screen->orientation() != oldScreen->orientation())
emit orientationChanged();
if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
emit primaryOrientationChanged();
-
+ if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
+ emit desktopGeometryChanged();
+ if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
+ emit logicalPixelDensityChanged();
connect(screen, SIGNAL(geometryChanged(QRect)),
this, SIGNAL(widthChanged()));
@@ -224,6 +300,10 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
this, SIGNAL(orientationChanged()));
connect(screen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)),
this, SIGNAL(primaryOrientationChanged()));
+ connect(screen, SIGNAL(virtualGeometryChanged(const QRect &)),
+ this, SIGNAL(desktopGeometryChanged()));
+ connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)),
+ this, SIGNAL(logicalPixelDensityChanged()));
}
}
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 98f38b7154..b35fd04e58 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -58,16 +58,24 @@ class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
{
Q_OBJECT
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged REVISION 1);
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
+ Q_PROPERTY(int desktopAvailableWidth READ desktopAvailableWidth NOTIFY desktopGeometryChanged REVISION 1)
+ Q_PROPERTY(int desktopAvailableHeight READ desktopAvailableHeight NOTIFY desktopGeometryChanged REVISION 1)
+ Q_PROPERTY(qreal logicalPixelDensity READ logicalPixelDensity NOTIFY logicalPixelDensityChanged REVISION 1)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
public:
QQuickScreenAttached(QObject* attachee);
+ QString name() const;
int width() const;
int height() const;
+ int desktopAvailableWidth() const;
+ int desktopAvailableHeight() const;
+ qreal logicalPixelDensity() const;
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
@@ -77,8 +85,11 @@ public:
void windowChanged(QQuickWindow*);
Q_SIGNALS:
+ Q_REVISION(1) void nameChanged();
void widthChanged();
void heightChanged();
+ Q_REVISION(1) void desktopGeometryChanged();
+ Q_REVISION(1) void logicalPixelDensityChanged();
void primaryOrientationChanged();
void orientationChanged();
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 102066704b..f39a15070c 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
{
QQuickShaderEffectNode *node = static_cast<QQuickShaderEffectNode *>(oldNode);
- // In the case of a bad vertex shader, don't try to create a node...
- if (m_common.attributes.isEmpty()) {
+ // In the case of zero-size or a bad vertex shader, don't try to create a node...
+ if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) {
if (node)
delete node;
return 0;
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 59b788643a..9debfe35b3 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -468,7 +468,7 @@ QImage QQuickShaderEffectTexture::toImage() const
\since QtQuick 2.0
\inherits Item
\ingroup qtquick-effects
- \brief Renders a QtQuick item into a texture and displays it
+ \brief Renders a \l {Qt Quick} item into a texture and displays it
The ShaderEffectSource type renders \l sourceItem into a texture and
displays it in the scene. \l sourceItem is drawn into the texture as though
@@ -478,7 +478,7 @@ QImage QQuickShaderEffectTexture::toImage() const
ShaderEffectSource can be used as:
\list
\li a texture source in a \l ShaderEffect.
- This allows you to apply custom shader effects to any QtQuick item.
+ This allows you to apply custom shader effects to any \l {Qt Quick} item.
\li a cache for a complex item.
The complex item can be rendered once into the texture, which can
then be animated freely without the need to render the complex item
@@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources()
QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
- if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) {
+ if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) {
if (m_texture)
m_texture->setItem(0);
delete oldNode;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 9a90b408c3..cc2cbb3cb3 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -107,6 +107,7 @@ void QQuickTextPrivate::init()
Q_Q(QQuickText);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QQuickItem::ItemHasContents);
+ q->setAcceptHoverEvents(true);
}
QQuickTextDocumentWithImageResources::QQuickTextDocumentWithImageResources(QQuickItem *parent)
@@ -313,7 +314,8 @@ qreal QQuickTextPrivate::getImplicitHeight() const
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickText::RenderType QQuickText::renderType() const
{
@@ -953,7 +955,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// Create the remainder of the unwrapped lines up to maxLineCount to get the
// implicit width.
- if (line.isValid() && layoutText.at(line.textStart() + line.textLength()) != QChar::LineSeparator)
+ const int eol = line.isValid()
+ ? line.textStart() + line.textLength()
+ : layoutText.length();
+ if (eol < layoutText.length() && layoutText.at(eol) != QChar::LineSeparator)
line = layout.createLine();
for (; line.isValid() && unwrappedLineCount <= maxLineCount; ++unwrappedLineCount)
line = layout.createLine();
@@ -1334,10 +1339,10 @@ QQuickText::~QQuickText()
\snippet qml/text/onLinkActivated.qml 0
The example code will display the text
- "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}."
+ "See the \l{http://qt-project.org}{Qt Project website}."
Clicking on the highlighted link will output
- \tt{http://qt.nokia.com link activated} to the console.
+ \tt{http://qt-project.org link activated} to the console.
*/
/*!
@@ -1988,6 +1993,7 @@ void QQuickText::setTextFormat(TextFormat format)
d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft();
} else {
d->rightToLeftText = d->text.isRightToLeft();
+ d->textHasChanged = true;
}
d->determineHorizontalAlignment();
}
@@ -2150,9 +2156,10 @@ void QQuickText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo
if ((!widthChanged && !heightChanged) || d->internalWidthUpdate)
goto geomChangeDone;
- if (effectiveHAlign() != QQuickText::AlignLeft && widthChanged) {
+ if ((effectiveHAlign() != QQuickText::AlignLeft && widthChanged)
+ || vAlign() != QQuickText::AlignTop && heightChanged) {
// If the width has changed and we're not left aligned do an update so the text is
- // repositioned even if a full layout isn't required.
+ // repositioned even if a full layout isn't required. And the same for vertical.
d->updateType = QQuickTextPrivate::UpdatePaintNode;
update();
}
@@ -2575,4 +2582,83 @@ void QQuickText::mouseReleaseEvent(QMouseEvent *event)
QQuickItem::mouseReleaseEvent(event);
}
+bool QQuickTextPrivate::isLinkHoveredConnected()
+{
+ Q_Q(QQuickText);
+ IS_SIGNAL_CONNECTED(q, QQuickText, linkHovered, (const QString &));
+}
+
+/*!
+ \qmlsignal QtQuick2::Text::onLinkHovered(string link)
+ \since QtQuick 2.2
+
+ This handler is called when the user hovers 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.
+
+ \sa hoveredLink
+*/
+
+/*!
+ \qmlproperty string QtQuick2::Text::hoveredLink
+ \since QtQuick 2.2
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the \a hoveredLink string provides access to the particular link.
+
+ \sa onLinkHovered
+*/
+
+QString QQuickText::hoveredLink() const
+{
+ Q_D(const QQuickText);
+ if (const_cast<QQuickTextPrivate *>(d)->isLinkHoveredConnected()) {
+ if (d->extra.isAllocated())
+ return d->extra->hoveredLink;
+ } else {
+#ifndef QT_NO_CURSOR
+ if (QQuickWindow *wnd = window()) {
+ QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
+ return d->anchorAt(pos);
+ }
+#endif // QT_NO_CURSOR
+ }
+ return QString();
+}
+
+void QQuickTextPrivate::processHoverEvent(QHoverEvent *event)
+{
+ Q_Q(QQuickText);
+ QString link;
+ if (event->type() != QEvent::HoverLeave)
+ link = anchorAt(event->posF());
+
+ if ((!extra.isAllocated() && !link.isEmpty()) || (extra.isAllocated() && extra->hoveredLink != link)) {
+ extra.value().hoveredLink = link;
+ emit q->linkHovered(extra->hoveredLink);
+ }
+}
+
+void QQuickText::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
+void QQuickText::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
+void QQuickText::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickText);
+ if (d->isLinkHoveredConnected())
+ d->processHoverEvent(event);
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 03b436b3fb..f34cf17e5d 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -90,6 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem
Q_PROPERTY(int minimumPointSize READ minimumPointSize WRITE setMinimumPointSize NOTIFY minimumPointSizeChanged)
Q_PROPERTY(FontSizeMode fontSizeMode READ fontSizeMode WRITE setFontSizeMode NOTIFY fontSizeModeChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
+ Q_PROPERTY(QString hoveredLink READ hoveredLink NOTIFY linkHovered REVISION 2)
public:
QQuickText(QQuickItem *parent=0);
@@ -207,9 +208,12 @@ public:
RenderType renderType() const;
void setRenderType(RenderType renderType);
+ QString hoveredLink() const;
+
Q_SIGNALS:
void textChanged(const QString &text);
void linkActivated(const QString &link);
+ Q_REVISION(2) void linkHovered(const QString &link);
void fontChanged(const QFont &font);
void colorChanged();
void linkColorChanged();
@@ -243,6 +247,10 @@ protected:
void updatePolish();
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverMoveEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+
private Q_SLOTS:
void q_imagesLoaded();
void triggerPreprocess();
diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h
index ff6b0f20be..7a31e77ae4 100644
--- a/src/quick/items/qquicktext_p_p.h
+++ b/src/quick/items/qquicktext_p_p.h
@@ -87,6 +87,8 @@ public:
QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const;
void elideFormats(int start, int length, int offset, QList<QTextLayout::FormatRange> *elidedFormats);
+ void processHoverEvent(QHoverEvent *event);
+
QRectF layedOutTextRect;
struct ExtraData {
@@ -95,6 +97,7 @@ public:
qreal lineHeight;
QQuickTextDocumentWithImageResources *doc;
QString activeLink;
+ QString hoveredLink;
int minimumPixelSize;
int minimumPointSize;
int nbActiveDownloads;
@@ -167,6 +170,7 @@ public:
QRectF setupTextLayout(qreal * const baseline);
void setupCustomLineGeometry(QTextLine &line, qreal &height, int lineOffset = 0);
bool isLinkActivatedConnected();
+ bool isLinkHoveredConnected();
static QString anchorAt(const QTextLayout *layout, const QPointF &mousePos);
QString anchorAt(const QPointF &pos) const;
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index 9625aa5d5e..fce5e02b4d 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -298,6 +298,8 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
bool previousUndoRedoState = doc->isUndoRedoEnabled();
doc->setUndoRedoEnabled(false);
+ const int oldCursorPos = cursor.position();
+
// avoid multiple textChanged() signals being emitted
qmlobject_disconnect(doc, QTextDocument, SIGNAL(contentsChanged()), q, QQuickTextControl, SIGNAL(textChanged()));
@@ -341,7 +343,8 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &
doc->setModified(false);
q->updateCursorRectangle(true);
- emit q->cursorPositionChanged();
+ if (cursor.position() != oldCursorPos)
+ emit q->cursorPositionChanged();
}
void QQuickTextControlPrivate::setCursorPosition(const QPointF &pos)
@@ -698,6 +701,9 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
case QEvent::KeyPress:
d->keyPressEvent(static_cast<QKeyEvent *>(e));
break;
+ case QEvent::KeyRelease:
+ d->keyReleaseEvent(static_cast<QKeyEvent *>(e));
+ break;
case QEvent::MouseButtonPress: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mousePressEvent(ev, matrix.map(ev->localPos()));
@@ -714,6 +720,12 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mouseDoubleClickEvent(ev, matrix.map(ev->localPos()));
break; }
+ case QEvent::HoverEnter:
+ case QEvent::HoverMove:
+ case QEvent::HoverLeave: {
+ QHoverEvent *ev = static_cast<QHoverEvent *>(e);
+ d->hoverEvent(ev, matrix.map(ev->posF()));
+ break; }
#ifndef QT_NO_IM
case QEvent::InputMethod:
d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
@@ -809,9 +821,25 @@ void QQuickTextControl::setHtml(const QString &text)
d->setContent(Qt::RichText, text);
}
+
+void QQuickTextControlPrivate::keyReleaseEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Back) {
+ e->ignore();
+ return;
+ }
+ return;
+}
+
void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)
{
Q_Q(QQuickTextControl);
+
+ if (e->key() == Qt::Key_Back) {
+ e->ignore();
+ return;
+ }
+
#ifndef QT_NO_SHORTCUT
if (e == QKeySequence::SelectAll) {
e->accept();
@@ -1381,6 +1409,20 @@ void QQuickTextControlPrivate::focusEvent(QFocusEvent *e)
}
}
+void QQuickTextControlPrivate::hoverEvent(QHoverEvent *e, const QPointF &pos)
+{
+ Q_Q(QQuickTextControl);
+
+ QString link;
+ if (e->type() != QEvent::HoverLeave)
+ link = q->anchorAt(pos);
+
+ if (hoveredLink != link) {
+ hoveredLink = link;
+ emit q->linkHovered(link);
+ }
+}
+
bool QQuickTextControl::hasImState() const
{
Q_D(const QQuickTextControl);
@@ -1416,6 +1458,12 @@ QRectF QQuickTextControl::cursorRect() const
return cursorRect(d->cursor);
}
+QString QQuickTextControl::hoveredLink() const
+{
+ Q_D(const QQuickTextControl);
+ return d->hoveredLink;
+}
+
QString QQuickTextControl::anchorAt(const QPointF &pos) const
{
Q_D(const QQuickTextControl);
diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h
index 7ec8a68b4c..bc5371b0c3 100644
--- a/src/quick/items/qquicktextcontrol_p.h
+++ b/src/quick/items/qquicktextcontrol_p.h
@@ -103,6 +103,7 @@ public:
QRectF selectionRect(const QTextCursor &cursor) const;
QRectF selectionRect() const;
+ QString hoveredLink() const;
QString anchorAt(const QPointF &pos) const;
void setCursorWidth(int width);
@@ -151,6 +152,7 @@ Q_SIGNALS:
void updateRequest();
void cursorRectangleChanged();
void linkActivated(const QString &link);
+ void linkHovered(const QString &link);
public:
virtual void processEvent(QEvent *e, const QMatrix &matrix);
diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h
index fbb88bd255..e0bcbc2191 100644
--- a/src/quick/items/qquicktextcontrol_p_p.h
+++ b/src/quick/items/qquicktextcontrol_p_p.h
@@ -108,6 +108,7 @@ public:
QRectF rectForPosition(int position) const;
void keyPressEvent(QKeyEvent *e);
+ void keyReleaseEvent(QKeyEvent *e);
void mousePressEvent(QMouseEvent *event, const QPointF &pos);
void mouseMoveEvent(QMouseEvent *event, const QPointF &pos);
void mouseReleaseEvent(QMouseEvent *event, const QPointF &pos);
@@ -117,6 +118,7 @@ public:
#ifndef QT_NO_IM
void inputMethodEvent(QInputMethodEvent *);
#endif
+ void hoverEvent(QHoverEvent *e, const QPointF &pos);
void activateLinkUnderCursor(QString href = QString());
@@ -137,6 +139,7 @@ public:
QTextCursor selectedBlockOnTripleClick;
QString anchorOnMousePress;
QString linkToCopy;
+ QString hoveredLink;
QBasicTimer cursorBlinkTimer;
QBasicTimer tripleClickTimer;
diff --git a/src/quick/items/qquicktextdocument.h b/src/quick/items/qquicktextdocument.h
index 25d3bbeaf0..7c22c01d5a 100644
--- a/src/quick/items/qquicktextdocument.h
+++ b/src/quick/items/qquicktextdocument.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
The class has to be used from C++ directly, using the property of the \l TextEdit.
- Warning: The QTextDocument provided is used internally by QtQuick elements to provide text manipulation primitives.
+ Warning: The QTextDocument provided is used internally by \l {Qt Quick} elements to provide text manipulation primitives.
You are not allowed to perform any modification of the internal state of the QTextDocument. If you do, the element
in question may stop functioning or crash.
*/
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index dde3587018..6e2262831d 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -55,6 +55,7 @@
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qtextobject.h>
+#include <QtGui/qtexttable.h>
#include <QtCore/qmath.h>
#include <QtCore/qalgorithms.h>
@@ -271,6 +272,12 @@ QString QQuickTextEdit::text() const
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().
+
+ The text-property is mostly suitable for setting the initial content and
+ handling modifications to relatively small text content. The append(),
+ insert() and remove() methods provide more fine-grained control and
+ remarkably better performance for modifying especially large rich text
+ content.
*/
void QQuickTextEdit::setText(const QString &text)
{
@@ -380,7 +387,8 @@ void QQuickTextEdit::setTextFormat(TextFormat format)
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickTextEdit::RenderType QQuickTextEdit::renderType() const
{
@@ -1709,6 +1717,13 @@ static bool comesBefore(TextNode* n1, TextNode* n2)
return n1->startPos() < n2->startPos();
}
+static inline void updateNodeTransform(QQuickTextNode* node, const QPointF &topLeft)
+{
+ QMatrix4x4 transformMatrix;
+ transformMatrix.translate(topLeft.x(), topLeft.y());
+ node->setMatrix(transformMatrix);
+}
+
QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
Q_UNUSED(updatePaintNodeData);
@@ -1749,17 +1764,12 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
rootNode->removeChildNode(d->frameDecorationsNode);
delete d->frameDecorationsNode;
}
- d->frameDecorationsNode = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- d->frameDecorationsNode->initEngine(QColor(), QColor(), QColor());
-
-
- QQuickTextNode *node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- node->setUseNativeRenderer(d->renderType == NativeRendering && d->window->devicePixelRatio() <= 1);
- node->initEngine(d->color, d->selectedTextColor, d->selectionColor);
+ d->frameDecorationsNode = d->createTextNode();
+ QQuickTextNode *node = 0;
- int sizeCounter = 0;
- int prevBlockStart = firstDirtyPos;
+ int currentNodeSize = 0;
+ int nodeStart = firstDirtyPos;
QPointF basePosition(d->xoff, d->yoff);
QPointF nodeOffset;
TextNode *firstCleanNode = (nodeIterator != d->textNodeMap.end()) ? *nodeIterator : 0;
@@ -1772,16 +1782,14 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
frames.append(textFrame->childFrames());
d->frameDecorationsNode->m_engine->addFrameDecorations(d->document, textFrame);
+
+ if (textFrame->lastPosition() < firstDirtyPos || (firstCleanNode && textFrame->firstPosition() >= firstCleanNode->startPos()))
+ continue;
+ node = d->createTextNode();
+
if (textFrame->firstPosition() > textFrame->lastPosition()
&& textFrame->frameFormat().position() != QTextFrameFormat::InFlow) {
- QRectF rect = d->document->documentLayout()->frameBoundingRect(textFrame);
-
- if (!node->m_engine->hasContents()) {
- nodeOffset = rect.topLeft();
- QMatrix4x4 transformMatrix;
- transformMatrix.translate(nodeOffset.x(), nodeOffset.y());
- node->setMatrix(transformMatrix);
- }
+ updateNodeTransform(node, d->document->documentLayout()->frameBoundingRect(textFrame).topLeft());
const int pos = textFrame->firstPosition() - 1;
ProtectedLayoutAccessor *a = static_cast<ProtectedLayoutAccessor *>(d->document->documentLayout());
QTextCharFormat format = a->formatAccessor(pos);
@@ -1789,10 +1797,23 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
node->m_engine->setCurrentLine(block.layout()->lineForTextPosition(pos - block.position()));
node->m_engine->addTextObject(QPointF(0, 0), format, QQuickTextNodeEngine::Unselected, d->document,
pos, textFrame->frameFormat().position());
+ nodeStart = pos;
+ } else if (qobject_cast<QTextTable*>(textFrame)) { // To keep things simple, map text tables as one text node
+ QTextFrame::iterator it = textFrame->begin();
+ nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft();
+ updateNodeTransform(node, nodeOffset);
+ while (!it.atEnd())
+ node->m_engine->addTextBlock(d->document, (it++).currentBlock(), basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ nodeStart = textFrame->firstPosition();
} else {
+ // Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that.
+ QList<int> frameBoundaries;
+ frameBoundaries.reserve(frames.size());
+ Q_FOREACH (QTextFrame *frame, frames)
+ frameBoundaries.append(frame->firstPosition());
+ std::sort(frameBoundaries.begin(), frameBoundaries.end());
QTextFrame::iterator it = textFrame->begin();
-
while (!it.atEnd()) {
QTextBlock block = it.currentBlock();
++it;
@@ -1801,35 +1822,27 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
if (!node->m_engine->hasContents()) {
nodeOffset = d->document->documentLayout()->blockBoundingRect(block).topLeft();
- QMatrix4x4 transformMatrix;
- transformMatrix.translate(nodeOffset.x(), nodeOffset.y());
- node->setMatrix(transformMatrix);
+ updateNodeTransform(node, nodeOffset);
+ nodeStart = block.position();
}
node->m_engine->addTextBlock(d->document, block, basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
- sizeCounter += block.length();
+ currentNodeSize += block.length();
- if ((it.atEnd() && frames.isEmpty()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the last frame
+ if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame
break;
- if (sizeCounter > nodeBreakingSize) {
- sizeCounter = 0;
- node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
- nodeIterator = d->textNodeMap.insert(nodeIterator, new TextNode(prevBlockStart, node));
- ++nodeIterator;
- rootNode->appendChildNode(node);
- prevBlockStart = block.next().position();
- node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- node->setUseNativeRenderer(d->renderType == NativeRendering && d->window->devicePixelRatio() <= 1);
- node->initEngine(d->color, d->selectedTextColor, d->selectionColor);
+ QList<int>::const_iterator lowerBound = qLowerBound(frameBoundaries, block.next().position());
+ if (currentNodeSize > nodeBreakingSize || *lowerBound > nodeStart) {
+ currentNodeSize = 0;
+ d->addCurrentTextNodeToRoot(rootNode, node, nodeIterator, nodeStart);
+ node = d->createTextNode();
+ nodeStart = block.next().position();
}
}
}
+ d->addCurrentTextNodeToRoot(rootNode, node, nodeIterator, nodeStart);
}
- node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
- nodeIterator = d->textNodeMap.insert(nodeIterator, new TextNode(prevBlockStart, node));
- ++nodeIterator;
- rootNode->appendChildNode(node);
d->frameDecorationsNode->m_engine->addToSceneGraph(d->frameDecorationsNode, QQuickText::Normal, QColor());
// Now prepend the frame decorations since we want them rendered first, with the text nodes and cursor in front.
rootNode->prependChildNode(d->frameDecorationsNode);
@@ -1848,6 +1861,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
}
}
+
+ // Since we iterate over blocks from different text frames that are potentially not sorted
+ // we need to ensure that our list of nodes is sorted again:
+ std::sort(d->textNodeMap.begin(), d->textNodeMap.end(), &comesBefore);
}
if (d->cursorComponent == 0 && !isReadOnly()) {
@@ -1942,6 +1959,8 @@ void QQuickTextEditPrivate::init()
#endif
q->setFlag(QQuickItem::ItemHasContents);
+ q->setAcceptHoverEvents(true);
+
document = new QQuickTextDocumentWithImageResources(q);
control = new QQuickTextControl(document, q);
@@ -1956,6 +1975,7 @@ void QQuickTextEditPrivate::init()
qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorPositionChanged()), q, QQuickTextEdit, SIGNAL(cursorPositionChanged()));
qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorRectangleChanged()), q, QQuickTextEdit, SLOT(moveCursorDelegate()));
qmlobject_connect(control, QQuickTextControl, SIGNAL(linkActivated(QString)), q, QQuickTextEdit, SIGNAL(linkActivated(QString)));
+ qmlobject_connect(control, QQuickTextControl, SIGNAL(linkHovered(QString)), q, QQuickTextEdit, SIGNAL(linkHovered(QString)));
qmlobject_connect(control, QQuickTextControl, SIGNAL(textChanged()), q, QQuickTextEdit, SLOT(q_textChanged()));
#ifndef QT_NO_CLIPBOARD
qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()), q, QQuickTextEdit, SLOT(q_canPasteChanged()));
@@ -1994,11 +2014,16 @@ void QQuickTextEdit::markDirtyNodesForRange(int start, int end, int charDelta)
Q_D(QQuickTextEdit);
if (start == end)
return;
+
TextNode dummyNode(start, 0);
TextNodeIterator it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &dummyNode, &comesBefore);
- // qLowerBound gives us the first node past the start of the affected portion, rewind by one if we can.
- if (it != d->textNodeMap.begin())
+ // qLowerBound gives us the first node past the start of the affected portion, rewind to the first node
+ // that starts at the last position before the edit position. (there might be several because of images)
+ if (it != d->textNodeMap.begin()) {
--it;
+ TextNode otherDummy((*it)->startPos(), 0);
+ it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &otherDummy, &comesBefore);
+ }
// mark the affected nodes as dirty
while (it != d->textNodeMap.constEnd()) {
@@ -2148,8 +2173,10 @@ void QQuickTextEdit::updateSize()
if (d->inLayout) // probably the result of a binding loop, but by letting it
return; // get this far we'll get a warning to that effect.
}
- if (d->document->textWidth() != width())
+ if (d->document->textWidth() != width()) {
d->document->setTextWidth(width());
+ newWidth = d->document->idealWidth();
+ }
//### need to confirm cost of always setting these
} else if (d->wrapMode == NoWrap && d->document->textWidth() != newWidth) {
d->document->setTextWidth(newWidth); // ### Text does not align if width is not set or the idealWidth exceeds the textWidth (QTextDoc bug)
@@ -2305,6 +2332,23 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event)
}
}
+void QQuickTextEditPrivate::addCurrentTextNodeToRoot(QSGTransformNode *root, QQuickTextNode *node, TextNodeIterator &it, int startPos)
+{
+ node->m_engine->addToSceneGraph(node, QQuickText::Normal, QColor());
+ it = textNodeMap.insert(it, new TextNode(startPos, node));
+ ++it;
+ root->appendChildNode(node);
+}
+
+QQuickTextNode *QQuickTextEditPrivate::createTextNode()
+{
+ Q_Q(QQuickTextEdit);
+ QQuickTextNode* node = new QQuickTextNode(QQuickItemPrivate::get(q)->sceneGraphContext(), q);
+ node->setUseNativeRenderer(renderType == QQuickTextEdit::NativeRendering && window->devicePixelRatio() <= 1);
+ node->initEngine(color, selectedTextColor, selectionColor);
+ return node;
+}
+
void QQuickTextEdit::q_canPasteChanged()
{
Q_D(QQuickTextEdit);
@@ -2433,4 +2477,102 @@ QQuickTextDocument *QQuickTextEdit::textDocument()
return d->quickDocument;
}
+bool QQuickTextEditPrivate::isLinkHoveredConnected()
+{
+ Q_Q(QQuickTextEdit);
+ IS_SIGNAL_CONNECTED(q, QQuickTextEdit, linkHovered, (const QString &));
+}
+
+/*!
+ \qmlsignal QtQuick2::TextEdit::onLinkHovered(string link)
+ \since QtQuick 2.2
+
+ This handler is called when the user hovers 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.
+
+ \sa hoveredLink
+*/
+
+/*!
+ \qmlproperty string QtQuick2::TextEdit::hoveredLink
+ \since QtQuick 2.2
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the link string provides access to the particular link.
+
+ \sa onLinkHovered
+*/
+
+QString QQuickTextEdit::hoveredLink() const
+{
+ Q_D(const QQuickTextEdit);
+ if (const_cast<QQuickTextEditPrivate *>(d)->isLinkHoveredConnected()) {
+ return d->control->hoveredLink();
+ } else {
+#ifndef QT_NO_CURSOR
+ if (QQuickWindow *wnd = window()) {
+ QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0));
+ return d->control->anchorAt(pos);
+ }
+#endif // QT_NO_CURSOR
+ }
+ return QString();
+}
+
+void QQuickTextEdit::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+void QQuickTextEdit::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+void QQuickTextEdit::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextEdit);
+ if (d->isLinkHoveredConnected())
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+}
+
+/*!
+ \qmlmethod void QtQuick2::TextEdit::append(string text)
+ \since QtQuick 2.2
+
+ Appends a new paragraph with \a text to the end of the TextEdit.
+
+ In order to append without inserting a new paragraph,
+ call \c myTextEdit.insert(myTextEdit.length, text) instead.
+*/
+void QQuickTextEdit::append(const QString &text)
+{
+ Q_D(QQuickTextEdit);
+ QTextCursor cursor(d->document);
+ cursor.beginEditBlock();
+ cursor.movePosition(QTextCursor::End);
+
+ if (!d->document->isEmpty())
+ cursor.insertBlock();
+
+#ifndef QT_NO_TEXTHTMLPARSER
+ if (d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text))) {
+ cursor.insertHtml(text);
+ } else {
+ cursor.insertText(text);
+ }
+#else
+ cursor.insertText(text);
+#endif // QT_NO_TEXTHTMLPARSER
+
+ cursor.endEditBlock();
+ d->control->updateCursorRectangle(false);
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h
index 4e09eafcac..69ffad7e70 100644
--- a/src/quick/items/qquicktextedit_p.h
+++ b/src/quick/items/qquicktextedit_p.h
@@ -102,6 +102,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem
Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl RESET resetBaseUrl NOTIFY baseUrlChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
Q_PROPERTY(QQuickTextDocument *textDocument READ textDocument FINAL REVISION 1)
+ Q_PROPERTY(QString hoveredLink READ hoveredLink NOTIFY linkHovered REVISION 2)
public:
QQuickTextEdit(QQuickItem *parent=0);
@@ -255,6 +256,8 @@ public:
QQuickTextDocument *textDocument();
+ QString hoveredLink() const;
+
Q_SIGNALS:
void textChanged();
void contentSizeChanged();
@@ -282,6 +285,7 @@ Q_SIGNALS:
void selectByMouseChanged(bool selectByMouse);
void mouseSelectionModeChanged(SelectionMode mode);
void linkActivated(const QString &link);
+ Q_REVISION(2) void linkHovered(const QString &link);
void canPasteChanged();
void canUndoChanged();
void canRedoChanged();
@@ -310,6 +314,7 @@ public Q_SLOTS:
void redo();
void insert(int position, const QString &text);
void remove(int start, int end);
+ Q_REVISION(2) void append(const QString &text);
private Q_SLOTS:
void q_textChanged();
@@ -338,6 +343,10 @@ protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
+ void hoverEnterEvent(QHoverEvent *event);
+ void hoverMoveEvent(QHoverEvent *event);
+ void hoverLeaveEvent(QHoverEvent *event);
+
// mouse filter?
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index feb7e98873..ec3cf1cec5 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -87,6 +87,7 @@ public:
QQuickTextNode* m_node;
bool m_dirty;
};
+ typedef QList<Node*>::iterator TextNodeIterator;
QQuickTextEditPrivate()
@@ -123,9 +124,12 @@ public:
void mirrorChange();
qreal getImplicitWidth() const;
Qt::LayoutDirection textDirection(const QString &text) const;
+ bool isLinkHoveredConnected();
void setNativeCursorEnabled(bool enabled) { control->setCursorWidth(enabled ? 1 : 0); }
void handleFocusEvent(QFocusEvent *event);
+ void addCurrentTextNodeToRoot(QSGTransformNode *, QQuickTextNode*, TextNodeIterator&, int startPos);
+ QQuickTextNode* createTextNode();
#ifndef QT_NO_IM
Qt::InputMethodHints effectiveInputMethodHints() const;
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 989c0db3ab..2bd3a3da37 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -155,7 +155,8 @@ void QQuickTextInput::setText(const QString &s)
combination with the NativeRendering render type will lend poor and sometimes pixelated
results.
- On HighDpi "retina" displays this property is ignored and QtRendering is always used.
+ On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
+ and QtRendering is always used.
*/
QQuickTextInput::RenderType QQuickTextInput::renderType() const
{
@@ -778,7 +779,10 @@ QRectF QQuickTextInput::cursorRectangle() const
QTextLine l = d->m_textLayout.lineForTextPosition(c);
if (!l.isValid())
return QRectF();
- return QRectF(l.cursorToX(c) - d->hscroll, l.y() - d->vscroll, 1, l.height());
+ qreal x = l.cursorToX(c) - d->hscroll;
+ qreal y = l.y() - d->vscroll;
+ qreal height = l.ascent() + l.descent();
+ return QRectF(x, y, 1, height);
}
/*!
@@ -1227,10 +1231,11 @@ Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
Specifies how the text should be displayed in the TextInput.
\list
\li TextInput.Normal - Displays the text as it is. (Default)
- \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.Password - Displays platform-dependent password mask
+ characters instead of the actual characters.
\li TextInput.NoEcho - Displays nothing.
\li TextInput.PasswordEchoOnEdit - Displays characters as they are entered
- while editing, otherwise displays asterisks.
+ while editing, otherwise identical to \c TextInput.Password.
\endlist
*/
QQuickTextInput::EchoMode QQuickTextInput::echoMode() const
@@ -1372,9 +1377,12 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
pos += d->preeditAreaText().length();
#endif
QTextLine l = d->m_textLayout.lineForTextPosition(pos);
- return l.isValid()
- ? QRectF(l.cursorToX(pos) - d->hscroll, l.y() - d->vscroll, 1, l.height())
- : QRectF();
+ if (!l.isValid())
+ return QRectF();
+ qreal x = l.cursorToX(pos) - d->hscroll;
+ qreal y = l.y() - d->vscroll;
+ qreal height = l.ascent() + l.descent();
+ return QRectF(x, y, 1, height);
}
/*!
@@ -1465,7 +1473,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev)
int cursorPosition = d->m_cursor;
if (cursorPosition == 0)
ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right);
- if (!ignore && cursorPosition == text().length())
+ if (!ignore && cursorPosition == d->m_text.length())
ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left);
}
if (ignore) {
@@ -2194,7 +2202,8 @@ void QQuickTextInput::selectWord()
\qmlproperty string QtQuick2::TextInput::passwordCharacter
This is the character displayed when echoMode is set to Password or
- PasswordEchoOnEdit. By default it is an asterisk.
+ PasswordEchoOnEdit. By default it is the password character used by
+ the platform theme.
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
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 57eff175a2..11096cfa1d 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -110,7 +110,7 @@ public:
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)
- , m_passwordCharacter(QLatin1Char('*'))
+ , m_passwordCharacter(qApp->styleHints()->passwordMaskCharacter())
, focusOnPress(true)
, cursorVisible(false)
, cursorPending(false)
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 4952a37082..d8040a1110 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -176,7 +176,7 @@ void QQuickTextNode::setCursor(const QRectF &rect, const QColor &color)
appendChildNode(m_cursorNode);
}
-void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedTextColor, const QColor& selectionColor, const QColor& anchorColor)
+void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedTextColor, const QColor& selectionColor, const QColor& anchorColor, const QPointF &position)
{
m_engine.reset(new QQuickTextNodeEngine);
m_engine->m_hasContents = false;
@@ -184,6 +184,7 @@ void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedT
m_engine->setSelectedTextColor(selectedTextColor);
m_engine->setSelectionColor(selectionColor);
m_engine->setAnchorColor(anchorColor);
+ m_engine->setPosition(position);
}
void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
@@ -249,8 +250,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay
int selectionStart, int selectionEnd,
int lineStart, int lineCount)
{
- Q_UNUSED(position);
- initEngine(color, selectedTextColor, selectionColor, anchorColor);
+ initEngine(color, selectedTextColor, selectionColor, anchorColor, position);
#ifndef QT_NO_IM
int preeditLength = textLayout->preeditAreaText().length();
diff --git a/src/quick/items/qquicktextnode_p.h b/src/quick/items/qquicktextnode_p.h
index 16da3ce685..f5de6cc9b6 100644
--- a/src/quick/items/qquicktextnode_p.h
+++ b/src/quick/items/qquicktextnode_p.h
@@ -107,8 +107,8 @@ public:
void setUseNativeRenderer(bool on) { m_useNativeRenderer = on; }
private:
- void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor());
-
+ void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor()
+ , const QPointF &position = QPointF());
QSGContext *m_context;
QSGSimpleRectNode *m_cursorNode;
@@ -118,6 +118,7 @@ private:
QScopedPointer<QQuickTextNodeEngine> m_engine;
friend class QQuickTextEdit;
+ friend class QQuickTextEditPrivate;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 65343cdc52..cc32c40aa3 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -494,7 +494,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
<< "loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur." << endl
<< endl
<< "To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the" << endl
- << "QDeclarativeView class in the qtquick1 module." << endl;
+ << "QDeclarativeView class in the Qt Quick 1 module." << endl;
delete obj;
root = 0;
}
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 4789314e01..619c72afb8 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -72,6 +72,10 @@
QT_BEGIN_NAMESPACE
+extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+
+bool QQuickWindowPrivate::defaultAlphaBuffer(0);
+
void QQuickWindowPrivate::updateFocusItemTransform()
{
Q_Q(QQuickWindow);
@@ -85,44 +89,49 @@ void QQuickWindowPrivate::updateFocusItemTransform()
#endif
}
-
class QQuickWindowIncubationController : public QObject, public QQmlIncubationController
{
Q_OBJECT
public:
- QQuickWindowIncubationController(const QQuickWindow *window)
- : m_window(QQuickWindowPrivate::get(const_cast<QQuickWindow *>(window)))
+ QQuickWindowIncubationController(QSGRenderLoop *loop)
+ : m_renderLoop(loop), m_timer(0)
{
// Allow incubation for 1/3 of a frame.
m_incubation_time = qMax(1, int(1000 / QGuiApplication::primaryScreen()->refreshRate()) / 3);
- m_animation_driver = m_window->windowManager->animationDriver();
+ m_animation_driver = m_renderLoop->animationDriver();
if (m_animation_driver) {
connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped()));
- connect(window, SIGNAL(frameSwapped()), this, SLOT(incubate()));
+ connect(m_renderLoop, SIGNAL(timeToIncubate()), this, SLOT(incubate()));
}
}
protected:
- virtual bool event(QEvent *e)
+ void timerEvent(QTimerEvent *)
{
- if (e->type() == QEvent::User) {
- incubate();
- return true;
+ killTimer(m_timer);
+ m_timer = 0;
+ incubate();
+ }
+
+ void incubateAgain() {
+ if (m_timer == 0) {
+ // Wait for a while before processing the next batch. Using a
+ // timer to avoid starvation of system events.
+ m_timer = startTimer(m_incubation_time);
}
- return QObject::event(e);
}
public slots:
void incubate() {
if (incubatingObjectCount()) {
- if (m_animation_driver && m_animation_driver->isRunning()) {
+ if (m_renderLoop->interleaveIncubation()) {
incubateFor(m_incubation_time);
} else {
incubateFor(m_incubation_time * 2);
if (incubatingObjectCount())
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+ incubateAgain();
}
}
}
@@ -132,14 +141,15 @@ public slots:
protected:
virtual void incubatingObjectCountChanged(int count)
{
- if (count && (!m_animation_driver || !m_animation_driver->isRunning()))
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+ if (count && !m_renderLoop->interleaveIncubation())
+ incubateAgain();
}
private:
- QQuickWindowPrivate *m_window;
+ QSGRenderLoop *m_renderLoop;
int m_incubation_time;
QAnimationDriver *m_animation_driver;
+ int m_timer;
};
#include "qquickwindow.moc"
@@ -149,8 +159,6 @@ private:
/*!
Returns an accessibility interface for this window, or 0 if such an
interface cannot be created.
-
- \warning The caller is responsible for deleting the returned interface.
*/
QAccessibleInterface *QQuickWindow::accessibleRoot() const
{
@@ -258,29 +266,6 @@ void QQuickWindowPrivate::polishItems()
updateFocusItemTransform();
}
-/**
- * This parameter enables that this window can be rendered without
- * being shown on screen. This feature is very limited in what it supports.
- *
- * For this feature to be useful one needs to hook into beforeRender()
- * and set the render target.
- *
- */
-void QQuickWindowPrivate::setRenderWithoutShowing(bool render)
-{
- if (render == renderWithoutShowing)
- return;
-
- Q_Q(QQuickWindow);
- renderWithoutShowing = render;
-
- if (render)
- windowManager->show(q);
- else
- windowManager->hide(q);
-}
-
-
/*!
* Schedules the window to render another frame.
*
@@ -361,7 +346,6 @@ QQuickWindowPrivate::QQuickWindowPrivate()
#endif
, touchMouseId(-1)
, touchMousePressTimestamp(0)
- , renderWithoutShowing(false)
, dirtyItemList(0)
, context(0)
, renderer(0)
@@ -371,6 +355,7 @@ QQuickWindowPrivate::QQuickWindowPrivate()
, persistentGLContext(true)
, persistentSceneGraph(true)
, lastWheelEventAccepted(false)
+ , componentCompleted(true)
, renderTarget(0)
, renderTargetId(0)
, incubationController(0)
@@ -414,7 +399,10 @@ void QQuickWindowPrivate::init(QQuickWindow *c)
QQmlListProperty<QObject> QQuickWindowPrivate::data()
{
initContentItem();
- return QQuickItemPrivate::get(contentItem)->data();
+ return QQmlListProperty<QObject>(q_func(), 0, QQuickWindowPrivate::data_append,
+ QQuickWindowPrivate::data_count,
+ QQuickWindowPrivate::data_at,
+ QQuickWindowPrivate::data_clear);
}
void QQuickWindowPrivate::initContentItem()
@@ -432,7 +420,7 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc
{
// The touch point local position and velocity are not yet transformed.
QMouseEvent *me = new QMouseEvent(type, transformNeeded ? item->mapFromScene(p.scenePos()) : p.pos(), p.scenePos(), p.screenPos(),
- Qt::LeftButton, Qt::LeftButton, event->modifiers());
+ Qt::LeftButton, (type == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton), event->modifiers());
me->setAccepted(true);
me->setTimestamp(event->timestamp());
QVector2D transformedVelocity = p.velocity();
@@ -838,15 +826,34 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
\ingroup qtquick-visual
\brief Creates a new top-level window
- The Window object creates a new top-level window for a QtQuick scene. It automatically sets up the
- window for use with QtQuick 2.x graphical types.
+ The Window object creates a new top-level window for a Qt Quick scene. It automatically sets up the
+ window for use with \c {QtQuick 2.x} graphical types.
To use this type, you will need to import the module with the following line:
\code
import QtQuick.Window 2.1
\endcode
- Restricting this import will allow you to have a QML environment without access to window system features.
+ Omitting this import will allow you to have a QML environment without
+ access to window system features.
+
+ A Window can be declared inside an Item or inside another Window; in that
+ case the inner Window will automatically become "transient for" the outer
+ Window: that is, most platforms will show it centered upon the outer window
+ by default, and there may be other platform-dependent behaviors, depending
+ also on the \l flags. If the nested window is intended to be a dialog in
+ your application, you should also set \l flags to Qt.Dialog, because some
+ window managers will not provide the centering behavior without that flag.
+ You can also declare multiple windows inside a top-level \l QtObject, in which
+ case the windows will have no transient relationship.
+
+ Alternatively you can set or bind \l x and \l y to position the Window
+ explicitly on the screen.
+
+ When the user attempts to close a window, the \a closing signal will be
+ emitted. You can force the window to stay open (for example to prompt the
+ user to save changes) by writing an onClosing handler and setting
+ close.accepted = false.
*/
/*!
\class QQuickWindow
@@ -1094,7 +1101,10 @@ QQuickItem *QQuickWindow::contentItem() const
}
/*!
- Returns the item which currently has active focus.
+ \property QQuickWindow::activeFocusItem
+
+ \brief The item which currently has active focus or \c null if there is
+ no item with active focus.
*/
QQuickItem *QQuickWindow::activeFocusItem() const
{
@@ -1178,6 +1188,14 @@ bool QQuickWindow::event(QEvent *e)
case QEvent::WindowDeactivate:
contentItem()->windowDeactivateEvent();
break;
+ case QEvent::Close: {
+ // TOOD Qt 6 (binary incompatible)
+ // closeEvent(static_cast<QCloseEvent *>(e));
+ QQuickCloseEvent qev;
+ qev.setAccepted(e->isAccepted());
+ emit closing(&qev);
+ e->setAccepted(qev.isAccepted());
+ } break;
case QEvent::FocusAboutToChange:
#ifndef QT_NO_IM
if (d->activeFocusItem)
@@ -2037,16 +2055,68 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
return overThreshold;
}
+/*!
+ \qmlproperty list<Object> QtQuick.Window2::Window::data
+ \default
+
+ The data property allows you to freely mix visual children, resources
+ and other Windows in a Window.
+
+ If you assign another Window to the data list, the nested window will
+ become "transient for" the outer Window.
+
+ If you assign an \l Item to the data list, it becomes a child of the
+ Window's \l contentItem, so that it appears inside the window. The item's
+ parent will be the window's contentItem, which is the root of the Item
+ ownership tree within that Window.
+
+ If you assign any other object type, it is added as a resource.
+
+ It should not generally be necessary to refer to the \c data property,
+ as it is the default property for Window and thus all child items are
+ automatically assigned to this property.
+
+ \sa QWindow::transientParent()
+ */
+
+void QQuickWindowPrivate::data_append(QQmlListProperty<QObject> *property, QObject *o)
+{
+ if (!o)
+ return;
+ QQuickWindow *that = static_cast<QQuickWindow *>(property->object);
+ if (QQuickWindow *window = qmlobject_cast<QQuickWindow *>(o))
+ window->setTransientParent(that);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(that->contentItem())->data();
+ itemProperty.append(&itemProperty, o);
+}
+
+int QQuickWindowPrivate::data_count(QQmlListProperty<QObject> *property)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ if (!win || !win->contentItem() || !QQuickItemPrivate::get(win->contentItem())->data().count)
+ return 0;
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ return itemProperty.count(&itemProperty);
+}
+
+QObject *QQuickWindowPrivate::data_at(QQmlListProperty<QObject> *property, int i)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ return itemProperty.at(&itemProperty, i);
+}
+
+void QQuickWindowPrivate::data_clear(QQmlListProperty<QObject> *property)
+{
+ QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
+ QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
+ itemProperty.clear(&itemProperty);
+}
+
bool QQuickWindowPrivate::isRenderable() const
{
- const QQuickWindow *q = q_func();
- QRect geom = q->geometry();
- if (geom.width() <= 0 || geom.height() <= 0)
- return false;
- // Change to be applied after the visibility property is integrated in qtbase:
-// return visibility != QWindow::Hidden || (renderWithoutShowing && platformWindow);
- // Temporary version which is implementation-agnostic but slightly less efficient:
- return q->isVisible() || (renderWithoutShowing && platformWindow);
+ Q_Q(const QQuickWindow);
+ return q->isExposed() && q->isVisible() && q->geometry().isValid();
}
/*!
@@ -2456,6 +2526,13 @@ void QQuickWindow::cleanupSceneGraph()
d->renderer = 0;
}
+void QQuickWindow::setTransientParent_helper(QQuickWindow *window)
+{
+ setTransientParent(window);
+ disconnect(sender(), SIGNAL(windowChanged(QQuickWindow*)),
+ this, SLOT(setTransientParent_helper(QQuickWindow*)));
+}
+
/*!
Returns the opengl context used for rendering.
@@ -2503,6 +2580,57 @@ QOpenGLContext *QQuickWindow::openglContext() const
This signal will be emitted from the scene graph rendering thread.
*/
+/*!
+ \class QQuickCloseEvent
+ \internal
+ \since QtQuick 2.1
+
+ \inmodule QtQuick.Window
+
+ \brief Notification that a \l QQuickWindow is about to be closed
+*/
+/*!
+ \qmltype CloseEvent
+ \instantiates QQuickCloseEvent
+ \inqmlmodule QtQuick.Window 2
+ \ingroup qtquick-visual
+ \brief Notification that a \l Window is about to be closed
+ \since Qt 5.1
+
+ Notification that a window is about to be closed by the windowing system
+ (e.g. the user clicked the titlebar close button). The CloseEvent contains
+ an accepted property which can be set to false to abort closing the window.
+
+ \sa Window.closing()
+*/
+
+/*!
+ \qmlproperty bool QtQuick.Window2::CloseEvent::accepted
+
+ This property indicates whether the application will allow the user to
+ close the window. It is true by default.
+*/
+
+/*!
+ \fn void QQuickWindow::closing()
+ \since QtQuick 2.1
+
+ This signal is emitted when the window receives a QCloseEvent from the
+ windowing system.
+*/
+
+/*!
+ \qmlsignal QtQuick.Window2::closing(CloseEvent close)
+ \since Qt 5.1
+
+ This signal is emitted when the user tries to close the window.
+
+ This signal includes a closeEvent parameter. The \a close \l accepted
+ property is true by default so that the window is allowed to close; but you
+ can implement an onClosing() handler and set close.accepted = false if
+ you need to do something else before the window can be closed.
+ */
+
/*!
Sets the render target for this window to be \a fbo.
@@ -2600,7 +2728,10 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
/*!
Grabs the contents of the window and returns it as an image.
- This function might not work if the window is not visible.
+ It is possible to call the grabWindow() function when the window is not
+ visible. This requires that the window is \l{QWindow::create} {created}
+ and has a valid size and that no other QQuickWindow instances are rendering
+ in the same process.
\warning Calling this function will cause performance problems.
@@ -2609,6 +2740,36 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
QImage QQuickWindow::grabWindow()
{
Q_D(QQuickWindow);
+ if (!isVisible()) {
+
+ if (d->context->isReady()) {
+ qWarning("QQuickWindow::grabWindow: scene graph already in use");
+ return QImage();
+ }
+
+ if (!handle() || !size().isValid()) {
+ qWarning("QQuickWindow::grabWindow: window must be created and have a valid size");
+ return QImage();
+ }
+
+ QOpenGLContext context;
+ context.setFormat(requestedFormat());
+ context.create();
+ context.makeCurrent(this);
+ d->context->initialize(&context);
+
+ d->polishItems();
+ d->syncSceneGraph();
+ d->renderSceneGraph(size());
+
+ QImage image = qt_gl_read_framebuffer(size(), false, false);
+ d->cleanupNodesOnShutdown();
+ d->context->invalidate();
+ context.doneCurrent();
+
+ return image;
+ }
+
return d->windowManager->grab(this);
}
@@ -2625,7 +2786,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const
Q_D(const QQuickWindow);
if (!d->incubationController)
- d->incubationController = new QQuickWindowIncubationController(this);
+ d->incubationController = new QQuickWindowIncubationController(d->windowManager);
return d->incubationController;
}
@@ -2817,7 +2978,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
Setting the clear color has no effect when clearing is disabled.
By default, the clear color is white.
- \sa setClearBeforeRendering()
+ \sa setClearBeforeRendering(), setDefaultAlphaBuffer()
*/
void QQuickWindow::setColor(const QColor &color)
@@ -2827,7 +2988,7 @@ void QQuickWindow::setColor(const QColor &color)
return;
if (color.alpha() != d->clearColor.alpha()) {
- QSurfaceFormat fmt = format();
+ QSurfaceFormat fmt = requestedFormat();
if (color.alpha() < 255)
fmt.setAlphaBufferSize(8);
else
@@ -2845,6 +3006,31 @@ QColor QQuickWindow::color() const
}
/*!
+ \brief Returns whether to use alpha transparency on newly created windows.
+
+ \since Qt 5.1
+ \sa setDefaultAlphaBuffer()
+ */
+bool QQuickWindow::hasDefaultAlphaBuffer()
+{
+ return QQuickWindowPrivate::defaultAlphaBuffer;
+}
+
+/*!
+ \brief \a useAlpha specifies whether to use alpha transparency on newly created windows.
+ \since Qt 5.1
+
+ In any application which expects to create translucent windows, it's
+ necessary to set this to true before creating the first QQuickWindow,
+ because all windows will share the same \l QOpenGLContext. The default
+ value is false.
+ */
+void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha)
+{
+ QQuickWindowPrivate::defaultAlphaBuffer = useAlpha;
+}
+
+/*!
\qmlproperty string QtQuick.Window2::Window::title
The window's title in the windowing system.
@@ -2994,6 +3180,22 @@ QColor QQuickWindow::color() const
no item with active focus.
*/
+/*!
+ \qmlproperty QtQuick.Window2::Window::active
+ \since Qt 5.1
+
+ The active status of the window.
+
+ \sa requestActivate()
+ */
+
+/*!
+ \qmlmethod QtQuick2::Window::requestActivate()
+ \since QtQuick 2.1
+
+ Requests the window to be activated, i.e. receive keyboard focus.
+ */
+
#include "moc_qquickwindow.cpp"
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index a2ba9e9fe0..a0bc832334 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -57,6 +57,7 @@ class QQuickWindowPrivate;
class QOpenGLFramebufferObject;
class QQmlIncubationController;
class QInputMethodEvent;
+class QQuickCloseEvent;
class Q_QUICK_EXPORT QQuickWindow : public QWindow
{
@@ -114,6 +115,9 @@ public:
void setColor(const QColor &color);
QColor color() const;
+ static bool hasDefaultAlphaBuffer();
+ static void setDefaultAlphaBuffer(bool useAlpha);
+
void setPersistentOpenGLContext(bool persistent);
bool isPersistentOpenGLContext() const;
@@ -129,6 +133,7 @@ Q_SIGNALS:
void beforeSynchronizing();
void beforeRendering();
void afterRendering();
+ Q_REVISION(1) void closing(QQuickCloseEvent *close);
void colorChanged(const QColor &);
Q_REVISION(1) void activeFocusItemChanged();
@@ -144,6 +149,7 @@ protected:
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
+ // TODO Qt 6: reimplement QWindow::closeEvent to emit closing
virtual void focusInEvent(QFocusEvent *);
virtual void focusOutEvent(QFocusEvent *);
@@ -162,6 +168,7 @@ protected:
private Q_SLOTS:
void maybeUpdate();
void cleanupSceneGraph();
+ void setTransientParent_helper(QQuickWindow *window);
private:
friend class QQuickItem;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index ab772ca2bc..2dddd9ab68 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -178,9 +178,6 @@ public:
bool isRenderable() const;
- bool renderWithoutShowing;
- void setRenderWithoutShowing(bool enabled);
-
QQuickItem::UpdatePaintNodeData updatePaintNodeData;
QQuickItem *dirtyItemList;
@@ -212,6 +209,7 @@ public:
uint persistentSceneGraph : 1;
uint lastWheelEventAccepted : 1;
+ bool componentCompleted : 1;
QOpenGLFramebufferObject *renderTarget;
uint renderTargetId;
@@ -222,15 +220,40 @@ public:
mutable QQuickWindowIncubationController *incubationController;
+ static bool defaultAlphaBuffer;
+
static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event);
+ // data property
+ static void data_append(QQmlListProperty<QObject> *, QObject *);
+ static int data_count(QQmlListProperty<QObject> *);
+ static QObject *data_at(QQmlListProperty<QObject> *, int);
+ static void data_clear(QQmlListProperty<QObject> *);
+
private:
static void cleanupNodesOnShutdown(QQuickItem *);
};
+class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+
+public:
+ QQuickCloseEvent()
+ : _accepted(true) {}
+
+ bool isAccepted() { return _accepted; }
+ void setAccepted(bool accepted) { _accepted = accepted; }
+
+private:
+ bool _accepted;
+};
Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickWindowPrivate::FocusOptions)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickCloseEvent)
+
#endif // QQUICKWINDOW_P_H
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index f826a53a29..b91edc2fd5 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -42,18 +42,40 @@
#include "qquickwindowmodule_p.h"
#include "qquickscreen_p.h"
#include <QtQuick/QQuickWindow>
+#include <QtCore/QCoreApplication>
+#include <QtQml/QQmlEngine>
QT_BEGIN_NAMESPACE
+class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus
+{
+ Q_INTERFACES(QQmlParserStatus)
+ Q_OBJECT
+protected:
+ void classBegin() {
+ //Give QQuickView behavior when created from QML with QQmlApplicationEngine
+ if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) {
+ QQmlEngine* e = qmlEngine(this);
+ if (e && !e->incubationController())
+ e->setIncubationController(incubationController());
+ }
+ }
+
+ void componentComplete() {}
+};
+
void QQuickWindowModule::defineModule()
{
const char uri[] = "QtQuick.Window";
qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window");
qmlRegisterRevision<QWindow,1>(uri, 2, 1);
- qmlRegisterType<QQuickWindow,1>(uri, 2, 1, "Window");
+ qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members
+ qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window");
qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
}
+#include "qquickwindowmodule.moc"
+
QT_END_NAMESPACE
diff --git a/src/quick/quick.pro b/src/quick/quick.pro
index 393fe34e89..057f3d5db5 100644
--- a/src/quick/quick.pro
+++ b/src/quick/quick.pro
@@ -14,8 +14,15 @@ exists("qqml_enable_gcov") {
QMAKE_DOCS = $$PWD/doc/qtquick.qdocconf
+ANDROID_LIB_DEPENDENCIES = \
+ lib/libQt5QuickParticles.so
ANDROID_LIB_DEPENDENCY_REPLACEMENTS = \
"plugins/platforms/android/libqtforandroid.so:plugins/platforms/android/libqtforandroidGL.so"
+MODULE_PLUGIN_TYPES = \
+ accessible
+ANDROID_BUNDLED_FILES += \
+ qml \
+ lib/libQt5QuickParticles.so
load(qt_module)
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 818b9b26aa..7f09af4da3 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -332,42 +332,42 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
/*!
\fn const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::ColoredPoint2D.
*/
/*!
\fn QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::ColoredPoint2D.
*/
/*!
\fn const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::TexturedPoint2D.
*/
/*!
\fn QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::TexturedPoint2D.
*/
/*!
\fn const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const
- Convenience function to access the vertex data as an immuatble
+ Convenience function to access the vertex data as an immutable
array of QSGGeometry::Point2D.
*/
/*!
\fn QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D()
- Convenience function to access the vertex data as a muatble
+ Convenience function to access the vertex data as a mutable
array of QSGGeometry::Point2D.
*/
@@ -705,7 +705,8 @@ void QSGGeometry::updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect,
The default is AlwaysUploadPattern. When set to anything other than
the default, the user must call markIndexDataDirty() after changing
- the index data.
+ the index data, in addition to calling QSGNode::markDirty() with
+ QSGNode::DirtyGeometry.
*/
void QSGGeometry::setIndexDataPattern(DataPattern p)
@@ -728,7 +729,8 @@ void QSGGeometry::setIndexDataPattern(DataPattern p)
The default is AlwaysUploadPattern. When set to anything other than
the default, the user must call markVertexDataDirty() after changing
- the vertex data.
+ the vertex data, in addition to calling QSGNode::markDirty() with
+ QSGNode::DirtyGeometry.
*/
void QSGGeometry::setVertexDataPattern(DataPattern p)
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index c0794d0d69..9346236db9 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -556,6 +556,7 @@ static void qt_print_material_count()
QSGMaterial::QSGMaterial()
: m_flags(0)
+ , m_reserved(0)
{
#ifndef QT_NO_DEBUG
if (qsg_leak_check) {
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h
index ee8889deac..20ab21ad28 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.h
@@ -133,6 +133,7 @@ public:
void setFlag(Flags flags, bool on = true);
private:
+ friend class QSGContext;
Flags m_flags;
void *m_reserved;
Q_DISABLE_COPY(QSGMaterial)
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 6a22e0e7f9..25f8f342c9 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsgnode.h"
+#include "qsgnode_p.h"
#include "qsgrenderer_p.h"
#include "qsgnodeupdater_p.h"
#include "qsgmaterial.h"
@@ -128,12 +129,12 @@ static void qt_print_node_count()
before rendering starts.
\value OwnsGeometry Only valid for QSGGeometryNode and QSGClipNode.
The node has ownership over the QSGGeometry instance and will
- delete it when the node is destroyed.
+ delete it when the node is destroyed or a geometry is assigned.
\value OwnsMaterial Only valid for QSGGeometryNode. The node has ownership
- over the material and will delete it when the node is destroyed.
+ over the material and will delete it when the node is destroyed or a material is assigned.
\value OwnsOpaqueMaterial Only valid for QSGGeometryNode. The node has
ownership over the opaque material and will delete it when the node is
- destroyed.
+ destroyed or a material is assigned.
*/
/*!
@@ -267,6 +268,26 @@ QSGNode::QSGNode(NodeType type)
}
/*!
+ * Constructs a new node with the given node type.
+ *
+ * \internal
+ */
+QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type)
+ : m_parent(0)
+ , m_type(type)
+ , m_firstChild(0)
+ , m_lastChild(0)
+ , m_nextSibling(0)
+ , m_previousSibling(0)
+ , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
+ , m_nodeFlags(OwnedByParent)
+ , m_dirtyState(0)
+ , d_ptr(&dd)
+{
+ init();
+}
+
+/*!
* \internal
*/
void QSGNode::init()
@@ -678,6 +699,18 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type)
/*!
+ \internal
+ */
+QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type)
+ : QSGNode(dd, type)
+ , m_geometry(0)
+ , m_matrix(0)
+ , m_clip_list(0)
+{
+}
+
+
+/*!
Deletes this QSGBasicGeometryNode.
If the node has the flag QSGNode::OwnsGeometry set, it will also delete the
@@ -808,6 +841,19 @@ QSGGeometryNode::QSGGeometryNode()
/*!
+ \internal
+ */
+QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd)
+ : QSGBasicGeometryNode(dd, GeometryNodeType)
+ , m_render_order(0)
+ , m_material(0)
+ , m_opaque_material(0)
+ , m_opacity(1)
+{
+}
+
+
+/*!
Deletes this geometry node.
The flags QSGNode::OwnsMaterial, QSGNode::OwnsOpaqueMaterial and
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index 3fa2f7fc04..d83e6bcc81 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -58,6 +58,9 @@ class QSGRootNode;
class QSGGeometryNode;
class QSGTransformNode;
class QSGClipNode;
+class QSGNodePrivate;
+class QSGBasicGeometryNodePrivate;
+class QSGGeometryNodePrivate;
class Q_QUICK_EXPORT QSGNode
{
@@ -149,6 +152,7 @@ public:
protected:
QSGNode(NodeType type);
+ QSGNode(QSGNodePrivate &dd, NodeType type);
private:
friend class QSGRootNode;
@@ -167,7 +171,8 @@ private:
Flags m_nodeFlags;
DirtyState m_dirtyState;
- void *m_reserved;
+protected:
+ QScopedPointer<QSGNodePrivate> d_ptr;
};
class Q_QUICK_EXPORT QSGBasicGeometryNode : public QSGNode
@@ -184,6 +189,7 @@ public:
protected:
QSGBasicGeometryNode(NodeType type);
+ QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type);
private:
friend class QSGNodeUpdater;
@@ -218,6 +224,9 @@ public:
void setInheritedOpacity(qreal opacity);
qreal inheritedOpacity() const { return m_opacity; }
+protected:
+ QSGGeometryNode(QSGGeometryNodePrivate &dd);
+
private:
friend class QSGNodeUpdater;
diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h
new file mode 100644
index 0000000000..b0d8088af2
--- /dev/null
+++ b/src/quick/scenegraph/coreapi/qsgnode_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGNODE_P_H
+#define QSGNODE_P_H
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSGNodePrivate
+{
+public:
+ QSGNodePrivate() {}
+ virtual ~QSGNodePrivate() {}
+};
+
+
+class QSGBasicGeometryNodePrivate : public QSGNodePrivate
+{
+public:
+ QSGBasicGeometryNodePrivate()
+ : QSGNodePrivate()
+ {}
+};
+
+
+class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate
+{
+public:
+ QSGGeometryNodePrivate()
+ : QSGBasicGeometryNodePrivate()
+ {}
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGNODE_P_H
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index b46d45be57..805cfaad0d 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -53,6 +53,8 @@
#include <qdatetime.h>
+#include <private/qqmlprofilerservice_p.h>
+
QT_BEGIN_NAMESPACE
//#define RENDERER_DEBUG
@@ -62,9 +64,9 @@ QT_BEGIN_NAMESPACE
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
-static QTime frameTimer;
-static int preprocessTime;
-static int updatePassTime;
+static QElapsedTimer frameTimer;
+static qint64 preprocessTime;
+static qint64 updatePassTime;
#endif
void QSGBindable::clear(QSGRenderer::ClearMode mode) const
@@ -238,10 +240,11 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
frameTimer.start();
- int bindTime = 0;
- int renderTime = 0;
+ qint64 bindTime = 0;
+ qint64 renderTime = 0;
#endif
m_bindable = &bindable;
@@ -249,8 +252,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindable.bind();
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- bindTime = frameTimer.elapsed();
+ if (profileFrames)
+ bindTime = frameTimer.nsecsElapsed();
#endif
#ifndef QT_NO_DEBUG
@@ -270,8 +273,8 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- renderTime = frameTimer.elapsed();
+ if (profileFrames)
+ renderTime = frameTimer.nsecsElapsed();
#endif
glDisable(GL_SCISSOR_TEST);
@@ -292,12 +295,22 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing) {
printf(" - Breakdown of render time: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n",
- preprocessTime,
- updatePassTime - preprocessTime,
- bindTime - updatePassTime,
- renderTime - bindTime,
- renderTime);
+ int(preprocessTime / 1000000),
+ int((updatePassTime - preprocessTime) / 1000000),
+ int((bindTime - updatePassTime) / 1000000),
+ int((renderTime - bindTime) / 1000000),
+ int(renderTime / 1000000));
+ }
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRendererFrame,
+ preprocessTime,
+ updatePassTime - preprocessTime,
+ bindTime - updatePassTime,
+ renderTime - bindTime);
}
+
#endif
}
@@ -380,16 +393,17 @@ void QSGRenderer::preprocess()
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- preprocessTime = frameTimer.elapsed();
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
+ preprocessTime = frameTimer.nsecsElapsed();
#endif
nodeUpdater()->setToplevelOpacity(context()->renderAlpha());
nodeUpdater()->updateStates(m_root_node);
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- updatePassTime = frameTimer.elapsed();
+ if (profileFrames)
+ updatePassTime = frameTimer.nsecsElapsed();
#endif
}
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 1d534e3563..3536975e94 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -48,6 +48,7 @@
#include <QtGui/qguiapplication.h>
#include <qdir.h>
+#include <private/qqmlprofilerservice_p.h>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
@@ -162,7 +163,8 @@ void QSGDistanceFieldGlyphCache::update()
return;
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
qsg_render_timer.start();
#endif
@@ -176,10 +178,10 @@ void QSGDistanceFieldGlyphCache::update()
}
#ifndef QSG_NO_RENDER_TIMING
- int renderTime = 0;
+ qint64 renderTime = 0;
int count = m_pendingGlyphs.size();
- if (qsg_render_timing)
- renderTime = qsg_render_timer.elapsed();
+ if (profileFrames)
+ renderTime = qsg_render_timer.nsecsElapsed();
#endif
m_pendingGlyphs.reset();
@@ -190,11 +192,18 @@ void QSGDistanceFieldGlyphCache::update()
if (qsg_render_timing) {
printf(" - glyphs: count=%d, render=%d, store=%d, total=%d\n",
count,
- renderTime,
- (int) qsg_render_timer.elapsed() - renderTime,
+ int(renderTime/1000000),
+ (int) qsg_render_timer.elapsed() - int(renderTime/1000000),
(int) qsg_render_timer.elapsed());
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphAdaptationLayerFrame,
+ count,
+ renderTime,
+ qsg_render_timer.nsecsElapsed() - renderTime);
+ }
#endif
}
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 8d36fce481..866d678412 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -47,13 +47,16 @@
#include <QtQuick/private/qsgdefaultimagenode_p.h>
#include <QtQuick/private/qsgdefaultglyphnode_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
+#include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h>
#include <QtQuick/private/qsgshareddistancefieldglyphcache_p.h>
+#include <QtQuick/QSGFlatColorMaterial>
#include <QtQuick/private/qsgtexture_p.h>
#include <QtQuick/private/qquickpixmapcache_p.h>
#include <QGuiApplication>
#include <QOpenGLContext>
+#include <QQuickWindow>
#include <QtGui/qopenglframebufferobject.h>
#include <private/qqmlglobal_p.h>
@@ -67,6 +70,8 @@
#include <private/qobject_p.h>
#include <qmutex.h>
+#include <private/qqmlprofilerservice_p.h>
+
DEFINE_BOOL_CONFIG_OPTION(qmlFlashMode, QML_FLASH_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlTranslucentMode, QML_TRANSLUCENT_MODE)
DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
@@ -157,15 +162,13 @@ QSGContext::QSGContext(QObject *parent) :
QObject(*(new QSGContextPrivate), parent)
{
Q_D(QSGContext);
- 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 (doSubpixel)
+ QByteArray mode = qgetenv("QSG_DISTANCEFIELD_ANTIALIASING");
+ if (mode == "subpixel")
d->distanceFieldAntialiasing = QSGGlyphNode::HighQualitySubPixelAntialiasing;
- else if (doLowQualSubpixel)
+ else if (mode == "subpixel-lowq")
d->distanceFieldAntialiasing = QSGGlyphNode::LowQualitySubPixelAntialiasing;
- else if (doGray)
- d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
+ else if (mode == "gray")
+ d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
}
@@ -260,9 +263,35 @@ void QSGContext::initialize(QOpenGLContext *context)
Q_ASSERT(!d->gl);
d->gl = context;
+ precompileMaterials();
+
emit initialized();
}
+#define QSG_PRECOMPILE_MATERIAL(name) { name m; prepareMaterial(&m); }
+
+/*
+ * Some glsl compilers take their time compiling materials, and
+ * the way the scene graph is being processed, these materials
+ * get compiled when they are first taken into use. This can
+ * easily lead to skipped frames. By precompiling the most
+ * common materials, we potentially add a few milliseconds to the
+ * start up, and reduce the chance of avoiding skipped frames
+ * later on.
+ */
+void QSGContext::precompileMaterials()
+{
+ if (qEnvironmentVariableIsEmpty("QSG_NO_MATERIAL_PRELOADING")) {
+ QSG_PRECOMPILE_MATERIAL(QSGVertexColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGFlatColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGOpaqueTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGSmoothTextureMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGSmoothColorMaterial);
+ QSG_PRECOMPILE_MATERIAL(QSGDistanceFieldTextMaterial);
+ }
+}
+
/*!
Returns if the scene graph context is ready or not, meaning that it has a valid
@@ -354,7 +383,11 @@ QSGDistanceFieldGlyphCache *QSGContext::distanceFieldGlyphCache(const QRawFont &
*/
QSGGlyphNode *QSGContext::createNativeGlyphNode()
{
+#if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2_ANGLE)
+ return createGlyphNode();
+#else
return new QSGDefaultGlyphNode;
+#endif
}
/*!
@@ -392,6 +425,8 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
+ if (QQuickWindow::hasDefaultAlphaBuffer())
+ format.setAlphaBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
return format;
}
@@ -472,17 +507,24 @@ QSGDepthStencilBufferManager *QSGContext::depthStencilBufferManager()
QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
{
Q_D(QSGContext);
+
+ if (material->m_reserved)
+ return reinterpret_cast<QSGMaterialShader *>(material->m_reserved);
+
QSGMaterialType *type = material->type();
QSGMaterialShader *shader = d->materials.value(type);
- if (shader)
+ if (shader) {
+ material->m_reserved = shader;
return shader;
+ }
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ if (qsg_render_timing || QQmlProfilerService::enabled)
qsg_renderer_timer.start();
#endif
shader = material->createShader();
+ material->m_reserved = shader;
shader->compile();
shader->initialize();
d->materials[type] = shader;
@@ -490,6 +532,12 @@ QSGMaterialShader *QSGContext::prepareMaterial(QSGMaterial *material)
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
printf(" - compiling material: %dms\n", (int) qsg_renderer_timer.elapsed());
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphContextFrame,
+ qsg_renderer_timer.nsecsElapsed());
+ }
#endif
return shader;
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index b069c53dd3..bbc42674c6 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -90,6 +90,7 @@ public:
bool isReady() const;
+ virtual void precompileMaterials();
QSGMaterialShader *prepareMaterial(QSGMaterial *material);
virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId);
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 419062d025..f5a461f19e 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -95,7 +95,8 @@ const char *QSGTextMaskMaterialData::fragmentShader() const {
"uniform sampler2D texture; \n"
"uniform lowp vec4 color; \n"
"void main() { \n"
- " gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb * color.a, 1.0); \n"
+ " lowp vec4 glyph = texture2D(texture, sampleCoord); \n"
+ " gl_FragColor = vec4(glyph.rgb * color.a, glyph.a); \n"
"}";
}
@@ -162,7 +163,7 @@ void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial
state.context()->functions()->glBlendColor(c.redF(),
c.greenF(),
c.blueF(),
- 1.0f);
+ c.alphaF());
}
}
@@ -520,7 +521,7 @@ int QSGTextMaskMaterial::compare(const QSGMaterial *o) const
Q_ASSERT(o && type() == o->type());
const QSGTextMaskMaterial *other = static_cast<const QSGTextMaskMaterial *>(o);
if (m_glyphCache != other->m_glyphCache)
- return m_glyphCache - other->m_glyphCache;
+ return m_glyphCache.data() < other->m_glyphCache.data() ? -1 : 1;
QRgb c1 = m_color.rgba();
QRgb c2 = other->m_color.rgba();
return int(c2 < c1) - int(c1 < c2);
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp
index cadd18e833..aed69913fa 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp
@@ -87,24 +87,24 @@ protected:
};
-SmoothTextureMaterial::SmoothTextureMaterial()
+QSGSmoothTextureMaterial::QSGSmoothTextureMaterial()
{
setFlag(RequiresFullMatrixExceptTranslate, true);
setFlag(Blending, true);
}
-void SmoothTextureMaterial::setTexture(QSGTexture *texture)
+void QSGSmoothTextureMaterial::setTexture(QSGTexture *texture)
{
m_texture = texture;
}
-QSGMaterialType *SmoothTextureMaterial::type() const
+QSGMaterialType *QSGSmoothTextureMaterial::type() const
{
static QSGMaterialType type;
return &type;
}
-QSGMaterialShader *SmoothTextureMaterial::createShader() const
+QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const
{
return new SmoothTextureMaterialShader;
}
diff --git a/src/quick/scenegraph/qsgdefaultimagenode_p.h b/src/quick/scenegraph/qsgdefaultimagenode_p.h
index 7d299faee3..723943fd71 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultimagenode_p.h
@@ -48,10 +48,10 @@
QT_BEGIN_NAMESPACE
-class SmoothTextureMaterial : public QSGTextureMaterial
+class Q_QUICK_PRIVATE_EXPORT QSGSmoothTextureMaterial : public QSGTextureMaterial
{
public:
- SmoothTextureMaterial();
+ QSGSmoothTextureMaterial();
void setTexture(QSGTexture *texture);
@@ -60,7 +60,7 @@ protected:
virtual QSGMaterialShader *createShader() const;
};
-class QSGDefaultImageNode : public QSGImageNode
+class Q_QUICK_PRIVATE_EXPORT QSGDefaultImageNode : public QSGImageNode
{
public:
QSGDefaultImageNode();
@@ -90,7 +90,7 @@ private:
QSGOpaqueTextureMaterial m_material;
QSGTextureMaterial m_materialO;
- SmoothTextureMaterial m_smoothMaterial;
+ QSGSmoothTextureMaterial m_smoothMaterial;
uint m_antialiasing : 1;
uint m_mirror : 1;
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
index f642ca8d16..76fbbb4209 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
@@ -211,24 +211,24 @@ const char *SmoothColorMaterialShader::fragmentShader() const
"}";
}
-SmoothColorMaterial::SmoothColorMaterial()
+QSGSmoothColorMaterial::QSGSmoothColorMaterial()
{
setFlag(RequiresFullMatrixExceptTranslate, true);
setFlag(Blending, true);
}
-int SmoothColorMaterial::compare(const QSGMaterial *) const
+int QSGSmoothColorMaterial::compare(const QSGMaterial *) const
{
return 0;
}
-QSGMaterialType *SmoothColorMaterial::type() const
+QSGMaterialType *QSGSmoothColorMaterial::type() const
{
static QSGMaterialType type;
return &type;
}
-QSGMaterialShader *SmoothColorMaterial::createShader() const
+QSGMaterialShader *QSGSmoothColorMaterial::createShader() const
{
return new SmoothColorMaterialShader;
}
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
index 24bdbb3d34..1994e015e9 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
@@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE
class QSGContext;
-class SmoothColorMaterial : public QSGMaterial
+class Q_QUICK_PRIVATE_EXPORT QSGSmoothColorMaterial : public QSGMaterial
{
public:
- SmoothColorMaterial();
+ QSGSmoothColorMaterial();
int compare(const QSGMaterial *other) const;
@@ -63,7 +63,7 @@ protected:
virtual QSGMaterialShader *createShader() const;
};
-class QSGDefaultRectangleNode : public QSGRectangleNode
+class Q_QUICK_PRIVATE_EXPORT QSGDefaultRectangleNode : public QSGRectangleNode
{
public:
QSGDefaultRectangleNode();
@@ -83,7 +83,7 @@ private:
void updateGradientTexture();
QSGVertexColorMaterial m_material;
- SmoothColorMaterial m_smoothMaterial;
+ QSGSmoothColorMaterial m_smoothMaterial;
QRectF m_rect;
QGradientStops m_gradient_stops;
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index 86c3356d58..bdbce6165b 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -144,8 +144,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
if (oldMaterial == 0
|| material->color() != oldMaterial->color()
|| state.isOpacityDirty()) {
- QColor c = material->color();
- QVector4D color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
+ QVector4D color = material->color();
color *= state.opacity();
program()->setUniformValue(m_color_id, color);
}
@@ -206,10 +205,10 @@ QSGMaterialType *QSGDistanceFieldTextMaterial::type() const
void QSGDistanceFieldTextMaterial::setColor(const QColor &color)
{
- m_color = QColor::fromRgbF(color.redF() * color.alphaF(),
- color.greenF() * color.alphaF(),
- color.blueF() * color.alphaF(),
- color.alphaF());
+ m_color = QVector4D(color.redF() * color.alphaF(),
+ color.greenF() * color.alphaF(),
+ color.blueF() * color.alphaF(),
+ color.alphaF());
}
QSGMaterialShader *QSGDistanceFieldTextMaterial::createShader() const
@@ -239,10 +238,8 @@ int QSGDistanceFieldTextMaterial::compare(const QSGMaterial *o) const
if (m_fontScale != other->m_fontScale) {
return int(other->m_fontScale < m_fontScale) - int(m_fontScale < other->m_fontScale);
}
- QRgb c1 = m_color.rgba();
- QRgb c2 = other->m_color.rgba();
- if (c1 != c2)
- return int(c2 < c1) - int(c1 < c2);
+ if (m_color != other->m_color)
+ return &m_color < &other->m_color ? -1 : 1;
int t0 = m_texture ? m_texture->textureId : -1;
int t1 = other->m_texture ? other->m_texture->textureId : -1;
return t0 - t1;
@@ -284,8 +281,7 @@ void DistanceFieldStyledTextMaterialShader::updateState(const RenderState &state
if (oldMaterial == 0
|| material->styleColor() != oldMaterial->styleColor()
|| (state.isOpacityDirty())) {
- QColor c = material->styleColor();
- QVector4D color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
+ QVector4D color = material->styleColor();
color *= state.opacity();
program()->setUniformValue(m_styleColor_id, color);
}
@@ -302,21 +298,18 @@ QSGDistanceFieldStyledTextMaterial::~QSGDistanceFieldStyledTextMaterial()
void QSGDistanceFieldStyledTextMaterial::setStyleColor(const QColor &color)
{
- m_styleColor = QColor::fromRgbF(color.redF() * color.alphaF(),
- color.greenF() * color.alphaF(),
- color.blueF() * color.alphaF(),
- color.alphaF());
+ m_styleColor = QVector4D(color.redF() * color.alphaF(),
+ color.greenF() * color.alphaF(),
+ color.blueF() * color.alphaF(),
+ color.alphaF());
}
int QSGDistanceFieldStyledTextMaterial::compare(const QSGMaterial *o) const
{
Q_ASSERT(o && type() == o->type());
const QSGDistanceFieldStyledTextMaterial *other = static_cast<const QSGDistanceFieldStyledTextMaterial *>(o);
- if (m_styleColor != other->m_styleColor) {
- QRgb c1 = m_styleColor.rgba();
- QRgb c2 = other->m_styleColor.rgba();
- return int(c2 < c1) - int(c1 < c2);
- }
+ if (m_styleColor != other->m_color)
+ return &m_styleColor < &other->m_styleColor ? -1 : 1;
return QSGDistanceFieldTextMaterial::compare(o);
}
@@ -657,8 +650,8 @@ void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderStat
QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect);
if (oldMaterial == 0 || material->color() != oldMaterial->color()) {
- QColor c = material->color();
- state.context()->functions()->glBlendColor(c.redF(), c.greenF(), c.blueF(), 1.0f);
+ QVector4D c = material->color();
+ state.context()->functions()->glBlendColor(c.x(), c.y(), c.z(), 1.0f);
}
if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale())
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
index 7fea8f65dc..54d4146ddb 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
@@ -59,7 +59,7 @@ public:
virtual int compare(const QSGMaterial *other) const;
virtual void setColor(const QColor &color);
- const QColor &color() const { return m_color; }
+ const QVector4D &color() const { return m_color; }
void setGlyphCache(QSGDistanceFieldGlyphCache *a) { m_glyph_cache = a; }
QSGDistanceFieldGlyphCache *glyphCache() const { return m_glyph_cache; }
@@ -76,7 +76,7 @@ public:
protected:
QSize m_size;
- QColor m_color;
+ QVector4D m_color;
QSGDistanceFieldGlyphCache *m_glyph_cache;
const QSGDistanceFieldGlyphCache::Texture *m_texture;
qreal m_fontScale;
@@ -93,10 +93,10 @@ public:
virtual int compare(const QSGMaterial *other) const;
void setStyleColor(const QColor &color);
- const QColor &styleColor() const { return m_styleColor; }
+ const QVector4D &styleColor() const { return m_styleColor; }
protected:
- QColor m_styleColor;
+ QVector4D m_styleColor;
};
class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldOutlineTextMaterial : public QSGDistanceFieldStyledTextMaterial
@@ -130,7 +130,7 @@ class Q_QUICK_PRIVATE_EXPORT QSGHiQSubPixelDistanceFieldTextMaterial : public QS
public:
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = color; }
+ void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
class Q_QUICK_PRIVATE_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
@@ -138,7 +138,7 @@ class Q_QUICK_PRIVATE_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QS
public:
virtual QSGMaterialType *type() const;
virtual QSGMaterialShader *createShader() const;
- void setColor(const QColor &color) { m_color = color; }
+ void setColor(const QColor &color) { m_color = QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()); }
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 33a99d1506..e099d94a53 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -41,6 +41,7 @@
#include "qsgrenderloop_p.h"
#include "qsgthreadedrenderloop_p.h"
+#include "qsgwindowsrenderloop_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
@@ -55,6 +56,7 @@
#include <QtQuick/QQuickWindow>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qsgcontext_p.h>
+#include <private/qqmlprofilerservice_p.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +82,7 @@ QSGRenderLoop::~QSGRenderLoop()
{
}
-class QSGGuiThreadRenderLoop : public QObject, public QSGRenderLoop
+class QSGGuiThreadRenderLoop : public QSGRenderLoop
{
Q_OBJECT
public:
@@ -130,15 +132,6 @@ QSGRenderLoop *QSGRenderLoop::instance()
s_instance = QSGContext::createWindowManager();
bool bufferQueuing = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::BufferQueueingOpenGL);
-#ifdef Q_OS_WIN
- bool fancy = false; // QTBUG-28037
-#else
- bool fancy = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL);
-#endif
- if (qmlNoThreadedRenderer())
- fancy = false;
- else if (qmlForceThreadedRenderer())
- fancy = true;
// Enable fixed animation steps...
QByteArray fixed = qgetenv("QML_FIXED_ANIMATION_STEP");
@@ -151,9 +144,45 @@ QSGRenderLoop *QSGRenderLoop::instance()
QUnifiedTimer::instance(true)->setConsistentTiming(true);
if (!s_instance) {
- s_instance = fancy
- ? (QSGRenderLoop*) new QSGThreadedRenderLoop
- : (QSGRenderLoop*) new QSGGuiThreadRenderLoop;
+
+ enum RenderLoopType {
+ BasicRenderLoop,
+ ThreadedRenderLoop,
+ WindowsRenderLoop
+ };
+
+ RenderLoopType loopType = BasicRenderLoop;
+
+#ifdef Q_OS_WIN
+ loopType = WindowsRenderLoop;
+#else
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))
+ loopType = ThreadedRenderLoop;
+#endif
+ if (qmlNoThreadedRenderer())
+ loopType = BasicRenderLoop;
+ else if (qmlForceThreadedRenderer())
+ loopType = ThreadedRenderLoop;
+
+ const QByteArray loopName = qgetenv("QSG_RENDER_LOOP");
+ if (loopName == QByteArrayLiteral("windows"))
+ loopType = WindowsRenderLoop;
+ else if (loopName == QByteArrayLiteral("basic"))
+ loopType = BasicRenderLoop;
+ else if (loopName == QByteArrayLiteral("threaded"))
+ loopType = ThreadedRenderLoop;
+
+ switch (loopType) {
+ case ThreadedRenderLoop:
+ s_instance = new QSGThreadedRenderLoop();
+ break;
+ case WindowsRenderLoop:
+ s_instance = new QSGWindowsRenderLoop();
+ break;
+ default:
+ s_instance = new QSGGuiThreadRenderLoop();
+ break;
+ }
}
}
return s_instance;
@@ -215,49 +244,25 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
{
- bool renderWithoutShowing = QQuickWindowPrivate::get(window)->renderWithoutShowing;
- if ((!window->isExposed() && !renderWithoutShowing) || !m_windows.contains(window))
+ if (!QQuickWindowPrivate::get(window)->isRenderable() || !m_windows.contains(window))
return;
WindowData &data = const_cast<WindowData &>(m_windows[window]);
- QQuickWindow *masterWindow = 0;
- if (!window->isVisible() && !renderWithoutShowing) {
- // Find a "proper surface" to bind...
- for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
- it != m_windows.constEnd() && !masterWindow; ++it) {
- if (it.key()->isVisible())
- masterWindow = it.key();
- }
- } else {
- masterWindow = window;
- }
-
- if (!masterWindow)
- return;
-
- if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) {
- qWarning().nospace()
- << "Unable to find a renderable master window "
- << masterWindow << "when trying to render"
- << window << " (" << window->geometry() << ").";
- return;
- }
-
bool current = false;
if (!gl) {
gl = new QOpenGLContext();
- gl->setFormat(masterWindow->requestedFormat());
+ gl->setFormat(window->requestedFormat());
if (!gl->create()) {
delete gl;
gl = 0;
}
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
if (current)
sg->initialize(gl);
} else {
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
}
bool alsoSwap = data.updatePending;
@@ -269,20 +274,21 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->polishItems();
- int renderTime = 0, syncTime = 0;
- QTime renderTimer;
- if (qsg_render_timing())
+ qint64 renderTime = 0, syncTime = 0;
+ QElapsedTimer renderTimer;
+ bool profileFrames = qsg_render_timing() || QQmlProfilerService::enabled;
+ if (profileFrames)
renderTimer.start();
cd->syncSceneGraph();
- if (qsg_render_timing())
- syncTime = renderTimer.elapsed();
+ if (profileFrames)
+ syncTime = renderTimer.nsecsElapsed();
cd->renderSceneGraph(window->size());
- if (qsg_render_timing())
- renderTime = renderTimer.elapsed() - syncTime;
+ if (profileFrames)
+ renderTime = renderTimer.nsecsElapsed() - syncTime;
if (data.grabOnly) {
grabContent = qt_gl_read_framebuffer(window->size(), false, false);
@@ -294,17 +300,29 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
cd->fireFrameSwapped();
}
+ qint64 swapTime = 0;
+ if (profileFrames) {
+ swapTime = renderTimer.nsecsElapsed() - renderTime - syncTime;
+ }
+
if (qsg_render_timing()) {
static QTime lastFrameTime = QTime::currentTime();
- const int swapTime = renderTimer.elapsed() - renderTime - syncTime;
- qDebug() << "- Breakdown of frame time; sync:" << syncTime
- << "ms render:" << renderTime << "ms swap:" << swapTime
- << "ms total:" << swapTime + renderTime + syncTime
+ qDebug() << "- Breakdown of frame time; sync:" << syncTime/1000000
+ << "ms render:" << renderTime/1000000 << "ms swap:" << swapTime/1000000
+ << "ms total:" << (swapTime + renderTime + syncTime)/1000000
<< "ms time since last frame:" << (lastFrameTime.msecsTo(QTime::currentTime()))
<< "ms";
lastFrameTime = QTime::currentTime();
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ syncTime,
+ renderTime,
+ swapTime);
+ }
+
// Might have been set during syncSceneGraph()
if (data.updatePending)
maybeUpdate(window);
diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h
index b18e6f00ad..6ff9c4c5f9 100644
--- a/src/quick/scenegraph/qsgrenderloop_p.h
+++ b/src/quick/scenegraph/qsgrenderloop_p.h
@@ -51,8 +51,10 @@ class QQuickWindow;
class QSGContext;
class QAnimationDriver;
-class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop
+class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop : public QObject
{
+ Q_OBJECT
+
public:
virtual ~QSGRenderLoop();
@@ -77,6 +79,11 @@ public:
static QSGRenderLoop *instance();
static void setInstance(QSGRenderLoop *instance);
+ virtual bool interleaveIncubation() const { return false; }
+
+signals:
+ void timeToIncubate();
+
private:
static QSGRenderLoop *s_instance;
};
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index b01d816661..3ab7d2fb30 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -56,6 +56,8 @@
#include "qsgthreadedrenderloop_p.h"
+#include <private/qqmlprofilerservice_p.h>
+
/*
Overall design:
@@ -139,10 +141,10 @@ static inline int qsgrl_animation_interval() {
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
-static QTime threadTimer;
-static int syncTime;
-static int renderTime;
-static int sinceLastTime;
+static QElapsedTimer threadTimer;
+static qint64 syncTime;
+static qint64 renderTime;
+static qint64 sinceLastTime;
#endif
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
@@ -329,9 +331,9 @@ public:
QEventLoop eventLoop;
- uint pendingUpdate : 2;
- uint sleeping : 1;
- uint syncResultedInChanges : 1;
+ uint pendingUpdate;
+ uint sleeping;
+ uint syncResultedInChanges;
volatile bool guiIsLocked;
volatile bool shouldExit;
@@ -516,7 +518,6 @@ void QSGRenderThread::sync()
mutex.lock();
Q_ASSERT_X(guiIsLocked, "QSGRenderThread::sync()", "sync triggered on bad terms as gui is not already locked...");
- pendingUpdate = 0;
for (int i=0; i<m_windows.size(); ++i) {
Window &w = const_cast<Window &>(m_windows.at(i));
@@ -547,8 +548,11 @@ void QSGRenderThread::sync()
void QSGRenderThread::syncAndRender()
{
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- sinceLastTime = threadTimer.restart();
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames) {
+ sinceLastTime = threadTimer.nsecsElapsed();
+ threadTimer.start();
+ }
#endif
QElapsedTimer waitTimer;
waitTimer.start();
@@ -558,8 +562,10 @@ void QSGRenderThread::syncAndRender()
syncResultedInChanges = false;
bool repaintRequested = pendingUpdate & RepaintRequest;
+ bool syncRequested = pendingUpdate & SyncRequest;
+ pendingUpdate = 0;
- if (pendingUpdate & SyncRequest) {
+ if (syncRequested) {
RLDEBUG(" Render: - update pending, doing sync");
sync();
}
@@ -569,12 +575,13 @@ void QSGRenderThread::syncAndRender()
int waitTime = vsyncDelta - (int) waitTimer.elapsed();
if (waitTime > 0)
msleep(waitTime);
+ emit wm->timeToIncubate();
return;
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- syncTime = threadTimer.elapsed();
+ if (profileFrames)
+ syncTime = threadTimer.nsecsElapsed();
#endif
RLDEBUG(" Render: - rendering starting");
@@ -588,21 +595,30 @@ void QSGRenderThread::syncAndRender()
gl->makeCurrent(w.window);
d->renderSceneGraph(w.size);
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing && i == 0)
- renderTime = threadTimer.elapsed();
+ if (profileFrames && i == 0)
+ renderTime = threadTimer.nsecsElapsed();
#endif
gl->swapBuffers(w.window);
d->fireFrameSwapped();
}
RLDEBUG(" Render: - rendering done");
+ emit wm->timeToIncubate();
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
qDebug("window Time: sinceLast=%d, sync=%d, first render=%d, after final swap=%d",
- sinceLastTime,
- syncTime,
- renderTime - syncTime,
- threadTimer.elapsed() - renderTime);
+ int(sinceLastTime/1000000),
+ int(syncTime/1000000),
+ int((renderTime - syncTime)/1000000),
+ int(threadTimer.elapsed() - renderTime/1000000));
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ syncTime,
+ renderTime - syncTime,
+ threadTimer.nsecsElapsed() - renderTime);
+ }
#endif
}
@@ -710,7 +726,7 @@ QSGContext *QSGThreadedRenderLoop::sceneGraphContext() const
return m_thread->sg;
}
-bool QSGThreadedRenderLoop::anyoneShowing()
+bool QSGThreadedRenderLoop::anyoneShowing() const
{
for (int i=0; i<m_windows.size(); ++i) {
QQuickWindow *c = m_windows.at(i).window;
@@ -720,6 +736,11 @@ bool QSGThreadedRenderLoop::anyoneShowing()
return false;
}
+bool QSGThreadedRenderLoop::interleaveIncubation() const
+{
+ return m_animation_driver->isRunning() && anyoneShowing();
+}
+
void QSGThreadedRenderLoop::animationStarted()
{
RLDEBUG("GUI: animationStarted()");
@@ -950,10 +971,11 @@ void QSGThreadedRenderLoop::polishAndSync()
#ifndef QSG_NO_RENDER_TIMING
QElapsedTimer timer;
- int polishTime = 0;
- int waitTime = 0;
- int syncTime;
- if (qsg_render_timing)
+ qint64 polishTime = 0;
+ qint64 waitTime = 0;
+ qint64 syncTime = 0;
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
timer.start();
#endif
@@ -964,8 +986,8 @@ void QSGThreadedRenderLoop::polishAndSync()
d->polishItems();
}
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- polishTime = timer.elapsed();
+ if (profileFrames)
+ polishTime = timer.nsecsElapsed();
#endif
m_sync_triggered_update = false;
@@ -977,8 +999,8 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - wait for sync...");
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- waitTime = timer.elapsed();
+ if (profileFrames)
+ waitTime = timer.nsecsElapsed();
#endif
m_thread->waitCondition.wait(&m_thread->mutex);
m_thread->guiIsLocked = false;
@@ -986,8 +1008,8 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - unlocked after sync...");
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
- syncTime = timer.elapsed();
+ if (profileFrames)
+ syncTime = timer.nsecsElapsed();
#endif
killTimer(m_update_timer);
@@ -997,7 +1019,6 @@ void QSGThreadedRenderLoop::polishAndSync()
RLDEBUG("GUI: - animations advancing");
m_animation_driver->advance();
RLDEBUG("GUI: - animations done");
-
// We need to trigger another sync to keep animations running...
maybePostPolishRequest();
} else if (m_sync_triggered_update) {
@@ -1006,7 +1027,20 @@ void QSGThreadedRenderLoop::polishAndSync()
#ifndef QSG_NO_RENDER_TIMING
if (qsg_render_timing)
- qDebug(" - polish=%d, wait=%d, sync=%d -- animations=%d", polishTime, waitTime - polishTime, syncTime - waitTime, int(timer.elapsed() - syncTime));
+ qDebug(" - polish=%d, wait=%d, sync=%d -- animations=%d",
+ int(polishTime/1000000),
+ int((waitTime - polishTime)/1000000),
+ int((syncTime - waitTime)/1000000),
+ int((timer.nsecsElapsed() - syncTime)/1000000));
+
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphPolishAndSync,
+ polishTime,
+ waitTime - polishTime,
+ syncTime - waitTime,
+ timer.nsecsElapsed() - syncTime);
+ }
#endif
}
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
index aab0e8726f..6ff5cabf43 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h
+++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QSGRenderThread;
-class QSGThreadedRenderLoop : public QObject, public QSGRenderLoop
+class QSGThreadedRenderLoop : public QSGRenderLoop
{
Q_OBJECT
public:
@@ -79,7 +79,7 @@ public:
bool event(QEvent *);
- void wakeup();
+ bool interleaveIncubation() const;
public slots:
void animationStarted();
@@ -91,7 +91,7 @@ private:
void releaseResources(QQuickWindow *window, bool inDestructor);
bool checkAndResetForceUpdate(QQuickWindow *window);
- bool anyoneShowing();
+ bool anyoneShowing() const;
void initialize();
void maybePostPolishRequest();
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
new file mode 100644
index 0000000000..8e97f65ea5
--- /dev/null
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -0,0 +1,469 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsgwindowsrenderloop_p.h"
+
+#include <QtCore/QCoreApplication>
+
+#include <QtGui/QScreen>
+#include <QtGui/QGuiApplication>
+
+#include <QtQuick/private/qsgcontext_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+
+#include <QtQuick/QQuickWindow>
+
+#include <private/qqmlprofilerservice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+
+// #define QSG_RENDER_LOOP_DEBUG
+
+#ifdef QSG_RENDER_LOOP_DEBUG
+static QElapsedTimer qsg_debug_timer;
+# define RLDEBUG(x) printf("(%6d) %s : %4d - %s\n", (int) qsg_debug_timer.elapsed(), __FILE__, __LINE__, x)
+#else
+# define RLDEBUG(x)
+#endif
+
+#ifndef QSG_NO_RENDER_TIMING
+static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
+static QElapsedTimer qsg_render_timer;
+#define QSG_RENDER_TIMING_SAMPLE(sampleName) qint64 sampleName = 0; if (qsg_render_timing || QQmlProfilerService::enabled) sampleName = qsg_render_timer.nsecsElapsed()
+#else
+#define QSG_RENDER_TIMING_SAMPLE(sampleName)
+#endif
+
+
+QSGWindowsRenderLoop::QSGWindowsRenderLoop()
+ : m_gl(0)
+ , m_sg(QSGContext::createDefaultContext())
+ , m_updateTimer(0)
+ , m_animationTimer(0)
+{
+#ifdef QSG_RENDER_LOOP_DEBUG
+ qsg_debug_timer.start();
+#endif
+
+ m_animationDriver = m_sg->createAnimationDriver(m_sg);
+ m_animationDriver->install();
+
+ connect(m_animationDriver, SIGNAL(started()), this, SLOT(started()));
+ connect(m_animationDriver, SIGNAL(stopped()), this, SLOT(stopped()));
+
+ m_vsyncDelta = 1000 / QGuiApplication::primaryScreen()->refreshRate();
+ if (m_vsyncDelta <= 0)
+ m_vsyncDelta = 16;
+
+ RLDEBUG("Windows Render Loop created");
+
+#ifndef QSG_NO_RENDER_TIMIMG
+ qsg_render_timer.start();
+#endif
+}
+
+bool QSGWindowsRenderLoop::interleaveIncubation() const
+{
+ return m_animationDriver->isRunning() && anyoneShowing();
+}
+
+QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow *window)
+{
+ for (int i=0; i<m_windows.size(); ++i) {
+ WindowData &wd = m_windows[i];
+ if (wd.window == window)
+ return &wd;
+ }
+ return 0;
+}
+
+void QSGWindowsRenderLoop::maybePostUpdateTimer()
+{
+ if (!m_updateTimer) {
+ RLDEBUG(" - posting event");
+ m_updateTimer = startTimer(m_vsyncDelta / 3);
+ }
+}
+
+/*
+ * If no windows are showing, start ticking animations using a timer,
+ * otherwise, start rendering
+ */
+void QSGWindowsRenderLoop::started()
+{
+ RLDEBUG("Animations started...");
+ if (!anyoneShowing()) {
+ if (m_animationTimer == 0) {
+ RLDEBUG(" - starting non-visual animation timer");
+ m_animationTimer = startTimer(m_vsyncDelta);
+ }
+ } else {
+ maybePostUpdateTimer();
+ }
+}
+
+void QSGWindowsRenderLoop::stopped()
+{
+ RLDEBUG("Animations stopped...");
+ if (m_animationTimer) {
+ RLDEBUG(" - stopping non-visual animation timer");
+ killTimer(m_animationTimer);
+ m_animationTimer = 0;
+ }
+}
+
+void QSGWindowsRenderLoop::show(QQuickWindow *window)
+{
+ RLDEBUG("show");
+ if (windowData(window) != 0)
+ return;
+
+ // This happens before the platform window is shown, but after
+ // it is created. Creating the GL context takes a lot of time
+ // (hundreds of milliseconds) and will prevent us from rendering
+ // the first frame in time for the initial show on screen.
+ // By preparing the GL context here, it is feasible (if the app
+ // is quick enough) to have a perfect first frame.
+ if (!m_gl) {
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+
+ RLDEBUG(" - creating GL context");
+ m_gl = new QOpenGLContext();
+ m_gl->setFormat(window->requestedFormat());
+ m_gl->create();
+ QSG_RENDER_TIMING_SAMPLE(time_created);
+ RLDEBUG(" - making current");
+ m_gl->makeCurrent(window);
+ RLDEBUG(" - initializing SG");
+ QSG_RENDER_TIMING_SAMPLE(time_current);
+ m_sg->initialize(m_gl);
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop: GL=%d ms, makeCurrent=%d ms, SG=%d ms",
+ int((time_created - time_start)/1000000),
+ int((time_current - time_created)/1000000),
+ int((qsg_render_timer.nsecsElapsed() - time_current)/1000000));
+ }
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsRenderShow,
+ time_created - time_start,
+ time_current - time_created,
+ qsg_render_timer.nsecsElapsed() - time_current);
+ }
+#endif
+
+ }
+
+ WindowData data;
+ data.window = window;
+ data.pendingUpdate = false;
+ m_windows << data;
+
+ RLDEBUG(" - done with show");
+}
+
+void QSGWindowsRenderLoop::hide(QQuickWindow *window)
+{
+ RLDEBUG("hide");
+
+ for (int i=0; i<m_windows.size(); ++i) {
+ if (m_windows.at(i).window == window) {
+ m_windows.removeAt(i);
+ break;
+ }
+ }
+
+ // The expose event is queued while hide is sent synchronously, so
+ // the value might not be updated yet. (plus that the windows plugin
+ // sends exposed=true when it goes to hidden, so it is doubly broken)
+ // The check is made here, after the removal from m_windows, so
+ // anyoneShowing will report the right value.
+ if (window->isExposed())
+ handleObscurity();
+
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
+ cd->cleanupNodesOnShutdown();
+
+ // If this is the last tracked window, check for persistent SG and GL and
+ // potentially clean up.
+ if (m_windows.size() == 0) {
+ if (!cd->persistentSceneGraph) {
+ m_sg->invalidate();
+ if (!cd->persistentGLContext) {
+ delete m_gl;
+ m_gl = 0;
+ }
+ }
+ }
+}
+
+void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
+{
+ RLDEBUG("windowDestroyed");
+ hide(window);
+
+ // If this is the last tracked window, clean up SG and GL.
+ if (m_windows.size() == 0) {
+ m_sg->invalidate();
+ delete m_gl;
+ m_gl = 0;
+ }
+}
+
+bool QSGWindowsRenderLoop::anyoneShowing() const
+{
+ foreach (const WindowData &wd, m_windows)
+ if (wd.window->isExposed() && wd.window->size().isValid())
+ return true;
+ return false;
+}
+
+void QSGWindowsRenderLoop::exposureChanged(QQuickWindow *window)
+{
+
+ if (windowData(window) == 0)
+ return;
+
+ if (window->isExposed()) {
+
+ // Stop non-visual animation timer as we now have a window rendering
+ if (m_animationTimer && anyoneShowing()) {
+ RLDEBUG(" - stopping non-visual animation timer");
+ killTimer(m_animationTimer);
+ m_animationTimer = 0;
+ }
+
+ RLDEBUG("exposureChanged - exposed");
+ WindowData *wd = windowData(window);
+ wd->pendingUpdate = true;
+
+ // If we have a pending timer and we get an expose, we need to stop it.
+ // Otherwise we get two frames and two animation ticks in the same time-interval.
+ if (m_updateTimer) {
+ RLDEBUG(" - killing pending update timer");
+ killTimer(m_updateTimer);
+ m_updateTimer = 0;
+ }
+ render();
+ } else {
+ handleObscurity();
+ }
+}
+
+void QSGWindowsRenderLoop::handleObscurity()
+{
+ RLDEBUG("handleObscurity");
+ // Potentially start the non-visual animation timer if nobody is rendering
+ if (m_animationDriver->isRunning() && !anyoneShowing() && !m_animationTimer) {
+ RLDEBUG(" - starting non-visual animation timer");
+ m_animationTimer = startTimer(m_vsyncDelta);
+ }
+}
+
+QImage QSGWindowsRenderLoop::grab(QQuickWindow *window)
+{
+ RLDEBUG("grab");
+ if (!m_gl)
+ return QImage();
+
+ m_gl->makeCurrent(window);
+
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+ d->polishItems();
+ d->syncSceneGraph();
+ d->renderSceneGraph(window->size());
+
+ QImage image = qt_gl_read_framebuffer(window->size(), false, false);
+ return image;
+}
+
+void QSGWindowsRenderLoop::update(QQuickWindow *window)
+{
+ RLDEBUG("update");
+ maybeUpdate(window);
+}
+
+void QSGWindowsRenderLoop::maybeUpdate(QQuickWindow *window)
+{
+ RLDEBUG("maybeUpdate");
+
+ WindowData *wd = windowData(window);
+ if (!wd || !anyoneShowing())
+ return;
+
+ wd->pendingUpdate = true;
+ maybePostUpdateTimer();
+}
+
+bool QSGWindowsRenderLoop::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::Timer: {
+ QTimerEvent *te = static_cast<QTimerEvent *>(event);
+ if (te->timerId() == m_animationTimer) {
+ RLDEBUG("event : animation tick while nothing is showing");
+ m_animationDriver->advance();
+ } else if (te->timerId() == m_updateTimer) {
+ RLDEBUG("event : update");
+ killTimer(m_updateTimer);
+ m_updateTimer = 0;
+ render();
+ }
+ return true; }
+ default:
+ break;
+ }
+
+ return QObject::event(event);
+}
+
+/*
+ * Go through all windows we control and render them in turn.
+ * Then tick animations if active.
+ */
+void QSGWindowsRenderLoop::render()
+{
+ RLDEBUG("render");
+ foreach (const WindowData &wd, m_windows) {
+ if (wd.pendingUpdate) {
+ const_cast<WindowData &>(wd).pendingUpdate = false;
+ renderWindow(wd.window);
+ }
+ }
+
+ if (m_animationDriver->isRunning()) {
+ RLDEBUG("advancing animations");
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+ m_animationDriver->advance();
+ RLDEBUG("animations advanced");
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop: animations=%d ms",
+ int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
+ }
+ if (QQmlProfilerService::Enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsAnimations,
+ qsg_render_timer.nsecsElapsed() - time_start);
+ }
+#endif
+
+ // It is not given that animations triggered another maybeUpdate()
+ // and thus another render pass, so to keep things running,
+ // make sure there is another frame pending.
+ maybePostUpdateTimer();
+
+ emit timeToIncubate();
+ }
+}
+
+/*
+ * Render the contents of this window. First polish, then sync, render
+ * then finally swap.
+ *
+ * Note: This render function does not implement aborting
+ * the render call when sync step results in no scene graph changes,
+ * like the threaded renderer does.
+ */
+void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
+{
+ RLDEBUG("renderWindow");
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+
+ if (!d->isRenderable())
+ return;
+
+ if (!m_gl->makeCurrent(window))
+ return;
+
+ QSG_RENDER_TIMING_SAMPLE(time_start);
+
+ RLDEBUG(" - polishing");
+ d->polishItems();
+ QSG_RENDER_TIMING_SAMPLE(time_polished);
+
+ RLDEBUG(" - syncing");
+ d->syncSceneGraph();
+ QSG_RENDER_TIMING_SAMPLE(time_synced);
+
+ RLDEBUG(" - rendering");
+ d->renderSceneGraph(window->size());
+ QSG_RENDER_TIMING_SAMPLE(time_rendered);
+
+ RLDEBUG(" - swapping");
+ m_gl->swapBuffers(window);
+ QSG_RENDER_TIMING_SAMPLE(time_swapped);
+
+ RLDEBUG(" - frameDone");
+ d->fireFrameSwapped();
+
+#ifndef QSG_NO_RENDER_TIMING
+ if (qsg_render_timing) {
+ qDebug("WindowsRenderLoop(t=%d): window=%p, polish=%d ms, sync=%d ms, render=%d ms, swap=%d ms",
+ int(qsg_render_timer.elapsed()),
+ window,
+ int((time_polished - time_start)/1000000),
+ int((time_synced - time_polished)/1000000),
+ int((time_rendered - time_synced)/1000000),
+ int((time_swapped - time_rendered)/1000000));
+ }
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphWindowsPolishFrame,
+ time_polished - time_start
+ );
+
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphRenderLoopFrame,
+ time_synced - time_polished,
+ time_rendered - time_synced,
+ time_swapped - time_rendered
+ );
+ }
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
new file mode 100644
index 0000000000..218e18c3e2
--- /dev/null
+++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGWINDOWSRENDERLOOP_P_H
+#define QSGWINDOWSRENDERLOOP_P_H
+
+#include <QtCore/QObject>
+#include <QtCore/QElapsedTimer>
+
+#include <QtGui/QOpenGLContext>
+
+#include "qsgrenderloop_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSGWindowsRenderLoop : public QSGRenderLoop
+{
+ Q_OBJECT
+public:
+ explicit QSGWindowsRenderLoop();
+
+ void show(QQuickWindow *window);
+ void hide(QQuickWindow *window);
+
+ void windowDestroyed(QQuickWindow *window);
+
+ void exposureChanged(QQuickWindow *window);
+ QImage grab(QQuickWindow *window);
+
+ void update(QQuickWindow *window);
+ void maybeUpdate(QQuickWindow *window);
+
+ QAnimationDriver *animationDriver() const { return m_animationDriver; }
+
+ QSGContext *sceneGraphContext() const { return m_sg; }
+
+ void releaseResources(QQuickWindow *) { }
+
+ void render();
+ void renderWindow(QQuickWindow *window);
+
+ void resize(QQuickWindow *, const QSize &) { }
+
+ bool event(QEvent *event);
+ bool anyoneShowing() const;
+
+ bool interleaveIncubation() const;
+
+public slots:
+ void started();
+ void stopped();
+
+private:
+ struct WindowData {
+ QQuickWindow *window;
+ bool pendingUpdate;
+ };
+
+ void handleObscurity();
+ void maybePostUpdateTimer();
+ WindowData *windowData(QQuickWindow *window);
+
+ QList<WindowData> m_windows;
+
+ QOpenGLContext *m_gl;
+ QSGContext *m_sg;
+
+ QAnimationDriver *m_animationDriver;
+
+ int m_updateTimer;
+ int m_animationTimer;
+
+ int m_vsyncDelta;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGWINDOWSRENDERLOOP_P_H
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index 8c87e23ac9..34432ffd9c 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -6,6 +6,7 @@ HEADERS += \
$$PWD/coreapi/qsggeometry.h \
$$PWD/coreapi/qsgmaterial.h \
$$PWD/coreapi/qsgnode.h \
+ $$PWD/coreapi/qsgnode_p.h \
$$PWD/coreapi/qsgnodeupdater_p.h \
$$PWD/coreapi/qsgrenderer_p.h \
$$PWD/coreapi/qsgrendernode_p.h \
@@ -51,7 +52,6 @@ SOURCES += \
$$PWD/util/qsgpainternode.cpp \
$$PWD/util/qsgdistancefieldutil.cpp
-
# QML / Adaptations API
HEADERS += \
$$PWD/qsgadaptationlayer_p.h \
@@ -67,8 +67,8 @@ HEADERS += \
$$PWD/qsgflashnode_p.h \
$$PWD/qsgshareddistancefieldglyphcache_p.h \
$$PWD/qsgrenderloop_p.h \
- $$PWD/qsgthreadedrenderloop_p.h
-
+ $$PWD/qsgthreadedrenderloop_p.h \
+ $$PWD/qsgwindowsrenderloop_p.h
SOURCES += \
$$PWD/qsgadaptationlayer.cpp \
@@ -84,12 +84,5 @@ SOURCES += \
$$PWD/qsgflashnode.cpp \
$$PWD/qsgshareddistancefieldglyphcache.cpp \
$$PWD/qsgrenderloop.cpp \
- $$PWD/qsgthreadedrenderloop.cpp
-
-
-
-
-
-
-
-
+ $$PWD/qsgthreadedrenderloop.cpp \
+ $$PWD/qsgwindowsrenderloop.cpp
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index 307201277c..09e2a7da27 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -74,11 +74,11 @@ void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial
const QColor &c = newMaterial->color();
if (oldMaterial == 0 || c != oldMaterial->color() || state.isOpacityDirty()) {
- float opacity = state.opacity();
- QVector4D v(c.redF() * c.alphaF() * opacity,
- c.greenF() * c.alphaF() * opacity,
- c.blueF() * c.alphaF() * opacity,
- c.alphaF() * opacity);
+ float opacity = state.opacity() * c.alphaF();
+ QVector4D v(c.redF() * opacity,
+ c.greenF() * opacity,
+ c.blueF() * opacity,
+ opacity);
program()->setUniformValue(m_color_id, v);
}
diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp
index e5cf6b8295..97b3500ad0 100644
--- a/src/quick/scenegraph/util/qsgpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgpainternode.cpp
@@ -73,10 +73,6 @@ QSGPainterTexture::QSGPainterTexture()
m_retain_image = true;
}
-#ifdef QT_OPENGL_ES
-extern void qsg_swizzleBGRAToRGBA(QImage *image);
-#endif
-
void QSGPainterTexture::bind()
{
if (m_dirty_rect.isNull()) {
@@ -84,33 +80,8 @@ void QSGPainterTexture::bind()
return;
}
- bool oldMipmapsGenerated = m_mipmaps_generated;
- m_mipmaps_generated = true;
+ setImage(m_image);
QSGPlainTexture::bind();
- m_mipmaps_generated = oldMipmapsGenerated;
-
- QImage subImage = m_image.copy(m_dirty_rect);
-
- int w = m_dirty_rect.width();
- int h = m_dirty_rect.height();
-
-#ifdef QT_OPENGL_ES
- qsg_swizzleBGRAToRGBA(&subImage);
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_RGBA, GL_UNSIGNED_BYTE, subImage.constBits());
-#else
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_BGRA, GL_UNSIGNED_BYTE, subImage.constBits());
-#endif
-
- if (m_has_mipmaps && !m_mipmaps_generated) {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
- m_mipmaps_generated = true;
- }
-
- m_dirty_texture = false;
- m_dirty_bind_options = false;
m_dirty_rect = QRect();
}
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index 318120e4bf..86e0d36f6c 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -41,18 +41,44 @@
#include "qsgsimpletexturenode.h"
+#include <private/qsgnode_p.h>
QT_BEGIN_NAMESPACE
+class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate
+{
+public:
+ QSGSimpleTextureNodePrivate()
+ : QSGGeometryNodePrivate()
+ , m_texCoordMode(QSGSimpleTextureNode::NoTransform)
+ {}
+
+ QSGSimpleTextureNode::TextureCoordinatesTransformMode m_texCoordMode;
+};
+
static void qsgsimpletexturenode_update(QSGGeometry *g,
QSGTexture *texture,
- const QRectF &rect)
+ const QRectF &rect,
+ QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode)
{
if (!texture)
return;
QSize ts = texture->textureSize();
QRectF sourceRect(0, 0, ts.width(), ts.height());
+
+ // Maybe transform the texture coordinates
+ if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)) {
+ float tmp = sourceRect.left();
+ sourceRect.setLeft(sourceRect.right());
+ sourceRect.setRight(tmp);
+ }
+ if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorVertically)) {
+ float tmp = sourceRect.top();
+ sourceRect.setTop(sourceRect.bottom());
+ sourceRect.setBottom(tmp);
+ }
+
QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));
}
@@ -71,7 +97,8 @@ static void qsgsimpletexturenode_update(QSGGeometry *g,
Constructs a new simple texture node
*/
QSGSimpleTextureNode::QSGSimpleTextureNode()
- : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+ : QSGGeometryNode(*new QSGSimpleTextureNodePrivate)
+ , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
{
setGeometry(&m_geometry);
setMaterial(&m_material);
@@ -112,7 +139,8 @@ void QSGSimpleTextureNode::setRect(const QRectF &r)
if (m_rect == r)
return;
m_rect = r;
- qsgsimpletexturenode_update(&m_geometry, texture(), m_rect);
+ Q_D(QSGSimpleTextureNode);
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
markDirty(DirtyGeometry);
}
@@ -144,7 +172,8 @@ void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
return;
m_material.setTexture(texture);
m_opaque_material.setTexture(texture);
- qsgsimpletexturenode_update(&m_geometry, texture, m_rect);
+ Q_D(QSGSimpleTextureNode);
+ qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->m_texCoordMode);
markDirty(DirtyMaterial);
}
@@ -158,4 +187,48 @@ QSGTexture *QSGSimpleTextureNode::texture() const
return m_material.texture();
}
+/*!
+ \enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
+
+ The TextureCoordinatesTransformFlag enum is used to specify the
+ mode used to generate texture coordinates for a textured quad.
+
+ \value NoTransform Texture coordinates are oriented with window coordinates
+ i.e. with origin at top-left.
+
+ \value MirrorHorizontally Texture coordinates are inverted in the horizontal axis with
+ respect to window coordinates
+
+ \value MirrorVertically Texture coordinates are inverted in the vertical axis with
+ respect to window coordinates
+ */
+
+/*!
+ Sets the method used to generate texture coordinates to \a mode. This can be used to obtain
+ correct orientation of the texture. This is commonly needed when using a third party OpenGL
+ library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.
+
+ \sa textureCoordinatesTransform()
+ */
+void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)
+{
+ Q_D(QSGSimpleTextureNode);
+ if (d->m_texCoordMode == mode)
+ return;
+ d->m_texCoordMode = mode;
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
+ markDirty(DirtyMaterial);
+}
+
+/*!
+ Returns the mode used to generate texture coordinates for this node.
+
+ \sa setTextureCoordinatesTransform()
+ */
+QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const
+{
+ Q_D(const QSGSimpleTextureNode);
+ return d->m_texCoordMode;
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.h b/src/quick/scenegraph/util/qsgsimpletexturenode.h
index ffd10210ae..f5ab7fb3bb 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.h
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.h
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+class QSGSimpleTextureNodePrivate;
+
class Q_QUICK_EXPORT QSGSimpleTextureNode : public QSGGeometryNode
{
public:
@@ -63,14 +65,28 @@ public:
void setFiltering(QSGTexture::Filtering filtering);
QSGTexture::Filtering filtering() const;
+ enum TextureCoordinatesTransformFlag {
+ NoTransform = 0x00,
+ MirrorHorizontally = 0x01,
+ MirrorVertically = 0x02
+ };
+ Q_DECLARE_FLAGS(TextureCoordinatesTransformMode, TextureCoordinatesTransformFlag)
+
+ void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode);
+ TextureCoordinatesTransformMode textureCoordinatesTransform() const;
+
private:
QSGGeometry m_geometry;
QSGOpaqueTextureMaterial m_opaque_material;
QSGTextureMaterial m_material;
QRectF m_rect;
+
+ Q_DECLARE_PRIVATE(QSGSimpleTextureNode)
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSGSimpleTextureNode::TextureCoordinatesTransformMode)
+
QT_END_NAMESPACE
#endif // QSGSIMPLETEXTURENODE_H
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index ad98fe9d47..a69f43f8d6 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -614,7 +614,8 @@ void QSGPlainTexture::bind()
m_dirty_texture = false;
#ifndef QSG_NO_RENDER_TIMING
- if (qsg_render_timing)
+ bool profileFrames = qsg_render_timing || QQmlProfilerService::enabled;
+ if (profileFrames)
qsg_renderer_timer.start();
#endif
@@ -628,6 +629,11 @@ void QSGPlainTexture::bind()
m_texture_size.width(),
m_texture_size.height());
}
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphTextureDeletion,
+ qsg_renderer_timer.nsecsElapsed());
+ }
#endif
}
m_texture_id = 0;
@@ -645,9 +651,9 @@ void QSGPlainTexture::bind()
glBindTexture(GL_TEXTURE_2D, m_texture_id);
#ifndef QSG_NO_RENDER_TIMING
- int bindTime = 0;
- if (qsg_render_timing)
- bindTime = qsg_renderer_timer.elapsed();
+ qint64 bindTime = 0;
+ if (profileFrames)
+ bindTime = qsg_renderer_timer.nsecsElapsed();
#endif
// ### TODO: check for out-of-memory situations...
@@ -657,11 +663,13 @@ void QSGPlainTexture::bind()
QImage tmp = (m_image.format() == QImage::Format_RGB32 || m_image.format() == QImage::Format_ARGB32_Premultiplied)
? m_image
: m_image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ if (tmp.width() * 4 != tmp.bytesPerLine())
+ tmp = tmp.copy();
#ifndef QSG_NO_RENDER_TIMING
- int convertTime = 0;
- if (qsg_render_timing)
- convertTime = qsg_renderer_timer.elapsed();
+ qint64 convertTime = 0;
+ if (profileFrames)
+ convertTime = qsg_renderer_timer.nsecsElapsed();
#endif
updateBindOptions(m_dirty_bind_options);
@@ -684,16 +692,16 @@ void QSGPlainTexture::bind()
}
#ifndef QSG_NO_RENDER_TIMING
- int swizzleTime = 0;
- if (qsg_render_timing)
- swizzleTime = qsg_renderer_timer.elapsed();
+ qint64 swizzleTime = 0;
+ if (profileFrames)
+ swizzleTime = qsg_renderer_timer.nsecsElapsed();
#endif
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits());
#ifndef QSG_NO_RENDER_TIMING
- int uploadTime = 0;
- if (qsg_render_timing)
- uploadTime = qsg_renderer_timer.elapsed();
+ qint64 uploadTime = 0;
+ if (profileFrames)
+ uploadTime = qsg_renderer_timer.nsecsElapsed();
#endif
@@ -704,23 +712,35 @@ void QSGPlainTexture::bind()
}
#ifndef QSG_NO_RENDER_TIMING
- int mipmapTime = 0;
+ qint64 mipmapTime = 0;
if (qsg_render_timing) {
- mipmapTime = qsg_renderer_timer.elapsed();
+ mipmapTime = qsg_renderer_timer.nsecsElapsed();
printf(" - plaintexture(%dx%d) bind=%d, convert=%d, swizzle=%d (%s->%s), upload=%d, mipmap=%d, total=%d\n",
m_texture_size.width(), m_texture_size.height(),
- bindTime,
- convertTime - bindTime,
- swizzleTime - convertTime,
+ int(bindTime/1000000),
+ int((convertTime - bindTime)/1000000),
+ int((swizzleTime - convertTime)/1000000),
externalFormat == GL_BGRA ? "BGRA" : "RGBA",
internalFormat == GL_BGRA ? "BGRA" : "RGBA",
- uploadTime - swizzleTime,
- mipmapTime - uploadTime,
+ int((uploadTime - swizzleTime)/1000000),
+ int((mipmapTime - uploadTime)/1000000),
(int) qsg_renderer_timer.elapsed());
}
+ if (QQmlProfilerService::enabled) {
+ mipmapTime = qsg_renderer_timer.nsecsElapsed();
+
+ QQmlProfilerService::sceneGraphFrame(
+ QQmlProfilerService::SceneGraphTexturePrepare,
+ bindTime,
+ convertTime - bindTime,
+ swizzleTime - convertTime,
+ uploadTime - swizzleTime,
+ mipmapTime - uploadTime);
+ }
+
#endif
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index 6430a93ed8..7282d4051f 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
class QSGTexturePrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QSGTexture);
+ Q_DECLARE_PUBLIC(QSGTexture)
public:
QSGTexturePrivate();
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index ff91109a2a..87414766e3 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -145,7 +145,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
tuple. The QSGGeometry::defaultAttributes_TexturedPoint2D returns an
attribute set compatible with this material.
- The texture to be rendered is can be set using setTexture(). How the
+ The texture to be rendered can be set using setTexture(). How the
texture should be rendered can be specified using setMipmapFiltering(),
setFiltering(), setHorizontalWrapMode() and setVerticalWrapMode().
The rendering state is set on the texture instance just before it
@@ -208,7 +208,7 @@ QSGMaterialShader *QSGOpaqueTextureMaterial::createShader() const
/*!
Sets the texture of this material to \a texture.
- The material does not take ownership over the texture.
+ The material does not take ownership of the texture.
*/
void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture)
@@ -337,7 +337,7 @@ int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const
tuple. The QSGGeometry::defaultAttributes_TexturedPoint2D returns an
attribute set compatible with this material.
- The texture to be rendered is set using setTexture(). How the
+ The texture to be rendered can be set using setTexture(). How the
texture should be rendered can be specified using setMipmapFiltering(),
setFiltering(), setHorizontalWrapMode() and setVerticalWrapMode().
The rendering state is set on the texture instance just before it
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index f74ad20bc6..c05b254b51 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -1025,7 +1025,7 @@ QAbstractAnimationJob* QQuickScriptAction::transition(QQuickStateActions &action
PropertyAction object) so that the rotation animation begins with the
correct transform origin.
- \sa {Animation and Transitions in Qt Quick}, QtQml
+ \sa {Animation and Transitions in Qt Quick}, {Qt QML}
*/
QQuickPropertyAction::QQuickPropertyAction(QObject *parent)
: QQuickAbstractAnimation(*(new QQuickPropertyActionPrivate), parent)
@@ -1975,7 +1975,7 @@ void QQuickPropertyAnimation::setDuration(int duration)
}
/*!
- \qmlproperty real QtQuick2::PropertyAnimation::from
+ \qmlproperty variant QtQuick2::PropertyAnimation::from
This property holds the starting value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
@@ -2002,7 +2002,7 @@ void QQuickPropertyAnimation::setFrom(const QVariant &f)
}
/*!
- \qmlproperty real QtQuick2::PropertyAnimation::to
+ \qmlproperty variant QtQuick2::PropertyAnimation::to
This property holds the end value for the animation.
If the PropertyAnimation is defined within a \l Transition or \l Behavior,
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index e332f37493..1e77084e42 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -98,7 +98,7 @@ public:
state change. For general advice on using Behaviors to animate state changes, see
\l{Using Qt Quick Behaviors with States}.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/behaviors}{Behavior example}, QtQml
+ \sa {Animation and Transitions in Qt Quick}, {declarative/animation/behaviors}{Behavior example}, {Qt QML}
*/
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index abdadaa5d3..6fbba8ca2f 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -169,7 +169,7 @@ QImage QQuickTextureFactory::image() const
an image provider named "colors", and the images to be loaded are "yellow"
and "red", respectively:
- \snippet quick/imageprovider/imageprovider-example.qml 0
+ \snippet imageprovider/imageprovider-example.qml 0
When these images are loaded by QML, it looks for a matching image provider
and calls its requestImage() or requestPixmap() method (depending on its
@@ -180,9 +180,9 @@ QImage QQuickTextureFactory::image() const
requested by the above QML. This implementation dynamically
generates QPixmap images that are filled with the requested color:
- \snippet quick/imageprovider/imageprovider.cpp 0
+ \snippet imageprovider/imageprovider.cpp 0
\codeline
- \snippet quick/imageprovider/imageprovider.cpp 1
+ \snippet imageprovider/imageprovider.cpp 1
To make this provider accessible to QML, it is registered with the QML engine
with a "colors" identifier:
@@ -242,7 +242,7 @@ QImage QQuickTextureFactory::image() const
\c cache property to \c false for the relevant \l Image, \l BorderImage or
\l AnimatedImage object.
- The QtQuick 1 version of this class is named QDeclarativeImageProvider.
+ The \l {Qt Quick 1} version of this class is named QDeclarativeImageProvider.
\sa QQmlEngine::addImageProvider()
*/
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 3aea724983..2278fd25ba 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -188,8 +188,67 @@ bool QQuickPath::hasEnd() const
QQmlListProperty<QQuickPathElement> QQuickPath::pathElements()
{
- Q_D(QQuickPath);
- return QQmlListProperty<QQuickPathElement>(this, d->_pathElements);
+ return QQmlListProperty<QQuickPathElement>(this,
+ 0,
+ pathElements_append,
+ pathElements_count,
+ pathElements_at,
+ pathElements_clear);
+}
+
+static QQuickPathPrivate *privatePath(QObject *object)
+{
+ QQuickPath *path = static_cast<QQuickPath*>(object);
+
+ return QQuickPathPrivate::get(path);
+}
+
+QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+
+ return d->_pathElements.at(index);
+}
+
+void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *property, QQuickPathElement *pathElement)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+ QQuickPath *path = static_cast<QQuickPath*>(property->object);
+
+ d->_pathElements.append(pathElement);
+
+ if (d->componentComplete) {
+ QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement);
+ if (curve)
+ d->_pathCurves.append(curve);
+ else {
+ QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement);
+ if (attribute && !d->_attributes.contains(attribute->name()))
+ d->_attributes.append(attribute->name());
+ }
+
+ path->processPath();
+
+ connect(pathElement, SIGNAL(changed()), path, SLOT(processPath()));
+ }
+}
+
+int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+
+ return d->_pathElements.count();
+}
+
+void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property)
+{
+ QQuickPathPrivate *d = privatePath(property->object);
+ QQuickPath *path = static_cast<QQuickPath*>(property->object);
+
+ path->disconnectPathElements();
+ d->_pathElements.clear();
+ d->_pathCurves.clear();
+ d->_pointCache.clear();
}
void QQuickPath::interpolate(int idx, const QString &name, qreal value)
@@ -373,27 +432,49 @@ void QQuickPath::classBegin()
d->componentComplete = false;
}
-void QQuickPath::componentComplete()
+void QQuickPath::disconnectPathElements()
+{
+ Q_D(QQuickPath);
+
+ foreach (QQuickPathElement *pathElement, d->_pathElements)
+ disconnect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+}
+
+void QQuickPath::connectPathElements()
{
Q_D(QQuickPath);
- QSet<QString> attrs;
- d->componentComplete = true;
+
+ foreach (QQuickPathElement *pathElement, d->_pathElements)
+ connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+}
+
+void QQuickPath::gatherAttributes()
+{
+ Q_D(QQuickPath);
+
+ QSet<QString> attributes;
// First gather up all the attributes
foreach (QQuickPathElement *pathElement, d->_pathElements) {
- if (QQuickCurve *curve =
- qobject_cast<QQuickCurve *>(pathElement))
+ if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement))
d->_pathCurves.append(curve);
- else if (QQuickPathAttribute *attribute =
- qobject_cast<QQuickPathAttribute *>(pathElement))
- attrs.insert(attribute->name());
+ else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement))
+ attributes.insert(attribute->name());
}
- d->_attributes = attrs.toList();
+
+ d->_attributes = attributes.toList();
+}
+
+void QQuickPath::componentComplete()
+{
+ Q_D(QQuickPath);
+ d->componentComplete = true;
+
+ gatherAttributes();
processPath();
- foreach (QQuickPathElement *pathElement, d->_pathElements)
- connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
+ connectPathElements();
}
QPainterPath QQuickPath::path() const
@@ -1465,7 +1546,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa
nextData.curves = data.curves;
next = positionForCurve(nextData, point);
} else {
- if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0))) {
+ if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0)) && path.elementCount() >= 3) {
//this is a closed path starting and ending with catmull-rom segments.
//we try to smooth the join point
next = QPointF(path.elementAt(3)); //the first catmull-rom point
diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h
index 71545851e4..1a9be7c82a 100644
--- a/src/quick/util/qquickpath_p.h
+++ b/src/quick/util/qquickpath_p.h
@@ -393,6 +393,15 @@ Q_SIGNALS:
protected:
virtual void componentComplete();
virtual void classBegin();
+ void disconnectPathElements();
+ void connectPathElements();
+ void gatherAttributes();
+
+ // pathElements property
+ static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, int);
+ static void pathElements_append(QQmlListProperty<QQuickPathElement> *, QQuickPathElement *);
+ static int pathElements_count(QQmlListProperty<QQuickPathElement> *);
+ static void pathElements_clear(QQmlListProperty<QQuickPathElement> *);
private Q_SLOTS:
void processPath();
diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h
index b4227e64f3..e376925f21 100644
--- a/src/quick/util/qquickpath_p_p.h
+++ b/src/quick/util/qquickpath_p_p.h
@@ -67,6 +67,9 @@ class QQuickPathPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QQuickPath)
public:
+ static QQuickPathPrivate* get(QQuickPath *path) { return path->d_func(); }
+ static const QQuickPathPrivate* get(const QQuickPath *path) { return path->d_func(); }
+
QQuickPathPrivate() : pathLength(0), closed(false), componentComplete(true) { }
QPainterPath _path;
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index c5968c2bc1..9cf8c5812d 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -71,6 +71,8 @@
#include <QQmlFile>
#include <QMetaMethod>
+#include <private/qqmlprofilerservice_p.h>
+
#define IMAGEREQUEST_MAX_REQUEST_COUNT 8
#define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16
#define CACHE_EXPIRE_TIME 30
@@ -890,11 +892,15 @@ bool QQuickPixmapReply::event(QEvent *event)
if (data) {
Event *de = static_cast<Event *>(event);
data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error;
-
+ QQmlPixmapProfiler pixmapProfiler;
if (data->pixmapStatus == QQuickPixmap::Ready) {
+ pixmapProfiler.finishLoading(data->url);
data->textureFactory = de->textureFactory;
data->implicitSize = de->implicitSize;
+ if (data->implicitSize.width() > 0)
+ pixmapProfiler.setSize(url, data->implicitSize.width(), data->implicitSize.height());
} else {
+ pixmapProfiler.errorLoading(data->url);
data->errorString = de->errorString;
data->removeFromCache(); // We don't continue to cache error'd pixmaps
}
@@ -920,6 +926,7 @@ int QQuickPixmapData::cost() const
void QQuickPixmapData::addref()
{
++refCount;
+ QQmlPixmapProfiler().referenceCountChanged(url, refCount);
if (prevUnreferencedPtr)
pixmapStore()->referencePixmap(this);
}
@@ -928,6 +935,7 @@ void QQuickPixmapData::release()
{
Q_ASSERT(refCount > 0);
--refCount;
+ QQmlPixmapProfiler().referenceCountChanged(url, refCount);
if (refCount == 0) {
if (reply) {
QQuickPixmapReply *cancelReply = reply;
@@ -958,6 +966,10 @@ void QQuickPixmapData::addToCache()
QQuickPixmapKey key = { &url, &requestSize };
pixmapStore()->m_cache.insert(key, this);
inCache = true;
+ QQmlPixmapProfiler pixmapProfiler;
+ pixmapProfiler.cacheCountChanged(url, pixmapStore()->m_cache.count());
+ if (implicitSize.width() > 0)
+ pixmapProfiler.setSize(url, implicitSize.width(), implicitSize.height());
}
}
@@ -965,6 +977,7 @@ void QQuickPixmapData::removeFromCache()
{
if (inCache) {
QQuickPixmapKey key = { &url, &requestSize };
+ QQmlPixmapProfiler().cacheCountChanged(url, pixmapStore()->m_cache.count());
pixmapStore()->m_cache.remove(key);
inCache = false;
}
@@ -1238,14 +1251,21 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!(options & QQuickPixmap::Asynchronous)) {
bool ok = false;
+ QQmlPixmapProfiler pixmapProfiler;
+ pixmapProfiler.startLoading(url);
d = createPixmapDataSync(this, engine, url, requestSize, &ok);
if (ok) {
+ pixmapProfiler.finishLoading(url);
+ if (d->implicitSize.width() > 0)
+ QQmlPixmapProfiler().setSize(url, d->implicitSize.width(), d->implicitSize.height());
if (options & QQuickPixmap::Cache)
d->addToCache();
return;
}
- if (d) // loadable, but encountered error while loading
+ if (d) { // loadable, but encountered error while loading
+ pixmapProfiler.errorLoading(url);
return;
+ }
}
if (!engine)
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index c1173d70f5..ec3a2f8170 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE
See the PropertyAction documentation for more details.
- \sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, QtQml
+ \sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {Qt QML}
*/
/*!
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp
index 491146660b..c89cea6767 100644
--- a/src/quick/util/qquickstate.cpp
+++ b/src/quick/util/qquickstate.cpp
@@ -151,7 +151,7 @@ QQuickStateOperation::QQuickStateOperation(QObjectPrivate &dd, QObject *parent)
not allowed.
\sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States},
- {Animation and Transitions in Qt Quick}{Transitions}, QtQml
+ {Animation and Transitions in Qt Quick}{Transitions}, {Qt QML}
*/
QQuickState::QQuickState(QObject *parent)
: QObject(*(new QQuickStatePrivate), parent)
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index b4c8f214b9..a72a45e96b 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -119,7 +119,7 @@ public:
}
\endqml
- \sa {Qt Quick States}{Qt Quick States}, {Animation and Transitions in Qt Quick}{Transitions}, {QtQml}
+ \sa {Qt Quick States}{Qt Quick States}, {Animation and Transitions in Qt Quick}{Transitions}, {Qt QML}
*/
QQuickStateGroup::QQuickStateGroup(QObject *parent)
diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp
index 760b4b0e2f..ece6d24ee1 100644
--- a/src/quick/util/qquicksvgparser.cpp
+++ b/src/quick/util/qquicksvgparser.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
static const double Q_PI = 3.14159265358979323846; // pi
-//copied from QtSvg (qsvghandler.cpp).
+//copied from Qt SVG (qsvghandler.cpp).
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
// '0' is 0x30 and '9' is 0x39
static inline bool isDigit(ushort ch)
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index 025c7d7b03..ead28fe496 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
\l Behavior, the Transition animation overrides the \l Behavior for that
state change.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {QtQml}
+ \sa {Animation and Transitions in Qt Quick}, {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {Qt QML}
*/
//ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting
diff --git a/sync.profile b/sync.profile
index 6ddda684da..92467195f0 100644
--- a/sync.profile
+++ b/sync.profile
@@ -15,8 +15,9 @@
# Each of the module version specifiers can take one of the following values:
# - A specific Git revision.
# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
+# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch)
#
%dependencies = (
- "qtbase" => "refs/heads/dev",
- "qtxmlpatterns" => "refs/heads/dev",
+ "qtbase" => "",
+ "qtxmlpatterns" => "",
);
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index 363efeabbc..e6cbd41b8e 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -48,7 +48,7 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
-const char *NORMALMODE = "-qmljsdebugger=port:3777,block";
+const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block";
const char *QMLFILE = "test.qml";
class QQmlDebugMsgClient;
@@ -186,7 +186,8 @@ void tst_QDebugMessageService::init()
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
- m_connection->connectToHost("127.0.0.1", 3777);
+ const int port = m_process->debugPort();
+ m_connection->connectToHost("127.0.0.1", port);
QVERIFY(m_connection->waitForConnected());
if (m_client->state() != QQmlDebugClient::Enabled)
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index eb5f17a55d..d4ce36dc4a 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -22,3 +22,5 @@ OTHER_FILES += data/test.qml data/test.js \
data/breakpointRelocation.qml \
data/createComponent.qml
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG+=insignificant_test # QTBUG-28263
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9c2ba5bcde..424a3b36ac 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -53,6 +53,11 @@
#include "qqmldebugclient.h"
#include "../../../shared/util.h"
+#if defined (Q_OS_WINCE)
+#undef IN
+#undef OUT
+#endif
+
const char *V8REQUEST = "v8request";
const char *V8MESSAGE = "v8message";
const char *SEQ = "seq";
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index dd4dd003ec..1c1d84f37b 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -104,7 +104,7 @@ void tst_QQmlDebugService::checkPortRange()
QQmlDebugConnection *connection1 = new QQmlDebugConnection();
QQmlDebugProcess *process1 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
- process1->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772, 3774 ") << testFile("test.qml"));
+ process1->start(QStringList() << QLatin1String("-qmljsdebugger=port:3782,3792") << testFile("test.qml"));
if (!process1->waitForSessionStart())
QFAIL("could not launch application, or did not get 'Waiting for connection'.");
@@ -118,7 +118,7 @@ void tst_QQmlDebugService::checkPortRange()
QQmlDebugConnection *connection2 = new QQmlDebugConnection();
QQmlDebugProcess *process2 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
- process2->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772,3774") << testFile("test.qml"));
+ process2->start(QStringList() << QLatin1String("-qmljsdebugger=port:3782,3792") << testFile("test.qml"));
if (!process2->waitForSessionStart())
QFAIL("could not launch application, or did not get 'Waiting for connection'.");
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 6f99afd917..5badcaa3ae 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -52,8 +52,8 @@
#include "qqmlinspectorclient.h"
#include "qqmlenginedebugclient.h"
-#define PORT 3776
-#define STR_PORT "3776"
+#define STR_PORT_FROM "3776"
+#define STR_PORT_TO "3786"
class tst_QQmlEngineDebugInspectorIntegration : public QQmlDataTest
{
@@ -105,7 +105,7 @@ QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject(
void tst_QQmlEngineDebugInspectorIntegration::init()
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
+ const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ "/qmlscene", this);
@@ -117,7 +117,8 @@ void tst_QQmlEngineDebugInspectorIntegration::init()
m_inspectorClient = new QQmlInspectorClient(m_connection);
m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
- m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+ const int port = m_process->debugPort();
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
bool ok = m_connection->waitForConnected();
QVERIFY(ok);
}
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index f1fbdd20a9..e430875355 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -50,8 +50,8 @@
#include "../../../shared/util.h"
#include "qqmlinspectorclient.h"
-#define PORT 3772
-#define STR_PORT "3772"
+#define STR_PORT_FROM "3772"
+#define STR_PORT_TO "3782"
@@ -87,7 +87,7 @@ private slots:
void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
+ const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
@@ -97,7 +97,8 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
QQmlDebugConnection *m_connection = new QQmlDebugConnection();
m_client = new QQmlInspectorClient(m_connection);
- m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+ const int port = m_process->debugPort();
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
}
void tst_QQmlInspector::init()
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png b/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png
new file mode 100644
index 0000000000..30228cbbdc
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png
Binary files differ
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/pixmapCacheTest.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/pixmapCacheTest.qml
new file mode 100644
index 0000000000..d56786bfae
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/pixmapCacheTest.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ Image {
+ source: "TestImage_2x2.png"
+ onStatusChanged: switch (status) {
+ case 0: console.log("no image"); break;
+ case 1: console.log("image loaded"); break;
+ case 2: console.log("image loading"); break;
+ case 3: console.log("image error"); break;
+ }
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/scenegraphTest.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/scenegraphTest.qml
new file mode 100644
index 0000000000..dd9d053296
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/scenegraphTest.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ Rectangle {
+ width: 10
+ height: 10
+ color: "blue"
+ }
+
+ Component.onCompleted: timer.start();
+
+ Timer {
+ id: timer
+ interval: 100 // 100 ms, enough for at least one frame
+ running: false
+ onTriggered: console.log("tick")
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 5bff33dd25..b2b325dc72 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -12,3 +12,6 @@ TESTDATA = data/*
QT += core qml testlib gui-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+OTHER_FILES += \
+ data/pixmapCacheTest.qml
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 3a925e2905..e4f886f7ce 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -46,8 +46,8 @@
#include "qqmldebugclient.h"
#include "../../../shared/util.h"
-#define PORT 13773
-#define STR_PORT "13773"
+#define STR_PORT_FROM "13773"
+#define STR_PORT_TO "13783"
struct QQmlProfilerData
{
@@ -77,6 +77,8 @@ public:
RangeLocation,
RangeEnd,
Complete, // end of transmission
+ PixmapCacheEvent,
+ SceneGraphFrame,
MaximumMessage
};
@@ -102,6 +104,32 @@ public:
MaximumRangeType
};
+ enum PixmapEventType {
+ PixmapSizeKnown,
+ PixmapReferenceCountChanged,
+ PixmapCacheCountChanged,
+ PixmapLoadingStarted,
+ PixmapLoadingFinished,
+ PixmapLoadingError,
+
+ MaximumPixmapEventType
+ };
+
+ enum SceneGraphFrameType {
+ SceneGraphRendererFrame,
+ SceneGraphAdaptationLayerFrame,
+ SceneGraphContextFrame,
+ SceneGraphRenderLoopFrame,
+ SceneGraphTexturePrepare,
+ SceneGraphTextureDeletion,
+ SceneGraphPolishAndSync,
+ SceneGraphWindowsRenderShow,
+ SceneGraphWindowsAnimations,
+ SceneGraphWindowsPolishFrame,
+
+ MaximumSceneGraphFrameType
+ };
+
QQmlProfilerClient(QQmlDebugConnection *connection)
: QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection)
{
@@ -135,6 +163,7 @@ public:
{
}
+
private:
QQmlDebugProcess *m_process;
QQmlDebugConnection *m_connection;
@@ -148,6 +177,8 @@ private slots:
void blockingConnectWithTraceEnabled();
void blockingConnectWithTraceDisabled();
void nonBlockingConnect();
+ void pixmapCacheData();
+ void scenegraphData();
void profileOnExit();
};
@@ -219,6 +250,44 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
QVERIFY(data.line >= -2);
break;
}
+ case QQmlProfilerClient::PixmapCacheEvent: {
+ stream >> data.detailType >> data.detailData;
+ if (data.detailType == QQmlProfilerClient::PixmapSizeKnown)
+ stream >> data.line >> data.column;
+ if (data.detailType == QQmlProfilerClient::PixmapReferenceCountChanged)
+ stream >> data.animationcount;
+ if (data.detailType == QQmlProfilerClient::PixmapCacheCountChanged)
+ stream >> data.animationcount;
+ break;
+ }
+ case QQmlProfilerClient::SceneGraphFrame: {
+ stream >> data.detailType;
+ qint64 subtime_1, subtime_2, subtime_3, subtime_4, subtime_5;
+ int glyphCount;
+ switch (data.detailType) {
+ // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
+ case QQmlProfilerClient::SceneGraphRendererFrame: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4; break;
+ // AdaptationLayerFrame: glyphCount, glyphRenderTime, glyphStoreTime
+ case QQmlProfilerClient::SceneGraphAdaptationLayerFrame: stream >> glyphCount >> subtime_2 >> subtime_3; break;
+ // ContextFrame: compiling material time
+ case QQmlProfilerClient::SceneGraphContextFrame: stream >> subtime_1; break;
+ // RenderLoop: syncTime, renderTime, swapTime
+ case QQmlProfilerClient::SceneGraphRenderLoopFrame: stream >> subtime_1 >> subtime_2 >> subtime_3; break;
+ // TexturePrepare: bind, convert, swizzle, upload, mipmap
+ case QQmlProfilerClient::SceneGraphTexturePrepare: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4 >> subtime_5; break;
+ // TextureDeletion: deletionTime
+ case QQmlProfilerClient::SceneGraphTextureDeletion: stream >> subtime_1; break;
+ // PolishAndSync: polishTime, waitTime, syncTime, animationsTime,
+ case QQmlProfilerClient::SceneGraphPolishAndSync: stream >> subtime_1 >> subtime_2 >> subtime_3 >> subtime_4; break;
+ // WindowsRenderLoop: GL time, make current time, SceneGraph time
+ case QQmlProfilerClient::SceneGraphWindowsRenderShow: stream >> subtime_1 >> subtime_2 >> subtime_3; break;
+ // WindowsAnimations: update time
+ case QQmlProfilerClient::SceneGraphWindowsAnimations: stream >> subtime_1; break;
+ // WindowsRenderWindow: polish time
+ case QQmlProfilerClient::SceneGraphWindowsPolishFrame: stream >> subtime_1; break;
+ }
+ break;
+ }
default:
QString failMsg = QString("Unknown message type:") + data.messageType;
QFAIL(qPrintable(failMsg));
@@ -234,9 +303,9 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
QStringList arguments;
if (block)
- arguments << QString("-qmljsdebugger=port:" STR_PORT ",block");
+ arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
else
- arguments << QString("-qmljsdebugger=port:" STR_PORT);
+ arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO );
arguments << QQmlDataTest::instance()->testFile(testFile);
@@ -247,7 +316,8 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
QQmlDebugConnection *m_connection = new QQmlDebugConnection();
m_client = new QQmlProfilerClient(m_connection);
- m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+ const int port = m_process->debugPort();
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
}
void tst_QQmlProfilerService::cleanup()
@@ -319,6 +389,84 @@ void tst_QQmlProfilerService::nonBlockingConnect()
QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
+void tst_QQmlProfilerService::pixmapCacheData()
+{
+ connect(true, "pixmapCacheTest.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
+
+ QVERIFY(m_process->output().indexOf(QLatin1String("image loaded")) != -1 ||
+ m_process->output().indexOf(QLatin1String("image error")) != -1 );
+
+
+ m_client->setTraceState(false);
+
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+ QVERIFY(m_client->traceMessages.count());
+
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ // image starting to load
+ QCOMPARE(m_client->traceMessages[8].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
+ QCOMPARE(m_client->traceMessages[8].detailType, (int)QQmlProfilerClient::PixmapLoadingStarted);
+
+ // image loaded
+ QCOMPARE(m_client->traceMessages[9].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
+ QCOMPARE(m_client->traceMessages[9].detailType, (int)QQmlProfilerClient::PixmapLoadingFinished);
+
+ // image size
+ QCOMPARE(m_client->traceMessages[10].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
+ QCOMPARE(m_client->traceMessages[10].detailType, (int)QQmlProfilerClient::PixmapSizeKnown);
+ QCOMPARE(m_client->traceMessages[10].line, 2); // width
+ QCOMPARE(m_client->traceMessages[10].column, 2); // height
+
+ // cache size
+ QCOMPARE(m_client->traceMessages[11].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
+ QCOMPARE(m_client->traceMessages[11].detailType, (int)QQmlProfilerClient::PixmapCacheCountChanged);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+
+}
+
+void tst_QQmlProfilerService::scenegraphData()
+{
+ connect(true, "scenegraphTest.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
+ QVERIFY(m_process->output().indexOf(QLatin1String("tick")) != -1);
+ m_client->setTraceState(false);
+
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+ QVERIFY(m_client->traceMessages.count());
+
+ // check that at least one frame was rendered
+ // there should be a SGPolishAndSync + SGRendererFrame + SGRenderLoopFrame sequence
+ // since the rendering happens in a different thread, there could be other unrelated events interleaved
+ int loopcheck = 0;
+ foreach (const QQmlProfilerData &msg, m_client->traceMessages) {
+ if (msg.messageType == QQmlProfilerClient::SceneGraphFrame) {
+ if (loopcheck == 0 && msg.detailType == QQmlProfilerClient::SceneGraphContextFrame)
+ loopcheck = 1;
+ else
+ if (loopcheck == 1 && msg.detailType == QQmlProfilerClient::SceneGraphRendererFrame)
+ loopcheck = 2;
+ else
+ if (loopcheck == 2 && msg.detailType == QQmlProfilerClient::SceneGraphRenderLoopFrame)
+ loopcheck = 3;
+ }
+ }
+
+ QCOMPARE(loopcheck, 3);
+}
+
void tst_QQmlProfilerService::profileOnExit()
{
connect(true, "exit.qml");
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 6585f7eca2..ff3140f520 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -182,6 +182,8 @@ void QQmlDebugProcess::processAppOutput()
{
m_mutex.lock();
+ bool outputFromAppItself = false;
+
QString newOutput = m_process.readAll();
m_output.append(newOutput);
m_outputBuffer.append(newOutput);
@@ -208,7 +210,13 @@ void QQmlDebugProcess::processAppOutput()
m_eventLoop.quit();
continue;
}
+ } else {
+ // set to true if there is output not coming from the debugger
+ outputFromAppItself = true;
}
}
m_mutex.unlock();
+
+ if (outputFromAppItself)
+ emit readyReadStandardOutput();
}
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 2b9a94366a..11b16a1fb8 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -57,7 +57,7 @@
class QQmlDebugTest
{
public:
- static bool waitForSignal(QObject *receiver, const char *member, int timeout = 10000);
+ static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
};
class QQmlDebugTestClient : public QQmlDebugClient
@@ -98,6 +98,9 @@ public:
QString output() const;
void stop();
+signals:
+ void readyReadStandardOutput();
+
private slots:
void timeout();
void processAppOutput();
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 5e3d78d39b..7c9f5b106c 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -2554,7 +2554,7 @@ void tst_QJSEngine::qRegExpInport()
}
// QScriptValue::toDateTime() returns a local time, whereas JS dates
-// are always stored as UTC. QtScript must respect the current time
+// are always stored as UTC. Qt Script must respect the current time
// zone, and correctly adjust for daylight saving time that may be in
// effect at a given date (QTBUG-9770).
void tst_QJSEngine::dateRoundtripJSQtJS()
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index b080a824cf..371d47ba32 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -69,3 +69,7 @@ SUBDIRS += debugger
contains(QT_CONFIG, private_tests) {
SUBDIRS += $$PRIVATETESTS
}
+
+qtNomakeTools( \
+ qmlplugindump \
+)
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
index a69dce7ec3..e513861bdf 100644
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -169,7 +169,7 @@ bool tst_qmlmin::isInvalidFile(const QFileInfo &fileName) const
}
/*
-This test runs all the examples in the QtQml UI source tree and ensures
+This test runs all the examples in the Qt QML UI source tree and ensures
that they start and exit cleanly.
Examples are any .qml files under the examples/ directory that start
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
index 6aca47656b..d9a370b200 100644
--- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
@@ -68,9 +68,7 @@ void tst_qmlplugindump::initTestCase()
{
qmlplugindumpPath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
-#if defined(Q_OS_MAC)
- qmlplugindumpPath += QLatin1String("/qmlplugindump.app/Contents/MacOS/qmlplugindump");
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
qmlplugindumpPath += QLatin1String("/qmlplugindump.exe");
#else
qmlplugindumpPath += QLatin1String("/qmlplugindump");
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index 1c11fcbc73..4780ee0310 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -110,13 +110,11 @@ void tst_qqmlapplicationengine::application()
*/
QDir::setCurrent(buildDir);
QProcess *testProcess = new QProcess(this);
- QTest::ignoreMessage(QtWarningMsg, "Don't know how to handle 'QProcess::ExitStatus', use qRegisterMetaType to register it.");
- QSignalSpy processFinished(testProcess, SIGNAL(finished(int,QProcess::ExitStatus)));
QStringList args;
args << QLatin1String("testData");
testProcess->start(QLatin1String("testapp/testapp"), args);
- QTRY_VERIFY(processFinished.count());//Application should immediately exit
- QCOMPARE(processFinished[0][0].toInt(), 0);
+ QVERIFY(testProcess->waitForFinished(5000));
+ QCOMPARE(testProcess->exitCode(), 0);
QByteArray test_stdout = testProcess->readAllStandardOutput();
QByteArray test_stderr = testProcess->readAllStandardError();
QByteArray test_stderr_target("Start: testData\nEnd\n");
diff --git a/tests/auto/qml/qqmlcomponent/data/createWindow.qml b/tests/auto/qml/qqmlcomponent/data/createWindow.qml
new file mode 100644
index 0000000000..af0b7edeb2
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/createWindow.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.1
+import QtQuick.Window 2.1
+
+Window {
+ id: window1;
+ objectName: "window1";
+ color: "#00FF00";
+ width: 100; height: 100;
+ Item {
+ objectName: "item1"
+ width: 100; height: 100;
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent;
+ onPressed: window2.requestActivate();
+ }
+ Component.onCompleted: window2.show();
+ }
+
+ Window {
+ id: window2;
+ objectName: "window2";
+ color: "#FF0000";
+ width: 100; height: 100;
+ Item {
+ width: 100; height: 100;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index 697c8103b0..9eeff66e7a 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -105,6 +105,7 @@ public:
private slots:
void null();
void loadEmptyUrl();
+ void qmlCreateWindow();
void qmlCreateObject();
void qmlCreateObjectWithProperties();
void qmlIncubateObject();
@@ -163,6 +164,15 @@ void tst_qqmlcomponent::qmlIncubateObject()
delete object;
}
+void tst_qqmlcomponent::qmlCreateWindow()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("createWindow.qml"));
+ QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window);
+}
+
void tst_qqmlcomponent::qmlCreateObject()
{
QQmlEngine engine;
diff --git a/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent.qml b/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent.qml
new file mode 100644
index 0000000000..1432e7da55
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQml 2.0
+
+MyDeferredObject {
+ id: root
+ property QtObject target: null
+ objectProperty: MyQmlObject {
+ value: target.value
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent2.qml b/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent2.qml
new file mode 100644
index 0000000000..de73629f7a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/MyDeferredComponent2.qml
@@ -0,0 +1,3 @@
+import Qt.test 1.0
+
+MyDeferredObject {}
diff --git a/tests/auto/qml/qqmlecmascript/data/deferredPropertiesInComponents.qml b/tests/auto/qml/qqmlecmascript/data/deferredPropertiesInComponents.qml
new file mode 100644
index 0000000000..868b7b1908
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deferredPropertiesInComponents.qml
@@ -0,0 +1,15 @@
+import Qt.test 1.0
+import QtQml 2.0
+
+QtObject {
+ id: root
+ property int value: 10
+ property QtObject deferredInside: MyDeferredComponent {
+ target: root
+ }
+ property QtObject deferredOutside: MyDeferredComponent2 {
+ objectProperty: MyQmlObject {
+ value: root.value
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index dcf72f9dc0..cb1b0b3212 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -89,6 +89,7 @@ private slots:
void objectPropertiesTriggerReeval();
void deferredProperties();
void deferredPropertiesErrors();
+ void deferredPropertiesInComponents();
void extensionObjects();
void overrideExtensionProperties();
void attachedProperties();
@@ -863,6 +864,37 @@ void tst_qqmlecmascript::deferredPropertiesErrors()
delete object;
}
+void tst_qqmlecmascript::deferredPropertiesInComponents()
+{
+ // Test that it works when the property is set inside and outside component
+ QQmlComponent component(&engine, testFileUrl("deferredPropertiesInComponents.qml"));
+ QObject *object = component.create();
+ if (!object)
+ qDebug() << component.errorString();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").value<int>(), 10);
+
+ MyDeferredObject *defObjectA =
+ qobject_cast<MyDeferredObject *>(object->property("deferredInside").value<QObject*>());
+ QVERIFY(defObjectA != 0);
+ QVERIFY(defObjectA->objectProperty() == 0);
+
+ qmlExecuteDeferred(defObjectA);
+ QVERIFY(defObjectA->objectProperty() != 0);
+ QCOMPARE(defObjectA->objectProperty()->property("value").value<int>(), 10);
+
+ MyDeferredObject *defObjectB =
+ qobject_cast<MyDeferredObject *>(object->property("deferredOutside").value<QObject*>());
+ QVERIFY(defObjectB != 0);
+ QVERIFY(defObjectB->objectProperty() == 0);
+
+ qmlExecuteDeferred(defObjectB);
+ QVERIFY(defObjectB->objectProperty() != 0);
+ QCOMPARE(defObjectB->objectProperty()->property("value").value<int>(), 10);
+
+ delete object;
+}
+
void tst_qqmlecmascript::extensionObjects()
{
QQmlComponent component(&engine, testFileUrl("extensionObjects.qml"));
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/qmldir/Intercepted.qml
new file mode 100644
index 0000000000..0331a01ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/Intercepted.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted.js
new file mode 100644
index 0000000000..6f54ebcdc5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted.js
@@ -0,0 +1 @@
+var myStr = "base file"
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted.qml
new file mode 100644
index 0000000000..ef5c28f87b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+ property Intercepted2 compilationIsTest: Intercepted2{}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted2.qml b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted2.qml
new file mode 100644
index 0000000000..0331a01ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/Intercepted2.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/intercepted.js
new file mode 100644
index 0000000000..6eeee6e72f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/intercepted.js
@@ -0,0 +1 @@
+var myStr = "intercepted"
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/urlInterceptor.qml
new file mode 100644
index 0000000000..bd4aee056a
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/intercepted/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "FailsTest"
+ property url resolvedUrl: Qt.resolvedUrl("FailsTest");
+ property url absoluteUrl: Qt.resolvedUrl("file:///FailsTest");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/qmldir/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/qmldir/urlInterceptor.qml
new file mode 100644
index 0000000000..22a09e5522
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/qmldir/urlInterceptor.qml
@@ -0,0 +1,12 @@
+import QtQml 2.0
+import "."
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "doesNotExist.file"
+ property url resolvedUrl: Qt.resolvedUrl("doesNotExist.file");
+ property url absoluteUrl: Qt.resolvedUrl("file:///doesNotExist.file");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/strings/Intercepted.qml
new file mode 100644
index 0000000000..449207e0e3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/Intercepted.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "base file"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted.js
new file mode 100644
index 0000000000..6f54ebcdc5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted.js
@@ -0,0 +1 @@
+var myStr = "base file"
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/Intercepted.qml
new file mode 100644
index 0000000000..0331a01ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/Intercepted.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/intercepted.js
new file mode 100644
index 0000000000..6eeee6e72f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/intercepted.js
@@ -0,0 +1 @@
+var myStr = "intercepted"
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/urlInterceptor.qml
new file mode 100644
index 0000000000..bd4aee056a
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/intercepted/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "FailsTest"
+ property url resolvedUrl: Qt.resolvedUrl("FailsTest");
+ property url absoluteUrl: Qt.resolvedUrl("file:///FailsTest");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/strings/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/strings/urlInterceptor.qml
new file mode 100644
index 0000000000..be86195bd8
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/strings/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "doesNotExist.file"
+ property url resolvedUrl: Qt.resolvedUrl("doesNotExist.file");
+ property url absoluteUrl: Qt.resolvedUrl("file:///doesNotExist.file");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/types/Intercepted.qml
new file mode 100644
index 0000000000..449207e0e3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/Intercepted.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "base file"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/Intercepted2.qml b/tests/auto/qml/qqmlengine/data/interception/types/Intercepted2.qml
new file mode 100644
index 0000000000..0331a01ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/Intercepted2.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/types/intercepted.js
new file mode 100644
index 0000000000..6f54ebcdc5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/intercepted.js
@@ -0,0 +1 @@
+var myStr = "base file"
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted.qml
new file mode 100644
index 0000000000..ef5c28f87b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+ property Intercepted2 compilationIsTest: Intercepted2{}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted2.qml b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted2.qml
new file mode 100644
index 0000000000..0331a01ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/Intercepted2.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "intercepted"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/intercepted/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/intercepted.js
new file mode 100644
index 0000000000..6eeee6e72f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/intercepted.js
@@ -0,0 +1 @@
+var myStr = "intercepted"
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/intercepted/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/urlInterceptor.qml
new file mode 100644
index 0000000000..be86195bd8
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/intercepted/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "doesNotExist.file"
+ property url resolvedUrl: Qt.resolvedUrl("doesNotExist.file");
+ property url absoluteUrl: Qt.resolvedUrl("file:///doesNotExist.file");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/types/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/types/urlInterceptor.qml
new file mode 100644
index 0000000000..bd4aee056a
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/types/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "FailsTest"
+ property url resolvedUrl: Qt.resolvedUrl("FailsTest");
+ property url absoluteUrl: Qt.resolvedUrl("file:///FailsTest");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index 9177ff58f7..d604118b58 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -54,6 +54,7 @@
#include <QQmlExpression>
#include <QQmlIncubationController>
#include <private/qqmlengine_p.h>
+#include <private/qqmlabstracturlinterceptor_p.h>
class tst_qqmlengine : public QQmlDataTest
{
@@ -79,6 +80,8 @@ private slots:
void multipleEngines();
void qtqmlModule_data();
void qtqmlModule();
+ void urlInterceptor_data();
+ void urlInterceptor();
public slots:
QObject *createAQObjectForOwnershipTest ()
@@ -674,6 +677,99 @@ void tst_qqmlengine::qtqmlModule()
}
}
+class CustomSelector : public QQmlAbstractUrlInterceptor
+{
+public:
+ virtual QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType d)
+ {
+ if (url.scheme() != QStringLiteral("file"))
+ return url;
+ if (!m_interceptionPoints.contains(d))
+ return url;
+
+ QString alteredPath = url.path();
+ int a = alteredPath.lastIndexOf('/');
+ if (a < 0)
+ a = 0;
+ alteredPath.insert(a, QStringLiteral("/intercepted"));
+
+ QUrl ret = url;
+ ret.setPath(alteredPath);
+ return ret;
+ }
+ QList<QQmlAbstractUrlInterceptor::DataType> m_interceptionPoints;
+};
+
+Q_DECLARE_METATYPE(QList<QQmlAbstractUrlInterceptor::DataType>);
+void tst_qqmlengine::urlInterceptor_data()
+{
+ QTest::addColumn<QUrl>("testFile");
+ QTest::addColumn<QList<QQmlAbstractUrlInterceptor::DataType> >("interceptionPoint");
+ QTest::addColumn<QString>("expectedFilePath");
+ QTest::addColumn<QString>("expectedChildString");
+ QTest::addColumn<QString>("expectedScriptString");
+ QTest::addColumn<QString>("expectedResolvedUrl");
+ QTest::addColumn<QString>("expectedAbsoluteUrl");
+
+ QTest::newRow("InterceptTypes")
+ << testFileUrl("interception/types/urlInterceptor.qml")
+ << (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::QmlFile << QQmlAbstractUrlInterceptor::JavaScriptFile << QQmlAbstractUrlInterceptor::UrlString)
+ << testFileUrl("interception/types/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("intercepted")
+ << QStringLiteral("intercepted")
+ << testFileUrl("interception/types/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("file:///intercepted/doesNotExist.file");
+
+ QTest::newRow("InterceptQmlDir")
+ << testFileUrl("interception/qmldir/urlInterceptor.qml")
+ << (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::QmldirFile << QQmlAbstractUrlInterceptor::UrlString)
+ << testFileUrl("interception/qmldir/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("intercepted")
+ << QStringLiteral("base file")
+ << testFileUrl("interception/qmldir/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("file:///intercepted/doesNotExist.file");
+
+ QTest::newRow("InterceptStrings")
+ << testFileUrl("interception/strings/urlInterceptor.qml")
+ << (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::UrlString)
+ << testFileUrl("interception/strings/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("base file")
+ << QStringLiteral("base file")
+ << testFileUrl("interception/strings/intercepted/doesNotExist.file").toString()
+ << QStringLiteral("file:///intercepted/doesNotExist.file");
+}
+
+void tst_qqmlengine::urlInterceptor()
+{
+
+ QFETCH(QUrl, testFile);
+ QFETCH(QList<QQmlAbstractUrlInterceptor::DataType>, interceptionPoint);
+ QFETCH(QString, expectedFilePath);
+ QFETCH(QString, expectedChildString);
+ QFETCH(QString, expectedScriptString);
+ QFETCH(QString, expectedResolvedUrl);
+ QFETCH(QString, expectedAbsoluteUrl);
+
+ QQmlEngine e;
+ CustomSelector cs;
+ cs.m_interceptionPoints = interceptionPoint;
+ e.setUrlInterceptor(&cs);
+ QQmlComponent c(&e, testFile); //Note that this can get intercepted too
+ QObject *o = c.create();
+ if (!o)
+ qDebug() << c.errorString();
+ QVERIFY(o);
+ //Test a URL as a property initialization
+ QCOMPARE(o->property("filePath").toString(), expectedFilePath);
+ //Test a URL as a Type location
+ QCOMPARE(o->property("childString").toString(), expectedChildString);
+ //Test a URL as a Script location
+ QCOMPARE(o->property("scriptString").toString(), expectedScriptString);
+ //Test a URL as a resolveUrl() call
+ QCOMPARE(o->property("resolvedUrl").toString(), expectedResolvedUrl);
+ QCOMPARE(o->property("absoluteUrl").toString(), expectedAbsoluteUrl);
+}
+
QTEST_MAIN(tst_qqmlengine)
#include "tst_qqmlengine.moc"
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 1a82bacfb2..29c4463471 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -242,6 +242,7 @@ private:
void tst_qqmllanguage::cleanupTestCase()
{
QVERIFY(QFile::remove(testFile(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml"))));
+ qmlClearTypeRegistrations(); // Should not crash
}
void tst_qqmllanguage::insertedSemicolon_data()
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 327716f1b5..ca212d333b 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -66,6 +66,8 @@ private slots:
void crashBug();
void QTBUG_17868();
void metaObjectAccessibility();
+ void QTBUG_31226();
+ void QTBUG_29836();
};
void tst_QQmlPropertyMap::insert()
@@ -286,13 +288,17 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap
{
Q_OBJECT
public:
- MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0) {}
+ MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0), m_testSlotCalled(false) {}
+ bool testSlotCalled() const { return m_testSlotCalled; }
signals:
void testSignal();
public slots:
- void testSlot() {}
+ void testSlot() { m_testSlotCalled = true; }
+
+private:
+ bool m_testSlotCalled;
};
void tst_QQmlPropertyMap::metaObjectAccessibility()
@@ -312,6 +318,57 @@ void tst_QQmlPropertyMap::metaObjectAccessibility()
QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
+void tst_QQmlPropertyMap::QTBUG_31226()
+{
+ /* Instantiate a property map from QML, and verify that property changes
+ * made from C++ are visible from QML */
+ QQmlEngine engine;
+ QQmlContext context(&engine);
+ qmlRegisterType<QQmlPropertyMap>("QTBUG_31226", 1, 0, "PropertyMap");
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0\nimport QTBUG_31226 1.0\n"
+ "Item {\n"
+ " property string myProp\n"
+ " PropertyMap { id: qmlPropertyMap; objectName: \"qmlPropertyMap\" }\n"
+ " Timer { interval: 5; running: true; onTriggered: { myProp = qmlPropertyMap.greeting; } }\n"
+ "}",
+ QUrl());
+ QObject *obj = c.create(&context);
+ QVERIFY(obj);
+
+ QQmlPropertyMap *qmlPropertyMap = obj->findChild<QQmlPropertyMap*>(QString("qmlPropertyMap"));
+ QVERIFY(qmlPropertyMap);
+
+ qmlPropertyMap->insert("greeting", QString("Hello world!"));
+ QTRY_COMPARE(obj->property("myProp").toString(), QString("Hello world!"));
+
+ delete obj;
+
+}
+
+void tst_QQmlPropertyMap::QTBUG_29836()
+{
+ MyEnhancedPropertyMap map;
+ QCOMPARE(map.testSlotCalled(), false);
+
+ QQmlEngine engine;
+ QQmlContext context(&engine);
+ context.setContextProperty("enhancedMap", &map);
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0\n"
+ "Item {\n"
+ " Timer { interval: 5; running: true; onTriggered: enhancedMap.testSlot() }\n"
+ "}",
+ QUrl());
+ QObject *obj = c.create(&context);
+ QVERIFY(obj);
+
+ QTRY_COMPARE(map.testSlotCalled(), true);
+
+ delete obj;
+
+}
+
QTEST_MAIN(tst_QQmlPropertyMap)
#include "tst_qqmlpropertymap.moc"
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/showDotAndDotDot.qml b/tests/auto/qml/qquickfolderlistmodel/data/showDotAndDotDot.qml
new file mode 100644
index 0000000000..b65ace2f78
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/showDotAndDotDot.qml
@@ -0,0 +1,5 @@
+import Qt.labs.folderlistmodel 1.0
+
+FolderListModel {
+ showDotAndDotDot: false
+}
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
index a8bb887158..b845faca7d 100644
--- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
+++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
@@ -73,9 +73,12 @@ private slots:
void basicProperties();
void resetFiltering();
void refresh();
-#if defined (Q_OS_WIN)
+#if defined (Q_OS_WIN) && !defined (Q_OS_WINCE)
+ // WinCE does not have drive concept, so lets execute this test only on desktop Windows.
void changeDrive();
#endif
+ void showDotAndDotDot();
+ void showDotAndDotDot_data();
private:
void checkNoErrors(const QQmlComponent& component);
@@ -112,7 +115,7 @@ void tst_qquickfolderlistmodel::basicProperties()
QVERIFY(flm != 0);
flm->setProperty("folder", dataDirectoryUrl());
- QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(),5); // wait for refresh
QCOMPARE(flm->property("folder").toUrl(), dataDirectoryUrl());
QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(directory()).canonicalPath()));
QCOMPARE(flm->property("sortField").toInt(), int(Name));
@@ -168,7 +171,7 @@ void tst_qquickfolderlistmodel::refresh()
QVERIFY(flm != 0);
flm->setProperty("folder", dataDirectoryUrl());
- QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(),5); // wait for refresh
int count = flm->rowCount();
@@ -181,7 +184,7 @@ void tst_qquickfolderlistmodel::refresh()
QTRY_COMPARE(removeEnd, count-1); // wait for refresh
}
-#if defined (Q_OS_WIN)
+#if defined (Q_OS_WIN) && !defined (Q_OS_WINCE)
void tst_qquickfolderlistmodel::changeDrive()
{
QSKIP("QTBUG-26728");
@@ -227,6 +230,49 @@ void tst_qquickfolderlistmodel::changeDrive()
}
#endif
+void tst_qquickfolderlistmodel::showDotAndDotDot()
+{
+ QFETCH(QUrl, folder);
+ QFETCH(QUrl, rootFolder);
+ QFETCH(bool, showDotAndDotDot);
+ QFETCH(bool, showDot);
+ QFETCH(bool, showDotDot);
+
+ QQmlComponent component(&engine, testFileUrl("showDotAndDotDot.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ flm->setProperty("folder", folder);
+ flm->setProperty("rootFolder", rootFolder);
+ flm->setProperty("showDotAndDotDot", showDotAndDotDot);
+
+ int count = 5;
+ if (showDot) count++;
+ if (showDotDot) count++;
+ QTRY_COMPARE(flm->property("count").toInt(), count); // wait for refresh
+
+ if (showDot)
+ QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("."));
+ if (showDotDot)
+ QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String(".."));
+}
+
+void tst_qquickfolderlistmodel::showDotAndDotDot_data()
+{
+ QTest::addColumn<QUrl>("folder");
+ QTest::addColumn<QUrl>("rootFolder");
+ QTest::addColumn<bool>("showDotAndDotDot");
+ QTest::addColumn<bool>("showDot");
+ QTest::addColumn<bool>("showDotDot");
+
+ QTest::newRow("false") << dataDirectoryUrl() << QUrl() << false << false << false;
+ QTest::newRow("true") << dataDirectoryUrl() << QUrl() << true << true << true;
+ QTest::newRow("true but root") << dataDirectoryUrl() << dataDirectoryUrl() << true << true << false;
+
+}
+
QTEST_MAIN(tst_qquickfolderlistmodel)
#include "tst_qquickfolderlistmodel.moc"
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
index 9d74e32383..1530ce83e2 100644
--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -138,7 +138,7 @@ void tst_QQuickWorkerScript::messaging_data()
QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c"));
QTest::newRow("date time") << qVariantFromValue(QDateTime::currentDateTime());
#ifndef QT_NO_REGEXP
- // QtScript's QScriptValue -> QRegExp uses RegExp2 pattern syntax
+ // Qt Script's QScriptValue -> QRegExp uses RegExp2 pattern syntax
QTest::newRow("regexp") << qVariantFromValue(QRegExp("^\\d\\d?$", Qt::CaseInsensitive, QRegExp::RegExp2));
#endif
}
diff --git a/tests/auto/qmldevtools/compile/compile.pro b/tests/auto/qmldevtools/compile/compile.pro
index 1c65daf909..0ed113a031 100644
--- a/tests/auto/qmldevtools/compile/compile.pro
+++ b/tests/auto/qmldevtools/compile/compile.pro
@@ -1,9 +1,12 @@
option(host_build)
TARGET = tst_compile
-force_bootstrap: \
+force_bootstrap {
QT = bootstrap-private
-else: \
+ !build_pass: CONFIG += release
+} else {
QT = core
+ !build_pass:contains(QT_CONFIG, build_all): CONFIG += release
+}
QT += qmldevtools-private
macx:CONFIG -= app_bundle
diff --git a/tests/auto/qmltest/fontloader/tst_fontloader.qml b/tests/auto/qmltest/fontloader/tst_fontloader.qml
index 4d79a170f3..33307a3702 100644
--- a/tests/auto/qmltest/fontloader/tst_fontloader.qml
+++ b/tests/auto/qmltest/fontloader/tst_fontloader.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick 2.1
import QtTest 1.0
Item {
@@ -63,34 +63,37 @@ Item {
name: "FontLoader"
function test_fontloading() {
+ if (Qt.platform.os === "mac")
+ skip("Skipped for QTBUG-25306")
+
compare(fontloader.status, FontLoader.Null)
compare(testinput.font.family, "")
fontloader.source = "tarzeau_ocr_a.ttf";
- tryCompare(fontloader.status, FontLoader.Loading)
- tryCompare(fontloader.status, FontLoader.Ready)
+ tryCompare(fontloader, 'status', FontLoader.Ready)
compare(testinput.font.family, "OCRA")
fontloader.source = "dummy.ttf";
- tryCompare(fontloader.status, FontLoader.Error)
+ tryCompare(fontloader, 'status', FontLoader.Error)
compare(testinput.font.family, "")
fontloader.source = "";
fontloader.name = "Courier";
- tryCompare(fontloader.status, FontLoader.Ready)
+ tryCompare(fontloader, 'status', FontLoader.Ready)
compare(testinput.font.family, "Courier")
}
function test_fontswitching() {
+ if (Qt.platform.os === "mac")
+ skip("Skipped for QTBUG-25306")
+
compare(fontswitch.status, FontLoader.Null)
fontswitch.source = "tarzeau_ocr_a.ttf";
- tryCompare(fontswitch.status, FontLoader.Loading)
- tryCompare(fontswitch.status, FontLoader.Ready)
- tryCompare(fontswitch.name, "OCRA")
+ tryCompare(fontswitch, 'status', FontLoader.Ready)
+ compare(fontswitch.name, "OCRA")
fontswitch.source = "";
fontswitch.name = "Courier";
- tryCompare(fontswitch.status, FontLoader.Ready)
- tryCompare(fontswitch.name, "Courier")
+ tryCompare(fontswitch, 'status', FontLoader.Ready)
+ compare(fontswitch.name, "Courier")
fontswitch.source = "tarzeau_ocr_a.ttf";
- tryCompare(fontswitch.status, FontLoader.Loading)
- tryCompare(fontswitch.status, FontLoader.Ready)
+ tryCompare(fontswitch, 'status', FontLoader.Ready)
compare(fontswitch.name, "OCRA")
}
}
diff --git a/tests/auto/qmltest/listmodel/tst_listmodel.qml b/tests/auto/qmltest/listmodel/tst_listmodel.qml
index a975691462..603993a092 100644
--- a/tests/auto/qmltest/listmodel/tst_listmodel.qml
+++ b/tests/auto/qmltest/listmodel/tst_listmodel.qml
@@ -95,28 +95,28 @@ Item {
}
function test_altermodeled() {
- tryCompare(altermodel.count, 2)
+ tryCompare(altermodel, 'count', 2)
compare(altermodel.get(0).name, "AlterModelElement0")
compare(altermodel.get(1).name, "AlterModelElement1")
altermodel.append({"name":"AlterModelElement2"})
- tryCompare(altermodel.count, 3)
+ tryCompare(altermodel, 'count', 3)
compare(altermodel.get(0).name, "AlterModelElement0")
compare(altermodel.get(1).name, "AlterModelElement1")
compare(altermodel.get(2).name, "AlterModelElement2")
altermodel.insert(2,{"name":"AlterModelElement1.5"})
- tryCompare(altermodel.count, 4)
+ tryCompare(altermodel, 'count', 4)
compare(altermodel.get(0).name, "AlterModelElement0")
compare(altermodel.get(1).name, "AlterModelElement1")
compare(altermodel.get(2).name, "AlterModelElement1.5")
compare(altermodel.get(3).name, "AlterModelElement2")
- tryCompare(altermodel.count, 4)
+ tryCompare(altermodel, 'count', 4)
altermodel.move(2,1,1);
compare(altermodel.get(0).name, "AlterModelElement0")
compare(altermodel.get(1).name, "AlterModelElement1.5")
compare(altermodel.get(2).name, "AlterModelElement1")
compare(altermodel.get(3).name, "AlterModelElement2")
altermodel.remove(1,2)
- tryCompare(altermodel.count, 2)
+ tryCompare(altermodel, 'count', 2)
compare(altermodel.get(0).name, "AlterModelElement0")
compare(altermodel.get(1).name, "AlterModelElement2")
altermodel.set(1,{"name":"AlterModelElement1"})
@@ -125,7 +125,7 @@ Item {
altermodel.setProperty(0, "name", "AlteredProperty")
compare(altermodel.get(0).name, "AlteredProperty")
altermodel.clear()
- tryCompare(altermodel.count, 0)
+ tryCompare(altermodel, 'count', 0)
compare(altermodel.get(0), undefined)
}
}
diff --git a/src/quick/doc/snippets/qml/usecases/styling-text.qml b/tests/auto/qmltest/listview/data/asynclistviewloader.qml
index 0c68a11ad6..f7a55ff055 100644
--- a/src/quick/doc/snippets/qml/usecases/styling-text.qml
+++ b/tests/auto/qmltest/listview/data/asynclistviewloader.qml
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,36 +38,42 @@
**
****************************************************************************/
-//![0]
import QtQuick 2.0
-Item {
+ListView {
id: root
- width: 480
- height: 320
-
- Rectangle {
- color: "#272822"
- width: 480
- height: 320
+ width: 360
+ height: 360
+ cacheBuffer: 100000
+ model: ListModel {
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
+ ListElement { component: "asyncloadercurrentindex.qml" }
}
-//![texts]
- Column {
- spacing: 20
-
- MyText { text: 'I am the very model of a modern major general!' }
+ interactive: false
+ orientation: ListView.Horizontal
- MyText { text: 'I\'ve information vegetable, animal and mineral.' }
+ currentIndex: 0
- MyText {
- width: root.width
- wrapMode: Text.WordWrap
- text: 'I know the kings of England and I quote the fights historical:'
- }
+ delegate: Loader {
+ width: root.width
+ height: root.height
- MyText { text: 'From Marathon to Waterloo in order categorical.' }
+ source: component
+ asynchronous: true
}
-//![texts]
}
-//![0]
diff --git a/src/qml/doc/snippets/qml/folderlistmodel.qml b/tests/auto/qmltest/listview/data/asyncloadercurrentindex.qml
index b43949c487..a721f85eb9 100644
--- a/src/qml/doc/snippets/qml/folderlistmodel.qml
+++ b/tests/auto/qmltest/listview/data/asyncloadercurrentindex.qml
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,24 +38,27 @@
**
****************************************************************************/
-//![0]
import QtQuick 2.0
-import Qt.labs.folderlistmodel 1.0
-ListView {
- width: 200; height: 400
+Rectangle {
+ color: "black"
- FolderListModel {
- id: folderModel
- nameFilters: ["*.qml"]
- }
+ Rectangle {
+ color: "red"
- Component {
- id: fileDelegate
- Text { text: fileName }
- }
+ height: 150
+ width: 150
- model: folderModel
- delegate: fileDelegate
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+
+ NumberAnimation on rotation {
+ from: 0
+ to: 360
+ duration: 5000
+ loops: Animation.Infinite
+ }
+ }
}
-//![0]
diff --git a/tests/auto/qmltest/listview/tst_listview.qml b/tests/auto/qmltest/listview/tst_listview.qml
index cbace624c3..0589e7c46b 100644
--- a/tests/auto/qmltest/listview/tst_listview.qml
+++ b/tests/auto/qmltest/listview/tst_listview.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick 2.1
import QtTest 1.0
Item {
@@ -53,6 +53,7 @@ Item {
ListView {
id: viewmanyitems
model: manyitems
+ delegate: Text { text: model.name }
}
ListView {
@@ -67,14 +68,66 @@ Item {
delegate: Text { text: model.name }
}
+ ListView {
+ id: asyncLoaderCurrentIndexListView
+ width: 360
+ height: 360
+ model: asyncLoaderCurrentIndexListModel
+
+ currentIndex: 0
+
+ delegate: Loader {
+ width: asyncLoaderCurrentIndexListView.width
+ height: asyncLoaderCurrentIndexListView.height
+
+ source: component
+ asynchronous: true
+ }
+ }
+
+ ListView {
+ id: asyncListViewLoaderView
+ width: 360
+ height: 360
+ model: asyncListViewLoaderModel
+
+ currentIndex: 0
+
+ delegate: Loader {
+ width: asyncListViewLoaderView.width
+ height: asyncListViewLoaderView.height
+
+ source: component
+ asynchronous: true
+ }
+ }
+
ListModel { id: emptymodel }
ListModel { id: manyitems }
ListModel { id: firstmodel; ListElement { name: "FirstModelElement0" } }
ListModel { id: secondmodel; ListElement { name: "SecondModelElement0" } ListElement { name: "SecondModelElement1" } }
ListModel { id: altermodel; ListElement { name: "AlterModelElement0" } ListElement { name: "AlterModelElement1" } }
+ ListModel {
+ id: asyncLoaderCurrentIndexListModel
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ ListElement { component: "data/asyncloadercurrentindex.qml" }
+ }
+ ListModel {
+ id: asyncListViewLoaderModel
+ ListElement { component: "data/asynclistviewloader.qml" }
+ ListElement { component: "data/asynclistviewloader.qml" }
+ ListElement { component: "data/asynclistviewloader.qml" }
+ ListElement { component: "data/asynclistviewloader.qml" }
+ ListElement { component: "data/asynclistviewloader.qml" }
+ }
TestCase {
name: "ListView"
+ when: windowShown
function test_empty() {
compare(emptylist.count, 0)
@@ -107,15 +160,16 @@ Item {
manyitems.append({"name":"Item"+i})
}
compare(manyitems.count, row.numitems)
- tryCompare(viewmanyitems.count, row.numitems)
+ tryCompare(viewmanyitems, 'count', row.numitems)
+
}
function test_modelchange() {
- tryCompare(modelchange.count, 1)
+ tryCompare(modelchange, 'count', 1)
modelchange.currentIndex = 0;
compare(modelchange.currentItem.text, "FirstModelElement0")
modelchange.model = secondmodel;
- tryCompare(modelchange.count, 2)
+ tryCompare(modelchange, 'count', 2)
modelchange.currentIndex = 0;
compare(modelchange.currentItem.text, "SecondModelElement0")
modelchange.currentIndex = 1;
@@ -123,13 +177,13 @@ Item {
}
function test_modelaltered() {
- tryCompare(modelalter.count, 2)
+ tryCompare(modelalter, 'count', 2)
modelalter.currentIndex = 0;
compare(modelalter.currentItem.text, "AlterModelElement0")
modelalter.currentIndex = 1;
compare(modelalter.currentItem.text, "AlterModelElement1")
altermodel.append({"name":"AlterModelElement2"})
- tryCompare(modelalter.count, 3)
+ tryCompare(modelalter, 'count', 3)
modelalter.currentIndex = 0;
compare(modelalter.currentItem.text, "AlterModelElement0")
modelalter.currentIndex = 1;
@@ -137,7 +191,7 @@ Item {
modelalter.currentIndex = 2;
compare(modelalter.currentItem.text, "AlterModelElement2")
altermodel.insert(2,{"name":"AlterModelElement1.5"})
- tryCompare(modelalter.count, 4)
+ tryCompare(modelalter, 'count', 4)
modelalter.currentIndex = 0;
compare(modelalter.currentItem.text, "AlterModelElement0")
modelalter.currentIndex = 1;
@@ -147,7 +201,7 @@ Item {
modelalter.currentIndex = 3;
compare(modelalter.currentItem.text, "AlterModelElement2")
altermodel.move(2,1,1);
- tryCompare(modelalter.count, 4)
+ tryCompare(modelalter, 'count', 4)
modelalter.currentIndex = 0;
compare(modelalter.currentItem.text, "AlterModelElement0")
modelalter.currentIndex = 1;
@@ -157,7 +211,7 @@ Item {
modelalter.currentIndex = 3;
compare(modelalter.currentItem.text, "AlterModelElement2")
altermodel.remove(1,2)
- tryCompare(modelalter.count, 2)
+ tryCompare(modelalter, 'count', 2)
modelalter.currentIndex = 0;
compare(modelalter.currentItem.text, "AlterModelElement0")
modelalter.currentIndex = 1;
@@ -168,8 +222,32 @@ Item {
modelalter.currentIndex = 1;
compare(modelalter.currentItem.text, "AlterModelElement1")
altermodel.clear()
- tryCompare(modelalter.count, 0)
+ modelalter.forceLayout()
+ tryCompare(modelalter, 'count', 0)
compare(modelalter.currentItem, null)
}
+
+ function test_asyncLoaderCurrentIndexChange() {
+ for (var i = 0; i < 500; i++) {
+ asyncLoaderCurrentIndexListView.currentIndex = 0;
+ asyncLoaderCurrentIndexListView.currentIndex = 1;
+ asyncLoaderCurrentIndexListView.currentIndex = 2;
+ asyncLoaderCurrentIndexListView.currentIndex = 3;
+ asyncLoaderCurrentIndexListView.currentIndex = 4;
+ asyncLoaderCurrentIndexListView.currentIndex = 5;
+ }
+ wait(1000)
+ }
+
+ function test_asyncListViewLoader() {
+ for (var i = 0; i < 50; i++) {
+ wait(10);
+ asyncListViewLoaderView.currentIndex = 0;
+ asyncListViewLoaderView.currentIndex = 1;
+ asyncListViewLoaderView.currentIndex = 2;
+ asyncListViewLoaderView.currentIndex = 3;
+ asyncListViewLoaderView.currentIndex = 4;
+ }
+ }
}
}
diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro
index 0a7967654c..b1c29226e6 100644
--- a/tests/auto/qmltest/qmltest.pro
+++ b/tests/auto/qmltest/qmltest.pro
@@ -9,5 +9,4 @@ importFiles.files = borderimage buttonclick createbenchmark events qqmlbindi
importFiles.path = .
DEPLOYMENT += importFiles
-mac:CONFIG+=insignificant_test # QTBUG-25306
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qmltest/selftests/tst_destroy.qml b/tests/auto/qmltest/selftests/tst_destroy.qml
new file mode 100644
index 0000000000..b2a473dfca
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_destroy.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtTest 1.0
+
+TestCase {
+ id: testCase
+ width: 100
+ height: 100
+ name: "SelfTests_Destroy"
+
+ function test_a_QTBUG_30523() {
+ compare(testCase.children.length, 0)
+ var tmp = Qt.createQmlObject('import QtQuick 2.1; Rectangle {width: 20; height: 20;}', testCase, '')
+ compare(testCase.children.length, 1)
+ tmp.destroy()
+ }
+
+ function test_b_QTBUG_30523() {
+ // The object created in test above should be deleted
+ compare(testCase.children.length, 0)
+ }
+}
diff --git a/tests/auto/qmltest/text/tst_text.qml b/tests/auto/qmltest/text/tst_text.qml
index 87e9501ccd..b1d743f630 100644
--- a/tests/auto/qmltest/text/tst_text.qml
+++ b/tests/auto/qmltest/text/tst_text.qml
@@ -78,6 +78,13 @@ Item {
font.pixelSize: 18
}
+ Text {
+ id: txtlines
+ property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
+ text: "Line 1\nLine 2\nLine 3"
+ textFormat: Text.PlainText
+ }
+
TestCase {
name: "Text"
@@ -116,6 +123,16 @@ Item {
txtlinecount.width = 50;
compare(txtlinecount.lineCount, 3)
}
+ function test_linecounts() {
+ compare(txtlines.lineCount, 3)
+ txtlines.text = txtlines.styledtextvalue;
+ compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
+ tryCompare(txtlines, 'lineCount', 1)
+ txtlines.textFormat = Text.StyledText;
+ tryCompare(txtlines, 'lineCount', 3)
+ txtlines.textFormat = Text.RichText;
+ tryCompare(txtlines, 'lineCount', 3)
+ }
}
}
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
index edfa127c59..eb53eaa604 100644
--- a/tests/auto/qmltest/textedit/tst_textedit.qml
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -91,7 +91,7 @@ Item {
id: txtlines
property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
text: "Line 1\nLine 2\nLine 3"
- textFormat: Text.PlainText
+ textFormat: TextEdit.PlainText
}
TestCase {
@@ -179,11 +179,9 @@ Item {
compare(txtlines.lineCount, 3)
txtlines.text = txtlines.styledtextvalue;
compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
- tryCompare(txtlines.lineCount, 1)
- txtlines.textFormat = Text.StyledText;
- tryCompare(txtlines.lineCount, 3)
- txtlines.textFormat = Text.RichText;
- tryCompare(txtlines.lineCount, 3)
+ tryCompare(txtlines, 'lineCount', 1)
+ txtlines.textFormat = TextEdit.RichText;
+ tryCompare(txtlines, 'lineCount', 3)
}
}
}
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
index 201287b2a8..0377eaa71d 100644
--- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -201,26 +201,28 @@ void tst_qquickanimatedimage::mirror_notRunning()
QFETCH(QUrl, fileUrl);
QQuickView window;
+ window.setSource(fileUrl);
window.show();
+ QTRY_VERIFY(window.isExposed());
- window.setSource(fileUrl);
QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject());
QVERIFY(anim);
int width = anim->property("width").toInt();
- QPixmap screenshot = QPixmap::fromImage(window.grabWindow());
+ QImage screenshot = window.grabWindow();
QTransform transform;
transform.translate(width, 0).scale(-1, 1.0);
- QPixmap expected = screenshot.transformed(transform);
+ QImage expected = screenshot.transformed(transform);
int frame = anim->currentFrame();
bool playing = anim->isPlaying();
bool paused = anim->isPlaying();
anim->setProperty("mirror", true);
- screenshot = QPixmap::fromImage(window.grabWindow());
+ screenshot = window.grabWindow();
+ screenshot.save("screen.png");
QCOMPARE(screenshot, expected);
// mirroring should not change the current frame or playing status
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
index b72e755ed9..ad44f6d28e 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
@@ -70,4 +70,20 @@ Canvas {
compare(canvas.contextInPaint, canvas.getContext("2d"));
}
}
+
+ TestCase {
+ name: "ContextFontValidation"
+ when: canvas.available
+
+ function test_pixelSize() {
+ wait(100);
+ compare(contextSpy.count, 1);
+
+ var ctx = canvas.getContext("2d");
+ compare(ctx.font, "sans-serif,-1,10,5,50,0,0,0,0,0");
+
+ ctx.font = "80.1px sans-serif";
+ compare(ctx.font, "sans-serif,-1,80,5,50,0,0,0,0,0");
+ }
+ }
}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_image.qml b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
index 72b6dcdb00..ca95f2aec1 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
@@ -216,6 +216,17 @@ CanvasTestCase {
}
+ property url green: 'green.png'
+
+ function test_url(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+
+ canvas.loadImage(testCase.green);
+ ctx.drawImage(testCase.green, 0, 0);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ }
+
function test_composite(row) {
var canvas = createCanvasObject(row);
var ctx = canvas.getContext('2d');
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 0c9788ab8e..d0ffba9435 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -532,6 +532,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow,
for (int i=0; i<insertCount; i++)
newData << qMakePair(QString("value %1").arg(i), QString::number(i));
model.insertItems(insertIndex, newData);
+ gridview->forceLayout();
QTRY_COMPARE(gridview->property("count").toInt(), model.count());
// check visibleItems.first() is in correct position
@@ -728,6 +729,7 @@ void tst_QQuickGridView::insertBeforeVisible()
for (int i=0; i<insertCount; i++)
newData << qMakePair(QString("value %1").arg(i), QString::number(i));
model.insertItems(insertIndex, newData);
+ gridview->forceLayout();
QTRY_COMPARE(gridview->property("count").toInt(), model.count());
// now, moving to the top of the view should position the inserted items correctly
@@ -958,6 +960,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow,
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
model.removeItems(removeIndex, removeCount);
+ gridview->forceLayout();
QTRY_COMPARE(gridview->property("count").toInt(), model.count());
QString firstName;
@@ -1245,6 +1248,7 @@ void tst_QQuickGridView::clear()
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
model.clear();
+ gridview->forceLayout();
QVERIFY(gridview->count() == 0);
QVERIFY(gridview->currentItem() == 0);
@@ -1254,6 +1258,7 @@ void tst_QQuickGridView::clear()
// confirm sanity when adding an item to cleared list
model.addItem("New", "1");
+ gridview->forceLayout();
QTRY_COMPARE(gridview->count(), 1);
QVERIFY(gridview->currentItem() != 0);
QVERIFY(gridview->currentIndex() == 0);
@@ -3483,6 +3488,7 @@ void tst_QQuickGridView::extents()
QCOMPARE(gridview->originY(), origin_empty.y());
for (int i=0; i<30; i++)
model.addItem("Item" + QString::number(i), "");
+ gridview->forceLayout();
QTRY_COMPARE(gridview->count(), model.count());
QCOMPARE(gridview->originX(), origin_nonEmpty.x());
QCOMPARE(gridview->originY(), origin_nonEmpty.y());
@@ -3942,9 +3948,9 @@ void tst_QQuickGridView::onAdd()
ctxt->setContextProperty("delegateHeight", delegateHeight);
window->setSource(testFileUrl("attachedSignals.qml"));
- QObject *object = window->rootObject();
- object->setProperty("width", window->width());
- object->setProperty("height", window->height());
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject());
+ gridview->setProperty("width", window->width());
+ gridview->setProperty("height", window->height());
qApp->processEvents();
QList<QPair<QString, QString> > items;
@@ -3952,10 +3958,11 @@ void tst_QQuickGridView::onAdd()
items << qMakePair(QString("value %1").arg(i), QString::number(i));
model.addItems(items);
- QTRY_COMPARE(model.count(), qobject_cast<QQuickGridView*>(window->rootObject())->count());
+ gridview->forceLayout();
+ QTRY_COMPARE(model.count(), gridview->count());
qApp->processEvents();
- QVariantList result = object->property("addedDelegates").toList();
+ QVariantList result = gridview->property("addedDelegates").toList();
QTRY_COMPARE(result.count(), items.count());
for (int i=0; i<items.count(); i++)
QCOMPARE(result[i].toString(), items[i].first);
@@ -3999,11 +4006,12 @@ void tst_QQuickGridView::onRemove()
ctxt->setContextProperty("delegateWidth", delegateWidth);
ctxt->setContextProperty("delegateHeight", delegateHeight);
window->setSource(testFileUrl("attachedSignals.qml"));
- QObject *object = window->rootObject();
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject());
model.removeItems(indexToRemove, removeCount);
- QTRY_COMPARE(model.count(), qobject_cast<QQuickGridView*>(window->rootObject())->count());
- QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
+ gridview->forceLayout();
+ QTRY_COMPARE(model.count(), gridview->count());
+ QCOMPARE(gridview->property("removedDelegateCount"), QVariant(removeCount));
releaseView(window);
}
@@ -4151,6 +4159,7 @@ void tst_QQuickGridView::margins()
gridview->setContentX(-400);
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
model.removeItems(0, 4);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
gridview->setContentX(-240+50);
gridview->returnToBounds();
@@ -4458,6 +4467,7 @@ void tst_QQuickGridView::unaligned()
// removing
model.removeItems(7, 10);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
for (int i = 0; i < 18; ++i) {
QQuickItem *item = 0;
@@ -4663,6 +4673,7 @@ void tst_QQuickGridView::addTransitions()
// start animation
if (!newData.isEmpty()) {
model.insertItems(insertionIndex, newData);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
}
@@ -4866,6 +4877,7 @@ void tst_QQuickGridView::moveTransitions()
// start animation
model.moveItems(moveFrom, moveTo, moveCount);
+ gridview->forceLayout();
QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(),
@@ -5114,6 +5126,7 @@ void tst_QQuickGridView::removeTransitions()
// start animation
model.removeItems(removalIndex, removalCount);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
if (shouldAnimateTargets || expectedDisplacedIndexes.isValid()) {
@@ -5327,6 +5340,7 @@ void tst_QQuickGridView::displacedTransitions()
case ListChange::Polish:
break;
}
+ gridview->forceLayout();
QVariantList resultTargetIndexes = gridview->property("displacedTargetIndexes").toList();
QVariantList resultTargetItems = gridview->property("displacedTargetItems").toList();
@@ -5534,6 +5548,7 @@ void tst_QQuickGridView::multipleTransitions()
for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
targetItems << qMakePair(QString("new item %1").arg(j), QString::number(j));
model.insertItems(changes[i].index, targetItems);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
if (i == changes.count() - 1) {
QTRY_VERIFY(!gridview->property("runningAddTargets").toBool());
@@ -5545,6 +5560,7 @@ void tst_QQuickGridView::multipleTransitions()
}
case ListChange::Removed:
model.removeItems(changes[i].index, changes[i].count);
+ gridview->forceLayout();
QTRY_COMPARE(model.count(), gridview->count());
if (i == changes.count() - 1) {
QTRY_VERIFY(!gridview->property("runningRemoveTargets").toBool());
@@ -5555,6 +5571,7 @@ void tst_QQuickGridView::multipleTransitions()
break;
case ListChange::Moved:
model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ gridview->forceLayout();
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
if (i == changes.count() - 1) {
QTRY_VERIFY(!gridview->property("runningMoveTargets").toBool());
@@ -5566,16 +5583,17 @@ void tst_QQuickGridView::multipleTransitions()
case ListChange::SetCurrent:
gridview->setCurrentIndex(changes[i].index);
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ gridview->forceLayout();
break;
case ListChange::SetContentY:
gridview->setContentY(changes[i].pos);
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ gridview->forceLayout();
break;
case ListChange::Polish:
break;
}
}
- QCOMPARE(gridview->count(), model.count());
QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
int firstVisibleIndex = -1;
@@ -5586,6 +5604,7 @@ void tst_QQuickGridView::multipleTransitions()
break;
}
}
+ QTRY_COMPARE(gridview->count(), model.count());
QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
// verify all items moved to the correct final positions
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index a790c7b9de..3eea3c955c 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -71,6 +71,9 @@ private slots:
void removeProvider_data();
void removeProvider();
+ void imageProviderId_data();
+ void imageProviderId();
+
void threadTest();
private:
@@ -372,6 +375,31 @@ void tst_qquickimageprovider::removeProvider()
delete obj;
}
+void tst_qquickimageprovider::imageProviderId_data()
+{
+ QTest::addColumn<QString>("providerId");
+
+ QTest::newRow("lowercase") << QStringLiteral("imageprovider");
+ QTest::newRow("CamelCase") << QStringLiteral("ImageProvider");
+ QTest::newRow("UPPERCASE") << QStringLiteral("IMAGEPROVIDER");
+}
+
+void tst_qquickimageprovider::imageProviderId()
+{
+ QFETCH(QString, providerId);
+
+ QQmlEngine engine;
+
+ bool deleteWatch = false;
+ TestQImageProvider *provider = new TestQImageProvider(&deleteWatch);
+
+ engine.addImageProvider(providerId, provider);
+ QVERIFY(engine.imageProvider(providerId) != 0);
+
+ engine.removeImageProvider(providerId);
+ QVERIFY(deleteWatch);
+}
+
class TestThreadProvider : public QQuickImageProvider
{
public:
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml
new file mode 100644
index 0000000000..22b4d249f0
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml
@@ -0,0 +1,144 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button12.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button12
+ objectName: "button12"
+ activeFocusOnTab: true
+ Accessible.role: Accessible.List
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button11.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button13
+ objectName: "button13"
+ enabled: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button14
+ objectName: "button14"
+ visible: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.List
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Row
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.PushButton
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button22
+ objectName: "button22"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.RadioButton
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: button21.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub2.right
+ TextEdit {
+ id: edit
+ objectName: "edit"
+ width: 230
+ height: 400
+ readOnly: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.EditableText
+ wrapMode: TextEdit.Wrap
+ textFormat: TextEdit.RichText
+
+ text: "aaa\n"
+ +"bbb\n"
+ +"ccc\n"
+ +"ddd\n"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml
new file mode 100644
index 0000000000..e81d9be950
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 300
+ height: 300
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Button
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.top: parent.top
+ anchors.left: parent.left
+ }
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Button
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml
new file mode 100644
index 0000000000..641a39c1fa
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 300
+ height: 300
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.top: parent.top
+ anchors.left: parent.left
+ }
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/resourcesProperty.qml b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
index b8f18bb375..2c4c0aa5c1 100644
--- a/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
+++ b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
@@ -8,14 +8,27 @@ Item {
property bool test3
property bool test4
property bool test5
+ property bool test6
Component.onCompleted: {
- test1 = (root.resources.length >= 3)
- test2 = root.resources[0] == item1
- test3 = root.resources[1] == item2
- test4 = root.resources[2] == item3
- test5 = root.resources[10] == null
+ test1 = (root.resources.length === 4)
+ test2 = root.resources[0] === item1
+ test3 = root.resources[1] === item2
+ test4 = root.resources[2] === item3
+ test5 = root.resources[3] === otherObject
+ test6 = root.resources[10] == null
}
+ //Resources can be used explicitly
resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+
+ Item {
+ //Item in Data go the children property.
+ }
+
+ QtObject {
+ //Objects in Data which are not items are put in resources.
+ id: otherObject
+ objectName: "subObject";
+ }
}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index f2d25e81ed..992e81aa64 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -47,6 +47,7 @@
#include <QtGui/private/qinputmethod_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
#include <QtQuick/private/qquicktextinput_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
#include <private/qquickitem_p.h>
#include "../../shared/util.h"
#include "../shared/visualtestutil.h"
@@ -69,6 +70,12 @@ private slots:
void activeFocusOnTab3();
void activeFocusOnTab4();
void activeFocusOnTab5();
+ void activeFocusOnTab6();
+ void activeFocusOnTab7();
+ void activeFocusOnTab8();
+
+ void nextItemInFocusChain();
+ void nextItemInFocusChain2();
void keys();
void keysProcessingOrder();
@@ -108,6 +115,11 @@ private slots:
private:
QQmlEngine engine;
+ bool qt_tab_all_widgets() {
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool();
+ return true;
+ }
};
class KeysTestObject : public QObject
@@ -281,6 +293,9 @@ void tst_QQuickItem::cleanup()
void tst_QQuickItem::activeFocusOnTab()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -390,6 +405,9 @@ void tst_QQuickItem::activeFocusOnTab()
void tst_QQuickItem::activeFocusOnTab2()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -427,6 +445,9 @@ void tst_QQuickItem::activeFocusOnTab2()
void tst_QQuickItem::activeFocusOnTab3()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -606,6 +627,9 @@ void tst_QQuickItem::activeFocusOnTab3()
void tst_QQuickItem::activeFocusOnTab4()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -635,6 +659,9 @@ void tst_QQuickItem::activeFocusOnTab4()
void tst_QQuickItem::activeFocusOnTab5()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -664,6 +691,273 @@ void tst_QQuickItem::activeFocusOnTab5()
delete window;
}
+void tst_QQuickItem::activeFocusOnTab6()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab6.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button12->edit
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: edit->button12
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab7()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300,300));
+
+ window->setSource(testFileUrl("activeFocusOnTab7.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ item->forceActiveFocus();
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button1->button1
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(!key.isAccepted());
+
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button1->button1
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(!key.isAccepted());
+
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab8()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300,300));
+
+ window->setSource(testFileUrl("activeFocusOnTab8.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *content = window->contentItem();
+ QVERIFY(content);
+ QVERIFY(content->hasActiveFocus());
+
+ QQuickItem *button1 = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(button1);
+ QVERIFY(!button1->hasActiveFocus());
+
+ QQuickItem *button2 = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(button2);
+ QVERIFY(!button2->hasActiveFocus());
+
+ // Tab: contentItem->button1
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button1->hasActiveFocus());
+
+ // Tab: button1->button2
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button2->hasActiveFocus());
+ QVERIFY(!button1->hasActiveFocus());
+
+ // BackTab: button2->button1
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button1->hasActiveFocus());
+ QVERIFY(!button2->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::nextItemInFocusChain()
+{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *button11 = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(button11);
+ QQuickItem *button12 = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(button12);
+
+ QQuickItem *sub2 = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(sub2);
+ QQuickItem *button21 = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(button21);
+ QQuickItem *button22 = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(button22);
+
+ QQuickItem *edit = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(edit);
+
+ QQuickItem *next, *prev;
+
+ next = button11->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button12);
+ prev = button11->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, edit);
+
+ next = button12->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, sub2);
+ prev = button12->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button11);
+
+ next = sub2->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button21);
+ prev = sub2->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button12);
+
+ next = button21->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button22);
+ prev = button21->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, sub2);
+
+ next = button22->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, edit);
+ prev = button22->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button21);
+
+ next = edit->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button11);
+ prev = edit->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button22);
+
+ delete window;
+}
+
+void tst_QQuickItem::nextItemInFocusChain2()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab6.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *button11 = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(button11);
+ QQuickItem *button12 = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(button12);
+
+ QQuickItem *edit = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(edit);
+
+ QQuickItem *next, *prev;
+
+ next = button11->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button12);
+ prev = button11->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, edit);
+
+ next = button12->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, edit);
+ prev = button12->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button11);
+
+ next = edit->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button11);
+ prev = edit->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button12);
+
+ delete window;
+}
+
void tst_QQuickItem::keys()
{
QQuickView *window = new QQuickView(0);
@@ -1633,15 +1927,35 @@ void tst_QQuickItem::resourcesProperty()
{
QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
- QCOMPARE(o->property("test1").toBool(), true);
- QCOMPARE(o->property("test2").toBool(), true);
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- delete o;
+ QQmlProperty property(object, "resources", component.creationContext());
+
+ QVERIFY(property.isValid());
+ QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
+ QVERIFY(list.isValid());
+
+ QCOMPARE(list.count(), 4);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+ QCOMPARE(object->property("test5").toBool(), true);
+ QCOMPARE(object->property("test6").toBool(), true);
+
+ QObject *subObject = object->findChild<QObject *>("subObject");
+
+ QVERIFY(subObject);
+
+ QCOMPARE(object, subObject->parent());
+
+ delete subObject;
+
+ QCOMPARE(list.count(), 3);
+
+ delete object;
}
void tst_QQuickItem::propertyChanges()
diff --git a/tests/auto/quick/qquicklistview/data/delayedChanges.qml b/tests/auto/quick/qquicklistview/data/delayedChanges.qml
new file mode 100644
index 0000000000..590af39c02
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/delayedChanges.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.1
+
+Item {
+ width: 400
+ height: 400
+ function takeTwo()
+ {
+ listView.model.remove(0);
+ listView.model.remove(0);
+ }
+ function takeTwo_sync()
+ {
+ listView.model.remove(0);
+ listView.forceLayout();
+ listView.model.remove(0);
+ listView.forceLayout();
+ }
+
+ ListView {
+ id: listView
+ height: parent.height
+ width: 400
+ model: ListModel {
+ ListElement { name: "A" }
+ ListElement { name: "B" }
+ ListElement { name: "C" }
+ ListElement { name: "D" }
+ ListElement { name: "E" }
+ ListElement { name: "F" }
+ ListElement { name: "G" }
+ ListElement { name: "H" }
+ ListElement { name: "I" }
+ ListElement { name: "J" }
+ }
+ delegate: Text {
+ text: index + listView.count
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/emptymodel.qml b/tests/auto/quick/qquicklistview/data/emptymodel.qml
index 16bcd3f9ae..3feec691cf 100644
--- a/tests/auto/quick/qquicklistview/data/emptymodel.qml
+++ b/tests/auto/quick/qquicklistview/data/emptymodel.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.1
Rectangle {
ListModel {
id: model
@@ -12,11 +12,13 @@ Rectangle {
}
function remove() {
model.remove(0)
+ list.forceLayout()
isCurrentItemNull = list.currentItem === null //check no seg fault
}
function add() {
model.append({name: "hello"})
+ list.forceLayout()
isCurrentItemNull = list.currentItem === null
}
property bool isCurrentItemNull
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index f8c7de6635..bec61eaccb 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -208,10 +208,11 @@ private slots:
void parentBinding();
void defaultHighlightMoveDuration();
void accessEmptyCurrentItem_QTBUG_30227();
+ void delayedChanges_QTBUG_30555();
private:
- template <class T> void items(const QUrl &source, bool forceLayout);
- template <class T> void changed(const QUrl &source, bool forceLayout);
+ template <class T> void items(const QUrl &source);
+ template <class T> void changed(const QUrl &source);
template <class T> void inserted(const QUrl &source);
template <class T> void inserted_more(QQuickItemView::VerticalLayoutDirection verticalLayoutDirection = QQuickItemView::TopToBottom);
template <class T> void removed(const QUrl &source, bool animated);
@@ -329,7 +330,7 @@ void tst_QQuickListView::cleanupTestCase()
}
template <class T>
-void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
+void tst_QQuickListView::items(const QUrl &source)
{
QQuickView *window = createView();
@@ -349,6 +350,7 @@ void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
+ listview->forceLayout();
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
@@ -359,6 +361,7 @@ void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
QTRY_VERIFY(listview->highlightItem() != 0);
QTRY_COMPARE(listview->count(), model.count());
QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ listview->forceLayout();
QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
// current item should be first item
@@ -398,8 +401,7 @@ void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
ctxt->setContextProperty("testModel", &model2);
// Force a layout, necessary if ListView is completed before VisualDataModel.
- if (forceLayout)
- QCOMPARE(listview->property("count").toInt(), 0);
+ listview->forceLayout();
int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
QTRY_VERIFY(itemCount == 0);
@@ -413,7 +415,7 @@ void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
template <class T>
-void tst_QQuickListView::changed(const QUrl &source, bool forceLayout)
+void tst_QQuickListView::changed(const QUrl &source)
{
QQuickView *window = createView();
@@ -431,15 +433,15 @@ void tst_QQuickListView::changed(const QUrl &source, bool forceLayout)
window->setSource(source);
qApp->processEvents();
- QQuickFlickable *listview = findItem<QQuickFlickable>(window->rootObject(), "list");
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
+ listview->forceLayout();
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
// Force a layout, necessary if ListView is completed before VisualDataModel.
- if (forceLayout)
- QCOMPARE(listview->property("count").toInt(), model.count());
+ listview->forceLayout();
model.modifyItem(1, "Will", "9876");
QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
@@ -579,22 +581,24 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
- bool waitForPolish = (contentY != 0);
if (verticalLayoutDirection == QQuickItemView::BottomToTop) {
listview->setVerticalLayoutDirection(verticalLayoutDirection);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
contentY = -listview->height() - contentY;
}
listview->setContentY(contentY);
- if (waitForPolish)
- QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QList<QPair<QString, QString> > newData;
for (int i=0; i<insertCount; i++)
newData << qMakePair(QString("value %1").arg(i), QString::number(i));
model.insertItems(insertIndex, newData);
+
+ //Wait for polish (updates list to the model changes)
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
QTRY_COMPARE(listview->property("count").toInt(), model.count());
+
// check visibleItems.first() is in correct position
QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
QVERIFY(item0);
@@ -1019,17 +1023,17 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
- bool waitForPolish = (contentY != 0);
if (verticalLayoutDirection == QQuickItemView::BottomToTop) {
listview->setVerticalLayoutDirection(verticalLayoutDirection);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
contentY = -listview->height() - contentY;
}
listview->setContentY(contentY);
- if (waitForPolish)
- QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
model.removeItems(removeIndex, removeCount);
+ //Wait for polish (updates list to the model changes)
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
QTRY_COMPARE(listview->property("count").toInt(), model.count());
// check visibleItems.first() is in correct position
@@ -1219,6 +1223,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou
// confirm sanity when adding an item to cleared list
model.addItem("New", "1");
+ listview->forceLayout();
QTRY_VERIFY(listview->count() == 1);
QVERIFY(listview->currentItem() != 0);
QVERIFY(listview->currentIndex() == 0);
@@ -1945,6 +1950,7 @@ void tst_QQuickListView::sections(const QUrl &source)
// Remove section boundary
model.removeItem(5);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
// New section header created
@@ -1953,6 +1959,7 @@ void tst_QQuickListView::sections(const QUrl &source)
QTRY_COMPARE(item->height(), 40.0);
model.insertItem(3, "New Item", "0");
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
// Section header moved
@@ -1966,6 +1973,7 @@ void tst_QQuickListView::sections(const QUrl &source)
// insert item which will become a section header
model.insertItem(6, "Replace header", "1");
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
item = findItem<QQuickItem>(contentItem, "wrapper", 6);
@@ -2061,6 +2069,7 @@ void tst_QQuickListView::sectionsDelegate()
// remove section boundary
model.removeItem(5);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
for (int i = 0; i < 3; ++i) {
QQuickItem *item = findItem<QQuickItem>(contentItem,
@@ -2288,6 +2297,7 @@ void tst_QQuickListView::sectionsPositioning()
listview->setContentY(120);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
model.removeItem(5);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
for (int i = 1; i < 3; ++i) {
QQuickItem *item = findVisibleChild(contentItem,
@@ -2485,7 +2495,8 @@ void tst_QQuickListView::currentIndex_delayedItemCreation()
QTRY_VERIFY(contentItem != 0);
QSignalSpy spy(listview, SIGNAL(currentItemChanged()));
- QCOMPARE(listview->currentIndex(), 0);
+ //QCOMPARE(listview->currentIndex(), 0);
+ listview->forceLayout();
QTRY_COMPARE(spy.count(), 1);
releaseView(window);
@@ -2536,6 +2547,7 @@ void tst_QQuickListView::currentIndex()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), QString::number(i));
ctxt->setContextProperty("testModel", &model);
+ listview->forceLayout();
QCOMPARE(listview->currentIndex(), 0);
QCOMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
@@ -2679,6 +2691,7 @@ void tst_QQuickListView::keyNavigation()
QTRY_COMPARE(listview->currentIndex(), i+1);
}
QTest::keyRelease(window, forwardsKey);
+ listview->forceLayout();
QTRY_COMPARE(listview->currentIndex(), model.count()-1);
QTRY_COMPARE(listview->contentX(), contentPosAtLastItem.x());
QTRY_COMPARE(listview->contentY(), contentPosAtLastItem.y());
@@ -2689,6 +2702,7 @@ void tst_QQuickListView::keyNavigation()
QTRY_COMPARE(listview->currentIndex(), i-1);
}
QTest::keyRelease(window, backwardsKey);
+ listview->forceLayout();
QTRY_COMPARE(listview->currentIndex(), 0);
QTRY_COMPARE(listview->contentX(), contentPosAtFirstItem.x());
QTRY_COMPARE(listview->contentY(), contentPosAtFirstItem.y());
@@ -3123,6 +3137,7 @@ void tst_QQuickListView::resetModel()
strings << "four" << "five" << "six" << "seven";
model.setStringList(strings);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.rowCount());
for (int i = 0; i < model.rowCount(); ++i) {
@@ -3470,6 +3485,7 @@ void tst_QQuickListView::header()
QCOMPARE(item->position(), firstDelegatePos);
model.clear();
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
QCOMPARE(header->position(), initialHeaderPos); // header should stay where it is
if (orientation == QQuickListView::Vertical)
@@ -3865,6 +3881,7 @@ void tst_QQuickListView::extents()
QCOMPARE(listview->originY(), origin_empty.y());
for (int i=0; i<30; i++)
model.addItem("Item" + QString::number(i), "");
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
QCOMPARE(listview->originX(), origin_nonEmpty.x());
QCOMPARE(listview->originY(), origin_nonEmpty.y());
@@ -4262,6 +4279,7 @@ void tst_QQuickListView::resizeFirstDelegate()
for (int i = 0; i < 10; i++)
model.addItem("Item" + QString::number(i), "");
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
item = findItem<QQuickItem>(contentItem, "wrapper", 1);
@@ -4461,6 +4479,7 @@ void tst_QQuickListView::indexAt_itemAt()
void tst_QQuickListView::incrementalModel()
{
QQuickView *window = createView();
+ QSKIP("QTBUG-30716");
IncrementalModel model;
QQmlContext *ctxt = window->rootContext();
@@ -4471,14 +4490,17 @@ void tst_QQuickListView::incrementalModel()
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
+ listview->forceLayout();
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != 0);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), 20);
listview->positionViewAtIndex(10, QQuickListView::Beginning);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), 25);
delete window;
@@ -4503,18 +4525,19 @@ void tst_QQuickListView::onAdd()
ctxt->setContextProperty("delegateHeight", delegateHeight);
window->setSource(testFileUrl("attachedSignals.qml"));
- QObject *object = window->rootObject();
- object->setProperty("width", window->width());
- object->setProperty("height", window->height());
+ QQuickListView* listview = qobject_cast<QQuickListView*>(window->rootObject());
+ listview->setProperty("width", window->width());
+ listview->setProperty("height", window->height());
qApp->processEvents();
QList<QPair<QString, QString> > items;
for (int i=0; i<itemsToAdd; i++)
items << qMakePair(QString("value %1").arg(i), QString::number(i));
model.addItems(items);
- QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ listview->forceLayout();
+ QTRY_COMPARE(listview->property("count").toInt(), model.count());
- QVariantList result = object->property("addedDelegates").toList();
+ QVariantList result = listview->property("addedDelegates").toList();
QCOMPARE(result.count(), items.count());
for (int i=0; i<items.count(); i++)
QCOMPARE(result[i].toString(), items[i].first);
@@ -4557,12 +4580,13 @@ void tst_QQuickListView::onRemove()
ctxt->setContextProperty("delegateHeight", delegateHeight);
window->setSource(testFileUrl("attachedSignals.qml"));
- QObject *object = window->rootObject();
+ QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject());
model.removeItems(indexToRemove, removeCount);
- QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ listview->forceLayout();
+ QTRY_COMPARE(listview->property("count").toInt(), model.count());
- QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
+ QCOMPARE(listview->property("removedDelegateCount"), QVariant(removeCount));
releaseView(window);
}
@@ -4741,6 +4765,7 @@ void tst_QQuickListView::margins()
// and originY is updated
listview->setContentY(100);
model.removeItem(1);
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), model.count());
listview->setContentY(-50);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
@@ -4979,22 +5004,22 @@ void tst_QQuickListView::snapToItem()
void tst_QQuickListView::qAbstractItemModel_package_items()
{
- items<QaimModel>(testFileUrl("listviewtest-package.qml"), true);
+ items<QaimModel>(testFileUrl("listviewtest-package.qml"));
}
void tst_QQuickListView::qAbstractItemModel_items()
{
- items<QaimModel>(testFileUrl("listviewtest.qml"), false);
+ items<QaimModel>(testFileUrl("listviewtest.qml"));
}
void tst_QQuickListView::qAbstractItemModel_package_changed()
{
- changed<QaimModel>(testFileUrl("listviewtest-package.qml"), true);
+ changed<QaimModel>(testFileUrl("listviewtest-package.qml"));
}
void tst_QQuickListView::qAbstractItemModel_changed()
{
- changed<QaimModel>(testFileUrl("listviewtest.qml"), false);
+ changed<QaimModel>(testFileUrl("listviewtest.qml"));
}
void tst_QQuickListView::qAbstractItemModel_package_inserted()
@@ -5555,6 +5580,7 @@ void tst_QQuickListView::populateTransitions()
// clear the model
window->rootContext()->setContextProperty("testModel", QVariant());
+ listview->forceLayout();
QTRY_COMPARE(listview->count(), 0);
QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
listview->setProperty("countPopulateTransitions", 0);
@@ -5683,6 +5709,7 @@ void tst_QQuickListView::addTransitions()
if (!newData.isEmpty()) {
model.insertItems(insertionIndex, newData);
QTRY_COMPARE(model.count(), listview->count());
+ listview->forceLayout();
}
QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
@@ -6291,6 +6318,7 @@ void tst_QQuickListView::displacedTransitions()
case ListChange::Polish:
break;
}
+ listview->forceLayout();
QVariantList resultTargetIndexes = listview->property("displacedTargetIndexes").toList();
QVariantList resultTargetItems = listview->property("displacedTargetItems").toList();
@@ -6539,6 +6567,7 @@ void tst_QQuickListView::multipleTransitions()
break;
}
}
+ listview->forceLayout();
QCOMPARE(listview->count(), model.count());
// verify all items moved to the correct final positions
@@ -6822,6 +6851,7 @@ void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227()
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QTRY_VERIFY(listview != 0);
+ listview->forceLayout();
QMetaObject::invokeMethod(window->rootObject(), "remove");
QVERIFY(window->rootObject()->property("isCurrentItemNull").toBool());
@@ -6830,6 +6860,26 @@ void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227()
QVERIFY(!window->rootObject()->property("isCurrentItemNull").toBool());
}
+void tst_QQuickListView::delayedChanges_QTBUG_30555()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("delayedChanges.qml"));
+
+ QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
+ QTRY_VERIFY(listview != 0);
+
+ QCOMPARE(listview->count(), 10);
+
+ //Takes two just like in the bug report
+ QMetaObject::invokeMethod(window->rootObject(), "takeTwo");
+ QTRY_COMPARE(listview->count(), 8);
+
+ QMetaObject::invokeMethod(window->rootObject(), "takeTwo_sync");
+ QCOMPARE(listview->count(), 6);
+
+ delete window;
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"
diff --git a/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml
new file mode 100644
index 0000000000..69ec8fbd47
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ width: 500
+ height: 500
+
+ Rectangle {
+ width: 300
+ height: 300
+ color: "grey"
+ x: 100
+ y: 100
+
+ MouseArea {
+ id: mouseArea
+ objectName: "mouseArea"
+ anchors.fill: parent
+ hoverEnabled: true
+ onPressed: mouse.accepted = false
+ //onContainsMouseChanged: print("containsMouse changed =", containsMouse)
+
+ Rectangle {
+ visible: parent.containsMouse
+ color: "red"
+ width: 10; height: 10
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index fa33f3f626..a582c62701 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -78,6 +78,7 @@ private slots:
void hoverPosition();
void hoverPropagation();
void hoverVisible();
+ void hoverAfterPress();
void disableAfterPress();
void onWheel();
void transformedMouseArea_data();
@@ -585,7 +586,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QWindow *secondWindow = qvariant_cast<QWindow*>(window->rootObject()->property("secondWindow"));
secondWindow->setProperty("visible", true);
- QTest::qWaitForWindowActive(secondWindow);
+ QTest::qWaitForWindowExposed(secondWindow);
QVERIFY(!window->rootObject()->property("pressed").toBool());
QVERIFY(window->rootObject()->property("canceled").toBool());
@@ -1007,6 +1008,33 @@ void tst_QQuickMouseArea::hoverVisible()
delete window;
}
+void tst_QQuickMouseArea::hoverAfterPress()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("hoverAfterPress.qml"));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea*>("mouseArea");
+ QVERIFY(mouseArea != 0);
+ QTest::mouseMove(window, QPoint(22,33));
+ QCOMPARE(mouseArea->hovered(), false);
+ QTest::mouseMove(window, QPoint(200,200));
+ QCOMPARE(mouseArea->hovered(), true);
+ QTest::mouseMove(window, QPoint(22,33));
+ QCOMPARE(mouseArea->hovered(), false);
+ QTest::mouseMove(window, QPoint(200,200));
+ QCOMPARE(mouseArea->hovered(), true);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(200,200));
+ QCOMPARE(mouseArea->hovered(), true);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(200,200));
+ QCOMPARE(mouseArea->hovered(), true);
+ QTest::mouseMove(window, QPoint(22,33));
+ QCOMPARE(mouseArea->hovered(), false);
+ delete window;
+}
+
void tst_QQuickMouseArea::disableAfterPress()
{
QQuickView *window = createView();
diff --git a/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
new file mode 100644
index 0000000000..b1b7b97881
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 360
+ height: 360
+
+ VisualItemModel {
+ id: visItemModel
+ Rectangle {
+ width: 20
+ height: 20
+ color: "red"
+ }
+ }
+
+ Column {
+ anchors.fill: parent
+ Repeater {
+ model: visItemModel
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index 582503f938..9fb76f9584 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -78,6 +78,7 @@ private slots:
void asynchronous();
void initParent();
void dynamicModelCrash();
+ void visualItemModelCrash();
};
class TestObject : public QObject
@@ -732,6 +733,17 @@ void tst_QQuickRepeater::dynamicModelCrash()
QVERIFY(qvariant_cast<QObject *>(repeater->model()) == 0);
}
+void tst_QQuickRepeater::visualItemModelCrash()
+{
+ // This used to crash because the model would get
+ // deleted before the repeater, leading to double-deletion
+ // of the items.
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("visualitemmodel.qml"));
+ qApp->processEvents();
+ delete window;
+}
+
QTEST_MAIN(tst_QQuickRepeater)
#include "tst_qquickrepeater.moc"
diff --git a/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml b/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml
new file mode 100644
index 0000000000..7f1ce705dd
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Text {
+ width: implicitWidth / 2
+ height: implicitHeight / 2
+ elide: Text.ElideRight
+ maximumLineCount: 4
+
+ text: "Line one\nLine two\nLine three\nLine four"
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index b95a646bd6..fdaa1d6617 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -110,8 +110,8 @@ private slots:
void letterSpacing();
void wordSpacing();
- void clickLink_data();
- void clickLink();
+ void linkInteraction_data();
+ void linkInteraction();
void implicitSize_data();
void implicitSize();
@@ -149,6 +149,8 @@ private slots:
void htmlLists();
void htmlLists_data();
+ void elideBeforeMaximumLineCount();
+
private:
QStringList standard;
QStringList richText;
@@ -1480,15 +1482,30 @@ void tst_qquicktext::wordSpacing()
class EventSender : public QQuickItem
{
public:
- void sendEvent(QMouseEvent *event) {
- if (event->type() == QEvent::MouseButtonPress)
- mousePressEvent(event);
- else if (event->type() == QEvent::MouseButtonRelease)
- mouseReleaseEvent(event);
- else if (event->type() == QEvent::MouseMove)
- mouseMoveEvent(event);
- else
+ void sendEvent(QEvent *event) {
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ mousePressEvent(static_cast<QMouseEvent *>(event));
+ break;
+ case QEvent::MouseButtonRelease:
+ mouseReleaseEvent(static_cast<QMouseEvent *>(event));
+ break;
+ case QEvent::MouseMove:
+ mouseMoveEvent(static_cast<QMouseEvent *>(event));
+ break;
+ case QEvent::HoverEnter:
+ hoverEnterEvent(static_cast<QHoverEvent *>(event));
+ break;
+ case QEvent::HoverLeave:
+ hoverLeaveEvent(static_cast<QHoverEvent *>(event));
+ break;
+ case QEvent::HoverMove:
+ hoverMoveEvent(static_cast<QHoverEvent *>(event));
+ break;
+ default:
qWarning() << "Trying to send unsupported event type";
+ break;
+ }
}
};
@@ -1498,10 +1515,12 @@ class LinkTest : public QObject
public:
LinkTest() {}
- QString link;
+ QString clickedLink;
+ QString hoveredLink;
public slots:
- void linkClicked(QString l) { link = l; }
+ void linkClicked(QString l) { clickedLink = l; }
+ void linkHovered(QString l) { hoveredLink = l; }
};
class TextMetrics
@@ -1587,13 +1606,15 @@ public:
typedef QVector<QPointF> PointVector;
Q_DECLARE_METATYPE(PointVector);
-void tst_qquicktext::clickLink_data()
+void tst_qquicktext::linkInteraction_data()
{
QTest::addColumn<QString>("text");
QTest::addColumn<qreal>("width");
QTest::addColumn<QString>("bindings");
QTest::addColumn<PointVector>("mousePositions");
- QTest::addColumn<QString>("link");
+ QTest::addColumn<QString>("clickedLink");
+ QTest::addColumn<QString>("hoverEnterLink");
+ QTest::addColumn<QString>("hoverMoveLink");
const QString singleLineText = "this text has a <a href=\\\"http://qt-project.org/single\\\">link</a> in it";
const QString singleLineLink = "http://qt-project.org/single";
@@ -1610,196 +1631,229 @@ void tst_qquicktext::clickLink_data()
<< singleLineText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(18).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("click on text")
<< singleLineText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(13).center())
- << QString();
+ << QString()
+ << QString() << QString();
QTest::newRow("drag within link")
<< singleLineText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(17).center()
<< metrics.characterRectangle(19).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("drag away from link")
<< singleLineText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(18).center()
<< metrics.characterRectangle(13).center())
- << QString();
+ << QString()
+ << singleLineLink << QString();
QTest::newRow("drag on to link")
<< singleLineText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(13).center()
<< metrics.characterRectangle(18).center())
- << QString();
+ << QString()
+ << QString() << singleLineLink;
QTest::newRow("click on bottom right aligned link")
<< singleLineText << 240.
<< "horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom"
<< (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignBottom).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("click on center aligned link")
<< singleLineText << 240.
<< "horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter"
<< (PointVector() << metrics.characterRectangle(18, Qt::AlignHCenter, Qt::AlignVCenter).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("click on rich text link")
<< singleLineText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(18).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("click on rich text")
<< singleLineText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(13).center())
- << QString();
+ << QString()
+ << QString() << QString();
QTest::newRow("click on bottom right aligned rich text link")
<< singleLineText << 240.
<< "textFormat: Text.RichText; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom"
<< (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignBottom).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
QTest::newRow("click on center aligned rich text link")
<< singleLineText << 240.
<< "textFormat: Text.RichText; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter"
<< (PointVector() << metrics.characterRectangle(18, Qt::AlignHCenter, Qt::AlignVCenter).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
} {
const TextMetrics metrics("this text has a li", Qt::ElideRight);
QTest::newRow("click on right elided link")
<< singleLineText << metrics.width() + 2
<< "elide: Text.ElideRight"
<< (PointVector() << metrics.characterRectangle(17).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
} {
const TextMetrics metrics("ink in it", Qt::ElideLeft);
QTest::newRow("click on left elided link")
<< singleLineText << metrics.width() + 2
<< "elide: Text.ElideLeft"
<< (PointVector() << metrics.characterRectangle(2).center())
- << singleLineLink;
+ << singleLineLink
+ << singleLineLink << singleLineLink;
} {
const TextMetrics metrics("this text\nhas multiple\nlines in it");
QTest::newRow("click on second line")
<< multipleLineText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(18).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
QTest::newRow("click on third line")
<< multipleLineText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(25).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
QTest::newRow("drag from second line to third")
<< multipleLineText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(18).center()
<< metrics.characterRectangle(25).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
QTest::newRow("click on rich text second line")
<< multipleLineText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(18).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
QTest::newRow("click on rich text third line")
<< multipleLineText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(25).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
QTest::newRow("drag rich text from second line to third")
<< multipleLineText << 240.
<< "textFormat: Text.RichText"
<< (PointVector()
<< metrics.characterRectangle(18).center()
<< metrics.characterRectangle(25).center())
- << multipleLineLink;
+ << multipleLineLink
+ << multipleLineLink << multipleLineLink;
} {
const TextMetrics metrics("this text has a nested link in it");
QTest::newRow("click on left outer link")
<< nestedText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(22).center())
- << outerLink;
+ << outerLink
+ << outerLink << outerLink;
QTest::newRow("click on right outer link")
<< nestedText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(27).center())
- << outerLink;
+ << outerLink
+ << outerLink << outerLink;
QTest::newRow("click on inner link left")
<< nestedText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(23).center())
- << innerLink;
+ << innerLink
+ << innerLink << innerLink;
QTest::newRow("click on inner link right")
<< nestedText << 240.
<< ""
<< (PointVector() << metrics.characterRectangle(26).center())
- << innerLink;
+ << innerLink
+ << innerLink << innerLink;
QTest::newRow("drag from inner to outer link")
<< nestedText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(25).center()
<< metrics.characterRectangle(30).center())
- << QString();
+ << QString()
+ << innerLink << outerLink;
QTest::newRow("drag from outer to inner link")
<< nestedText << 240.
<< ""
<< (PointVector()
<< metrics.characterRectangle(30).center()
<< metrics.characterRectangle(25).center())
- << QString();
+ << QString()
+ << outerLink << innerLink;
QTest::newRow("click on left outer rich text link")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(22).center())
- << outerLink;
+ << outerLink
+ << outerLink << outerLink;
QTest::newRow("click on right outer rich text link")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(27).center())
- << outerLink;
+ << outerLink
+ << outerLink << outerLink;
QTest::newRow("click on inner rich text link left")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(23).center())
- << innerLink;
+ << innerLink
+ << innerLink << innerLink;
QTest::newRow("click on inner rich text link right")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector() << metrics.characterRectangle(26).center())
- << innerLink;
+ << innerLink
+ << innerLink << innerLink;
QTest::newRow("drag from inner to outer rich text link")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector()
<< metrics.characterRectangle(25).center()
<< metrics.characterRectangle(30).center())
- << QString();
+ << QString()
+ << innerLink << outerLink;
QTest::newRow("drag from outer to inner rich text link")
<< nestedText << 240.
<< "textFormat: Text.RichText"
<< (PointVector()
<< metrics.characterRectangle(30).center()
<< metrics.characterRectangle(25).center())
- << QString();
+ << QString()
+ << outerLink << innerLink;
}
}
-void tst_qquicktext::clickLink()
+void tst_qquicktext::linkInteraction()
{
QFETCH(QString, text);
QFETCH(qreal, width);
QFETCH(QString, bindings);
QFETCH(PointVector, mousePositions);
- QFETCH(QString, link);
+ QFETCH(QString, clickedLink);
+ QFETCH(QString, hoverEnterLink);
+ QFETCH(QString, hoverMoveLink);
QString componentStr =
- "import QtQuick 2.0\nText {\n"
+ "import QtQuick 2.2\nText {\n"
"width: " + QString::number(width) + "\n"
"height: 320\n"
"text: \"" + text + "\"\n"
@@ -1813,28 +1867,46 @@ void tst_qquicktext::clickLink()
LinkTest test;
QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString)));
+ QObject::connect(textObject, SIGNAL(linkHovered(QString)), &test, SLOT(linkHovered(QString)));
QVERIFY(mousePositions.count() > 0);
QPointF mousePosition = mousePositions.first();
{
+ QHoverEvent he(QEvent::HoverEnter, mousePosition, QPointF());
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&he);
+
QMouseEvent me(QEvent::MouseButtonPress, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
}
+ QCOMPARE(test.hoveredLink, hoverEnterLink);
+ QCOMPARE(textObject->hoveredLink(), hoverEnterLink);
+
for (int i = 1; i < mousePositions.count(); ++i) {
mousePosition = mousePositions.at(i);
+ QHoverEvent he(QEvent::HoverMove, mousePosition, QPointF());
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&he);
+
QMouseEvent me(QEvent::MouseMove, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
}
+ QCOMPARE(test.hoveredLink, hoverMoveLink);
+ QCOMPARE(textObject->hoveredLink(), hoverMoveLink);
+
{
+ QHoverEvent he(QEvent::HoverLeave, mousePosition, QPointF());
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&he);
+
QMouseEvent me(QEvent::MouseButtonRelease, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
}
- QCOMPARE(test.link, link);
+ QCOMPARE(test.clickedLink, clickedLink);
+ QCOMPARE(test.hoveredLink, QString());
+ QCOMPARE(textObject->hoveredLink(), QString());
delete textObject;
}
@@ -3638,6 +3710,18 @@ void tst_qquicktext::htmlLists_data()
QTest::newRow("unordered list bad") << "<ul type=\"bad\"><li>one</li><li>two</li></ul>" << 2;
}
+void tst_qquicktext::elideBeforeMaximumLineCount()
+{ // QTBUG-31471
+ QQmlComponent component(&engine, testFile("elideBeforeMaximumLineCount.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickText *item = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(item);
+
+ QCOMPARE(item->lineCount(), 2);
+}
+
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"
diff --git a/tests/auto/quick/qquicktextedit/data/linkActivated.qml b/tests/auto/quick/qquicktextedit/data/linkInteraction.qml
index d3bba82b59..d3bba82b59 100644
--- a/tests/auto/quick/qquicktextedit/data/linkActivated.qml
+++ b/tests/auto/quick/qquicktextedit/data/linkInteraction.qml
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 2db79d7794..09ea35cd9e 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -144,7 +144,7 @@ private slots:
void positionAt_data();
void positionAt();
- void linkActivated();
+ void linkInteraction();
void cursorDelegate_data();
void cursorDelegate();
@@ -183,6 +183,8 @@ private slots:
void getText();
void getFormattedText_data();
void getFormattedText();
+ void append_data();
+ void append();
void insert_data();
void insert();
void remove_data();
@@ -2342,9 +2344,9 @@ void tst_qquicktextedit::positionAt()
QVERIFY(texteditObject->positionAt(x0 / 2, y1) > 0);
}
-void tst_qquicktextedit::linkActivated()
+void tst_qquicktextedit::linkInteraction()
{
- QQuickView window(testFileUrl("linkActivated.qml"));
+ QQuickView window(testFileUrl("linkInteraction.qml"));
QVERIFY(window.rootObject() != 0);
window.show();
window.requestActivate();
@@ -2354,6 +2356,7 @@ void tst_qquicktextedit::linkActivated()
QVERIFY(texteditObject != 0);
QSignalSpy spy(texteditObject, SIGNAL(linkActivated(QString)));
+ QSignalSpy hover(texteditObject, SIGNAL(linkHovered(QString)));
const QString link("http://example.com/");
@@ -2362,21 +2365,31 @@ void tst_qquicktextedit::linkActivated()
QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint());
QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE(hover.count(), 1);
QCOMPARE(spy.last()[0].toString(), link);
+ QCOMPARE(hover.last()[0].toString(), link);
+ QCOMPARE(texteditObject->hoveredLink(), link);
QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint());
- QTest::qWait(50);
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE(hover.count(), 2);
+ QCOMPARE(hover.last()[0].toString(), QString());
+ QCOMPARE(texteditObject->hoveredLink(), QString());
texteditObject->setReadOnly(true);
QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint());
QTRY_COMPARE(spy.count(), 2);
+ QTRY_COMPARE(hover.count(), 3);
QCOMPARE(spy.last()[0].toString(), link);
+ QCOMPARE(hover.last()[0].toString(), link);
+ QCOMPARE(texteditObject->hoveredLink(), link);
QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint());
- QTest::qWait(50);
- QCOMPARE(spy.count(), 2);
+ QTRY_COMPARE(spy.count(), 2);
+ QTRY_COMPARE(hover.count(), 4);
+ QCOMPARE(hover.last()[0].toString(), QString());
+ QCOMPARE(texteditObject->hoveredLink(), QString());
}
void tst_qquicktextedit::cursorDelegate_data()
@@ -3817,6 +3830,158 @@ void tst_qquicktextedit::getFormattedText()
}
}
+void tst_qquicktextedit::append_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QQuickTextEdit::TextFormat>("textFormat");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<QString>("appendText");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<int>("expectedSelectionStart");
+ QTest::addColumn<int>("expectedSelectionEnd");
+ QTest::addColumn<int>("expectedCursorPosition");
+ QTest::addColumn<bool>("selectionChanged");
+ QTest::addColumn<bool>("cursorPositionChanged");
+
+ QTest::newRow("cursor kept intact (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("cursor kept intact (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("cursor follows (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << standard.at(0).length() + 6 << standard.at(0).length() + 6 << standard.at(0).length() + 6
+ << false << true;
+
+ QTest::newRow("selection kept intact (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 18
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 0 << 18 << 18
+ << false << false;
+
+ QTest::newRow("selection kept intact (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 18
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 14 << 18 << 18
+ << false << false;
+
+ QTest::newRow("selection kept intact, cursor follows (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 18 << standard.at(0).length() + 6 << standard.at(0).length() + 6
+ << false << true;
+
+ QTest::newRow("reversed selection kept intact")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 14
+ << QString("Hello")
+ << standard.at(0) + QString("\nHello")
+ << 14 << 18 << 14
+ << false << false;
+
+ QTest::newRow("rich text into plain text")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << QString("<b>Hello</b>")
+ << standard.at(0) + QString("\n<b>Hello</b>")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("rich text into rich text")
+ << standard.at(0) << QQuickTextEdit::RichText
+ << 0 << 0
+ << QString("<b>Hello</b>")
+ << standard.at(0) + QChar(QChar::ParagraphSeparator) + QString("Hello")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("rich text into auto text")
+ << standard.at(0) << QQuickTextEdit::AutoText
+ << 0 << 0
+ << QString("<b>Hello</b>")
+ << standard.at(0) + QString("\nHello")
+ << 0 << 0 << 0
+ << false << false;
+}
+
+void tst_qquicktextedit::append()
+{
+ QFETCH(QString, text);
+ QFETCH(QQuickTextEdit::TextFormat, textFormat);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(QString, appendText);
+ QFETCH(QString, expectedText);
+ QFETCH(int, expectedSelectionStart);
+ QFETCH(int, expectedSelectionEnd);
+ QFETCH(int, expectedCursorPosition);
+ QFETCH(bool, selectionChanged);
+ QFETCH(bool, cursorPositionChanged);
+
+ QString componentStr = "import QtQuick 2.2\nTextEdit { text: \"" + text + "\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ textEdit->setTextFormat(textFormat);
+ textEdit->select(selectionStart, selectionEnd);
+
+ QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged()));
+ QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
+ QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));
+ QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged()));
+
+ textEdit->append(appendText);
+
+ if (textFormat == QQuickTextEdit::RichText || (textFormat == QQuickTextEdit::AutoText && (
+ Qt::mightBeRichText(text) || Qt::mightBeRichText(appendText)))) {
+ QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText);
+ } else {
+ QCOMPARE(textEdit->text(), expectedText);
+
+ }
+ QCOMPARE(textEdit->length(), expectedText.length());
+
+ QCOMPARE(textEdit->selectionStart(), expectedSelectionStart);
+ QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd);
+ QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition);
+
+ if (selectionStart > selectionEnd)
+ qSwap(selectionStart, selectionEnd);
+
+ QEXPECT_FAIL("into selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QEXPECT_FAIL("into reversed selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QCOMPARE(selectionSpy.count() > 0, selectionChanged);
+ QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart);
+ QEXPECT_FAIL("into reversed selection", "selectionEndChanged signal not emitted", Continue);
+ QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd);
+ QCOMPARE(textSpy.count() > 0, text != expectedText);
+ QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged);
+}
+
void tst_qquicktextedit::insert_data()
{
QTest::addColumn<QString>("text");
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index b1648cbed2..7a61ceb7fd 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -3149,6 +3149,7 @@ void tst_qquicktextinput::echoMode()
QCOMPARE(initial, QLatin1String("ABCDefgh"));
QCOMPARE(input->echoMode(), QQuickTextInput::Normal);
QCOMPARE(input->displayText(), input->text());
+ const QString passwordMaskCharacter = qApp->styleHints()->passwordMaskCharacter();
//Normal
ref &= ~Qt::ImhHiddenText;
ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
@@ -3156,7 +3157,7 @@ void tst_qquicktextinput::echoMode()
input->setEchoMode(QQuickTextInput::NoEcho);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String(""));
- QCOMPARE(input->passwordCharacter(), QLatin1String("*"));
+ QCOMPARE(input->passwordCharacter(), passwordMaskCharacter);
//NoEcho
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
@@ -3166,7 +3167,7 @@ void tst_qquicktextinput::echoMode()
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->text(), initial);
- QCOMPARE(input->displayText(), QLatin1String("********"));
+ QCOMPARE(input->displayText(), QString(8, passwordMaskCharacter.at(0)));
QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
// clearing input hints do not clear bits set by echo mode
input->setInputMethodHints(Qt::ImhNone);
@@ -3221,7 +3222,7 @@ void tst_qquicktextinput::passwordEchoDelay()
QQuickItem *cursor = input->findChild<QQuickItem *>("cursor");
QVERIFY(cursor);
- QChar fillChar = QLatin1Char('*');
+ QChar fillChar = qApp->styleHints()->passwordMaskCharacter();
input->setEchoMode(QQuickTextInput::Password);
QCOMPARE(input->displayText(), QString(8, fillChar));
@@ -6124,6 +6125,12 @@ void tst_qquicktextinput::keypress_inputMask_data()
keys << Qt::Key_Home << "12ab";
QTest::newRow("uppercase") << QString("9999 >AA;_") << keys << QString("12 AB") << QString("12__ AB");
}
+ {
+ KeyList keys;
+ // inserting '12ab'
+ keys << Qt::Key_Right << Qt::Key_Right << "1";
+ QTest::newRow("Move in mask") << QString("#0:00;*") << keys << QString(":1") << QString("**:1*");
+ }
}
void tst_qquicktextinput::keypress_inputMask()
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index d16bf81d88..d374d71280 100644
--- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -615,6 +615,7 @@ void tst_qquickvisualdatamodel::childChanged()
vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0))));
QCOMPARE(listview->count(), 1);
+ listview->forceLayout();
QQuickText *name = findItem<QQuickText>(contentItem, "display", 0);
QVERIFY(name);
QCOMPARE(name->text(), QString("Row 2 Child Item"));
@@ -628,6 +629,7 @@ void tst_qquickvisualdatamodel::childChanged()
model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2")));
QCOMPARE(listview->count(), 2);
+ listview->forceLayout();
name = findItem<QQuickText>(contentItem, "display", 1);
QVERIFY(name != 0);
QCOMPARE(name->text(), QString("Row 2 Child Item 2"));
@@ -638,6 +640,8 @@ void tst_qquickvisualdatamodel::childChanged()
vdm->setRootIndex(QVariant::fromValue(QModelIndex()));
QCOMPARE(listview->count(), 3);
+
+ listview->forceLayout();
name = findItem<QQuickText>(contentItem, "display", 0);
QVERIFY(name);
QCOMPARE(name->text(), QString("Row 1 Item"));
@@ -989,6 +993,8 @@ void tst_qquickvisualdatamodel::packagesDestroyed()
QQuickItem *rightContent = rightview->contentItem();
QTRY_VERIFY(rightContent != 0);
+ leftview->forceLayout();
+ rightview->forceLayout();
QCOMPARE(leftview->currentIndex(), 0);
QCOMPARE(rightview->currentIndex(), 0);
@@ -3548,6 +3554,7 @@ void tst_qquickvisualdatamodel::resolve()
evaluate<void>(visualModel, setupExpression);
QCOMPARE(evaluate<int>(listView, "count"), unresolvedCount);
+ listView->forceLayout();
evaluate<void>(visualModel, resolveExpression);
QCOMPARE(evaluate<int>(listView, "count"), inItems ? visualCount : modelCount);
diff --git a/tests/auto/quick/qquickwindow/data/active.qml b/tests/auto/quick/qquickwindow/data/active.qml
new file mode 100644
index 0000000000..af0b7edeb2
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/active.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.1
+import QtQuick.Window 2.1
+
+Window {
+ id: window1;
+ objectName: "window1";
+ color: "#00FF00";
+ width: 100; height: 100;
+ Item {
+ objectName: "item1"
+ width: 100; height: 100;
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent;
+ onPressed: window2.requestActivate();
+ }
+ Component.onCompleted: window2.show();
+ }
+
+ Window {
+ id: window2;
+ objectName: "window2";
+ color: "#FF0000";
+ width: 100; height: 100;
+ Item {
+ width: 100; height: 100;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/data/ucantclosethis.qml b/tests/auto/quick/qquickwindow/data/ucantclosethis.qml
new file mode 100644
index 0000000000..aa68cf5105
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/ucantclosethis.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.1
+import QtQuick.Window 2.1
+
+Window {
+ width: 240
+ height: 75
+ title: "Hammer sez"
+ color: "#e0c31e"
+ property bool canCloseThis: false;
+ Rectangle {
+ color: "#14148c"
+ width: parent.width * 0.85
+ height: parent.height * 0.7
+ anchors.horizontalCenter: parent.horizontalCenter
+ Text {
+ id: text
+ anchors.centerIn: parent
+ color: "white"
+ textFormat: Text.StyledText
+ text: "whoa-oa-oa-oh<br/>U can't <font color='#b40000' size='+1'>close</font> this"
+ }
+ }
+ onClosing: {
+ if (canCloseThis) {
+ text.text = "uncle! I give up"
+ // the event is accepted by default
+ } else {
+ close.accepted = false
+ text.text = "...but you still can't close this"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro
index 05b58fcb4c..46cf96423f 100644
--- a/tests/auto/quick/qquickwindow/qquickwindow.pro
+++ b/tests/auto/quick/qquickwindow/qquickwindow.pro
@@ -11,6 +11,7 @@ QT += core-private gui-private qml-private quick-private testlib
TESTDATA = data/*
OTHER_FILES += \
+ data/active.qml \
data/AnimationsWhileHidden.qml \
data/Headless.qml \
data/showHideAnimate.qml
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 2d3c8f7ca7..e2bb6b431c 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -48,6 +48,7 @@
#include <QtQml/QQmlComponent>
#include <QtQuick/private/qquickrectangle_p.h>
#include "../../shared/util.h"
+#include "../shared/visualtestutil.h"
#include <QSignalSpy>
#include <qpa/qwindowsysteminterface.h>
#include <private/qquickwindow_p.h>
@@ -304,6 +305,7 @@ private slots:
void qmlCreation();
void clearColor();
+ void grab_data();
void grab();
void multipleWindows();
@@ -322,6 +324,10 @@ private slots:
void testExpose();
+ void requestActivate();
+
+ void blockClosing();
+
#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -929,15 +935,28 @@ void tst_qquickwindow::clearColor()
QCOMPARE(window->color(), QColor(Qt::blue));
}
+void tst_qquickwindow::grab_data()
+{
+ QTest::addColumn<bool>("visible");
+ QTest::newRow("visible") << true;
+ QTest::newRow("invisible") << false;
+}
+
void tst_qquickwindow::grab()
{
+ QFETCH(bool, visible);
+
QQuickWindow window;
window.setColor(Qt::red);
window.resize(250, 250);
- window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ if (visible) {
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ } else {
+ window.create();
+ }
QImage content = window.grabWindow();
QCOMPARE(content.width(), window.width());
@@ -1400,6 +1419,74 @@ void tst_qquickwindow::testExpose()
QTRY_COMPARE(swapSpy.size(), 1);
}
+void tst_qquickwindow::requestActivate()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("active.qml"));
+ QQuickWindow* window1 = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window1);
+
+ QWindowList windows = QGuiApplication::topLevelWindows();
+ QVERIFY(windows.size() == 2);
+
+ for (int i = 0; i < windows.size(); ++i) {
+ if (windows.at(i)->objectName() == window1->objectName()) {
+ windows.removeAt(i);
+ break;
+ }
+ }
+ QVERIFY(windows.size() == 1);
+ QVERIFY(windows.at(0)->objectName() == "window2");
+
+ window1->show();
+ window1->requestActivate();
+
+ QTRY_VERIFY(QGuiApplication::focusWindow() == window1);
+ QVERIFY(window1->isActive() == true);
+
+ QQuickItem *item = QQuickVisualTestUtil::findItem<QQuickItem>(window1->contentItem(), "item1");
+ QVERIFY(item);
+
+ //copied from src/qmltest/quicktestevent.cpp
+ QPoint pos = item->mapToScene(QPointF(item->width()/2, item->height()/2)).toPoint();
+
+ QMouseEvent me(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QSpontaneKeyEvent::setSpontaneous(&me);
+ if (!qApp->notify(window1, &me)) {
+ QString warning = QString::fromLatin1("Mouse event MousePress not accepted by receiving window");
+ QWARN(warning.toLatin1().data());
+ }
+ me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, 0, Qt::NoModifier);
+ QSpontaneKeyEvent::setSpontaneous(&me);
+ if (!qApp->notify(window1, &me)) {
+ QString warning = QString::fromLatin1("Mouse event MouseRelease not accepted by receiving window");
+ QWARN(warning.toLatin1().data());
+ }
+
+ QTRY_VERIFY(QGuiApplication::focusWindow() == windows.at(0));
+ QVERIFY(windows.at(0)->isActive());
+}
+
+void tst_qquickwindow::blockClosing()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("ucantclosethis.qml"));
+ QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->isVisible());
+ QWindowSystemInterface::handleCloseEvent(window);
+ QVERIFY(window->isVisible());
+ QWindowSystemInterface::handleCloseEvent(window);
+ QVERIFY(window->isVisible());
+ window->setProperty("canCloseThis", true);
+ QWindowSystemInterface::handleCloseEvent(window);
+ QTRY_VERIFY(!window->isVisible());
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 15a4f0cc27..4779942406 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -195,8 +195,9 @@ void tst_TouchMouse::simpleTouchEvent()
window->setSource(testFileUrl("singleitem.qml"));
window->show();
- window->requestActivate();
QVERIFY(QTest::qWaitForWindowExposed(window));
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -344,7 +345,9 @@ void tst_TouchMouse::mouse()
window->setSource(testFileUrl("twoitems.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -376,7 +379,9 @@ void tst_TouchMouse::touchOverMouse()
window->setSource(testFileUrl("twoitems.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -417,7 +422,9 @@ void tst_TouchMouse::mouseOverTouch()
window->setSource(testFileUrl("twoitems.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -461,7 +468,9 @@ void tst_TouchMouse::buttonOnFlickable()
window->setSource(testFileUrl("buttononflickable.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
@@ -569,7 +578,9 @@ void tst_TouchMouse::buttonOnTouch()
QQuickView *window = createView();
window->setSource(testFileUrl("buttonontouch.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -691,7 +702,9 @@ void tst_TouchMouse::pinchOnFlickable()
QQuickView *window = createView();
window->setSource(testFileUrl("pinchonflickable.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -758,7 +771,9 @@ void tst_TouchMouse::flickableOnPinch()
QQuickView *window = createView();
window->setSource(testFileUrl("flickableonpinch.qml"));
window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -935,8 +950,9 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
window->setSource(testFileUrl("twoMouseAreas.qml"));
window->show();
- window->requestActivate();
QVERIFY(QTest::qWaitForWindowExposed(window));
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *bottomMouseArea =
diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp
index 205d5cec5d..fd681710de 100644
--- a/tests/auto/shared/testhttpserver.cpp
+++ b/tests/auto/shared/testhttpserver.cpp
@@ -137,7 +137,19 @@ bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &bod
bodyData = bodyFile.readAll();
}
- waitData = expectFile.readAll();
+ QByteArray line;
+ bool headers_done = false;
+ while (!(line = expectFile.readLine()).isEmpty()) {
+ line.replace('\r', "");
+ if (line.at(0) == '\n') {
+ headers_done = true;
+ continue;
+ }
+ if (headers_done)
+ waitData.body.append(line);
+ else
+ waitData.headers.append(line);
+ }
/*
while (waitData.endsWith('\n'))
waitData = waitData.left(waitData.count() - 1);
@@ -199,39 +211,38 @@ void TestHTTPServer::readyRead()
QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
if (!socket || socket->state() == QTcpSocket::ClosingState) return;
- QByteArray ba = socket->readAll();
-
if (!dirs.isEmpty()) {
- serveGET(socket, ba);
+ serveGET(socket, socket->readAll());
return;
}
- if (m_hasFailed || waitData.isEmpty()) {
- qWarning() << "TestHTTPServer: Unexpected data" << ba;
+ if (m_hasFailed || (waitData.body.isEmpty() && waitData.headers.count() == 0)) {
+ qWarning() << "TestHTTPServer: Unexpected data" << socket->readAll();
return;
}
- for (int ii = 0; ii < ba.count(); ++ii) {
- const char c = ba.at(ii);
- if (c == '\r' && waitData.isEmpty())
- continue;
- else if (!waitData.isEmpty() && c == waitData.at(0))
- waitData = waitData.mid(1);
- else if (c == '\r')
- continue;
- else {
- QByteArray data = ba.mid(ii);
- qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData;
+ QByteArray line;
+ while (!(line = socket->readLine()).isEmpty()) {
+ line.replace('\r', "");
+ if (line.at(0) == '\n') {
+ QByteArray data = socket->readAll();
+ if (waitData.body != data) {
+ qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData.body;
+ m_hasFailed = true;
+ socket->disconnectFromHost();
+ return;
+ }
+ }
+ else if (!waitData.headers.contains(line)) {
+ qWarning() << "TestHTTPServer: Unexpected header:" << line << "\nExpected headers: " << waitData.headers;
m_hasFailed = true;
socket->disconnectFromHost();
return;
}
}
- if (waitData.isEmpty()) {
- socket->write(replyData);
- socket->disconnectFromHost();
- }
+ socket->write(replyData);
+ socket->disconnectFromHost();
}
bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName)
diff --git a/tests/auto/shared/testhttpserver.h b/tests/auto/shared/testhttpserver.h
index 15e08afd0c..ce0501f170 100644
--- a/tests/auto/shared/testhttpserver.h
+++ b/tests/auto/shared/testhttpserver.h
@@ -81,7 +81,10 @@ private:
QHash<QTcpSocket *, QByteArray> dataCache;
QList<QPair<QTcpSocket *, QByteArray> > toSend;
- QByteArray waitData;
+ struct WaitData {
+ QList <QByteArray>headers;
+ QByteArray body;
+ } waitData;
QByteArray replyData;
QByteArray bodyData;
bool m_hasFailed;
diff --git a/tests/benchmarks/qml/animation/animation.pro b/tests/benchmarks/qml/animation/animation.pro
index 58933cf038..e089884a7e 100644
--- a/tests/benchmarks/qml/animation/animation.pro
+++ b/tests/benchmarks/qml/animation/animation.pro
@@ -1,11 +1,10 @@
+CONFIG += testcase
TEMPLATE = app
TARGET = tst_animation
-QT += qml
+QT += qml testlib core-private gui-private qml-private quick-private
macx:CONFIG -= app_bundle
SOURCES += tst_animation.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-QT += testlib core-private gui-private qml-private quick-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/compilation/tst_compilation.cpp b/tests/benchmarks/qml/compilation/tst_compilation.cpp
index 148396622b..eac3dcc2dd 100644
--- a/tests/benchmarks/qml/compilation/tst_compilation.cpp
+++ b/tests/benchmarks/qml/compilation/tst_compilation.cpp
@@ -120,7 +120,6 @@ void tst_compilation::jsparser()
QBENCHMARK {
QQmlJS::Engine engine;
- QQmlJS::NodePool nodePool(file, &engine);
QQmlJS::Lexer lexer(&engine);
lexer.setCode(code, -1);
@@ -146,11 +145,14 @@ void tst_compilation::scriptparser()
QVERIFY(f.open(QIODevice::ReadOnly));
QByteArray data = f.readAll();
+ //TODO(pvarga): check preparseData
+ QByteArray preparseData;
QUrl url = QUrl::fromLocalFile(file);
+ QString urlString = url.toString();
QBENCHMARK {
QQmlScript::Parser parser;
- parser.parse(data, url);
+ parser.parse(data, preparseData, url, urlString);
parser.tree();
}
}
diff --git a/tests/benchmarks/qml/creation/creation.pro b/tests/benchmarks/qml/creation/creation.pro
index 8d26ef88df..0cfac64d5f 100644
--- a/tests/benchmarks/qml/creation/creation.pro
+++ b/tests/benchmarks/qml/creation/creation.pro
@@ -1,11 +1,10 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_creation
+QT += core-private gui-private qml-private quick-private widgets testlib
macx:CONFIG -= app_bundle
SOURCES += tst_creation.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-QT += core-private gui-private qml-private qtquick1-private widgets testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index 4b5c1d1950..b6b402a6c0 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -48,7 +48,6 @@
#include <QGraphicsItem>
#include <QQuickItem>
#include <QQmlContext>
-#include <QtQuick1/private/qdeclarativetextinput_p.h>
#include <private/qobject_p.h>
class tst_creation : public QObject
@@ -96,7 +95,7 @@ public:
: QObject(parent) {}
QQmlListProperty<QObject> resources() {
- return QQmlListProperty<QObject>(this, 0, resources_append);
+ return QQmlListProperty<QObject>(this, 0, resources_append, 0, 0, 0);
}
static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {
@@ -107,9 +106,6 @@ public:
tst_creation::tst_creation()
{
qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType");
-
- //get rid of initialization effects
- QDeclarative1TextInput te;
}
inline QUrl TEST_FILE(const QString &filename)
@@ -321,9 +317,7 @@ void tst_creation::itemtree_qml()
void tst_creation::itemtree_scene_cpp()
{
- QGraphicsScene scene;
QQuickItem *root = new QQuickItem;
- scene.addItem(root);
QBENCHMARK {
QQuickItem *item = new QQuickItem;
for (int i = 0; i < 30; ++i) {
diff --git a/tests/benchmarks/qml/holistic/testtypes.cpp b/tests/benchmarks/qml/holistic/testtypes.cpp
index 0a9e36dc3a..9b1bb86850 100644
--- a/tests/benchmarks/qml/holistic/testtypes.cpp
+++ b/tests/benchmarks/qml/holistic/testtypes.cpp
@@ -82,13 +82,13 @@ void registerTypes()
qmlRegisterType<ScarceResourceProvider>("Qt.test", 1,0, "MyScarceResourceProvider");
qmlRegisterType<ArbitraryVariantProvider>("Qt.test", 1,0, "MyArbitraryVariantProvider");
- qmlRegisterSingletonType("Qt.test",1,0,script_api); // register (script) singleton Type for an existing uri which contains elements
- qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,qobject_api); // register (qobject) for an existing uri for which another singleton Type was previously regd. Should replace!
- qmlRegisterSingletonType("Qt.test.scriptApi",1,0,script_api); // register (script) singleton Type for a uri which doesn't contain elements
- qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
- qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
- qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
- qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType("Qt.test",1,0,"Script",script_api); // register (script) singleton Type for an existing uri which contains elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,"QObject",qobject_api); // register (qobject) for an existing uri for which another singleton Type was previously regd. Should replace!
+ qmlRegisterSingletonType("Qt.test.scriptApi",1,0,"Script",script_api); // register (script) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,"QObject",qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
}
//#include "testtypes.moc"
diff --git a/tests/benchmarks/qml/painting/paintbenchmark.cpp b/tests/benchmarks/qml/painting/paintbenchmark.cpp
index b99161749d..1fc7813c04 100644
--- a/tests/benchmarks/qml/painting/paintbenchmark.cpp
+++ b/tests/benchmarks/qml/painting/paintbenchmark.cpp
@@ -180,6 +180,8 @@ void paint_RoundedRect(QPainter &p)
}
}
+// Disable this test case since this cannot be compiled with Qt5.
+#if 0
void paint_QPixmapCachedRoundedRect(QPainter &p)
{
static bool first = true;
@@ -218,6 +220,7 @@ void paint_QPixmapCachedRoundedRect(QPainter &p)
}
}
}
+#endif
void paint_pathCacheRoundedRect(QPainter &p)
{
@@ -312,7 +315,7 @@ struct {
{ "QStaticTextWithBackendOptimizations", &paint_QStaticText_optimizations },
{ "CachedText", &paint_QPixmapCachedText },
{ "RoundedRect", &paint_RoundedRect },
- { "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
+ // { "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
{ "PathCacheRoundedRect", &paint_pathCacheRoundedRect },
{ "QPixmap63x63_opaque", &paint_QPixmap63x63_opaque },
{ "QPixmap64x64_opaque", &paint_QPixmap64x64_opaque },
diff --git a/tests/benchmarks/qml/pointers/pointers.pro b/tests/benchmarks/qml/pointers/pointers.pro
index 1db474428d..b9b44abb0f 100644
--- a/tests/benchmarks/qml/pointers/pointers.pro
+++ b/tests/benchmarks/qml/pointers/pointers.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-QT += qml testlib
+QT += core-private v8-private qml-private testlib
TEMPLATE = app
TARGET = tst_pointers
macx:CONFIG -= app_bundle
diff --git a/tests/benchmarks/qml/pointers/tst_pointers.cpp b/tests/benchmarks/qml/pointers/tst_pointers.cpp
index 65dda28fe7..0c25030c7f 100644
--- a/tests/benchmarks/qml/pointers/tst_pointers.cpp
+++ b/tests/benchmarks/qml/pointers/tst_pointers.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include <qtest.h>
-#include "private/qqmlguard_p.h"
+#include <QtQml/private/qqmlguard_p.h>
#include <QWeakPointer>
class tst_pointers : public QObject
diff --git a/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp b/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
index 01ddd70838..20e5fb6c64 100644
--- a/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
@@ -63,9 +63,9 @@ tst_qquickwindow::tst_qquickwindow()
{
window = new QQuickWindow;
window->resize(250, 250);
- window->setPos(100, 100);
+ window->setPosition(100, 100);
for ( int i=0; i<8000; i++ ) {
- QQuickRectangle *r =new QQuickRectangle(window->rootItem());
+ QQuickRectangle *r =new QQuickRectangle(window->contentItem());
for ( int j=0; j<10; ++j ) {
new QQuickRectangle(r);
}
diff --git a/tests/benchmarks/qml/typeimports/tst_typeimports.cpp b/tests/benchmarks/qml/typeimports/tst_typeimports.cpp
index c24e344a6b..5871565ace 100644
--- a/tests/benchmarks/qml/typeimports/tst_typeimports.cpp
+++ b/tests/benchmarks/qml/typeimports/tst_typeimports.cpp
@@ -67,7 +67,7 @@ public:
TestType1(QObject *parent = 0) : QObject(parent) {}
QQmlListProperty<QObject> resources() {
- return QQmlListProperty<QObject>(this, 0, resources_append);
+ return QQmlListProperty<QObject>(this, 0, resources_append, 0, 0, 0);
}
static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {
diff --git a/tests/manual/qmltypememory/README b/tests/manual/qmltypememory/README
new file mode 100644
index 0000000000..b1237a1fc7
--- /dev/null
+++ b/tests/manual/qmltypememory/README
@@ -0,0 +1,3 @@
+This test just continually builds up and tears down a QML scene. Watch over a long period to see if the memory usage goes up.
+
+This test specifically is targeting the QQmlType cache which is a global static.
diff --git a/src/quick/doc/snippets/qml/usecases/userinput.qml b/tests/manual/qmltypememory/TestPlugin/plugin.cpp
index 5aabcde18e..40c2af20f5 100644
--- a/src/quick/doc/snippets/qml/usecases/userinput.qml
+++ b/tests/manual/qmltypememory/TestPlugin/plugin.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Research In Motion.
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,33 +38,26 @@
**
****************************************************************************/
-//![0]
-import QtQuick 2.0
+#include <QtQml/QQmlExtensionPlugin>
+#include <QtQml/qqml.h>
+#include <qdebug.h>
-Item {
- id: root
+class TestType : public QObject
+{
+ Q_OBJECT
+};
- width: 320
- height: 480
+class TestPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
- Rectangle {
- color: "#272822"
- width: 320
- height: 480
+public:
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(uri == QLatin1String("TestPlugin"));
+ qmlRegisterType<TestType>(uri, 1, 0, "TestTypePlugin");
}
+};
- Rectangle {
- id: rectangle
- x: 40
- y: 20
- width: 120
- height: 120
- color: "red"
-
- MouseArea {
- anchors.fill: parent
- onClicked: rectangle.width += 10
- }
- }
-}
-//![0]
+#include "plugin.moc"
diff --git a/tests/manual/qmltypememory/TestPlugin/plugin.pro b/tests/manual/qmltypememory/TestPlugin/plugin.pro
new file mode 100644
index 0000000000..7575442800
--- /dev/null
+++ b/tests/manual/qmltypememory/TestPlugin/plugin.pro
@@ -0,0 +1,7 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += qml
+
+TARGET = testplugin
+
+SOURCES += plugin.cpp
diff --git a/tests/manual/qmltypememory/TestPlugin/qmldir b/tests/manual/qmltypememory/TestPlugin/qmldir
new file mode 100644
index 0000000000..f0624dfd82
--- /dev/null
+++ b/tests/manual/qmltypememory/TestPlugin/qmldir
@@ -0,0 +1,2 @@
+module TestPlugin
+plugin testplugin
diff --git a/tests/manual/qmltypememory/TestType.qml b/tests/manual/qmltypememory/TestType.qml
new file mode 100644
index 0000000000..59e0bcf477
--- /dev/null
+++ b/tests/manual/qmltypememory/TestType.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQml 2.0
+QtObject{property int notJustAStandardQtObject: 10 }
diff --git a/tests/manual/qmltypememory/main.cpp b/tests/manual/qmltypememory/main.cpp
new file mode 100644
index 0000000000..da086ec9f7
--- /dev/null
+++ b/tests/manual/qmltypememory/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml>
+#include <QGuiApplication>
+#include "testdriver.h"
+
+int main (int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ int i = -1;
+ if (argc > 1)
+ i = atoi(argv[1]);
+ if (i < 1)
+ i = -1;
+ TestDriver td(QUrl::fromLocalFile("main.qml"), i);
+ return app.exec();
+}
diff --git a/tests/manual/qmltypememory/main.qml b/tests/manual/qmltypememory/main.qml
new file mode 100644
index 0000000000..7bc9006aec
--- /dev/null
+++ b/tests/manual/qmltypememory/main.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQml 2.0
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import QtQuick.LocalStorage 2.0
+import Test 2.0
+import TestPlugin 1.0
+import "."
+
+QtObject {
+ property TestType tt //No object, although it should be properly parented if there were one
+ property TestTypeCpp tt2 //No object, although it should be properly parented if there were one
+ property TestTypePlugin tt3
+}
diff --git a/tests/manual/qmltypememory/qmldir b/tests/manual/qmltypememory/qmldir
new file mode 100644
index 0000000000..edb8c894c4
--- /dev/null
+++ b/tests/manual/qmltypememory/qmldir
@@ -0,0 +1,2 @@
+TestFromDir 2.0 TestType.qml
+internal TestFromDirInt TestType.qml
diff --git a/tests/manual/qmltypememory/qmltypememory.pro b/tests/manual/qmltypememory/qmltypememory.pro
new file mode 100644
index 0000000000..2bd873d554
--- /dev/null
+++ b/tests/manual/qmltypememory/qmltypememory.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+TARGET = qmltypememory
+INCLUDEPATH += .
+QT += qml
+
+# Input
+HEADERS += testdriver.h
+SOURCES += main.cpp testdriver.cpp
diff --git a/tests/manual/qmltypememory/testdriver.cpp b/tests/manual/qmltypememory/testdriver.cpp
new file mode 100644
index 0000000000..42de18c4d4
--- /dev/null
+++ b/tests/manual/qmltypememory/testdriver.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdriver.h"
+#include <QCoreApplication>
+const int interval = 0;
+
+QObject* singleFactory(QQmlEngine *, QJSEngine*)
+{
+ QObject* ret = new QObject; //NOTE: No parent - but also shouldn't need to be created
+ return ret;
+}
+
+TestDriver::TestDriver(const QUrl &componentUrl, int maxIter)
+ : QObject(0), e(0), c(0), i(maxIter)
+{
+ testFile = componentUrl;
+ QTimer::singleShot(interval, this, SLOT(setUp()));
+}
+
+void TestDriver::setUp()
+{
+ qmlRegisterType<TestType>("Test", 2, 0, "TestTypeCpp");
+ for (int j=2; j<1000; j++) {
+ qmlRegisterType<TestType>("Test", j, 0, "TestType");
+ qmlRegisterType<TestType>("Test", j, 1, "TestType");
+ qmlRegisterType<TestType>("Test", j, 2, "TestType");
+ qmlRegisterType<TestType>("Test", j, 3, "TestType");
+ qmlRegisterType<TestType>("Test", j, 4, "TestType");
+ qmlRegisterType<TestType>("Test", j, 5, "TestType");
+ qmlRegisterType<TestType>("Test", j, 6, "TestType");
+ qmlRegisterType<TestType>("Test", j, 7, "TestType");
+ qmlRegisterType<TestType>("Test", j, 8, "TestType");
+ qmlRegisterType<TestType>("Test", j, 9, "TestType");
+ }
+ qmlRegisterType<TestType>("Test2", 1, 0, "TestType");
+ qmlRegisterType<TestType>("Test2", 3, 0, "TestType");
+ qmlRegisterType<TestType>("Test3", 9, 0, "TestType");
+ qmlRegisterType(QUrl::fromLocalFile(QDir::currentPath() + QLatin1String("TestType.qml")), "Test", 2, 0, "TestType2");
+ qmlRegisterUncreatableType<TestType2>("Test", 2, 0, "CannotDoThis", QLatin1String("Just don't"));
+ qmlRegisterType<TestType3>();
+ qmlRegisterSingletonType<QObject>("Test", 2, 0, "Singlet", singleFactory);
+
+ e = new QQmlEngine(this);
+ c = new QQmlComponent(e, testFile);
+ QObject* unused = c->create();
+ if (!unused) {
+ qDebug() << "Creation failure" << c->errorString();
+ exit(1);
+ }
+ unused->setParent(c); //Not testing leaky objects in the tree
+ QTimer::singleShot(interval, this, SLOT(tearDown()));
+}
+
+void TestDriver::tearDown()
+{
+ delete c;
+ e->collectGarbage();
+ delete e;
+ qmlClearTypeRegistrations();
+ //Note that i < 0 will effectively never terminate. This is deliberate as a prime use is to run indefinitely and watch the memory *not* grow
+ i--;
+ if (!i)
+ qApp->quit();
+ else
+ QTimer::singleShot(interval, this, SLOT(setUp()));
+}
diff --git a/tests/manual/qmltypememory/testdriver.h b/tests/manual/qmltypememory/testdriver.h
new file mode 100644
index 0000000000..711a725aa1
--- /dev/null
+++ b/tests/manual/qmltypememory/testdriver.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTDRIVER_H
+#define TESTDRIVER_H
+#include <QtCore>
+#include <QtQml>
+
+class TestDriver : public QObject
+{
+ Q_OBJECT
+public:
+ TestDriver(const QUrl &componentUrl, int maxIter = -1);
+public slots:
+ void setUp();
+ void tearDown();
+private:
+ QUrl testFile;
+ QQmlEngine* e;
+ QQmlComponent* c;
+ signed long int i;
+};
+
+class TestType : public QObject { Q_OBJECT };
+class TestType2 : public QObject { Q_OBJECT };
+class TestType3 : public QObject { Q_OBJECT };
+#endif
diff --git a/tests/testapplications/elements/content/Help.qml b/tests/testapplications/elements/content/Help.qml
index 1e1e26e26c..cb534108b1 100644
--- a/tests/testapplications/elements/content/Help.qml
+++ b/tests/testapplications/elements/content/Help.qml
@@ -45,7 +45,7 @@ Item {
anchors.fill: parent
Text { textFormat: Text.RichText; anchors.fill: parent; anchors.margins: 5; wrapMode: Text.WordWrap
- text: "<b>QtQuick 2 System Testing</b><br><br>"+
+ text: "<b>Qt Quick 2 System Testing</b><br><br>"+
"Each system test qml \"application\" provides a basic visual element affected by one or more non-visual (functional) elements.<br>"+
"Simply select the element you wish to test, and follow the instructions. Use the arrow to advance the test.<br>"
}
diff --git a/tests/testapplications/text/textedit.qml b/tests/testapplications/text/textedit.qml
index e0d7dbdde4..6546abfe91 100644
--- a/tests/testapplications/text/textedit.qml
+++ b/tests/testapplications/text/textedit.qml
@@ -144,7 +144,7 @@ Rectangle {
"and a language runtime. "+
"A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
textmodel.append({ "name": "Links",
- "value": "This is a link - <a href=\"http://doc.qt.nokia.com\">Qt Docs</a>"});
+ "value": "This is a link - <a href=\"http://qt-project.org/doc\">Qt Docs</a>"});
}
}
ControlView {
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index e05c77cbfa..4337db1689 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -71,6 +71,7 @@
QString pluginImportPath;
bool verbose = false;
+bool creatable = true;
QString currentProperty;
QString inObjectInstantiation;
@@ -225,46 +226,48 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, const
qmlTypesByCppName[baseCpp] = baseExports;
}
- // find even more QMetaObjects by instantiating QML types and running
- // over the instances
- foreach (QQmlType *ty, QQmlMetaType::qmlTypes()) {
- if (skip.contains(ty))
- continue;
- if (ty->isExtendedType())
- continue;
- if (!ty->isCreatable())
- continue;
- if (ty->typeName() == "QQmlComponent")
- continue;
-
- QString tyName = ty->qmlTypeName();
- tyName = tyName.mid(tyName.lastIndexOf(QLatin1Char('/')) + 1);
- if (tyName.isEmpty())
- continue;
-
- inObjectInstantiation = tyName;
- QObject *object = 0;
-
- if (ty->isSingleton()) {
- QQmlType::SingletonInstanceInfo *siinfo = ty->singletonInstanceInfo();
- if (siinfo->qobjectCallback) {
- siinfo->init(engine);
- collectReachableMetaObjects(object, &metas);
- object = siinfo->qobjectApi(engine);
+ if (creatable) {
+ // find even more QMetaObjects by instantiating QML types and running
+ // over the instances
+ foreach (QQmlType *ty, QQmlMetaType::qmlTypes()) {
+ if (skip.contains(ty))
+ continue;
+ if (ty->isExtendedType())
+ continue;
+ if (!ty->isCreatable())
+ continue;
+ if (ty->typeName() == "QQmlComponent")
+ continue;
+
+ QString tyName = ty->qmlTypeName();
+ tyName = tyName.mid(tyName.lastIndexOf(QLatin1Char('/')) + 1);
+ if (tyName.isEmpty())
+ continue;
+
+ inObjectInstantiation = tyName;
+ QObject *object = 0;
+
+ if (ty->isSingleton()) {
+ QQmlType::SingletonInstanceInfo *siinfo = ty->singletonInstanceInfo();
+ if (siinfo->qobjectCallback) {
+ siinfo->init(engine);
+ collectReachableMetaObjects(object, &metas);
+ object = siinfo->qobjectApi(engine);
+ } else {
+ inObjectInstantiation.clear();
+ continue; // we don't handle QJSValue singleton types.
+ }
} else {
- inObjectInstantiation.clear();
- continue; // we don't handle QJSValue singleton types.
+ object = ty->create();
}
- } else {
- object = ty->create();
- }
- inObjectInstantiation.clear();
+ inObjectInstantiation.clear();
- if (object)
- collectReachableMetaObjects(object, &metas);
- else
- qWarning() << "Could not create" << tyName;
+ if (object)
+ collectReachableMetaObjects(object, &metas);
+ else
+ qWarning() << "Could not create" << tyName;
+ }
}
return metas;
@@ -330,17 +333,13 @@ public:
qSort(exportStrings);
qml->writeArrayBinding(QLatin1String("exports"), exportStrings);
- // write meta object revisions unless they're all zero
+ // write meta object revisions
QStringList metaObjectRevisions;
- bool shouldWriteMetaObjectRevisions = false;
foreach (const QString &exportString, exportStrings) {
int metaObjectRevision = exports[exportString]->metaObjectRevision();
- if (metaObjectRevision != 0)
- shouldWriteMetaObjectRevisions = true;
metaObjectRevisions += QString::number(metaObjectRevision);
}
- if (shouldWriteMetaObjectRevisions)
- qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjectRevisions);
+ qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjectRevisions);
if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType()) {
// Can happen when a type is registered that returns itself as attachedPropertiesType()
@@ -544,8 +543,8 @@ void sigSegvHandler(int) {
void printUsage(const QString &appName)
{
qWarning() << qPrintable(QString(
- "Usage: %1 [-v] [-notrelocatable] module.uri version [module/import/path]\n"
- " %1 [-v] -path path/to/qmldir/directory [version]\n"
+ "Usage: %1 [-v] [-noinstantiate] [-[non]relocatable] module.uri version [module/import/path]\n"
+ " %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n"
" %1 [-v] -builtins\n"
"Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg(
appName));
@@ -566,7 +565,7 @@ int main(int argc, char *argv[])
#endif
#ifdef QT_SIMULATOR
- // Running this application would bring up the Qt Simulator (since it links QtGui), avoid that!
+ // Running this application would bring up the Qt Simulator (since it links Qt GUI), avoid that!
QtSimulatorPrivate::SimulatorConnection::createStubInstance();
#endif
@@ -595,8 +594,16 @@ int main(int argc, char *argv[])
}
if (arg == QLatin1String("--notrelocatable")
- || arg == QLatin1String("-notrelocatable")) {
+ || arg == QLatin1String("-notrelocatable")
+ || arg == QLatin1String("--nonrelocatable")
+ || arg == QLatin1String("-nonrelocatable")) {
relocatable = false;
+ } else if (arg == QLatin1String("--relocatable")
+ || arg == QLatin1String("-relocatable")) {
+ relocatable = true;
+ } else if (arg == QLatin1String("--noinstantiate")
+ || arg == QLatin1String("-noinstantiate")) {
+ creatable = false;
} else if (arg == QLatin1String("--path")
|| arg == QLatin1String("-path")) {
action = Path;
diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro
index b777e0da75..0829173abe 100644
--- a/tools/qmlplugindump/qmlplugindump.pro
+++ b/tools/qmlplugindump/qmlplugindump.pro
@@ -9,7 +9,12 @@ SOURCES += \
HEADERS += \
qmlstreamwriter.h
-OTHER_FILES += Info.plist
-macx: QMAKE_INFO_PLIST = Info.plist
+mac {
+ # Prevent qmlplugindump from popping up in the dock when launched.
+ # We embed the Info.plist file, so the application doesn't need to
+ # be a bundle.
+ QMAKE_LFLAGS += -sectcreate __TEXT __info_plist $$shell_quote($$PWD/Info.plist)
+ CONFIG -= app_bundle
+}
load(qt_tool)
diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro
index b29768f10e..a939612c67 100644
--- a/tools/qmlprofiler/qmlprofiler.pro
+++ b/tools/qmlprofiler/qmlprofiler.pro
@@ -1,4 +1,4 @@
-QT += qml qml-private network core-private
+QT = qml qml-private network core-private
SOURCES += main.cpp \
qmlprofilerapplication.cpp \
diff --git a/tools/qmlprofiler/qqmldebugclient.cpp b/tools/qmlprofiler/qqmldebugclient.cpp
index bb57594a3b..3ba8b334ff 100644
--- a/tools/qmlprofiler/qqmldebugclient.cpp
+++ b/tools/qmlprofiler/qqmldebugclient.cpp
@@ -308,7 +308,9 @@ void QQmlDebugConnection::flush()
void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
{
QTcpSocket *socket = new QTcpSocket(d);
+#ifndef QT_NO_NETWORKPROXY
socket->setProxy(QNetworkProxy::NoProxy);
+#endif
d->device = socket;
d->connectDeviceSignals();
d->gotHello = false;
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index afc4be875c..8a48445d63 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -483,7 +483,9 @@ int main(int argc, char ** argv)
QObject *topLevel = component->create();
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
QQuickView* qxView = 0;
- if (!window) {
+ if (window) {
+ engine.setIncubationController(window->incubationController());
+ } else {
QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel);
if (contentItem) {
qxView = new QQuickView(&engine, NULL);
@@ -491,7 +493,6 @@ int main(int argc, char ** argv)
// Set window default properties; the qml can still override them
QString oname = contentItem->objectName();
window->setTitle(oname.isEmpty() ? QString::fromLatin1("qmlscene") : QString::fromLatin1("qmlscene: ") + oname);
- window->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint);
if (options.resizeViewToRootItem)
qxView->setResizeMode(QQuickView::SizeViewToRootObject);
else
@@ -512,11 +513,14 @@ int main(int argc, char ** argv)
}
window->setFormat(surfaceFormat);
+ if (window->flags() == Qt::Window) // Fix window flags unless set by QML.
+ window->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint);
+
if (options.fullscreen)
window->showFullScreen();
else if (options.maximized)
window->showMaximized();
- else
+ else if (!window->isVisible())
window->show();
}
diff --git a/tools/tools.pro b/tools/tools.pro
index ab2d2e93df..43b6c14022 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -7,3 +7,14 @@ SUBDIRS += \
qmlbundle \
v4
qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += qmleasing
+
+# qmlmin & qmlbundle are build tools.
+# qmlscene is needed by the autotests.
+# qmltestrunner may be useful for manual testing.
+# qmlplugindump cannot be a build tool, because it loads target plugins.
+# The other apps are mostly "desktop" tools and are thus excluded.
+qtNomakeTools( \
+ qmlprofiler \
+ qmlplugindump \
+ qmleasing \
+)