aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.12.589
-rw-r--r--dist/changes-5.13.1107
-rw-r--r--examples/HACKING23
-rw-r--r--examples/quick/imageelements/doc/src/imageelements.qdoc4
-rw-r--r--examples/quick/scenegraph/fboitem/doc/images/fboitem-example.jpg (renamed from examples/quick/scenegraph/textureinsgnode/doc/images/textureinsgnode-example.jpg)bin25863 -> 25863 bytes
-rw-r--r--examples/quick/scenegraph/fboitem/doc/src/fboitem.qdoc (renamed from examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc)4
-rw-r--r--examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp (renamed from examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp)0
-rw-r--r--examples/quick/scenegraph/fboitem/fboinsgrenderer.h (renamed from examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h)0
-rw-r--r--examples/quick/scenegraph/fboitem/fboitem.pro (renamed from examples/quick/scenegraph/textureinsgnode/textureinsgnode.pro)4
-rw-r--r--examples/quick/scenegraph/fboitem/fboitem.qrc (renamed from examples/quick/scenegraph/textureinsgnode/textureinsgnode.qrc)2
-rw-r--r--examples/quick/scenegraph/fboitem/main.cpp (renamed from examples/quick/scenegraph/textureinsgnode/main.cpp)2
-rw-r--r--examples/quick/scenegraph/fboitem/main.qml (renamed from examples/quick/scenegraph/textureinsgnode/main.qml)0
-rw-r--r--examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm8
-rw-r--r--examples/quick/scenegraph/metalunderqml/metalsquircle.mm8
-rw-r--r--examples/quick/scenegraph/rendernode/metalrenderer.mm8
-rw-r--r--examples/quick/scenegraph/scenegraph.pro2
-rw-r--r--examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp16
-rw-r--r--examples/quick/shapes/content/interactive.qml113
-rw-r--r--src/imports/builtins/builtins.qmltypes11
-rw-r--r--src/imports/folderlistmodel/plugins.qmltypes274
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp14
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/labsanimation/plugins.qmltypes4
-rw-r--r--src/imports/models/plugins.qmltypes52
-rw-r--r--src/imports/particles/plugins.qmltypes50
-rw-r--r--src/imports/qtqml/plugins.qmltypes22
-rw-r--r--src/imports/qtquick2/plugins.qmltypes268
-rw-r--r--src/imports/settings/qqmlsettings.cpp2
-rw-r--r--src/imports/window/plugins.qmltypes6
-rw-r--r--src/particles/qquickimageparticle.cpp20
-rw-r--r--src/particles/qquickitemparticle.cpp20
-rw-r--r--src/particles/qquickparticleaffector.cpp2
-rw-r--r--src/particles/qquickparticleemitter.cpp15
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp4
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp2
-rw-r--r--src/qml/doc/qtqml.qdocconf10
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc3
-rw-r--r--src/qml/doc/src/javascript/qtjavascript.qdoc7
-rw-r--r--src/qml/doc/src/javascript/string.qdoc4
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc42
-rw-r--r--src/qml/jit/qv4assemblercommon_p.h2
-rw-r--r--src/qml/jit/qv4baselineassembler.cpp7
-rw-r--r--src/qml/jit/qv4baselineassembler_p.h1
-rw-r--r--src/qml/jit/qv4baselinejit.cpp16
-rw-r--r--src/qml/jsapi/qjsengine.cpp4
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp16
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp10
-rw-r--r--src/qml/jsruntime/qv4promiseobject.cpp1
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp6
-rw-r--r--src/qml/qml/ftw/qintrusivelist.cpp4
-rw-r--r--src/qml/qml/qqml.h8
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp7
-rw-r--r--src/qml/qml/qqmldatablob_p.h2
-rw-r--r--src/qml/qml/qqmlglobal_p.h8
-rw-r--r--src/qml/qml/qqmlimport.cpp22
-rw-r--r--src/qml/qml/qqmlinfo.cpp6
-rw-r--r--src/qml/qml/qqmlmetatypedata.cpp1
-rw-r--r--src/qml/qml/qqmlpropertycachecreator_p.h11
-rw-r--r--src/qml/qml/qqmlscriptblob.cpp4
-rw-r--r--src/qml/qml/qqmlscriptdata.cpp6
-rw-r--r--src/qml/qml/qqmlscriptdata_p.h2
-rw-r--r--src/qml/qml/qqmltypecompiler.cpp9
-rw-r--r--src/qml/qml/qqmltypedata.cpp5
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp198
-rw-r--r--src/qml/types/qqmlbind.cpp2
-rw-r--r--src/qml/util/qqmlpropertymap.cpp4
-rw-r--r--src/qmlmodels/doc/qtqmlmodels.qdocconf37
-rw-r--r--src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml (renamed from src/qml/doc/snippets/delegatemodel/delegatemodel.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp (renamed from src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp)0
-rw-r--r--src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml (renamed from src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/delegatemodel/delegatemodelgroup.qml (renamed from src/qml/doc/snippets/delegatemodel/delegatemodelgroup.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/package/Delegate.qml (renamed from src/qml/doc/snippets/package/Delegate.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/package/view.qml (renamed from src/qml/doc/snippets/package/view.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/listmodel/listelements.qml (renamed from src/qml/doc/snippets/qml/listmodel/listelements.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/listmodel/listmodel-modify.qml (renamed from src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/listmodel/listmodel-nested.qml (renamed from src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/listmodel/listmodel-simple.qml (renamed from src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/listmodel/listmodel.qml (renamed from src/qml/doc/snippets/qml/listmodel/listmodel.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml (renamed from src/qml/doc/snippets/qml/tablemodel/fruit-example-complex.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml (renamed from src/qml/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml)0
-rw-r--r--src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml (renamed from src/qml/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml)0
-rw-r--r--src/qmlmodels/qmlmodels.pro2
-rw-r--r--src/qmlmodels/qqmldelegatecomponent.cpp13
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp4
-rw-r--r--src/qmlmodels/qqmlinstantiator.cpp5
-rw-r--r--src/qmlmodels/qqmlitemmodels.qdoc2
-rw-r--r--src/qmlmodels/qqmlobjectmodel.cpp8
-rw-r--r--src/qmlmodels/qqmltablemodel.cpp2
-rw-r--r--src/qmlmodels/qquickpackage.cpp7
-rw-r--r--src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf37
-rw-r--r--src/qmlworkerscript/qmlworkerscript.pro2
-rw-r--r--src/qmlworkerscript/qquickworkerscript.cpp4
-rw-r--r--src/quick/doc/qtquick.qdocconf2
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc2
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc13
-rw-r--r--src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc16
-rw-r--r--src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc6
-rw-r--r--src/quick/doc/src/qtquick.qdoc2
-rw-r--r--src/quick/handlers/qquickhoverhandler.cpp35
-rw-r--r--src/quick/handlers/qquickpointerdevicehandler.cpp51
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp10
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp58
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp179
-rw-r--r--src/quick/items/qquickanimatedimage.cpp3
-rw-r--r--src/quick/items/qquickanimatedimage_p.h1
-rw-r--r--src/quick/items/qquickborderimage.cpp2
-rw-r--r--src/quick/items/qquickborderimage_p_p.h2
-rw-r--r--src/quick/items/qquickdrag.cpp4
-rw-r--r--src/quick/items/qquickdroparea.cpp4
-rw-r--r--src/quick/items/qquickevents.cpp7
-rw-r--r--src/quick/items/qquickflickable.cpp4
-rw-r--r--src/quick/items/qquickflickablebehavior_p.h5
-rw-r--r--src/quick/items/qquickgridview.cpp24
-rw-r--r--src/quick/items/qquickitem.cpp5
-rw-r--r--src/quick/items/qquickitemsmodule.cpp4
-rw-r--r--src/quick/items/qquicklistview.cpp23
-rw-r--r--src/quick/items/qquickmousearea.cpp4
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp6
-rw-r--r--src/quick/items/qquickpathview.cpp180
-rw-r--r--src/quick/items/qquickrendercontrol.cpp3
-rw-r--r--src/quick/items/qquickscreen.cpp3
-rw-r--r--src/quick/items/qquicktableview.cpp16
-rw-r--r--src/quick/items/qquicktextcontrol.cpp8
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h2
-rw-r--r--src/quick/items/qquicktextedit.cpp6
-rw-r--r--src/quick/items/qquicktextinput.cpp25
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp4
-rw-r--r--src/quick/items/qquickwindow.cpp24
-rw-r--r--src/quick/items/qquickwindow.h6
-rw-r--r--src/quick/items/qquickwindow_p.h2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp5
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp48
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.h10
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp30
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp105
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialrhishader.h12
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.cpp34
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.cpp3
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.h1
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp5
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h1
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp38
-rw-r--r--src/quick/scenegraph/qsgdefaultinternalimagenode.cpp4
-rw-r--r--src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp4
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp5
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext_p.h13
-rw-r--r--src/quick/scenegraph/qsgdefaultspritenode.cpp8
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp28
-rw-r--r--src/quick/scenegraph/qsgopengllayer.cpp2
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp68
-rw-r--r--src/quick/scenegraph/qsgrhilayer.cpp5
-rw-r--r--src/quick/scenegraph/qsgrhishadereffectnode.cpp12
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp25
-rw-r--r--src/quick/scenegraph/qsgrhisupport_p.h3
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp162
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/scenegraph.pri8
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp4
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial_p.h6
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.cpp4
-rw-r--r--src/quick/util/qquickanimatorjob.cpp2
-rw-r--r--src/quick/util/qquickfontmetrics.cpp7
-rw-r--r--src/quickshapes/qquickshape.cpp12
-rw-r--r--src/quickshapes/qquickshapegenericrenderer.cpp12
-rw-r--r--src/quickshapes/qquickshapegenericrenderer_p.h12
-rw-r--r--src/quickwidgets/qquickwidget.cpp7
-rw-r--r--src/quickwidgets/qquickwidget_p.h1
-rw-r--r--tests/auto/qml/qmlcachegen/data/module.mjs6
-rw-r--r--tests/auto/qml/qmlcachegen/data/utils.mjs4
-rw-r--r--tests/auto/qml/qmlcachegen/qmlcachegen.pro4
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp9
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp12
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp2
-rw-r--r--tests/auto/qml/qqmlconsole/data/logging.qml4
-rw-r--r--tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp8
-rw-r--r--tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml1
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h8
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp107
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testLoaderComponent.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testReloadComponent.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testScriptComponent.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml1
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml1
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp25
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp75
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml7
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp2
-rw-r--r--tests/auto/qml/qqmlnotifier/data/connectnotify.qml3
-rw-r--r--tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp7
-rw-r--r--tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml17
-rw-r--r--tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp12
-rw-r--r--tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml1
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp15
-rw-r--r--tests/auto/qml/qqmlpropertycache/data/SpecialObject1.qml5
-rw-r--r--tests/auto/qml/qqmlpropertycache/data/SpecialObject2.qml5
-rw-r--r--tests/auto/qml/qqmlpropertycache/data/noDuckType.qml7
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp11
-rw-r--r--tests/auto/qml/qqmlqt/data/formatting.qml5
-rw-r--r--tests/auto/qml/qqmlqt/data/timeRoundtrip.qml2
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp19
-rw-r--r--tests/auto/qml/qqmltypeloader/data/Com/Orga/BaseStyle.qml5
-rw-r--r--tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/Handler.qml7
-rw-r--r--tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/qmldir2
-rw-r--r--tests/auto/qml/qqmltypeloader/data/Com/Orga/Style.qml6
-rw-r--r--tests/auto/qml/qqmltypeloader/data/Com/Orga/qmldir2
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp20
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml1
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp6
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp42
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/currentframe.qml13
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp46
-rw-r--r--tests/auto/quick/qquickflickable/data/resize.qml1
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp7
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml95
-rw-r--r--tests/auto/quick/qquickmousearea/BLACKLIST4
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp28
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp37
-rw-r--r--tests/auto/quick/qquickpathview/data/nestedmousearea2.qml101
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp27
-rw-r--r--tests/auto/quick/qquickpositioners/data/transitions-padding.qml10
-rw-r--r--tests/auto/quick/qquickpositioners/data/transitions.qml10
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp63
-rw-r--r--tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml89
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp27
-rw-r--r--tests/auto/quick/qquicktext/data/transparentBackground.qml16
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp22
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp23
-rw-r--r--tests/auto/quick/qquicktextinput/BLACKLIST3
-rw-r--r--tests/manual/nodetypes_ng/nodetypes_ng.cpp7
-rw-r--r--tests/manual/pointer/tapWithModifiers.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/hostinfo.sh76
-rw-r--r--tests/manual/scenegraph_lancelot/scenegrabber/main.cpp9
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro4
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp24
-rw-r--r--tools/qml/main.cpp14
-rw-r--r--tools/qmlplugindump/main.cpp74
278 files changed, 3370 insertions, 1193 deletions
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5
new file mode 100644
index 0000000000..be0621c138
--- /dev/null
+++ b/dist/changes-5.12.5
@@ -0,0 +1,89 @@
+Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-76871] TapHandler.point now holds the release position while the
+ tapped() signal is emitted.
+
+****************************************************************************
+* QtQml *
+****************************************************************************
+
+ - [QTBUG-76018] Readonly QML properties can now be templates such as
+ list<...>.
+ - [QTBUG-76085] QQmlApplication engine now automatically loads translation
+ files from resource directories.
+ - [QTBUG-75939] Instances of QJSValue can now safely be passed between
+ threads and destroyed in a different thread.
+ - [QTBUG-75642] Fixed an invalid memory read caused by the JIT compiler.
+ - [QTBUG-71387] Fixed a use-after-free condition caused by calling
+ qmlClearTypeRegistrations().
+ - [QTBUG-76656] Made sure JavaScript "this" points to the right object when
+ calling scope and context properties through lookups.
+ - [QTBUG-76796] Fixed bindings to typeof(<name>) to get re-evaluated when
+ <name> gets defined.
+ - [QTBUG-55407] Avoid invalid memory access when calling setData() on a
+ QQmlComponent constructed without an engine.
+ - [QTBUG-76441] Fixed importing "qrc:/" (with exactly one slash).
+ - [QTBUG-71329] Implemented the missing bits of JavaScript promise chains.
+ - [QTBUG-75983] Fixed null pointer dereference in QQmlXmlHttpRequest.
+ - [QTBUG-77012] Fixed static build issue: multiple definitions of
+ qtPositionAttributeName().
+ - [QTBUG-77102] The component versioning is not enforced when loading
+ singletons.
+
+****************************************************************************
+* QtQuick *
+****************************************************************************
+
+ - Item Views:
+ * [QTBUG-76487] We now properly populate delegates with the populate
+ transition when the view is resized after componentComplete.
+ * [QTBUG-31677] A ListView footer is now positioned correctly after the
+ last item is removed.
+ * [QTBUG-76433][QTBUG-44308] Fixed a crash while doing fast flicking in
+ transitions that use Animators.
+ * [QTBUG-76254] Fixed a crash in QQmlDelegateModel.
+
+ - Input:
+ * [QTBUG-75399] Fixed a crash when using the KeyNavigation attached property.
+ * [QTBUG-76875] DragHandler now respects acceptedButtons.
+ * [QTBUG-71218] If a Controls 2 Button has a DragHandler, the button is
+ now released when the drag begins.
+
+ - Scene graph:
+ * [QTBUG-76603] qmlscene now sets the default surface format earlier
+ and correctly.
+ * [QTBUG-68566] Fixed rendering freeze when using software rendering
+ of WebEngine in QQuickWidget.
+ * [QTBUG-66810] Software rendering: repaint everything when moving
+ between HiDpi and lower-resolution screens.
+
+ - Text:
+ * [QTBUG-77217] Fixed a bug where aligning an image to "top" or "bottom"
+ could cause a crash under certain circumstances.
+ * [QTBUG-76528] Fixed missing glyphs and in some cases crashes when
+ displaying many characters from the same font on a system with a
+ low maximum texture size.
+ * [QTBUG-76528] Fixed a bug when displaying many characters from the same
+ font on a system with a low maximum texture size.
+ * [QTBUG-74761] Added support for text color when using color fonts.
diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1
new file mode 100644
index 0000000000..d859a5e747
--- /dev/null
+++ b/dist/changes-5.13.1
@@ -0,0 +1,107 @@
+Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-76871] TapHandler.point now holds the release position while the
+ tapped() signal is emitted.
+ - [QTBUG-14769][QTBUG-50482] TextEdit now uses the I-beam cursor by default,
+ and the pointing cursor for links. But if user code sets a custom cursor,
+ we restore it when the mouse is no longer hovering a link.
+
+****************************************************************************
+* QtQml *
+****************************************************************************
+
+ - [QTBUG-56264] Fixed segfault on Sparc64.
+ - [QTBUG-77102] Fix bug with singletons not being imported from modules when
+ using older versions.
+ - [QTBUG-77047] Fixed crash when creating arrays using the spread operator.
+ - [QTBUG-75983] Fixed crash in XMLHttpRequest.open.
+ - [QTBUG-77012] Fixed static build issue: multiple definitions of
+ qtPositionAttributeName().
+ - [QTBUG-71329] Fixed promise chaining.
+ - [QTBUG-76441] Fix support for import statements using qrc:/ urls.
+ - [QTBUG-55407] Fixed a crash when setData or create is called after a user
+ mistakenly used the internal constructor of QQmlComponent which does
+ not take an engine.
+ - [QTBUG-76796] Fixed late binding re-evaluation when using typeof(name).
+ - [QTBUG-76627] qmlplugindump now finds enums in composite types.
+ - [QTBUG-76656] Fixed resolution of 'this' when using the call operator on scope and context
+ properties.
+ - [QTBUG-71387] Fixed a crash after calling qmlClearTypeRegistrations().
+ - [QTBUG-75642] Fixed an invalid memory read in JIT with template literals.
+ - [QTBUG-75939] Fix crash when destroying QJSValues from other threads.
+ - [QTBUG-76085] Fixed automatic loading of translations from resources.
+ - [QTBUG-76018] Fixed grammar to permit readonly list properties.
+ - [QTBUG-75880] Fix accidental implicit creation of local variable when using anonymous functions
+ in object literals.
+ - [QTBUG-67343] Fixed assertion when having a ShaderEffect as a delegate
+ in a ComboBox.
+ - [QTBUG-75896] Fixed property lookup in QML singletons.
+ - [QTBUG-75392] Fixed a crash by working around a compiler bug.
+ - [QTBUG-48809] Print a warning when using absolute paths in qmldir files.
+ - [QTBUG-75609] Fixed a performance regression with attached properties.
+ - [QTBUG-76074] Loader now frees custom qml types when unloading.
+
+****************************************************************************
+* QtQuick *
+****************************************************************************
+
+ - Item Views:
+ * [QTBUG-76487] We now properly populate delegates with the populate
+ transition when the view is resized after componentComplete.
+ * [QTBUG-31677] A ListView footer is now positioned correctly after the
+ last item is removed.
+ * [QTBUG-76433][QTBUG-44308] Fixed a crash while doing fast flicking in
+ transitions that use Animators.
+ * [QTBUG-76254] Fixed a crash in QQmlDelegateModel.
+ * [QTBUG-71581] Fixed a crash in ListView when closing an application that
+ dynamically creates and appends items to an ObjectModel.
+
+ - Input:
+ * [QTBUG-75399] Fixed a crash when using the KeyNavigation attached property.
+ * [QTBUG-76875] DragHandler now respects acceptedButtons.
+ * [QTBUG-71218] If a Controls 2 Button has a DragHandler, the button is
+ now released when the drag begins.
+ * [QTBUG-75770] MouseArea now respects QPlatformTheme::TouchDoubleTapDistance
+ to avoid generating double-clicks while moving and clicking the mouse quickly.
+
+ - Scene graph:
+ * [QTBUG-76603] qmlscene now sets the default surface format earlier
+ and correctly.
+ * [QTBUG-68566] Fixed rendering freeze when using software rendering
+ of WebEngine in QQuickWidget.
+ * [QTBUG-73768] Fixed an assert in BorderImage when any border size
+ exceeds source image size.
+ * [QTBUG-66810] Software rendering: repaint everything when moving
+ between HiDpi and lower-resolution screens.
+ * [QTBUG-74348] Fixed leaking scene graph rendering contexts when using
+ the threaded render loop.
+ * [QTBUG-76055] Cleaned up error messages in shadereffect.
+
+ - Text:
+ * [QTBUG-74761] Added support for text color when using color fonts.
+ * [QTBUG-76528] Fixed missing glyphs and in some cases crashes when
+ displaying many characters from the same font on a system with a
+ low maximum texture size.
+ * [QTBUG-75002] Accessibility: StaticText nodes are announced as
+ read-only rather than editable in Windows Narrator.
diff --git a/examples/HACKING b/examples/HACKING
deleted file mode 100644
index 7d2a61a481..0000000000
--- a/examples/HACKING
+++ /dev/null
@@ -1,23 +0,0 @@
-Some guidelines for Qt QML examples
-
-Snippets
----
-Snippets are snatches of QML code that won't even run on their own. They don't belong here, they belong in doc/src/snippets. They should be contained in files that will compile on their own, for automated syntax validation, but don't have to look like anything.
-
-Examples
----
-
-Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements. The code should be held to a high level of quality, and should be understandable by people new to QML.
-
-Unless the demonstrated feature uses it, assume no interface devices other than a screen that can show a 320x480 rectangle and a generic pointing device (with the shared subset of mouse/touch functionality).
-
-Groups of similar examples should be placed in one folder with a single launcher application, which uses the shared folder of common components.
-
-The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher. Usually this will consist primarily of using the macro found in shared.h.
-
-Demos
----
-
-Demos are examples of creating full applications using QML. They should fit both a desktop and a mobile form factor, they should have their own start screen and method of exiting the application. They should be at a level of quality that you'd be comfortable submitting them to an app store for a platform of the appropriate hardware (screen size, input methods, etc.). The code should be written to a level that is easily understood and modified by a QML expert.
-
-Demos should have a qdoc file in their directory explaining the demo at a high level. The demo should be buildable as a full C++ application and preferably runnable with the standard qml file launcher.
diff --git a/examples/quick/imageelements/doc/src/imageelements.qdoc b/examples/quick/imageelements/doc/src/imageelements.qdoc
index 2c6490fb2c..4c00915e56 100644
--- a/examples/quick/imageelements/doc/src/imageelements.qdoc
+++ b/examples/quick/imageelements/doc/src/imageelements.qdoc
@@ -38,12 +38,12 @@
\section1 Scaling with BorderImage
- \e BorderImage shows off the various scaling modes of the \l BorderImage
+ \e BorderImage shows the various scaling modes of the \l BorderImage
type by setting its horizontalTileMode and verticalTileMode properties.
\section1 Image Fill
- \e Image shows off the various fill modes of the \l Image type.
+ \e Image shows the various fill modes of the \l Image type.
\section1 Shadow Effects
diff --git a/examples/quick/scenegraph/textureinsgnode/doc/images/textureinsgnode-example.jpg b/examples/quick/scenegraph/fboitem/doc/images/fboitem-example.jpg
index 306b8bab20..306b8bab20 100644
--- a/examples/quick/scenegraph/textureinsgnode/doc/images/textureinsgnode-example.jpg
+++ b/examples/quick/scenegraph/fboitem/doc/images/fboitem-example.jpg
Binary files differ
diff --git a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc b/examples/quick/scenegraph/fboitem/doc/src/fboitem.qdoc
index c1c830338b..b5add02991 100644
--- a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc
+++ b/examples/quick/scenegraph/fboitem/doc/src/fboitem.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
- \example scenegraph/textureinsgnode
+ \example scenegraph/fboitem
\title Scene Graph - Rendering FBOs
\ingroup qtquickexamples
\brief Shows how to use FramebufferObjects with Qt Quick.
- \image textureinsgnode-example.jpg
+ \image fboitem-example.jpg
*/
diff --git a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp
index 8ba5bddb2a..8ba5bddb2a 100644
--- a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp
+++ b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp
diff --git a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h b/examples/quick/scenegraph/fboitem/fboinsgrenderer.h
index 1b92b56851..1b92b56851 100644
--- a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h
+++ b/examples/quick/scenegraph/fboitem/fboinsgrenderer.h
diff --git a/examples/quick/scenegraph/textureinsgnode/textureinsgnode.pro b/examples/quick/scenegraph/fboitem/fboitem.pro
index 238e20a553..e40e5f4cf8 100644
--- a/examples/quick/scenegraph/textureinsgnode/textureinsgnode.pro
+++ b/examples/quick/scenegraph/fboitem/fboitem.pro
@@ -7,9 +7,9 @@ INCLUDEPATH += ../shared
HEADERS += ../shared/logorenderer.h
SOURCES += ../shared/logorenderer.cpp
-RESOURCES += textureinsgnode.qrc
+RESOURCES += fboitem.qrc
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinsgnode
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/fboitem
INSTALLS += target
OTHER_FILES += \
diff --git a/examples/quick/scenegraph/textureinsgnode/textureinsgnode.qrc b/examples/quick/scenegraph/fboitem/fboitem.qrc
index 9ecf0ada1c..9d9db70654 100644
--- a/examples/quick/scenegraph/textureinsgnode/textureinsgnode.qrc
+++ b/examples/quick/scenegraph/fboitem/fboitem.qrc
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/scenegraph/textureinsgnode">
+ <qresource prefix="/scenegraph/fboitem">
<file>main.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/scenegraph/textureinsgnode/main.cpp b/examples/quick/scenegraph/fboitem/main.cpp
index 6358a1d75b..056bf24ade 100644
--- a/examples/quick/scenegraph/textureinsgnode/main.cpp
+++ b/examples/quick/scenegraph/fboitem/main.cpp
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
- view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml"));
+ view.setSource(QUrl("qrc:///scenegraph/fboitem/main.qml"));
view.show();
return app.exec();
diff --git a/examples/quick/scenegraph/textureinsgnode/main.qml b/examples/quick/scenegraph/fboitem/main.qml
index 92fa99e847..92fa99e847 100644
--- a/examples/quick/scenegraph/textureinsgnode/main.qml
+++ b/examples/quick/scenegraph/fboitem/main.qml
diff --git a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
index 6bb68dac44..66a39083f7 100644
--- a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
+++ b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
@@ -281,7 +281,7 @@ void CustomTextureNode::sync()
m_vs = compileShaderFromSource(m_vert, m_vertEntryPoint);
m_fs = compileShaderFromSource(m_frag, m_fragEntryPoint);
- const int framesInFlight = m_window->graphicsStateInfo()->framesInFlight;
+ const int framesInFlight = m_window->graphicsStateInfo().framesInFlight;
m_vbuf = [m_device newBufferWithLength: sizeof(vertices) options: MTLResourceStorageModeShared];
void *p = [m_vbuf contents];
@@ -348,8 +348,8 @@ void CustomTextureNode::render()
Q_ASSERT(cb);
id<MTLRenderCommandEncoder> encoder = [cb renderCommandEncoderWithDescriptor: renderpassdesc];
- const QQuickWindow::GraphicsStateInfo *stateInfo = m_window->graphicsStateInfo();
- void *p = [m_ubuf[stateInfo->currentFrameSlot] contents];
+ const QQuickWindow::GraphicsStateInfo &stateInfo(m_window->graphicsStateInfo());
+ void *p = [m_ubuf[stateInfo.currentFrameSlot] contents];
memcpy(p, &m_t, 4);
MTLViewport vp;
@@ -361,7 +361,7 @@ void CustomTextureNode::render()
vp.zfar = 1;
[encoder setViewport: vp];
- [encoder setFragmentBuffer: m_ubuf[stateInfo->currentFrameSlot] offset: 0 atIndex: 0];
+ [encoder setFragmentBuffer: m_ubuf[stateInfo.currentFrameSlot] offset: 0 atIndex: 0];
[encoder setVertexBuffer: m_vbuf offset: 0 atIndex: 1];
[encoder setRenderPipelineState: m_pipeline];
[encoder drawPrimitives: MTLPrimitiveTypeTriangleStrip vertexStart: 0 vertexCount: 4 instanceCount: 1 baseInstance: 0];
diff --git a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
index 8a1a03dc68..5ca6daa01a 100644
--- a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
+++ b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
@@ -215,7 +215,7 @@ void SquircleRenderer::frameStart()
prepareShader(FragmentStage);
if (!m_initialized)
- init(m_window->graphicsStateInfo()->framesInFlight);
+ init(m_window->graphicsStateInfo().framesInFlight);
}
static const float vertices[] = {
@@ -233,7 +233,7 @@ void SquircleRenderer::mainPassRecordingStart()
// the scenegraph's main renderpass. It does not create its own passes,
// rendertargets, etc. so no synchronization is needed.
- const QQuickWindow::GraphicsStateInfo *stateInfo = m_window->graphicsStateInfo();
+ const QQuickWindow::GraphicsStateInfo &stateInfo(m_window->graphicsStateInfo());
QSGRendererInterface *rif = m_window->rendererInterface();
id<MTLRenderCommandEncoder> encoder = (id<MTLRenderCommandEncoder>) rif->getResource(
@@ -242,7 +242,7 @@ void SquircleRenderer::mainPassRecordingStart()
m_window->beginExternalCommands();
- void *p = [m_ubuf[stateInfo->currentFrameSlot] contents];
+ void *p = [m_ubuf[stateInfo.currentFrameSlot] contents];
float t = m_t;
memcpy(p, &t, 4);
@@ -255,7 +255,7 @@ void SquircleRenderer::mainPassRecordingStart()
vp.zfar = 1;
[encoder setViewport: vp];
- [encoder setFragmentBuffer: m_ubuf[stateInfo->currentFrameSlot] offset: 0 atIndex: 0];
+ [encoder setFragmentBuffer: m_ubuf[stateInfo.currentFrameSlot] offset: 0 atIndex: 0];
[encoder setVertexBuffer: m_vbuf offset: 0 atIndex: 1];
[encoder setRenderPipelineState: m_pipeline];
[encoder drawPrimitives: MTLPrimitiveTypeTriangleStrip vertexStart: 0 vertexCount: 4 instanceCount: 1 baseInstance: 0];
diff --git a/examples/quick/scenegraph/rendernode/metalrenderer.mm b/examples/quick/scenegraph/rendernode/metalrenderer.mm
index 11db276f37..b83dc62c48 100644
--- a/examples/quick/scenegraph/rendernode/metalrenderer.mm
+++ b/examples/quick/scenegraph/rendernode/metalrenderer.mm
@@ -131,7 +131,7 @@ void MetalRenderNodeResourceBuilder::build()
g.fs = compileShaderFromSource(g.fsSource, QByteArrayLiteral("main0"));
}
- const int framesInFlight = m_window->graphicsStateInfo()->framesInFlight;
+ const int framesInFlight = m_window->graphicsStateInfo().framesInFlight;
// For simplicity's sake we use shared mode (something like host visible +
// host coherent) for everything.
@@ -258,9 +258,9 @@ void MetalRenderNode::releaseResources()
void MetalRenderNode::render(const RenderState *state)
{
Q_ASSERT(m_window);
- const QQuickWindow::GraphicsStateInfo *stateInfo = m_window->graphicsStateInfo();
- id<MTLBuffer> vbuf = g.vbuf[stateInfo->currentFrameSlot];
- id<MTLBuffer> ubuf = g.ubuf[stateInfo->currentFrameSlot];
+ const QQuickWindow::GraphicsStateInfo &stateInfo(m_window->graphicsStateInfo());
+ id<MTLBuffer> vbuf = g.vbuf[stateInfo.currentFrameSlot];
+ id<MTLBuffer> ubuf = g.ubuf[stateInfo.currentFrameSlot];
QPointF p0(m_width - 1, m_height - 1);
QPointF p1(0, 0);
diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro
index e05e1ddb44..5fea3b974a 100644
--- a/examples/quick/scenegraph/scenegraph.pro
+++ b/examples/quick/scenegraph/scenegraph.pro
@@ -5,7 +5,7 @@ qtConfig(opengl(es1|es2)?) {
graph \
simplematerial \
sgengine \
- textureinsgnode \
+ fboitem \
openglunderqml \
textureinthread \
twotextureproviders
diff --git a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
index 59e9606e7b..21f46a25c1 100644
--- a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
+++ b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
@@ -212,7 +212,7 @@ void SquircleRenderer::frameStart()
prepareShader(FragmentStage);
if (!m_initialized)
- init(m_window->graphicsStateInfo()->framesInFlight);
+ init(m_window->graphicsStateInfo().framesInFlight);
}
static const float vertices[] = {
@@ -230,10 +230,10 @@ void SquircleRenderer::mainPassRecordingStart()
// the scenegraph's main renderpass. It does not create its own passes,
// rendertargets, etc. so no synchronization is needed.
- const QQuickWindow::GraphicsStateInfo *stateInfo = m_window->graphicsStateInfo();
+ const QQuickWindow::GraphicsStateInfo &stateInfo(m_window->graphicsStateInfo());
QSGRendererInterface *rif = m_window->rendererInterface();
- VkDeviceSize ubufOffset = stateInfo->currentFrameSlot * m_allocPerUbuf;
+ VkDeviceSize ubufOffset = stateInfo.currentFrameSlot * m_allocPerUbuf;
void *p = nullptr;
VkResult err = m_devFuncs->vkMapMemory(m_dev, m_ubufMem, ubufOffset, m_allocPerUbuf, 0, &p);
if (err != VK_SUCCESS || !p)
@@ -259,7 +259,7 @@ void SquircleRenderer::mainPassRecordingStart()
VkDeviceSize vbufOffset = 0;
m_devFuncs->vkCmdBindVertexBuffers(cb, 0, 1, &m_vbuf, &vbufOffset);
- uint32_t dynamicOffset = m_allocPerUbuf * stateInfo->currentFrameSlot;
+ uint32_t dynamicOffset = m_allocPerUbuf * stateInfo.currentFrameSlot;
m_devFuncs->vkCmdBindDescriptorSets(cb, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1,
&m_ubufDescriptor, 1, &dynamicOffset);
@@ -362,13 +362,13 @@ void SquircleRenderer::init(int framesInFlight)
}
}
}
- if (memTypeIndex < 0)
+ if (memTypeIndex == uint32_t(-1))
qFatal("Failed to find host visible and coherent memory type");
allocInfo.memoryTypeIndex = memTypeIndex;
err = m_devFuncs->vkAllocateMemory(m_dev, &allocInfo, nullptr, &m_vbufMem);
if (err != VK_SUCCESS)
- qFatal("Failed to allocate vertex buffer memory of size %llu: %d", allocInfo.allocationSize, err);
+ qFatal("Failed to allocate vertex buffer memory of size %u: %d", uint(allocInfo.allocationSize), err);
void *p = nullptr;
err = m_devFuncs->vkMapMemory(m_dev, m_vbufMem, 0, allocInfo.allocationSize, 0, &p);
@@ -412,14 +412,14 @@ void SquircleRenderer::init(int framesInFlight)
}
}
}
- if (memTypeIndex < 0)
+ if (memTypeIndex == uint32_t(-1))
qFatal("Failed to find host visible and coherent memory type");
allocInfo.allocationSize = framesInFlight * m_allocPerUbuf;
allocInfo.memoryTypeIndex = memTypeIndex;
err = m_devFuncs->vkAllocateMemory(m_dev, &allocInfo, nullptr, &m_ubufMem);
if (err != VK_SUCCESS)
- qFatal("Failed to allocate uniform buffer memory of size %llu: %d", allocInfo.allocationSize, err);
+ qFatal("Failed to allocate uniform buffer memory of size %u: %d", uint(allocInfo.allocationSize), err);
err = m_devFuncs->vkBindBufferMemory(m_dev, m_ubuf, m_ubufMem, 0);
if (err != VK_SUCCESS)
diff --git a/examples/quick/shapes/content/interactive.qml b/examples/quick/shapes/content/interactive.qml
index 55a1d16299..78413db3f9 100644
--- a/examples/quick/shapes/content/interactive.qml
+++ b/examples/quick/shapes/content/interactive.qml
@@ -170,14 +170,45 @@ Rectangle {
property variant resizers: []
property variant funcs
+ property Component mouseArea: Component {
+ Rectangle {
+ id: rr
+
+ property variant obj
+ property string xprop
+ property string yprop
+
+ width: 20
+ height: 20
+
+ MouseArea {
+ property bool a: false
+
+ anchors.fill: parent
+ hoverEnabled: true
+ onEntered: color = "yellow"
+ onExited: color = rr.color
+ onPressed: a = true
+ onReleased: a = false
+ onPositionChanged: {
+ if (a) {
+ var pt = mapToItem(rr.parent, mouse.x, mouse.y);
+ rr.obj[rr.xprop] = pt.x
+ rr.obj[rr.yprop] = pt.y
+ rr.x = pt.x - 10
+ rr.y = pt.y - 10
+ }
+ }
+ }
+ }
+ }
+
function genResizer(obj, x, y, xprop, yprop, color) {
- var ma = Qt.createQmlObject('import QtQuick 2.9; import QtQuick.Shapes 1.0; Rectangle { id: rr; property variant obj; color: "' + color + '"; width: 20; height: 20;'+
- 'MouseArea { anchors.fill: parent; hoverEnabled: true;' +
- 'onEntered: color = "yellow"; onExited: color = "' + color + '";' +
- 'property bool a: false; onPressed: a = true; onReleased: a = false; ' +
- 'onPositionChanged: if (a) { var pt = mapToItem(rr.parent, mouse.x, mouse.y);' +
- 'obj.' + xprop + ' = pt.x; obj.' + yprop + ' = pt.y; rr.x = pt.x - 10; rr.y = pt.y - 10; } } }',
- canvas, "resizer_item");
+ var ma = mouseArea.createObject(canvas, {
+ color: color,
+ xprop: xprop,
+ yprop: yprop
+ });
ma.visible = root.showResizers;
ma.obj = obj;
ma.x = x - 10;
@@ -186,15 +217,55 @@ Rectangle {
return ma;
}
+ property Component linePath: Component {
+ ShapePath {
+ id: lineShapePath
+ strokeColor: "black"
+ strokeWidth: widthSlider.value
+ fillColor: "transparent"
+ PathLine {
+ x: lineShapePath.startX + 1
+ y: lineShapePath.startY + 1
+ }
+ }
+ }
+
+ property Component cubicPath: Component {
+ ShapePath {
+ id: cubicShapePath
+ strokeColor: "black"
+ strokeWidth: widthSlider.value
+ fillColor: root.fill ? 'green' : 'transparent'
+ PathCubic {
+ x: cubicShapePath.startX + 1
+ y: cubicShapePath.startY + 1
+ control1X: cubicShapePath.startX + 50;
+ control1Y: cubicShapePath.startY + 50;
+ control2X: cubicShapePath.startX + 150;
+ control2Y: cubicShapePath.startY + 50;
+ }
+ }
+ }
+
+ property Component quadPath: Component {
+ ShapePath {
+ id: quadShapePath
+ strokeColor: "black"
+ strokeWidth: widthSlider.value
+ fillColor: root.fill ? 'green' : 'transparent'
+ PathQuad {
+ x: quadShapePath.startx + 1
+ y: quadShapePath.startY + 1
+ controlX: quadShapePath.startX + 50
+ controlY: quadShapePath.startY + 50
+ }
+ }
+ }
+
Component.onCompleted: {
funcs = [
{ "start": function(x, y) {
- var p = Qt.createQmlObject('import QtQuick 2.9; import QtQuick.Shapes 1.0; ShapePath {' +
- 'strokeColor: "black"; fillColor: "transparent";'+
- 'strokeWidth: ' + widthSlider.value + ';' +
- 'startX: ' + x + '; startY: ' + y + ';' +
- 'PathLine { x: ' + x + ' + 1; y: ' + y + ' + 1 } }',
- root, "dynamic_visual_path");
+ var p = linePath.createObject(root, { startX: x, startY: y });
shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
@@ -211,13 +282,7 @@ Rectangle {
}
},
{ "start": function(x, y) {
- var p = Qt.createQmlObject('import QtQuick 2.9; import QtQuick.Shapes 1.0; ShapePath {' +
- 'strokeColor: "black"; fillColor: "' + (root.fill ? 'green' : 'transparent') + '";'+
- 'strokeWidth: ' + widthSlider.value + ';' +
- 'startX: ' + x + '; startY: ' + y + ';' +
- 'PathCubic { x: ' + x + ' + 1; y: ' + y + ' + 1;' +
- 'control1X: ' + x + ' + 50; control1Y: ' + y + ' + 50; control2X: ' + x + ' + 150; control2Y: ' + y + ' + 50; } }',
- root, "dynamic_visual_path");
+ var p = cubicPath.createObject(root, { startX: x, startY: y });
shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
@@ -236,13 +301,7 @@ Rectangle {
}
},
{ "start": function(x, y) {
- var p = Qt.createQmlObject('import QtQuick 2.9; import QtQuick.Shapes 1.0; ShapePath {' +
- 'strokeColor: "black"; fillColor: "' + (root.fill ? 'green' : 'transparent') + '";'+
- 'strokeWidth: ' + widthSlider.value + ';' +
- 'startX: ' + x + '; startY: ' + y + ';' +
- 'PathQuad { x: ' + x + ' + 1; y: ' + y + ' + 1;' +
- 'controlX: ' + x + ' + 50; controlY: ' + y + ' + 50 } }',
- root, "dynamic_visual_path");
+ var p = quadPath.createObject(root, { startX: x, startY: y });
shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes
index c783c63caf..765c92fcb9 100644
--- a/src/imports/builtins/builtins.qmltypes
+++ b/src/imports/builtins/builtins.qmltypes
@@ -1685,6 +1685,17 @@ Module {
"ChecksumItuV41": 1
}
}
+ Enum {
+ name: "HighDpiScaleFactorRoundingPolicy"
+ values: {
+ "Unset": 0,
+ "Round": 1,
+ "Ceil": 2,
+ "Floor": 3,
+ "RoundPreferFloor": 4,
+ "PassThrough": 5
+ }
+ }
}
Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" }
}
diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes
index 0fdbae66d3..7c53c99665 100644
--- a/src/imports/folderlistmodel/plugins.qmltypes
+++ b/src/imports/folderlistmodel/plugins.qmltypes
@@ -9,6 +9,280 @@ import QtQuick.tooling 1.2
Module {
dependencies: ["QtQuick 2.0"]
Component {
+ name: "QAbstractItemModel"
+ prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
+ Enum {
+ name: "CheckIndexOption"
+ values: {
+ "NoOption": 0,
+ "IndexIsValid": 1,
+ "DoNotUseParent": 2,
+ "ParentIsInvalid": 4
+ }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ Parameter { name: "roles"; type: "QVector<int>" }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ }
+ Signal {
+ name: "headerDataChanged"
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutChanged" }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutAboutToBeChanged" }
+ Signal {
+ name: "rowsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal { name: "modelAboutToBeReset" }
+ Signal { name: "modelReset" }
+ Signal {
+ name: "rowsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationRow"; type: "int" }
+ }
+ Signal {
+ name: "rowsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationColumn"; type: "int" }
+ }
+ Signal {
+ name: "columnsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method { name: "submit"; type: "bool" }
+ Method { name: "revert" }
+ Method {
+ name: "hasIndex"
+ type: "bool"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "hasIndex"
+ type: "bool"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method {
+ name: "index"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "index"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method {
+ name: "parent"
+ type: "QModelIndex"
+ Parameter { name: "child"; type: "QModelIndex" }
+ }
+ Method {
+ name: "sibling"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "idx"; type: "QModelIndex" }
+ }
+ Method {
+ name: "rowCount"
+ type: "int"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "rowCount"; type: "int" }
+ Method {
+ name: "columnCount"
+ type: "int"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "columnCount"; type: "int" }
+ Method {
+ name: "hasChildren"
+ type: "bool"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "hasChildren"; type: "bool" }
+ Method {
+ name: "data"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "data"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QModelIndex" }
+ }
+ Method {
+ name: "setData"
+ type: "bool"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "setData"
+ type: "bool"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "headerData"
+ type: "QVariant"
+ Parameter { name: "section"; type: "int" }
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "headerData"
+ type: "QVariant"
+ Parameter { name: "section"; type: "int" }
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ }
+ Method {
+ name: "fetchMore"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "canFetchMore"
+ type: "bool"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "flags"
+ type: "Qt::ItemFlags"
+ Parameter { name: "index"; type: "QModelIndex" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "hits"; type: "int" }
+ Parameter { name: "flags"; type: "Qt::MatchFlags" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "hits"; type: "int" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ }
+ Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
+ Component {
name: "QQuickFolderListModel"
prototype: "QAbstractListModel"
exports: [
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index affb1e9fe2..f5acfd86b7 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -539,6 +539,8 @@ QStringList QQuickFolderListModel::nameFilters() const
void QQuickFolderListModel::setNameFilters(const QStringList &filters)
{
Q_D(QQuickFolderListModel);
+ if (d->nameFilters == filters)
+ return;
d->fileInfoThread.setNameFilters(filters);
d->nameFilters = filters;
}
@@ -731,6 +733,7 @@ void QQuickFolderListModel::setShowDotAndDotDot(bool on)
if (on != d->showDotAndDotDot) {
d->fileInfoThread.setShowDotAndDotDot(on);
+ d->showDotAndDotDot = on;
}
}
@@ -756,6 +759,7 @@ void QQuickFolderListModel::setShowHidden(bool on)
if (on != d->showHidden) {
d->fileInfoThread.setShowHidden(on);
+ d->showHidden = on;
}
}
@@ -781,6 +785,7 @@ void QQuickFolderListModel::setShowOnlyReadable(bool on)
if (on != d->showOnlyReadable) {
d->fileInfoThread.setShowOnlyReadable(on);
+ d->showOnlyReadable = on;
}
}
@@ -805,6 +810,7 @@ void QQuickFolderListModel::setCaseSensitive(bool on)
if (on != d->caseSensitive) {
d->fileInfoThread.setCaseSensitive(on);
+ d->caseSensitive = on;
}
}
@@ -852,7 +858,7 @@ QQuickFolderListModel::Status QQuickFolderListModel::status() const
\qmlproperty bool FolderListModel::sortCaseSensitive
\since 5.12
- If set to true, the sort is case sensitive. This property is true by default.
+ If set to \c true, the sort is case sensitive. This property is \c true by default.
*/
bool QQuickFolderListModel::sortCaseSensitive() const
@@ -874,8 +880,8 @@ void QQuickFolderListModel::setSortCaseSensitive(bool on)
/*!
\qmlmethod var FolderListModel::get(int index, string property)
- Get the folder property for the given index. The following properties
- are available.
+ Returns the folder \a property for the given \a index. The following properties
+ are available:
\list
\li \c fileName
@@ -902,7 +908,7 @@ QVariant QQuickFolderListModel::get(int idx, const QString &property) const
\qmlmethod int FolderListModel::indexOf(url file)
\since 5.6
- Get the index of the given file URL if the model contains it,
+ Returns the index of the given \a file URL if the model contains it,
or -1 if not.
*/
int QQuickFolderListModel::indexOf(const QUrl &file) const
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index a87b0a59f6..9973883024 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -28,6 +28,6 @@ qtHaveModule(quick) {
qtConfig(quick-particles): \
SUBDIRS += particles
- qtConfig(quick-path):qtConfig(thread): SUBDIRS += shapes
+ qtConfig(quick-path): SUBDIRS += shapes
}
diff --git a/src/imports/labsanimation/plugins.qmltypes b/src/imports/labsanimation/plugins.qmltypes
index 065e65ad7a..2ecc5e6f5d 100644
--- a/src/imports/labsanimation/plugins.qmltypes
+++ b/src/imports/labsanimation/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.animation 1.0'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.animation 1.0'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: []
Component {
name: "QQuickBoundaryRule"
prototype: "QObject"
diff --git a/src/imports/models/plugins.qmltypes b/src/imports/models/plugins.qmltypes
index 0f8814d0cd..89a839e502 100644
--- a/src/imports/models/plugins.qmltypes
+++ b/src/imports/models/plugins.qmltypes
@@ -484,6 +484,58 @@ Module {
}
Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
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.Models/Instantiator 2.14"]
+ exportMetaObjectRevisions: [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: ["QtQml.Models/ListElement 2.1"]
diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes
index 4a11658f1f..48da0b26ed 100644
--- a/src/imports/particles/plugins.qmltypes
+++ b/src/imports/particles/plugins.qmltypes
@@ -1081,6 +1081,56 @@ Module {
}
}
Component {
+ name: "QQuickStochasticState"
+ prototype: "QObject"
+ Property { name: "duration"; type: "int" }
+ Property { name: "durationVariation"; type: "int" }
+ Property { name: "randomStart"; type: "bool" }
+ Property { name: "to"; type: "QVariantMap" }
+ Property { name: "name"; type: "string" }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Signal {
+ name: "durationVariationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal { name: "entered" }
+ Signal {
+ name: "randomStartChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setTo"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Method {
+ name: "setDurationVariation"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRandomStart"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
name: "QQuickTargetDirection"
prototype: "QQuickDirection"
exports: ["QtQuick.Particles/TargetDirection 2.0"]
diff --git a/src/imports/qtqml/plugins.qmltypes b/src/imports/qtqml/plugins.qmltypes
index ea8ef2b190..e4ddb3ddd1 100644
--- a/src/imports/qtqml/plugins.qmltypes
+++ b/src/imports/qtqml/plugins.qmltypes
@@ -10,8 +10,8 @@ Module {
dependencies: []
Component {
name: "QObject"
- exports: ["QML/QtObject 1.0", "QtQml/QtObject 2.0"]
- exportMetaObjectRevisions: [0, 0]
+ exports: ["QtQml/QtObject 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "objectName"; type: "string" }
Signal {
name: "objectNameChanged"
@@ -52,8 +52,8 @@ Module {
Component {
name: "QQmlComponent"
prototype: "QObject"
- exports: ["QML/Component 1.0", "QtQml/Component 2.0"]
- exportMetaObjectRevisions: [0, 0]
+ exports: ["QtQml/Component 2.0"]
+ exportMetaObjectRevisions: [0]
attachedType: "QQmlComponentAttached"
Enum {
name: "CompilationMode"
@@ -242,18 +242,4 @@ Module {
Method { name: "stop" }
Method { name: "restart" }
}
- Component {
- name: "QQuickMouseEvent"
- prototype: "QObject"
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "button"; type: "int"; isReadonly: true }
- Property { name: "buttons"; type: "int"; isReadonly: true }
- Property { name: "modifiers"; type: "int"; isReadonly: true }
- Property { name: "source"; revision: 7; type: "int"; isReadonly: true }
- Property { name: "wasHeld"; type: "bool"; isReadonly: true }
- Property { name: "isClick"; type: "bool"; isReadonly: true }
- Property { name: "accepted"; type: "bool" }
- Property { name: "flags"; revision: 11; type: "int"; isReadonly: true }
- }
}
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index 89d2f45f00..a773a8c428 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -449,6 +449,22 @@ Module {
}
}
Component {
+ name: "QObject"
+ exports: ["QtQuick/QtObject 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "objectName"; type: "string" }
+ Signal {
+ name: "objectNameChanged"
+ Parameter { name: "objectName"; type: "string" }
+ }
+ Method { name: "toString" }
+ Method { name: "destroy" }
+ Method {
+ name: "destroy"
+ Parameter { name: "delay"; type: "int" }
+ }
+ }
+ Component {
name: "QPointingDeviceUniqueId"
exports: ["QtQuick/PointingDeviceUniqueId 2.9"]
isCreatable: false
@@ -482,6 +498,92 @@ Module {
}
}
Component {
+ name: "QQmlBind"
+ prototype: "QObject"
+ exports: ["QtQuick/Binding 2.0", "QtQuick/Binding 2.8"]
+ exportMetaObjectRevisions: [0, 8]
+ Enum {
+ name: "RestorationMode"
+ values: {
+ "RestoreNone": 0,
+ "RestoreBinding": 1,
+ "RestoreValue": 2,
+ "RestoreBindingOrValue": 3
+ }
+ }
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "value"; type: "QVariant" }
+ Property { name: "when"; type: "bool" }
+ Property { name: "delayed"; revision: 8; type: "bool" }
+ Property { name: "restoreMode"; revision: 14; type: "RestorationMode" }
+ }
+ Component {
+ name: "QQmlComponent"
+ prototype: "QObject"
+ exports: ["QtQuick/Component 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlComponentAttached"
+ Enum {
+ name: "CompilationMode"
+ values: {
+ "PreferSynchronous": 0,
+ "Asynchronous": 1
+ }
+ }
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "url"; type: "QUrl"; isReadonly: true }
+ Signal {
+ name: "statusChanged"
+ Parameter { type: "QQmlComponent::Status" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { type: "double" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ Parameter { name: "mode"; type: "CompilationMode" }
+ }
+ Method {
+ name: "setData"
+ Parameter { type: "QByteArray" }
+ Parameter { name: "baseUrl"; type: "QUrl" }
+ }
+ Method { name: "errorString"; type: "string" }
+ }
+ Component {
+ name: "QQmlComponentAttached"
+ prototype: "QObject"
+ Signal { name: "completed" }
+ Signal { name: "destruction" }
+ }
+ Component {
+ name: "QQmlConnections"
+ prototype: "QObject"
+ exports: ["QtQuick/Connections 2.0", "QtQuick/Connections 2.7"]
+ exportMetaObjectRevisions: [0, 3]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "enabled"; revision: 3; type: "bool" }
+ Property { name: "ignoreUnknownSignals"; type: "bool" }
+ Signal { name: "enabledChanged"; revision: 3 }
+ }
+ Component {
name: "QQmlDelegateModel"
defaultProperty: "delegate"
prototype: "QQmlInstanceModel"
@@ -634,6 +736,58 @@ 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: ["QtQuick/Instantiator 2.1"]
+ exportMetaObjectRevisions: [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"]
@@ -733,6 +887,70 @@ Module {
Method { name: "sync" }
}
Component {
+ name: "QQmlLocale"
+ exports: ["QtQuick/Locale 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "MeasurementSystem"
+ values: {
+ "MetricSystem": 0,
+ "ImperialSystem": 1,
+ "ImperialUSSystem": 1,
+ "ImperialUKSystem": 2
+ }
+ }
+ Enum {
+ name: "FormatType"
+ values: {
+ "LongFormat": 0,
+ "ShortFormat": 1,
+ "NarrowFormat": 2
+ }
+ }
+ Enum {
+ name: "CurrencySymbolFormat"
+ values: {
+ "CurrencyIsoCode": 0,
+ "CurrencySymbol": 1,
+ "CurrencyDisplayName": 2
+ }
+ }
+ Enum {
+ name: "DayOfWeek"
+ values: {
+ "Sunday": 0,
+ "Monday": 1,
+ "Tuesday": 2,
+ "Wednesday": 3,
+ "Thursday": 4,
+ "Friday": 5,
+ "Saturday": 6
+ }
+ }
+ }
+ Component {
+ name: "QQmlLoggingCategory"
+ prototype: "QObject"
+ exports: [
+ "QtQuick/LoggingCategory 2.12",
+ "QtQuick/LoggingCategory 2.8"
+ ]
+ exportMetaObjectRevisions: [12, 0]
+ Enum {
+ name: "DefaultLogLevel"
+ values: {
+ "Debug": 0,
+ "Info": 4,
+ "Warning": 1,
+ "Critical": 2,
+ "Fatal": 3
+ }
+ }
+ Property { name: "name"; type: "string" }
+ Property { name: "defaultLogLevel"; revision: 12; type: "DefaultLogLevel" }
+ }
+ Component {
name: "QQmlObjectModel"
defaultProperty: "children"
prototype: "QQmlInstanceModel"
@@ -789,6 +1007,21 @@ Module {
Property { name: "index"; type: "int"; isReadonly: true }
}
Component {
+ name: "QQmlTimer"
+ prototype: "QObject"
+ exports: ["QtQuick/Timer 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "interval"; type: "int" }
+ Property { name: "running"; type: "bool" }
+ Property { name: "repeat"; type: "bool" }
+ Property { name: "triggeredOnStart"; type: "bool" }
+ Property { name: "parent"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal { name: "triggered" }
+ Method { name: "start" }
+ Method { name: "stop" }
+ Method { name: "restart" }
+ }
+ Component {
name: "QQuickAbstractAnimation"
prototype: "QObject"
exports: ["QtQuick/Animation 2.0", "QtQuick/Animation 2.12"]
@@ -1569,8 +1802,8 @@ Module {
Component {
name: "QQuickDragHandler"
prototype: "QQuickMultiPointHandler"
- exports: ["QtQuick/DragHandler 2.12"]
- exportMetaObjectRevisions: [12]
+ exports: ["QtQuick/DragHandler 2.12", "QtQuick/DragHandler 2.14"]
+ exportMetaObjectRevisions: [12, 14]
Enum {
name: "SnapMode"
values: {
@@ -1583,7 +1816,8 @@ Module {
Property { name: "xAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
Property { name: "yAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
Property { name: "translation"; type: "QVector2D"; isReadonly: true }
- Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "snapMode"; revision: 14; type: "SnapMode" }
+ Signal { name: "snapModeChanged"; revision: 14 }
}
Component {
name: "QQuickDropArea"
@@ -2282,12 +2516,13 @@ Module {
"QtQuick/Image 2.0",
"QtQuick/Image 2.1",
"QtQuick/Image 2.11",
+ "QtQuick/Image 2.14",
"QtQuick/Image 2.3",
"QtQuick/Image 2.4",
"QtQuick/Image 2.5",
"QtQuick/Image 2.7"
]
- exportMetaObjectRevisions: [0, 1, 11, 3, 4, 5, 7]
+ exportMetaObjectRevisions: [0, 1, 11, 14, 3, 4, 5, 7]
Enum {
name: "HAlignment"
values: {
@@ -2343,6 +2578,9 @@ Module {
name: "QQuickImageBase"
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/ImageBase 2.14"]
+ isCreatable: false
+ exportMetaObjectRevisions: [14]
Enum {
name: "Status"
values: {
@@ -2359,6 +2597,8 @@ Module {
Property { name: "cache"; type: "bool" }
Property { name: "sourceSize"; type: "QSize" }
Property { name: "mirror"; type: "bool" }
+ Property { name: "currentFrame"; revision: 14; type: "int" }
+ Property { name: "frameCount"; revision: 14; type: "int"; isReadonly: true }
Signal {
name: "sourceChanged"
Parameter { type: "QUrl" }
@@ -2371,6 +2611,8 @@ Module {
name: "progressChanged"
Parameter { name: "progress"; type: "double" }
}
+ Signal { name: "currentFrameChanged"; revision: 14 }
+ Signal { name: "frameCountChanged"; revision: 14 }
}
Component {
name: "QQuickImplicitSizeItem"
@@ -3189,6 +3431,20 @@ Module {
Signal { name: "pressAndHoldIntervalChanged"; revision: 9 }
}
Component {
+ name: "QQuickMouseEvent"
+ prototype: "QObject"
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "button"; type: "int"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "int"; isReadonly: true }
+ Property { name: "source"; revision: 7; type: "int"; isReadonly: true }
+ Property { name: "wasHeld"; type: "bool"; isReadonly: true }
+ Property { name: "isClick"; type: "bool"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ Property { name: "flags"; revision: 11; type: "int"; isReadonly: true }
+ }
+ Component {
name: "QQuickMultiPointHandler"
prototype: "QQuickPointerDeviceHandler"
Property { name: "minimumPointCount"; type: "int" }
@@ -3535,7 +3791,7 @@ Module {
exports: ["QtQuick/PathMultiline 2.14"]
exportMetaObjectRevisions: [14]
Property { name: "start"; type: "QPointF"; isReadonly: true }
- Property { name: "paths"; type: "QVariantList" }
+ Property { name: "paths"; type: "QVariant" }
}
Component {
name: "QQuickPathPercent"
@@ -3550,7 +3806,7 @@ Module {
exports: ["QtQuick/PathPolyline 2.14"]
exportMetaObjectRevisions: [14]
Property { name: "start"; type: "QPointF"; isReadonly: true }
- Property { name: "path"; type: "QVariantList" }
+ Property { name: "path"; type: "QVariant" }
}
Component {
name: "QQuickPathQuad"
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index 287a70363a..d43f9bafb7 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -473,7 +473,7 @@ QVariant QQmlSettings::value(const QString &key, const QVariant &defaultValue) c
/*!
\qmlmethod Settings::setValue(string key, var value)
- Sets the value of setting key to value. If the key already exists,
+ Sets the value of setting \a key to \a value. If the key already exists,
the previous value is overwritten.
\since Qt 5.12
diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes
index d9a9b432a2..5d6cf33f4f 100644
--- a/src/imports/window/plugins.qmltypes
+++ b/src/imports/window/plugins.qmltypes
@@ -104,6 +104,12 @@ Module {
"NativeTextRendering": 1
}
}
+ Enum {
+ name: "NativeObjectType"
+ values: {
+ "NativeObjectTexture": 0
+ }
+ }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "color"; type: "QColor" }
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 649fbb30c2..bd3865f42f 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -179,7 +179,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -216,7 +216,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -331,7 +331,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -357,7 +357,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -487,7 +487,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -524,7 +524,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -651,7 +651,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -677,7 +677,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -799,7 +799,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simple.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -825,7 +825,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp
index e68ea54707..fc28864746 100644
--- a/src/particles/qquickitemparticle.cpp
+++ b/src/particles/qquickitemparticle.cpp
@@ -59,32 +59,38 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmethod QtQuick.Particles::ItemParticle::freeze(Item item)
- Suspends the flow of time for the logical particle which item represents, allowing you to control its movement.
+ Suspends the flow of time for the logical particle which \a item represents,
+ allowing you to control its movement.
*/
/*!
\qmlmethod QtQuick.Particles::ItemParticle::unfreeze(Item item)
- Restarts the flow of time for the logical particle which item represents, allowing it to be moved by the particle system again.
+ Restarts the flow of time for the logical particle which \a item represents,
+ allowing it to be moved by the particle system again.
*/
/*!
\qmlmethod QtQuick.Particles::ItemParticle::take(Item item, bool prioritize)
- Asks the ItemParticle to take over control of item positioning temporarily.
+ Asks the ItemParticle to take over control of \a item positioning temporarily.
It will follow the movement of a logical particle when one is available.
- By default items form a queue when waiting for a logical particle, but if prioritize is true then it will go immediately to the
- head of the queue.
+ By default items form a queue when waiting for a logical particle, but if
+ \a prioritize is \c true, then it will go immediately to the head of the
+ queue.
ItemParticle does not take ownership of the item, and will relinquish
control when the logical particle expires. Commonly at this point you will
want to put it back in the queue, you can do this with the below line in
the delegate definition:
+
\code
ItemParticle.onDetached: itemParticleInstance.take(delegateRootItem);
\endcode
+
or delete it, such as with the below line in the delegate definition:
+
\code
ItemParticle.onDetached: delegateRootItem.destroy();
\endcode
@@ -93,7 +99,9 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmethod QtQuick.Particles::ItemParticle::give(Item item)
- Orders the ItemParticle to give you control of the item. It will cease controlling it and the item will lose its association to the logical particle.
+ Orders the ItemParticle to give you control of the \a item. It will cease
+ controlling it and the item will lose its association to the logical
+ particle.
*/
/*!
diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp
index 3d6035c577..ffbd5674f0 100644
--- a/src/particles/qquickparticleaffector.cpp
+++ b/src/particles/qquickparticleaffector.cpp
@@ -125,7 +125,7 @@ QT_BEGIN_NAMESPACE
themselves). As this executes JavaScript code per particle, it is not recommended to use this
signal with a high-volume particle system.
- x,y is the particle's current position.
+ (\a {x}, \a {y}) is the particle's current position.
The corresponding handler is \c onAffected.
*/
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index 4e36ad149a..c0d9fa941d 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -191,10 +191,10 @@ QT_BEGIN_NAMESPACE
/*!
\qmlsignal QtQuick.Particles::Emitter::emitParticles(Array particles)
- This signal is emitted when particles are emitted. particles is a JavaScript
+ This signal is emitted when particles are emitted. \a particles is a JavaScript
array of Particle objects. You can modify particle attributes directly within the handler.
- Note that JavaScript is slower to execute, so it is not recommended to use this in
+ \note JavaScript is slower to execute, so it is not recommended to use this in
high-volume particle systems.
The corresponding handler is \c onEmitParticles.
@@ -202,19 +202,20 @@ QT_BEGIN_NAMESPACE
/*! \qmlmethod QtQuick.Particles::Emitter::burst(int count)
- Emits count particles from this emitter immediately.
+ Emits a number of particles, specified by \a count, from this emitter immediately.
*/
/*! \qmlmethod QtQuick.Particles::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.
+ Emits a number of particles, specified by \a count, from this emitter immediately.
+ The particles are emitted as if the Emitter was positioned at (\a {x}, \a {y}) but
+ all other properties are the same.
*/
/*! \qmlmethod QtQuick.Particles::Emitter::pulse(int duration)
- If the emitter is not enabled, enables it for duration milliseconds and then switches
- it back off.
+ If the emitter is not enabled, enables it for a specified \a duration
+ (in milliseconds) and then switches it back off.
*/
QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) :
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
index 0d501f48c0..4a6894e69e 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
@@ -148,7 +148,7 @@ void QSGD3D12RenderLoop::windowDestroyed(QQuickWindow *window)
delete rc;
delete engine;
- delete wd->animationController;
+ wd->animationController.reset();
}
void QSGD3D12RenderLoop::exposeWindow(QQuickWindow *window)
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
index f505df1e5a..4302a9119b 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
@@ -373,7 +373,7 @@ bool QSGD3D12RenderThread::event(QEvent *e)
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
if (wme->destroying)
- delete wd->animationController;
+ wd->animationController.reset();
}
if (wme->destroying)
active = false;
@@ -1006,7 +1006,7 @@ void QSGD3D12ThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (Q_UNLIKELY(debug_loop()))
qDebug("starting render thread");
// Push a few things to the render thread.
- QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController;
+ QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController.data();
if (controller->thread() != w->thread)
controller->moveToThread(w->thread);
if (w->thread->thread() == QThread::currentThread()) {
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
index 94f7f76036..69b10fcdee 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
@@ -96,7 +96,7 @@ void QSGOpenVGRenderLoop::windowDestroyed(QQuickWindow *window)
vg->doneCurrent();
}
- delete d->animationController;
+ d->animationController.reset();
}
void QSGOpenVGRenderLoop::exposureChanged(QQuickWindow *window)
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index cb9fb575b2..74d0a3b27c 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -37,11 +37,17 @@ tagfile = ../../../doc/qtqml/qtqml.tags
depends += qtcore qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets qtxmlpatterns qtquickcontrols
headerdirs += .. \
- ../../imports/models
+ ../../imports/models \
+ ../../qmlmodels \
+ ../../qml \
+ ../../qmlworkerscript
sourcedirs += .. \
../../imports/models \
- ../../imports/statemachine
+ ../../imports/statemachine \
+ ../../qmlmodels \
+ ../../qml \
+ ../../qmlworkerscript
exampledirs += ../../../examples/qml \
../ \
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index 26556644d6..43987354ae 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -407,8 +407,7 @@ located at the same level as the application that uses our new import module.
This way, the QML engine will find our module as the default search path for QML
imports includes the directory of the application executable. On \macos, the
plugin binary is copied to \c Contents/PlugIns in the the application bundle;
-this path is set in \l {tutorials/extending-qml/chapter6-plugins/app.pro}
-{chapter6-plugins/app.pro}:
+this path is set in \c {chapter6-plugins/app.pro}:
\quotefromfile tutorials/extending-qml/chapter6-plugins/app.pro
\skipto osx
diff --git a/src/qml/doc/src/javascript/qtjavascript.qdoc b/src/qml/doc/src/javascript/qtjavascript.qdoc
index ad93d9d9ac..aa4dce6a37 100644
--- a/src/qml/doc/src/javascript/qtjavascript.qdoc
+++ b/src/qml/doc/src/javascript/qtjavascript.qdoc
@@ -26,13 +26,6 @@
****************************************************************************/
/*!
- \group qtjavascript
- \title Scripting Classes and Overviews
-
- \brief Classes for embedding JavaScript in Qt/C++ applications.
-*/
-
-/*!
\page qtjavascript.html
\title Making Applications Scriptable
\ingroup frameworks-technologies
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
index f896af3378..47922ff17a 100644
--- a/src/qml/doc/src/javascript/string.qdoc
+++ b/src/qml/doc/src/javascript/string.qdoc
@@ -39,8 +39,8 @@
/*!
\qmlmethod string String::arg(value)
- Returns a copy of this string with the lowest numbered place marker replaced by value,
- i.e., %1, %2, ..., %99. The following example prints "There are 20 items"
+ Returns a copy of this string with the lowest numbered place marker replaced by \a value,
+ i.e., %1, %2, ..., %99. The following example prints "There are 20 items":
\code
var message = "There are %1 items"
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index c71d18418a..b083012eab 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -276,25 +276,14 @@
/*!
\fn int qmlRegisterAnonymousType(const char *uri, int versionMajor)
- This template function registers the C++ type in the QML system. Instances of this type cannot be created from the QML system.
+ This template function registers the C++ type in the QML system as an anonymous type. The
+ resulting QML type does not have a name. Therefore, instances of this type cannot be created from
+ the QML system. You can, however, access instances of the type when they are exposed as properties
+ of other types.
- Use this function when the type will not be referenced by name. Use \a uri and \a versionMajor to indicate to which module the type belongs.
-
- \sa {Choosing the Correct Integration Method Between C++ and QML}
-*/
-
-/*!
- \fn int qmlRegisterType()
- \relates QQmlEngine
- \overload
-
- This template function registers the C++ type in the QML
- system. Instances of this type cannot be created from the QML
- system.
-
- This function should be used when the type will not be referenced by name.
- Specifically, it has to be used for C++ types that are used as the left-hand
- side of a property binding.
+ Use this function when the type will not be referenced by name, specifically for C++ types that
+ are used on the left-hand side of a property binding. To indicate to which module the type belongs
+ use \a uri and \a versionMajor.
For example, consider the following two classes:
@@ -354,18 +343,29 @@
\code
qmlRegisterType<Foo>("App", 1, 0, "Foo");
- qmlRegisterType<Bar>();
+ qmlRegisterAnonymousType<Bar>("App", 1);
\endcode
As the \c Foo type is instantiated in QML, it must be registered
- with the version of \l qmlRegisterType() that takes an import URI.
+ with the version of \l qmlRegisterType() that takes an element name.
Returns the QML type id.
+ \since 5.14
\sa {Choosing the Correct Integration Method Between C++ and QML}
*/
/*!
+ \fn int qmlRegisterType()
+ \relates QQmlEngine
+ \overload
+ \deprecated
+
+ Do not use this function. For anonymous type registrations, use \l qmlRegisterAnonymousType(),
+ and make sure to provide a URI and a major version.
+*/
+
+/*!
\fn int qmlRegisterInterface(const char *typeName)
\relates QQmlEngine
@@ -458,7 +458,7 @@
*/
/*!
- \fn template<typename T> QObject *qmlAttachedPropertiesObject(const QObject *attachee, bool create = true)
+ \fn template<typename T> QObject *qmlAttachedPropertiesObject(const QObject *attachee, bool create)
\relates QQmlEngine
The form of this template function is:
diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h
index b9f71b7bd9..b18d082be6 100644
--- a/src/qml/jit/qv4assemblercommon_p.h
+++ b/src/qml/jit/qv4assemblercommon_p.h
@@ -624,9 +624,9 @@ public:
// and jump out of the exception handler.
loadPtr(exceptionHandlerAddress(), ScratchRegister);
Jump exitFunction = branchPtr(Equal, ScratchRegister, TrustedImmPtr(0));
+ loadUndefined();
jump(ScratchRegister);
exitFunction.link(this);
- loadUndefined();
if (functionExit.isSet())
jump(functionExit);
diff --git a/src/qml/jit/qv4baselineassembler.cpp b/src/qml/jit/qv4baselineassembler.cpp
index 5e34087ff5..59de86a85d 100644
--- a/src/qml/jit/qv4baselineassembler.cpp
+++ b/src/qml/jit/qv4baselineassembler.cpp
@@ -1474,6 +1474,12 @@ void BaselineAssembler::saveAccumulatorInFrame()
offsetof(CallData, accumulator)));
}
+void BaselineAssembler::loadAccumulatorFromFrame()
+{
+ pasm()->loadAccumulator(PlatformAssembler::Address(PlatformAssembler::JSStackFrameRegister,
+ offsetof(CallData, accumulator)));
+}
+
static ReturnedValue TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing(CppStackFrame *frame, ExecutionEngine *engine)
{
return Runtime::TailCall::call(frame, engine);
@@ -1600,7 +1606,6 @@ void BaselineAssembler::deadTemporalZoneCheck(int offsetForSavedIP, int variable
{
auto valueIsAliveJump = pasm()->jumpNotEmpty();
storeInstructionPointer(offsetForSavedIP);
- saveAccumulatorInFrame();
prepareCallWithArgCount(2);
passInt32AsArg(variableName, 1);
passEngineAsArg(0);
diff --git a/src/qml/jit/qv4baselineassembler_p.h b/src/qml/jit/qv4baselineassembler_p.h
index 5e5d9d0672..33fd288ac3 100644
--- a/src/qml/jit/qv4baselineassembler_p.h
+++ b/src/qml/jit/qv4baselineassembler_p.h
@@ -155,6 +155,7 @@ public:
void passPointerAsArg(void *ptr, int arg);
void callRuntime(const char *functionName, const void *funcPtr, CallResultDestination dest);
void saveAccumulatorInFrame();
+ void loadAccumulatorFromFrame();
void jsTailCall(int func, int thisObject, int argc, int argv);
// exception/context stuff
diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp
index 906cc30e67..fcaa87290e 100644
--- a/src/qml/jit/qv4baselinejit.cpp
+++ b/src/qml/jit/qv4baselinejit.cpp
@@ -74,6 +74,7 @@ void BaselineJIT::generate()
#define STORE_IP() as->storeInstructionPointer(nextInstructionOffset())
#define STORE_ACC() as->saveAccumulatorInFrame()
+#define LOAD_ACC() as->loadAccumulatorFromFrame()
#define BASELINEJIT_GENERATE_RUNTIME_CALL(function, destination) { \
as->GENERATE_RUNTIME_CALL(function, destination); \
if (Runtime::function::throws) \
@@ -228,6 +229,7 @@ void BaselineJIT::generate_StoreNameSloppy(int name)
as->passInt32AsArg(name, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(StoreNameSloppy, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_StoreNameStrict(int name)
@@ -239,6 +241,7 @@ void BaselineJIT::generate_StoreNameStrict(int name)
as->passInt32AsArg(name, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(StoreNameStrict, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_LoadElement(int base)
@@ -262,6 +265,7 @@ void BaselineJIT::generate_StoreElement(int base, int index)
as->passJSSlotAsArg(base, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(StoreElement, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_LoadProperty(int name)
@@ -297,6 +301,7 @@ void BaselineJIT::generate_StoreProperty(int name, int base)
as->passJSSlotAsArg(base, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(StoreProperty, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_SetLookup(int index, int base)
@@ -317,7 +322,6 @@ void BaselineJIT::generate_SetLookup(int index, int base)
void BaselineJIT::generate_LoadSuperProperty(int property)
{
STORE_IP();
- STORE_ACC();
as->prepareCallWithArgCount(2);
as->passJSSlotAsArg(property, 1);
as->passEngineAsArg(0);
@@ -333,6 +337,7 @@ void BaselineJIT::generate_StoreSuperProperty(int property)
as->passJSSlotAsArg(property, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(StoreSuperProperty, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_Yield()
@@ -562,6 +567,7 @@ void BaselineJIT::generate_PushBlockContext(int index)
as->passInt32AsArg(index, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(PushBlockContext, CallResultDestination::Ignore);
+ as->loadAccumulatorFromFrame();
}
void BaselineJIT::generate_CloneBlockContext()
@@ -570,6 +576,7 @@ void BaselineJIT::generate_CloneBlockContext()
as->prepareCallWithArgCount(1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(CloneBlockContext, CallResultDestination::Ignore);
+ as->loadAccumulatorFromFrame();
}
void BaselineJIT::generate_PushScriptContext(int index)
@@ -579,6 +586,7 @@ void BaselineJIT::generate_PushScriptContext(int index)
as->passInt32AsArg(index, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(PushScriptContext, CallResultDestination::Ignore);
+ as->loadAccumulatorFromFrame();
}
void BaselineJIT::generate_PopScriptContext()
@@ -587,6 +595,7 @@ void BaselineJIT::generate_PopScriptContext()
as->prepareCallWithArgCount(1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(PopScriptContext, CallResultDestination::Ignore);
+ as->loadAccumulatorFromFrame();
}
void BaselineJIT::generate_PopContext() { as->popContext(); }
@@ -682,11 +691,13 @@ void BaselineJIT::generate_TypeofValue()
void BaselineJIT::generate_DeclareVar(int varName, int isDeletable)
{
+ STORE_ACC();
as->prepareCallWithArgCount(3);
as->passInt32AsArg(varName, 2);
as->passInt32AsArg(isDeletable, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(DeclareVar, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_DefineArray(int argc, int args)
@@ -744,11 +755,13 @@ void BaselineJIT::generate_CreateRestParameter(int argIndex)
void BaselineJIT::generate_ConvertThisToObject()
{
+ STORE_ACC();
as->prepareCallWithArgCount(2);
as->passJSSlotAsArg(CallData::This, 1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(ConvertThisToObject, CallResultDestination::InAccumulator);
as->storeReg(CallData::This);
+ LOAD_ACC();
}
void BaselineJIT::generate_LoadSuperConstructor()
@@ -893,6 +906,7 @@ void BaselineJIT::generate_ThrowOnNullOrUndefined()
as->passAccumulatorAsArg(1);
as->passEngineAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(ThrowOnNullOrUndefined, CallResultDestination::Ignore);
+ LOAD_ACC();
}
void BaselineJIT::generate_GetTemplateObject(int index)
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 1bfd72227f..065fbc1c0a 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -615,7 +615,9 @@ QJSValue QJSEngine::newObject()
/*!
\since 5.12
- Creates a JavaScript object of class Error.
+
+ Creates a JavaScript object of class Error, with \a message as the error
+ message.
The prototype of the created object will be \a errorType.
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index bba88e5c9a..5616b1450b 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -729,14 +729,16 @@ void Heap::DateObject::init(const QTime &time)
* time from it, which shall (via toQDateTime(), below) discard the date
* part. We need a date for which time-zone data is likely to be sane (so
* MakeDay(0, 0, 0) was a bad choice; 2 BC, December 31st is before
- * time-zones were standardized), with no transition nearby in date. We
- * ignore DST transitions before 1970, but even then zone transitions did
- * happen. Some do happen at new year, others on DST transitions in spring
- * and autumn; so pick the three hundredth anniversary of the birth of
- * Giovanni Domenico Cassini (1625-06-08), whose work first let us
- * synchronize clocks tolerably accurately at distant locations.
+ * time-zones were standardized), with no transition nearby in date.
+ * QDateTime ignores DST transitions before 1970, but even then zone
+ * transitions did happen; and DaylightSavingTA() will include DST, at odds
+ * with QDateTime. So pick a date since 1970 and prefer one when no zone
+ * was in DST. One such interval (according to the Olson database, at
+ * least) was 1971 March 15th to April 17th. Since converting a time to a
+ * date-time without specifying a date is foolish, let's use April Fools'
+ * day.
*/
- static const double d = MakeDay(1925, 5, 8);
+ static const double d = MakeDay(1971, 3, 1);
double t = MakeTime(time.hour(), time.minute(), time.second(), time.msec());
date = TimeClip(UTC(MakeDate(d, t), internalClass->engine->localTZA));
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index fca97d2e0c..590cebfa7c 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1765,6 +1765,12 @@ ReturnedValue ExecutionEngine::global()
QQmlRefPointer<ExecutableCompilationUnit> ExecutionEngine::compileModule(const QUrl &url)
{
+ QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError;
+ if (const QV4::CompiledData::Unit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(url, &cacheError)) {
+ return ExecutableCompilationUnit::create(
+ QV4::CompiledData::CompilationUnit(cachedUnit, url.fileName(), url.toString()));
+ }
+
QFile f(QQmlFile::urlToLocalFileOrQrc(url));
if (!f.open(QIODevice::ReadOnly)) {
throwError(QStringLiteral("Could not open module %1 for reading").arg(url.toString()));
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp
index 950e0b10ea..d51e986006 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -52,6 +52,7 @@
#include <private/qv4module_p.h>
#include <private/qv4compilationunitmapper_p.h>
#include <private/qml_compile_hash_p.h>
+#include <private/qqmltypewrapper_p.h>
#include <QtQml/qqmlfile.h>
#include <QtQml/qqmlpropertymap.h>
@@ -291,15 +292,18 @@ void ExecutableCompilationUnit::unlink()
if (runtimeLookups) {
for (uint i = 0; i < data->lookupTableSize; ++i) {
QV4::Lookup &l = runtimeLookups[i];
- if (l.getter == QV4::QObjectWrapper::lookupGetter) {
+ if (l.getter == QV4::QObjectWrapper::lookupGetter
+ || l.getter == QQmlTypeWrapper::lookupSingletonProperty) {
if (QQmlPropertyCache *pc = l.qobjectLookup.propertyCache)
pc->release();
- } else if (l.getter == QQmlValueTypeWrapper::lookupGetter) {
+ } else if (l.getter == QQmlValueTypeWrapper::lookupGetter
+ || l.getter == QQmlTypeWrapper::lookupSingletonProperty) {
if (QQmlPropertyCache *pc = l.qgadgetLookup.propertyCache)
pc->release();
}
- if (l.qmlContextPropertyGetter == QQmlContextWrapper::lookupScopeObjectProperty) {
+ if (l.qmlContextPropertyGetter == QQmlContextWrapper::lookupScopeObjectProperty
+ || l.qmlContextPropertyGetter == QQmlContextWrapper::lookupContextObjectProperty) {
if (QQmlPropertyCache *pc = l.qobjectLookup.propertyCache)
pc->release();
}
diff --git a/src/qml/jsruntime/qv4promiseobject.cpp b/src/qml/jsruntime/qv4promiseobject.cpp
index 27075e96a0..17d218a6eb 100644
--- a/src/qml/jsruntime/qv4promiseobject.cpp
+++ b/src/qml/jsruntime/qv4promiseobject.cpp
@@ -163,6 +163,7 @@ void ReactionHandler::executeReaction(ReactionEvent *event)
ScopedFunctionObject reaction(scope);
if (scope.hasException()) {
reaction = capability->d()->reject.as<QV4::FunctionObject>();
+ result = scope.engine->catchException();
} else {
reaction = capability->d()->resolve.as<QV4::FunctionObject>();
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 4d099d2e0f..27d518f5c6 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -647,7 +647,6 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(LoadSuperProperty)
STORE_IP();
- STORE_ACC();
acc = Runtime::LoadSuperProperty::call(engine, STACK_VALUE(property));
CHECK_EXCEPTION;
MOTH_END_INSTR(LoadSuperProperty)
@@ -794,12 +793,14 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(Construct)
STORE_IP();
+ STORE_ACC();
acc = Runtime::Construct::call(engine, STACK_VALUE(func), ACC, stack + argv, argc);
CHECK_EXCEPTION;
MOTH_END_INSTR(Construct)
MOTH_BEGIN_INSTR(ConstructWithSpread)
STORE_IP();
+ STORE_ACC();
acc = Runtime::ConstructWithSpread::call(engine, STACK_VALUE(func), ACC, stack + argv, argc);
CHECK_EXCEPTION;
MOTH_END_INSTR(ConstructWithSpread)
@@ -827,7 +828,6 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(DeadTemporalZoneCheck)
if (ACC.isEmpty()) {
STORE_IP();
- STORE_ACC();
Runtime::ThrowReferenceError::call(engine, name);
goto handleUnwind;
}
@@ -970,6 +970,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_END_INSTR(CreateRestParameter)
MOTH_BEGIN_INSTR(ConvertThisToObject)
+ STORE_ACC();
stack[CallData::This] = Runtime::ConvertThisToObject::call(engine, stack[CallData::This]);
CHECK_EXCEPTION;
MOTH_END_INSTR(ConvertThisToObject)
@@ -980,6 +981,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_END_INSTR(LoadSuperConstructor)
MOTH_BEGIN_INSTR(ToObject)
+ STORE_ACC();
acc = ACC.toObject(engine)->asReturnedValue();
CHECK_EXCEPTION;
MOTH_END_INSTR(ToObject)
diff --git a/src/qml/qml/ftw/qintrusivelist.cpp b/src/qml/qml/ftw/qintrusivelist.cpp
index eb337a4de0..2ebaffb375 100644
--- a/src/qml/qml/ftw/qintrusivelist.cpp
+++ b/src/qml/qml/ftw/qintrusivelist.cpp
@@ -150,6 +150,10 @@ Returns an STL-style iterator pointing to the imaginary item after the last item
Remove the current object from the list, and return an iterator to the next element.
*/
+/*!
+ \class QIntrusiveListNode
+ \internal
+*/
/*!
\fn QIntrusiveListNode::QIntrusiveListNode()
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h
index effa05180d..ae3893dd73 100644
--- a/src/qml/qml/qqml.h
+++ b/src/qml/qml/qqml.h
@@ -168,11 +168,13 @@ int qmlRegisterAnonymousType(const char *uri, int versionMajor)
return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
}
+#if QT_DEPRECATED_SINCE(5, 14)
template<typename T>
QT_DEPRECATED_VERSION_X_5_14("Use qmlRegisterAnonymousType instead") int qmlRegisterType()
{
return qmlRegisterAnonymousType<T>("", 1);
}
+#endif
int Q_QML_EXPORT qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message);
@@ -621,8 +623,10 @@ namespace QtQml {
Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
#if QT_DEPRECATED_SINCE(5, 14)
- Q_QML_EXPORT QT_DEPRECATED QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
- Q_QML_EXPORT QT_DEPRECATED QObject *qmlAttachedPropertiesObject(
+ Q_QML_EXPORT QT_DEPRECATED_VERSION_X_5_14("Use qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc, bool")
+ QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
+ Q_QML_EXPORT QT_DEPRECATED_VERSION_X_5_14("Use qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc, bool")
+ QObject *qmlAttachedPropertiesObject(
int *, const QObject *, const QMetaObject *, bool create);
#endif
Q_QML_EXPORT QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *,
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index d04a89b514..adb036e2d0 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -279,7 +279,7 @@ void QQmlApplicationEngine::load(const QString &filePath)
}
/*!
- Sets the initial properties with which the QML component gets initialized after
+ Sets the \a initialProperties with which the QML component gets initialized after
it gets loaded.
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index d651cbf636..f03f90e7f3 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -827,8 +827,9 @@ QObject *QQmlComponent::create(QQmlContext *context)
}
/*!
- Create an object instance of this component, and initialize its toplevel properties according to initalPropertyValues.
-
+ Create an object instance of this component, and initialize its toplevel
+ properties with \a initialProperties. \a context specifies the context
+ where the object instance is to be created.
\sa QQmlComponent::create
\since 5.14
@@ -1178,7 +1179,7 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context,
}
/*!
- Set toplevel properties of the component.
+ Set toplevel \a properties of the \a component.
This method provides advanced control over component instance creation.
diff --git a/src/qml/qml/qqmldatablob_p.h b/src/qml/qml/qqmldatablob_p.h
index da3bbe2c1f..0450e94c02 100644
--- a/src/qml/qml/qqmldatablob_p.h
+++ b/src/qml/qml/qqmldatablob_p.h
@@ -242,7 +242,9 @@ private:
mutable QString m_finalUrlString;
// List of QQmlDataBlob's that are waiting for me to complete.
+protected:
QList<QQmlDataBlob *> m_waitingOnMe;
+private:
// List of QQmlDataBlob's that I am waiting for to complete.
QVector<QQmlRefPointer<QQmlDataBlob>> m_waitingFor;
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index 96891af416..3c540a6124 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE
\endcode
*/
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method) \
-{ \
+do { \
SenderType *sender = (Sender); \
ReceiverType *receiver = (Receiver); \
const char *signal = (Signal); \
@@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE
} \
Q_ASSERT(signalIdx != -1 && methodIdx != -1); \
QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); \
-}
+} while (0)
/*!
Disconnect \a Signal of \a Sender from \a Method of \a Receiver. \a Signal must be
@@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE
\endcode
*/
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method) \
-{ \
+do { \
SenderType *sender = (Sender); \
ReceiverType *receiver = (Receiver); \
const char *signal = (Signal); \
@@ -150,7 +150,7 @@ QT_BEGIN_NAMESPACE
} \
Q_ASSERT(signalIdx != -1 && methodIdx != -1); \
QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); \
-}
+} while (0)
/*!
This method is identical to qobject_cast<T>() except that it does not require lazy
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 31a7004407..5feea9daa8 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1751,6 +1751,16 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
addImportPath(QStringLiteral("qrc:/qt-project.org/imports"));
addImportPath(QCoreApplication::applicationDirPath());
+#if defined(Q_OS_ANDROID)
+ addImportPath(QStringLiteral("qrc:/android_rcc_bundle/qml"));
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_BUNDLED_LIBS_PATH"))) {
+ const QString envImportPath = qEnvironmentVariable("QT_BUNDLED_LIBS_PATH");
+ QLatin1Char pathSep(':');
+ QStringList paths = envImportPath.split(pathSep, QString::SkipEmptyParts);
+ for (int ii = paths.count() - 1; ii >= 0; --ii)
+ addPluginPath(paths.at(ii));
+ }
+#endif
}
QQmlImportDatabase::~QQmlImportDatabase()
@@ -1798,6 +1808,18 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
if (!resolvedPath.endsWith(Slash))
resolvedPath += Slash;
+#if defined(Q_OS_ANDROID)
+ if (qmldirPath.size() > 25 && qmldirPath.at(0) == QLatin1Char(':') && qmldirPath.at(1) == QLatin1Char('/') &&
+ qmldirPath.startsWith(QStringLiteral(":/android_rcc_bundle/qml/"), Qt::CaseInsensitive)) {
+ QString pluginName = qmldirPath.mid(21) + Slash + baseName;
+ auto bundledPath = resolvedPath + QLatin1String("lib") + pluginName.replace(QLatin1Char('/'), QLatin1Char('_'));
+ for (const QString &suffix : suffixes) {
+ const QString absolutePath = typeLoader->absoluteFilePath(bundledPath + suffix);
+ if (!absolutePath.isEmpty())
+ return absolutePath;
+ }
+ }
+#endif
resolvedPath += prefix + baseName;
for (const QString &suffix : suffixes) {
const QString absolutePath = typeLoader->absoluteFilePath(resolvedPath + suffix);
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 6322302422..2bfd2d5bb4 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlDebug(const QObject *object)
- \relates QQmlEngine
+ \relates QtQml
\since 5.9
Prints debug messages that include the file and line number for the
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlInfo(const QObject *object)
- \relates QQmlEngine
+ \relates QtQml
Prints informational messages that include the file and line number for the
specified QML \a object.
@@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlWarning(const QObject *object)
- \relates QQmlEngine
+ \relates QtQml
\since 5.9
Prints warning messages that include the file and line number for the
diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp
index 5dc0083f54..41a7778da3 100644
--- a/src/qml/qml/qqmlmetatypedata.cpp
+++ b/src/qml/qml/qqmlmetatypedata.cpp
@@ -69,6 +69,7 @@ void QQmlMetaTypeData::registerType(QQmlTypePrivate *priv)
if (!types.at(i).isValid()) {
types[i] = QQmlType(priv);
priv->index = i;
+ priv->release();
return;
}
}
diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h
index def4480198..94bf3cbdc3 100644
--- a/src/qml/qml/qqmlpropertycachecreator_p.h
+++ b/src/qml/qml/qqmlpropertycachecreator_p.h
@@ -152,9 +152,18 @@ inline QQmlJS::DiagnosticMessage QQmlPropertyCacheCreator<ObjectContainer>::buil
template <typename ObjectContainer>
inline QQmlJS::DiagnosticMessage QQmlPropertyCacheCreator<ObjectContainer>::buildMetaObjectRecursively(int objectIndex, const QQmlBindingInstantiationContext &context)
{
+ auto isAddressable = [](const QUrl &url) {
+ const QString fileName = url.fileName();
+ return !fileName.isEmpty() && fileName.front().isUpper();
+ };
+
const CompiledObject *obj = objectContainer->objectAt(objectIndex);
+ bool needVMEMetaObject = obj->propertyCount() != 0 || obj->aliasCount() != 0
+ || obj->signalCount() != 0 || obj->functionCount() != 0 || obj->enumCount() != 0
+ || (((obj->flags & QV4::CompiledData::Object::IsComponent)
+ || (objectIndex == 0 && isAddressable(objectContainer->url())))
+ && !objectContainer->resolvedType(obj->inheritedTypeNameIndex)->isFullyDynamicType);
- bool needVMEMetaObject = obj->propertyCount() != 0 || obj->aliasCount() != 0 || obj->signalCount() != 0 || obj->functionCount() != 0 || obj->enumCount() != 0;
if (!needVMEMetaObject) {
auto binding = obj->bindingsBegin();
auto end = obj->bindingsEnd();
diff --git a/src/qml/qml/qqmlscriptblob.cpp b/src/qml/qml/qqmlscriptblob.cpp
index 69b26894a8..6ac30d3ab5 100644
--- a/src/qml/qml/qqmlscriptblob.cpp
+++ b/src/qml/qml/qqmlscriptblob.cpp
@@ -177,7 +177,7 @@ void QQmlScriptBlob::done()
}
if (!m_isModule) {
- m_scriptData->typeNameCache = new QQmlTypeNameCache(m_importCache);
+ m_scriptData->typeNameCache.adopt(new QQmlTypeNameCache(m_importCache));
QSet<QString> ns;
@@ -195,7 +195,7 @@ void QQmlScriptBlob::done()
m_scriptData->typeNameCache->add(script.qualifier, scriptIndex, script.nameSpace);
}
- m_importCache.populateCache(m_scriptData->typeNameCache);
+ m_importCache.populateCache(m_scriptData->typeNameCache.data());
}
m_scripts.clear();
}
diff --git a/src/qml/qml/qqmlscriptdata.cpp b/src/qml/qml/qqmlscriptdata.cpp
index 0725f40d2a..ae268ca904 100644
--- a/src/qml/qml/qqmlscriptdata.cpp
+++ b/src/qml/qml/qqmlscriptdata.cpp
@@ -156,11 +156,7 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent
void QQmlScriptData::clear()
{
- if (typeNameCache) {
- typeNameCache->release();
- typeNameCache = nullptr;
- }
-
+ typeNameCache = nullptr;
scripts.clear();
// An addref() was made when the QQmlCleanup was added to the engine.
diff --git a/src/qml/qml/qqmlscriptdata_p.h b/src/qml/qml/qqmlscriptdata_p.h
index 273ba3691f..80b65b699c 100644
--- a/src/qml/qml/qqmlscriptdata_p.h
+++ b/src/qml/qml/qqmlscriptdata_p.h
@@ -82,7 +82,7 @@ private:
public:
QUrl url;
QString urlString;
- QQmlTypeNameCache *typeNameCache;
+ QQmlRefPointer<QQmlTypeNameCache> typeNameCache;
QVector<QQmlRefPointer<QQmlScriptBlob>> scripts;
QV4::ReturnedValue scriptValueForContext(QQmlContextData *parentCtxt);
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp
index 9a6bd73326..bbeaf7be9a 100644
--- a/src/qml/qml/qqmltypecompiler.cpp
+++ b/src/qml/qml/qqmltypecompiler.cpp
@@ -158,6 +158,9 @@ QQmlRefPointer<QV4::ExecutableCompilationUnit> QQmlTypeCompiler::compile()
QmlIR::QmlUnitGenerator qmlGenerator;
qmlGenerator.generate(*document, dependencyHasher);
+ if (!errors.isEmpty())
+ return nullptr;
+
QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit
= QV4::ExecutableCompilationUnit::create(std::move(
document->javaScriptCompilationUnit));
@@ -165,11 +168,7 @@ QQmlRefPointer<QV4::ExecutableCompilationUnit> QQmlTypeCompiler::compile()
compilationUnit->resolvedTypes = *resolvedTypes;
compilationUnit->propertyCaches = std::move(m_propertyCaches);
Q_ASSERT(compilationUnit->propertyCaches.count() == static_cast<int>(compilationUnit->objectCount()));
-
- if (errors.isEmpty())
- return compilationUnit;
- else
- return nullptr;
+ return compilationUnit;
}
void QQmlTypeCompiler::recordError(const QV4::CompiledData::Location &location, const QString &description)
diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp
index 8d75b57fc1..99fe069685 100644
--- a/src/qml/qml/qqmltypedata.cpp
+++ b/src/qml/qml/qqmltypedata.cpp
@@ -305,6 +305,7 @@ void QQmlTypeData::done()
QQmlJS::DiagnosticMessage error = buildTypeResolutionCaches(&typeNameCache, &resolvedTypeCache);
if (error.isValid()) {
setError(error);
+ qDeleteAll(resolvedTypeCache);
return;
}
}
@@ -614,6 +615,8 @@ void QQmlTypeData::compile(const QQmlRefPointer<QQmlTypeNameCache> &typeNameCach
QQmlTypeCompiler compiler(enginePrivate, this, m_document.data(), typeNameCache, resolvedTypeCache, dependencyHasher);
m_compiledData = compiler.compile();
if (!m_compiledData) {
+ qDeleteAll(*resolvedTypeCache);
+ resolvedTypeCache->clear();
setError(compiler.compilationErrors());
return;
}
@@ -678,7 +681,7 @@ void QQmlTypeData::resolveTypes()
if (ref.type.isCompositeSingleton()) {
ref.typeData = typeLoader()->getType(ref.type.sourceUrl());
- if (ref.typeData->status() == QQmlDataBlob::ResolvingDependencies) {
+ if (ref.typeData->status() == QQmlDataBlob::ResolvingDependencies || m_waitingOnMe.contains(ref.typeData.data())) {
// TODO: give an error message? If so, we should record and show the path of the cycle.
continue;
}
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 355150b786..d634a48443 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -229,8 +229,10 @@ OwnPropertyKeyIterator *QtObject::virtualOwnPropertyKeys(const Object *m, Value
}
/*!
-\qmlmethod bool Qt::isQtObject(object)
-Returns true if \c object is a valid reference to a Qt or QML object, otherwise false.
+ \qmlmethod bool Qt::isQtObject(object)
+
+ Returns \c true if \a object is a valid reference to a Qt or QML object,
+ \c false otherwise.
*/
ReturnedValue QtObject::method_isQtObject(const FunctionObject *, const Value *, const Value *argv, int argc)
{
@@ -241,10 +243,10 @@ ReturnedValue QtObject::method_isQtObject(const FunctionObject *, const Value *,
}
/*!
-\qmlmethod color Qt::rgba(real red, real green, real blue, real alpha)
+ \qmlmethod color Qt::rgba(real red, real green, real blue, real alpha)
-Returns a color with the specified \c red, \c green, \c blue and \c alpha components.
-All components should be in the range 0-1 inclusive.
+ Returns a color with the specified \a red, \a green, \a blue, and \a alpha
+ components. All components should be in the range 0-1 (inclusive).
*/
ReturnedValue QtObject::method_rgba(const FunctionObject *f, const Value *, const Value *argv, int argc)
{
@@ -270,10 +272,10 @@ ReturnedValue QtObject::method_rgba(const FunctionObject *f, const Value *, cons
}
/*!
-\qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha)
+ \qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha)
-Returns a color with the specified \c hue, \c saturation, \c lightness and \c alpha components.
-All components should be in the range 0-1 inclusive.
+ Returns a color with the specified \a hue, \a saturation, \a lightness, and \a alpha
+ components. All components should be in the range 0-1 (inclusive).
*/
ReturnedValue QtObject::method_hsla(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -300,12 +302,12 @@ ReturnedValue QtObject::method_hsla(const FunctionObject *b, const Value *, cons
}
/*!
-\qmlmethod color Qt::hsva(real hue, real saturation, real value, real alpha)
+ \since 5.5
+ \qmlmethod color Qt::hsva(real hue, real saturation, real value, real alpha)
-Returns a color with the specified \c hue, \c saturation, \c value and \c alpha components.
-All components should be in the range 0-1 inclusive.
+ Returns a color with the specified \a hue, \a saturation, \a value and \a alpha
+ components. All components should be in the range 0-1 (inclusive).
-\since 5.5
*/
ReturnedValue QtObject::method_hsva(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -328,12 +330,12 @@ ReturnedValue QtObject::method_hsva(const FunctionObject *b, const Value *, cons
}
/*!
-\qmlmethod color Qt::colorEqual(color lhs, string rhs)
+ \qmlmethod color Qt::colorEqual(color lhs, string rhs)
-Returns true if both \c lhs and \c rhs yield equal color values. Both arguments
-may be either color values or string values. If a string value is supplied it
-must be convertible to a color, as described for the \l{colorbasictypedocs}{color}
-basic type.
+ Returns \c true if both \a lhs and \a rhs yield equal color values. Both
+ arguments may be either color values or string values. If a string value
+ is supplied it must be convertible to a color, as described for the
+ \l{colorbasictypedocs}{color} basic type.
*/
ReturnedValue QtObject::method_colorEqual(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -368,11 +370,9 @@ ReturnedValue QtObject::method_colorEqual(const FunctionObject *b, const Value *
}
/*!
-\qmlmethod rect Qt::rect(int x, int y, int width, int height)
-
-Returns a \c rect with the top-left corner at \c x, \c y and the specified \c width and \c height.
+ \qmlmethod rect Qt::rect(int x, int y, int width, int height)
-The returned object has \c x, \c y, \c width and \c height attributes with the given values.
+ Returns a rect with the top-left corner at \a x, \a y and the specified \a width and \a height.
*/
ReturnedValue QtObject::method_rect(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -389,8 +389,9 @@ ReturnedValue QtObject::method_rect(const FunctionObject *b, const Value *, cons
}
/*!
-\qmlmethod point Qt::point(int x, int y)
-Returns a Point with the specified \c x and \c y coordinates.
+ \qmlmethod point Qt::point(int x, int y)
+
+ Returns a point with the specified \a x and \a y coordinates.
*/
ReturnedValue QtObject::method_point(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -405,8 +406,9 @@ ReturnedValue QtObject::method_point(const FunctionObject *b, const Value *, con
}
/*!
-\qmlmethod Qt::size(int width, int height)
-Returns a Size with the specified \c width and \c height.
+ \qmlmethod size Qt::size(int width, int height)
+
+ Returns a size with the specified \a width and \a height.
*/
ReturnedValue QtObject::method_size(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -421,12 +423,13 @@ ReturnedValue QtObject::method_size(const FunctionObject *b, const Value *, cons
}
/*!
-\qmlmethod Qt::font(object fontSpecifier)
-Returns a Font with the properties specified in the \c fontSpecifier object
-or the nearest matching font. The \c fontSpecifier object should contain
-key-value pairs where valid keys are the \l{fontbasictypedocs}{font} type's
-subproperty names, and the values are valid values for each subproperty.
-Invalid keys will be ignored.
+ \qmlmethod font Qt::font(object fontSpecifier)
+
+ Returns a font with the properties specified in the \a fontSpecifier object
+ or the nearest matching font. The \a fontSpecifier object should contain
+ key-value pairs where valid keys are the \l{fontbasictypedocs}{font} type's
+ subproperty names, and the values are valid values for each subproperty.
+ Invalid keys will be ignored.
*/
ReturnedValue QtObject::method_font(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -445,8 +448,9 @@ ReturnedValue QtObject::method_font(const FunctionObject *b, const Value *, cons
/*!
-\qmlmethod Qt::vector2d(real x, real y)
-Returns a Vector2D with the specified \c x and \c y.
+ \qmlmethod vector2d Qt::vector2d(real x, real y)
+
+ Returns a vector2d with the specified \a x and \a y values.
*/
ReturnedValue QtObject::method_vector2d(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -463,8 +467,9 @@ ReturnedValue QtObject::method_vector2d(const FunctionObject *b, const Value *,
}
/*!
-\qmlmethod Qt::vector3d(real x, real y, real z)
-Returns a Vector3D with the specified \c x, \c y and \c z.
+ \qmlmethod vector3d Qt::vector3d(real x, real y, real z)
+
+ Returns a vector3d with the specified \a x, \a y, and \a z values.
*/
ReturnedValue QtObject::method_vector3d(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -482,8 +487,9 @@ ReturnedValue QtObject::method_vector3d(const FunctionObject *b, const Value *,
}
/*!
-\qmlmethod Qt::vector4d(real x, real y, real z, real w)
-Returns a Vector4D with the specified \c x, \c y, \c z and \c w.
+ \qmlmethod vector4d Qt::vector4d(real x, real y, real z, real w)
+
+ Returns a vector4d with the specified \a x, \a y, \a z, and \a w values.
*/
ReturnedValue QtObject::method_vector4d(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -502,8 +508,9 @@ ReturnedValue QtObject::method_vector4d(const FunctionObject *b, const Value *,
}
/*!
-\qmlmethod Qt::quaternion(real scalar, real x, real y, real z)
-Returns a Quaternion with the specified \c scalar, \c x, \c y, and \c z.
+ \qmlmethod quaternion Qt::quaternion(real scalar, real x, real y, real z)
+
+ Returns a quaternion with the specified \a scalar, \a x, \a y, and \a z values.
*/
ReturnedValue QtObject::method_quaternion(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -522,13 +529,25 @@ ReturnedValue QtObject::method_quaternion(const FunctionObject *b, const Value *
}
/*!
-\qmlmethod Qt::matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)
-Returns a Matrix4x4 with the specified values.
-Alternatively, the function may be called with a single argument
-where that argument is a JavaScript array which contains the sixteen
-matrix values.
-Finally, the function may be called with no arguments and the resulting
-matrix will be the identity matrix.
+ \qmlmethod matrix4x4 Qt::matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)
+
+ Returns a matrix4x4 with the specified values.
+
+ The arguments correspond to their positions in the matrix:
+
+ \table
+ \row \li \a m11 \li \a m12 \li \a m13 \li \a m14
+ \row \li \a m21 \li \a m22 \li \a m23 \li \a m24
+ \row \li \a m31 \li \a m32 \li \a m33 \li \a m34
+ \row \li \a m41 \li \a m42 \li \a m43 \li \a m44
+ \endtable
+
+ Alternatively, the function may be called with a single argument
+ where that argument is a JavaScript array which contains the sixteen
+ matrix values.
+
+ Finally, the function may be called with no arguments and the resulting
+ matrix will be the identity matrix.
*/
ReturnedValue QtObject::method_matrix4x4(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -572,18 +591,19 @@ ReturnedValue QtObject::method_matrix4x4(const FunctionObject *b, const Value *,
}
/*!
-\qmlmethod color Qt::lighter(color baseColor, real factor)
-Returns a color lighter than \c baseColor by the \c factor provided.
+ \qmlmethod color Qt::lighter(color baseColor, real factor)
+
+ Returns a color lighter than \a baseColor by the \a factor provided.
-If the factor is greater than 1.0, this functions returns a lighter color.
-Setting factor to 1.5 returns a color that is 50% brighter. If the factor is less than 1.0,
-the return color is darker, but we recommend using the Qt.darker() function for this purpose.
-If the factor is 0 or negative, the return value is unspecified.
+ If the factor is greater than 1.0, this functions returns a lighter color.
+ Setting factor to 1.5 returns a color that is 50% brighter. If the factor is less than 1.0,
+ the return color is darker, but we recommend using the Qt.darker() function for this purpose.
+ If the factor is 0 or negative, the return value is unspecified.
-The function converts the current RGB color to HSV, multiplies the value (V) component
-by factor and converts the color back to RGB.
+ The function converts the current RGB color to HSV, multiplies the value (V) component
+ by factor and converts the color back to RGB.
-If \c factor is not supplied, returns a color 50% lighter than \c baseColor (factor 1.5).
+ If \a factor is not supplied, returns a color that is 50% lighter than \a baseColor (factor 1.5).
*/
ReturnedValue QtObject::method_lighter(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -610,19 +630,20 @@ ReturnedValue QtObject::method_lighter(const FunctionObject *b, const Value *, c
}
/*!
-\qmlmethod color Qt::darker(color baseColor, real factor)
-Returns a color darker than \c baseColor by the \c factor provided.
+ \qmlmethod color Qt::darker(color baseColor, real factor)
-If the factor is greater than 1.0, this function returns a darker color.
-Setting factor to 3.0 returns a color that has one-third the brightness.
-If the factor is less than 1.0, the return color is lighter, but we recommend using
-the Qt.lighter() function for this purpose. If the factor is 0 or negative, the return
-value is unspecified.
+ Returns a color darker than \a baseColor by the \a factor provided.
-The function converts the current RGB color to HSV, divides the value (V) component
-by factor and converts the color back to RGB.
+ If the factor is greater than 1.0, this function returns a darker color.
+ Setting factor to 3.0 returns a color that has one-third the brightness.
+ If the factor is less than 1.0, the return color is lighter, but we recommend using
+ the Qt.lighter() function for this purpose. If the factor is 0 or negative, the return
+ value is unspecified.
-If \c factor is not supplied, returns a color 50% darker than \c baseColor (factor 2.0).
+ The function converts the current RGB color to HSV, divides the value (V) component
+ by factor and converts the color back to RGB.
+
+ If \a factor is not supplied, returns a color that is 50% darker than \a baseColor (factor 2.0).
*/
ReturnedValue QtObject::method_darker(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -650,7 +671,8 @@ ReturnedValue QtObject::method_darker(const FunctionObject *b, const Value *, co
/*!
\qmlmethod color Qt::tint(color baseColor, color tintColor)
- This function allows tinting one color with another.
+
+ This function allows tinting one color (\a baseColor) with another (\a tintColor).
The tint color should usually be mostly transparent, or you will not be
able to see the underlying color. The below example provides a slight red
@@ -670,7 +692,8 @@ ReturnedValue QtObject::method_darker(const FunctionObject *b, const Value *, co
\endqml
\image declarative-rect_tint.png
- Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color.
+ Tint is most useful when a subtle change is intended to be conveyed due to some event;
+ you can then use tinting to more effectively tune the visible color.
*/
ReturnedValue QtObject::method_tint(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -708,8 +731,8 @@ ReturnedValue QtObject::method_tint(const FunctionObject *b, const Value *, cons
/*!
\qmlmethod string Qt::formatDate(datetime date, variant format)
-Returns a string representation of \c date, optionally formatted according
-to \c format.
+Returns a string representation of \a date, optionally formatted according
+to \a 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
@@ -752,8 +775,8 @@ ReturnedValue QtObject::method_formatDate(const FunctionObject *b, const Value *
/*!
\qmlmethod string Qt::formatTime(datetime time, variant format)
-Returns a string representation of \c time, optionally formatted according to
-\c format.
+Returns a string representation of \a time, optionally formatted according to
+\a format.
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
@@ -801,10 +824,10 @@ ReturnedValue QtObject::method_formatTime(const FunctionObject *b, const Value *
/*!
\qmlmethod string Qt::formatDateTime(datetime dateTime, variant format)
-Returns a string representation of \c datetime, optionally formatted according to
-\c format.
+Returns a string representation of \a dateTime, optionally formatted according to
+\a format.
-The \a date parameter may be a JavaScript \c Date object, a \l{date}{date}
+The \a dateTime parameter may be a JavaScript \c Date object, a \l{date}{date}
property, a QDate, QTime, or QDateTime value.
If \a format is not provided, \a dateTime is formatted using
@@ -921,8 +944,8 @@ ReturnedValue QtObject::method_formatDateTime(const FunctionObject *b, const Val
/*!
\qmlmethod bool Qt::openUrlExternally(url target)
- Attempts to open the specified \c target url in an external application, based on the user's
- desktop preferences. Returns true if it succeeds, and false otherwise.
+ Attempts to open the specified \a target url in an external application, based on the user's
+ desktop preferences. Returns \c true if it succeeds, \c false otherwise.
\warning A return value of \c true indicates that the application has successfully requested
the operating system to open the URL in an external application. The external application may
@@ -942,6 +965,7 @@ ReturnedValue QtObject::method_openUrlExternally(const FunctionObject *b, const
/*!
\qmlmethod url Qt::resolvedUrl(url url)
+
Returns \a url resolved relative to the URL of the caller.
*/
ReturnedValue QtObject::method_resolvedUrl(const FunctionObject *b, const Value *, const Value *argv, int argc)
@@ -967,6 +991,7 @@ ReturnedValue QtObject::method_resolvedUrl(const FunctionObject *b, const Value
/*!
\qmlmethod list<string> Qt::fontFamilies()
+
Returns a list of the font families available to the application.
*/
ReturnedValue QtObject::method_fontFamilies(const FunctionObject *b, const Value *, const Value *, int argc)
@@ -980,7 +1005,7 @@ ReturnedValue QtObject::method_fontFamilies(const FunctionObject *b, const Value
/*!
\qmlmethod string Qt::md5(data)
-Returns a hex string of the md5 hash of \c data.
+Returns a hex string of the md5 hash of \a data.
*/
ReturnedValue QtObject::method_md5(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -995,7 +1020,7 @@ ReturnedValue QtObject::method_md5(const FunctionObject *b, const Value *, const
/*!
\qmlmethod string Qt::btoa(data)
-Binary to ASCII - this function returns a base64 encoding of \c data.
+Binary to ASCII - this function returns a base64 encoding of \a data.
*/
ReturnedValue QtObject::method_btoa(const FunctionObject *b, const Value *, const Value *argv, int argc)
{
@@ -1043,9 +1068,9 @@ ReturnedValue QtObject::method_quit(const FunctionObject *b, const Value *, cons
This function causes the QQmlEngine::exit(int) signal to be emitted.
Within the \l {Prototyping with qmlscene}, this causes the launcher application to exit
- the specified return code. To exit from the event loop with a specified return code when this
- method is called, a C++ application can connect the QQmlEngine::exit(int) signal
- to the QCoreApplication::exit(int) slot.
+ the specified return code (\a retCode). To exit from the event loop with a specified
+ return code when this method is called, a C++ application can connect the
+ QQmlEngine::exit(int) signal to the QCoreApplication::exit(int) slot.
\sa quit()
*/
@@ -1318,13 +1343,13 @@ ReturnedValue QtObject::method_createComponent(const FunctionObject *b, const Va
\qmlmethod Qt::locale(name)
Returns a JS object representing the locale with the specified
- name, which has the format "language[_territory][.codeset][@modifier]"
+ \a name, which has the format "language[_territory][.codeset][@modifier]"
or "C", where:
\list
- \li language is a lowercase, two-letter, ISO 639 language code,
- \li territory is an uppercase, two-letter, ISO 3166 country code,
- \li and codeset and modifier are ignored.
+ \li \c language is a lowercase, two-letter, ISO 639 language code,
+ \li \c territory is an uppercase, two-letter, ISO 3166 country code, and
+ \li \c codeset and \c modifier are ignored.
\endlist
If the string violates the locale format, or language is not a
@@ -1372,7 +1397,8 @@ DEFINE_OBJECT_VTABLE(QQmlBindingFunction);
/*!
\qmlmethod Qt::binding(function)
- Returns a JavaScript object representing a \l{Property Binding}{property binding}.
+ Returns a JavaScript object representing a \l{Property Binding}{property binding},
+ with a \a function that evaluates the binding.
There are two main use-cases for the function: firstly, to apply a
property binding imperatively from JavaScript code:
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index 861243987f..9d305cd24c 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -382,10 +382,10 @@ QQmlBind::RestorationMode QQmlBind::restoreMode() const
void QQmlBind::setRestoreMode(RestorationMode newMode)
{
Q_D(QQmlBind);
+ d->restoreModeExplicit = true;
if (newMode != restoreMode()) {
d->restoreValue = (newMode & RestoreValue);
d->restoreBinding = (newMode & RestoreBinding);
- d->restoreModeExplicit = true;
emit restoreModeChanged();
}
}
diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp
index 3f78ca6b69..82f048d9d9 100644
--- a/src/qml/util/qqmlpropertymap.cpp
+++ b/src/qml/util/qqmlpropertymap.cpp
@@ -180,6 +180,10 @@ int QQmlPropertyMapMetaObject::createProperty(const char *name, const char *valu
\note When deriving a class from QQmlPropertyMap, use the
\l {QQmlPropertyMap::QQmlPropertyMap(DerivedType *derived, QObject *parent)} {protected two-argument constructor}
which ensures that the class is correctly registered with the Qt \l {Meta-Object System}.
+
+ \note The QMetaObject of a QQmlPropertyMap is dynamically generated and modified.
+ Operations on that meta object are not thread safe, so applications need to take
+ care to explicitly synchronize access to the meta object.
*/
/*!
diff --git a/src/qmlmodels/doc/qtqmlmodels.qdocconf b/src/qmlmodels/doc/qtqmlmodels.qdocconf
new file mode 100644
index 0000000000..a4153f4a53
--- /dev/null
+++ b/src/qmlmodels/doc/qtqmlmodels.qdocconf
@@ -0,0 +1,37 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtdeclarative.qdocconf)
+
+project = QtQmlModels
+description = Qt Qml Models Reference Documentation
+version = $QT_VERSION
+moduleheader = QtQmlModels
+qhp.projects = QtQmlModels
+
+qhp.QtQmlModels.file = qtqmlmodels.qhp
+qhp.QtQmlModels.namespace = org.qt-project.qtqmlmodels.$QT_VERSION_TAG
+qhp.QtQmlModels.virtualFolder = qtqmlmodels
+qhp.QtQmlModels.indexRoot =
+
+qhp.QtQmlModels.filterAttributes = qtqmlmodels $QT_VERSION qtrefdoc
+qhp.QtQmlModels.customFilters.Qt.name = QtQmlModels $QT_VERSION
+qhp.QtQmlModels.customFilters.Qt.filterAttributes = qtqmlmodels $QT_VERSION
+
+qhp.QtQmlModels.title = QML Types
+qhp.QtQmlModels.indexTitle = Qt QML Models QML Types
+qhp.QtQmlModels.selectors = qmlclass
+qhp.QtQmlModels.sortPages = true
+
+tagfile = qtqmlmodels.tags
+
+depends += qtcore qtqml qtdoc
+
+headerdirs += ..
+
+sourcedirs += .. \
+ ../../imports/models
+
+exampledirs += ../../../examples/qml \
+ ../ \
+ snippets
+
+navigation.qmltypespage = "Qt Qml Models QML Types"
diff --git a/src/qml/doc/snippets/delegatemodel/delegatemodel.qml b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml
index 1a7baa6b1e..1a7baa6b1e 100644
--- a/src/qml/doc/snippets/delegatemodel/delegatemodel.qml
+++ b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml
diff --git a/src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp
index a56eb69616..a56eb69616 100644
--- a/src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp
+++ b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/main.cpp
diff --git a/src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml
index 2e17eed8f0..2e17eed8f0 100644
--- a/src/qml/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml
+++ b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel_rootindex/view.qml
diff --git a/src/qml/doc/snippets/delegatemodel/delegatemodelgroup.qml b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodelgroup.qml
index 8562deeeda..8562deeeda 100644
--- a/src/qml/doc/snippets/delegatemodel/delegatemodelgroup.qml
+++ b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodelgroup.qml
diff --git a/src/qml/doc/snippets/package/Delegate.qml b/src/qmlmodels/doc/snippets/package/Delegate.qml
index 7c73f35c3d..7c73f35c3d 100644
--- a/src/qml/doc/snippets/package/Delegate.qml
+++ b/src/qmlmodels/doc/snippets/package/Delegate.qml
diff --git a/src/qml/doc/snippets/package/view.qml b/src/qmlmodels/doc/snippets/package/view.qml
index 311cc3be8e..311cc3be8e 100644
--- a/src/qml/doc/snippets/package/view.qml
+++ b/src/qmlmodels/doc/snippets/package/view.qml
diff --git a/src/qml/doc/snippets/qml/listmodel/listelements.qml b/src/qmlmodels/doc/snippets/qml/listmodel/listelements.qml
index 12146c1420..12146c1420 100644
--- a/src/qml/doc/snippets/qml/listmodel/listelements.qml
+++ b/src/qmlmodels/doc/snippets/qml/listmodel/listelements.qml
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-modify.qml
index f293eff8ec..f293eff8ec 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml
+++ b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-modify.qml
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-nested.qml
index 8c193d6a5e..8c193d6a5e 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml
+++ b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-nested.qml
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-simple.qml
index d07f868476..d07f868476 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml
+++ b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel-simple.qml
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel.qml b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel.qml
index c2a69d6e8f..c2a69d6e8f 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel.qml
+++ b/src/qmlmodels/doc/snippets/qml/listmodel/listmodel.qml
diff --git a/src/qml/doc/snippets/qml/tablemodel/fruit-example-complex.qml b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml
index 104a2209d7..104a2209d7 100644
--- a/src/qml/doc/snippets/qml/tablemodel/fruit-example-complex.qml
+++ b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml
diff --git a/src/qml/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml
index d3f6176c70..d3f6176c70 100644
--- a/src/qml/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml
+++ b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-delegatechooser.qml
diff --git a/src/qml/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml
index f51c1818c3..f51c1818c3 100644
--- a/src/qml/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml
+++ b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-simpledelegate.qml
diff --git a/src/qmlmodels/qmlmodels.pro b/src/qmlmodels/qmlmodels.pro
index 7d1d9bdf67..1d733f5bdb 100644
--- a/src/qmlmodels/qmlmodels.pro
+++ b/src/qmlmodels/qmlmodels.pro
@@ -1,6 +1,8 @@
TARGET = QtQmlModels
QT = core-private qml-private
+QMAKE_DOCS = $$PWD/doc/qtqmlmodels.qdocconf
+
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH
HEADERS += \
diff --git a/src/qmlmodels/qqmldelegatecomponent.cpp b/src/qmlmodels/qqmldelegatecomponent.cpp
index ccb0d60053..cc3b38ec93 100644
--- a/src/qmlmodels/qqmldelegatecomponent.cpp
+++ b/src/qmlmodels/qqmldelegatecomponent.cpp
@@ -59,19 +59,6 @@ QVariant QQmlAbstractDelegateComponent::value(QQmlAdaptorModel *adaptorModel, in
}
/*!
- \qmlmodule Qt.labs.qmlmodels 1.0
- \title Qt Labs QML Models - QML Types
- \ingroup qmlmodules
- \brief The Qt Labs QML Models module provides various model-related types for use with views.
-
- To use this module, import the module with the following line:
-
- \qml
- import Qt.labs.qmlmodels 1.0
- \endqml
-*/
-
-/*!
\qmltype DelegateChoice
\instantiates QQmlDelegateChoice
\inqmlmodule Qt.labs.qmlmodels
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 55bf2ad783..691b4b3c29 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -539,10 +539,10 @@ void QQmlDelegateModel::setRootIndex(const QVariant &root)
\qmlmethod QModelIndex QtQml.Models::DelegateModel::modelIndex(int index)
QAbstractItemModel provides a hierarchical tree of data, whereas
- QML only operates on list data. This function assists in using
+ QML only operates on list data. This function assists in using
tree models in QML.
- Returns a QModelIndex for the specified index.
+ Returns a QModelIndex for the specified \a index.
This value can be assigned to rootIndex.
\sa rootIndex
diff --git a/src/qmlmodels/qqmlinstantiator.cpp b/src/qmlmodels/qqmlinstantiator.cpp
index af1b526e1d..f9d5762f6e 100644
--- a/src/qmlmodels/qqmlinstantiator.cpp
+++ b/src/qmlmodels/qqmlinstantiator.cpp
@@ -220,7 +220,8 @@ void QQmlInstantiatorPrivate::makeModel()
/*!
\qmltype Instantiator
\instantiates QQmlInstantiator
- \inqmlmodule QtQml
+ \inqmlmodule QtQml.Models
+ \ingroup qtquick-models
\brief Dynamically creates objects.
A Instantiator can be used to control the dynamic creation of objects, or to dynamically
@@ -231,6 +232,8 @@ void QQmlInstantiatorPrivate::makeModel()
can also be destroyed dynamically through other means, and the Instantiator will not recreate
them unless the properties of the Instantiator change.
+ \note Instantiator is part of QtQml.Models since version 2.14 and part of QtQml since
+ version 2.1. Importing Instantiator via QtQml is deprecated since Qt 5.14.
*/
QQmlInstantiator::QQmlInstantiator(QObject *parent)
: QObject(*(new QQmlInstantiatorPrivate), parent)
diff --git a/src/qmlmodels/qqmlitemmodels.qdoc b/src/qmlmodels/qqmlitemmodels.qdoc
index f6e1b0b1b9..2e12dbf656 100644
--- a/src/qmlmodels/qqmlitemmodels.qdoc
+++ b/src/qmlmodels/qqmlitemmodels.qdoc
@@ -62,7 +62,7 @@
\section1 QModelIndexList Type
- \l QModelIndexList is exposed in QML as a JavaScript array. Conversions are
+ QModelIndexList is exposed in QML as a JavaScript array. Conversions are
automatically made from and to C++. In fact, any JavaScript array can be
converted back to QModelIndexList, with non-QModelIndex objects replaced by
invalid \l{QModelIndex}es.
diff --git a/src/qmlmodels/qqmlobjectmodel.cpp b/src/qmlmodels/qqmlobjectmodel.cpp
index b6330b4295..7409178616 100644
--- a/src/qmlmodels/qqmlobjectmodel.cpp
+++ b/src/qmlmodels/qqmlobjectmodel.cpp
@@ -328,7 +328,7 @@ QObject *QQmlObjectModel::get(int index) const
\qmlmethod QtQml.Models::ObjectModel::append(object item)
\since 5.6
- Appends a new item to the end of the model.
+ Appends a new \a item to the end of the model.
\code
objectModel.append(objectComponent.createObject())
@@ -346,7 +346,7 @@ void QQmlObjectModel::append(QObject *object)
\qmlmethod QtQml.Models::ObjectModel::insert(int index, object item)
\since 5.6
- Inserts a new item to the model at position \a index.
+ Inserts a new \a item to the model at position \a index.
\code
objectModel.insert(2, objectComponent.createObject())
@@ -371,7 +371,7 @@ void QQmlObjectModel::insert(int index, QObject *object)
\qmlmethod QtQml.Models::ObjectModel::move(int from, int to, int n = 1)
\since 5.6
- Moves \a n items \a from one position \a to another.
+ Moves \e n items \a from one position \a to another.
The from and to ranges must exist; for example, to move the first 3 items
to the end of the model:
@@ -398,7 +398,7 @@ void QQmlObjectModel::move(int from, int to, int n)
\qmlmethod QtQml.Models::ObjectModel::remove(int index, int n = 1)
\since 5.6
- Removes the items at \a index from the model.
+ Removes \e n items at \a index from the model.
\sa clear()
*/
diff --git a/src/qmlmodels/qqmltablemodel.cpp b/src/qmlmodels/qqmltablemodel.cpp
index 4a96e7a46b..f190ad86b1 100644
--- a/src/qmlmodels/qqmltablemodel.cpp
+++ b/src/qmlmodels/qqmltablemodel.cpp
@@ -64,7 +64,7 @@ Q_LOGGING_CATEGORY(lcTableModel, "qt.qml.tablemodel")
The model's initial row data is set with either the \l rows property or by
calling \l appendRow(). Each column in the model is specified by declaring
a \l TableModelColumn instance, where the order of each instance determines
- its column index. Once the model's \l Component.completed() signal has been
+ its column index. Once the model's \l Component::completed() signal has been
emitted, the columns and roles will have been established and are then
fixed for the lifetime of the model.
diff --git a/src/qmlmodels/qquickpackage.cpp b/src/qmlmodels/qquickpackage.cpp
index 03539d8737..567381e5ab 100644
--- a/src/qmlmodels/qquickpackage.cpp
+++ b/src/qmlmodels/qquickpackage.cpp
@@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Package
\instantiates QQuickPackage
- \inqmlmodule QtQuick
- \ingroup qtquick-views
+ \inqmlmodule QtQml.Models
+ \ingroup qtquick-models
\brief Specifies a collection of named items.
The Package type is used in conjunction with
@@ -71,6 +71,9 @@ QT_BEGIN_NAMESPACE
\snippet package/view.qml 0
+ \note Package is part of QtQml.Models since version 2.14 and part of QtQuick since version 2.0.
+ Importing Package via QtQuick is deprecated since Qt 5.14.
+
\sa {Qt Quick Examples - Views}, {Qt Quick Demo - Photo Viewer}, {Qt QML}
*/
diff --git a/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf
new file mode 100644
index 0000000000..bb883cf39f
--- /dev/null
+++ b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf
@@ -0,0 +1,37 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtdeclarative.qdocconf)
+
+project = QtQmlWorkerScript
+description = Qt Qml WorkerScript Reference Documentation
+version = $QT_VERSION
+moduleheader = QtQmlWorkerScript
+qhp.projects = QtQmlWorkerScript
+
+qhp.QtQmlWorkerScript.file = qtqmlworkerscript.qhp
+qhp.QtQmlWorkerScript.namespace = org.qt-project.qtqmlworkerscript.$QT_VERSION_TAG
+qhp.QtQmlWorkerScript.virtualFolder = qtqmlworkerscript
+qhp.QtQmlWorkerScript.indexRoot =
+
+qhp.QtQmlWorkerScript.filterAttributes = qtqmlworkerscript $QT_VERSION qtrefdoc
+qhp.QtQmlWorkerScript.customFilters.Qt.name = QtQmlWorkerScript $QT_VERSION
+qhp.QtQmlWorkerScript.customFilters.Qt.filterAttributes = qtqmlworkerscript $QT_VERSION
+
+qhp.QtQmlWorkerScript.title = QML Types
+qhp.QtQmlWorkerScript.indexTitle = Qt QML WorkerScript QML Types
+qhp.QtQmlWorkerScript.selectors = qmlclass
+qhp.QtQmlWorkerScript.sortPages = true
+
+tagfile = qtqmlworkerscript.tags
+
+depends += qtcore qtqml qtdoc
+
+headerdirs += ..
+
+sourcedirs += .. \
+ ../../imports/workerscript
+
+exampledirs += ../../../examples/qml \
+ ../ \
+ snippets
+
+navigation.qmltypespage = "Qt Qml WorkerScript QML Types"
diff --git a/src/qmlworkerscript/qmlworkerscript.pro b/src/qmlworkerscript/qmlworkerscript.pro
index 908caa4ed4..9f5e0e809a 100644
--- a/src/qmlworkerscript/qmlworkerscript.pro
+++ b/src/qmlworkerscript/qmlworkerscript.pro
@@ -1,6 +1,8 @@
TARGET = QtQmlWorkerScript
QT = core-private qml-private
+QMAKE_DOCS = $$PWD/doc/qtqmlworkerscript.qdocconf
+
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH
HEADERS += \
diff --git a/src/qmlworkerscript/qquickworkerscript.cpp b/src/qmlworkerscript/qquickworkerscript.cpp
index 4da1def5f5..8b236697b9 100644
--- a/src/qmlworkerscript/qquickworkerscript.cpp
+++ b/src/qmlworkerscript/qquickworkerscript.cpp
@@ -374,7 +374,7 @@ QQuickWorkerScriptEngine::~QQuickWorkerScriptEngine()
yieldCurrentThread();
}
- d->deleteLater();
+ delete d;
}
WorkerScript::WorkerScript(int id, QQuickWorkerScriptEnginePrivate *parent)
@@ -441,7 +441,7 @@ void QQuickWorkerScriptEngine::run()
\qmltype WorkerScript
\instantiates QQuickWorkerScript
\ingroup qtquick-threading
- \inqmlmodule QtQml
+ \inqmlmodule QtQml.WorkerScript
\brief Enables the use of threads in a Qt Quick application.
Use WorkerScript to run operations in a new thread.
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 13746b13de..6a4300c1bd 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -41,9 +41,11 @@ tagfile = ../../../doc/qtquick/qtquick.tags
depends += qtcore qtqml qtqmltest qtgui qtlinguist qtquickcontrols1 qtquickcontrols qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns
headerdirs += ..\
+ ../../quick \
../../quickwidgets
sourcedirs += .. \
+ ../../quick \
../../quickwidgets
exampledirs += ../../../examples/quick \
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index e4d837112f..7695bb57db 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -227,7 +227,7 @@ access to the data from QML:
The QSqlQueryModel class is good enough to implement a custom read-only
model that represents data in an SQL database. The
-\l{Qt Quick Controls 2 - Chat Tutorial}{chat tutorial} example
+\l{Qt Quick Controls - Chat Tutorial}{chat tutorial} example
demonstrates this very well by implementing a custom model to fetch the
contact details from an SQLite database.
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index 864d90274c..e09c430e43 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -1016,6 +1016,14 @@ with multiple windows.
\li Where applicable (Vulkan, Direct3D), enables the graphics API implementation's debug
and/or validation layers, if available.
+ \row
+ \li \c QSG_RHI_PREFER_SOFTWARE_RENDERER
+ \li \c 1
+ \li Requests choosing an adapter or physical device that uses software-based
+ rasterization. Applicable only when the underlying API has support for
+ enumerating adapters (for example, Direct3D or Vulkan), and is ignored
+ otherwise.
+
\endtable
Applications wishing to always run with a single given graphics API, can
@@ -1031,4 +1039,9 @@ with multiple windows.
equivalent in effect to running with both \c QSG_RHI and \c QSG_RHI_BACKEND
set.
+ All QRhi backends will choose the system default GPU adapter or physical
+ device, unless overridden by \c{QSG_RHI_PREFER_SOFTWARE_RENDERER} or a
+ backend-specific variable, such as, \c{QT_D3D_ADAPTER_INDEX} or
+ \c{QT_VK_PHYSICAL_DEVICE_INDEX}. No further adapter configurability is
+ provided at this time.
*/
diff --git a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
index dd7f21e81a..f4a1616943 100644
--- a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
+++ b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
@@ -45,9 +45,9 @@ UI. It is recommended to browse this list of UI controls before creating your
own custom UI control.
Besides these basic UI controls offered by Qt Quick itself, a rich set of UI
-controls are also available with Qt Quick Controls 2. They cater to the most
+controls are also available with Qt Quick Controls. They cater to the most
common use cases without any change, and offer a lot more possibilities with their
-customization options. In particular, Qt Quick Controls 2 provides styling
+customization options. In particular, Qt Quick Controls provides styling
options that align with the latest UI design trends. If these UI controls do not
satisfy your application's needs, only then it is recommended to create a
custom control.
@@ -55,7 +55,7 @@ custom control.
\section2 Related Information
\list
-\li \l{Qt Quick Controls 2}
+\li \l{Qt Quick Controls}
\li \l{Qt Quick}
\endlist
@@ -323,7 +323,7 @@ see \l {Choosing the Correct Integration Method Between C++ and QML}.
\section2 Related Information
\list
\li \l{Integrating QML and C++}
-\li \l{Qt Quick Controls 2 - Chat Tutorial}{Chat application tutorial}
+\li \l{Qt Quick Controls - Chat Tutorial}{Chat application tutorial}
\endlist
\section1 Using Qt Quick Layouts
@@ -426,7 +426,7 @@ developers to follow these tips:
\li Use anchors or the Qt Quick Layouts module to lay out the visual items.
\li Do not specify explicit width and height for a visual item.
\li Provide UI resources such as images and icons for each display resolution
- that your application supports. The Qt Quick Controls 2 gallery example
+ that your application supports. The Qt Quick Controls gallery example
demonstrates this well by providing the \c qt-logo.png for \c @2x, \c @3x,
and \c @4x resolutions, enabling the application to cater to high
resolution displays. Qt automatically chooses the appropriate
@@ -437,7 +437,7 @@ developers to follow these tips:
versions of an image, as is necessary with bitmap images.
\li Use font-based icons, such as Font Awesome. These scale to any display
resolution, and also allow colorization. The
- Qt Quick Controls 2 Text Editor example demonstrates this well.
+ Qt Quick Controls Text Editor example demonstrates this well.
\endlist
With this in place, your application's UI should scale depending
@@ -448,8 +448,8 @@ on the display resolution on offer.
\section2 Related Information
\list
- \li \l{Qt Quick Controls 2 - Gallery}{Gallery example}
- \li \l{Qt Quick Controls 2 - Text Editor}{Text Editor example}
+ \li \l{Qt Quick Controls - Gallery}{Gallery example}
+ \li \l{Qt Quick Controls - Text Editor}{Text Editor example}
\li \l{Font Awesome}
\li \l{Scalability}
\li \l{High DPI Displays}
diff --git a/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc
index 0669ec06c8..84741efa61 100644
--- a/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc
+++ b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc
@@ -39,15 +39,15 @@ information about them.
The Qt Quick Designer enables designing Qt Quick-based UIs using simple
drag-n-drop gestures that most designers are familiar with. It offers UI
-elements from the Qt Quick and Qt Quick Controls 2 modules, as well as
+elements from the Qt Quick and Qt Quick Controls modules, as well as
integration for custom UI elements.
The following is a list of example applications that use UIs created by
the Qt Quick Designer:
\list
- \li \l{Qt Quick Controls 2 - Contact List}
- \li \l{Qt Quick Controls 2 - Flat Style}
+ \li \l{Qt Quick Controls - Contact List}
+ \li \l{Qt Quick Controls - Flat Style}
\endlist
\section2 QML Debugger and Profiler
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index 7f72217279..4b843f366b 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -43,7 +43,7 @@ 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 A set of Qt Quick-based UI controls is also available to create user
-interfaces. See \l{Qt Quick Controls 2} for more information.
+interfaces. See \l{Qt Quick Controls} for more information.
For those new to QML and Qt Quick, please see
\l{QML Applications}
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp
index d7566f0cd8..79cb288af8 100644
--- a/src/quick/handlers/qquickhoverhandler.cpp
+++ b/src/quick/handlers/qquickhoverhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -47,14 +47,24 @@ Q_LOGGING_CATEGORY(lcHoverHandler, "qt.quick.handler.hover")
/*!
\qmltype HoverHandler
\instantiates QQuickHoverHandler
+ \inherits SinglePointHandler
\inqmlmodule QtQuick
\ingroup qtquick-input-handlers
\brief Handler for mouse and tablet hover.
- HoverHandler detects a hovering cursor. Since touchscreens don't generally
- offer hover events, in practice it detects a hovering mouse or tablet stylus.
+ HoverHandler detects a hovering mouse or tablet stylus cursor.
- \sa MouseArea
+ A binding to the \l hovered property is the easiest way to react when the
+ cursor enters or leaves the \l {PointerHandler::parent}{parent} Item.
+ The \l {SinglePointHandler::point}{point} property provides more detail,
+ including the cursor position. The
+ \l {PointerDeviceHandler::acceptedDevices}{acceptedDevices},
+ \l {PointerDeviceHandler::acceptedPointerTypes}{acceptedPointerTypes},
+ and \l {PointerDeviceHandler::acceptedModifiers}{acceptedModifiers}
+ properties can be used to narrow the behavior to detect hovering of
+ specific kinds of devices or while holding a modifier key.
+
+ \sa MouseArea, PointHandler
*/
QQuickHoverHandler::QQuickHoverHandler(QQuickItem *parent)
@@ -62,9 +72,6 @@ QQuickHoverHandler::QQuickHoverHandler(QQuickItem *parent)
{
// Tell QQuickPointerDeviceHandler::wantsPointerEvent() to ignore button state
d_func()->acceptedButtons = Qt::NoButton;
- // Rule out the touchscreen for now (can be overridden in QML in case a hover-detecting touchscreen exists)
- setAcceptedDevices(static_cast<QQuickPointerDevice::DeviceType>(
- static_cast<int>(QQuickPointerDevice::AllDevices) ^ static_cast<int>(QQuickPointerDevice::TouchScreen)));
}
QQuickHoverHandler::~QQuickHoverHandler()
@@ -93,10 +100,22 @@ bool QQuickHoverHandler::wantsPointerEvent(QQuickPointerEvent *event)
void QQuickHoverHandler::handleEventPoint(QQuickEventPoint *point)
{
- setHovered(true);
+ bool hovered = true;
+ if (point->state() == QQuickEventPoint::Released &&
+ point->pointerEvent()->device()->pointerType() == QQuickPointerDevice::Finger)
+ hovered = false;
+ setHovered(hovered);
setPassiveGrab(point);
}
+/*!
+ \qmlproperty bool QtQuick::HoverHandler::hovered
+ \readonly
+
+ Holds true whenever any pointing device cursor (mouse or tablet) is within
+ the bounds of the \c parent Item, extended by the
+ \l {PointerHandler::margin}{margin}, if any.
+*/
void QQuickHoverHandler::setHovered(bool hovered)
{
if (m_hovered != hovered) {
diff --git a/src/quick/handlers/qquickpointerdevicehandler.cpp b/src/quick/handlers/qquickpointerdevicehandler.cpp
index 449d726b78..90f31bf9fd 100644
--- a/src/quick/handlers/qquickpointerdevicehandler.cpp
+++ b/src/quick/handlers/qquickpointerdevicehandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -230,6 +230,55 @@ void QQuickPointerDeviceHandler::setAcceptedPointerTypes(QQuickPointerDevice::Po
}
}
\endqml
+
+ If you set \c acceptedModifiers to an OR combination of modifier keys,
+ it means \e all of those modifiers must be pressed to activate the handler:
+
+ \qml
+ Item {
+ TapHandler {
+ acceptedModifiers: Qt.ControlModifier | Qt.AltModifier | Qt.ShiftModifier
+ onTapped: console.log("control-alt-shift-tapped")
+ }
+ }
+ \endqml
+
+ The available modifiers are as follows:
+
+ \value NoModifier No modifier key is allowed.
+ \value ShiftModifier A Shift key on the keyboard must be pressed.
+ \value ControlModifier A Ctrl key on the keyboard must be pressed.
+ \value AltModifier An Alt key on the keyboard must be pressed.
+ \value MetaModifier A Meta key on the keyboard must be pressed.
+ \value KeypadModifier A keypad button must be pressed.
+ \value GroupSwitchModifier X11 only (unless activated on Windows by a command line argument).
+ A Mode_switch key on the keyboard must be pressed.
+ \value KeyboardModifierMask The handler does not care which modifiers are pressed.
+
+ If you need even more complex behavior than can be achieved with
+ combinations of multiple handlers with multiple modifier flags, you can
+ check the modifiers in JavaScript code:
+
+ \qml
+ Item {
+ TapHandler {
+ onTapped:
+ switch (point.modifiers) {
+ case Qt.ControlModifier | Qt.AltModifier:
+ console.log("CTRL+ALT");
+ break;
+ case Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier:
+ console.log("CTRL+META+ALT");
+ break;
+ default:
+ console.log("other modifiers", point.modifiers);
+ break;
+ }
+ }
+ }
+ \endqml
+
+ \sa Qt::KeyboardModifier
*/
void QQuickPointerDeviceHandler::setAcceptedModifiers(Qt::KeyboardModifiers acceptedModifiers)
{
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 5f9d2151d7..272ebe6b63 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -379,7 +379,7 @@ void QQuickTapHandler::updateTimeHeld()
That is, if you press and release a touchpoint or button within a time
period less than \l longPressThreshold, while any movement does not exceed
the drag threshold, then the \c tapped signal will be emitted at the time
- of release. The \c eventPoint signal parameter contains information
+ of release. The \a eventPoint signal parameter contains information
from the release event about the point that was tapped:
\snippet pointerHandlers/tapHandlerOnTapped.qml 0
@@ -392,7 +392,7 @@ void QQuickTapHandler::updateTimeHeld()
This signal is emitted when the \c parent Item is tapped once.
After an amount of time greater than QStyleHints::mouseDoubleClickInterval,
it can be tapped again; but if the time until the next tap is less,
- \l tapCount will increase. The \c eventPoint signal parameter contains
+ \l tapCount will increase. The \a eventPoint signal parameter contains
information from the release event about the point that was tapped.
*/
@@ -404,13 +404,13 @@ void QQuickTapHandler::updateTimeHeld()
short span of time (QStyleHints::mouseDoubleClickInterval()) and distance
(QStyleHints::mouseDoubleClickDistance() or
QStyleHints::touchDoubleTapDistance()). This signal always occurs after
- \l singleTapped, \l tapped, and \l tapCountChanged. The \c eventPoint
+ \l singleTapped, \l tapped, and \l tapCountChanged. The \a eventPoint
signal parameter contains information from the release event about the
point that was tapped.
*/
/*!
- \qmlsignal QtQuick::TapHandler::longPressed
+ \qmlsignal QtQuick::TapHandler::longPressed()
This signal is emitted when the \c parent Item is pressed and held for a
time period greater than \l longPressThreshold. That is, if you press and
@@ -420,7 +420,7 @@ void QQuickTapHandler::updateTimeHeld()
*/
/*!
- \qmlsignal QtQuick::TapHandler::tapCountChanged
+ \qmlsignal QtQuick::TapHandler::tapCountChanged()
This signal is emitted when the \c parent Item is tapped once or more (within
a specified time and distance span) and when the present \c tapCount differs
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index ac4e86d8da..b8e6d58af4 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -848,13 +848,15 @@ QSGTextureProvider *QQuickCanvasItem::textureProvider() const
The \a contextId parameter names the required context. The Canvas item
will return a context that implements the required drawing mode. After the
first call to getContext, any subsequent call to getContext with the same
- contextId will return the same context object.
+ contextId will return the same context object. Any additional arguments
+ (\a args) are currently ignored.
If the context type is not supported or the canvas has previously been
requested to provide a different and incompatible context type, \c null
will be returned.
Canvas only supports a 2d context.
+
*/
void QQuickCanvasItem::getContext(QQmlV4Function *args)
@@ -897,7 +899,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
/*!
\qmlmethod int QtQuick::Canvas::requestAnimationFrame(callback)
- This function schedules callback to be invoked before composing the Qt Quick
+ This function schedules \a callback to be invoked before composing the Qt Quick
scene.
*/
@@ -960,7 +962,7 @@ void QQuickCanvasItem::requestPaint()
/*!
\qmlmethod QtQuick::Canvas::markDirty(rect area)
- Mark the given \a area as dirty, so that when this area is visible the
+ Marks the given \a area as dirty, so that when this area is visible the
canvas renderer will redraw it. This will trigger the \c paint signal.
\sa paint, requestPaint()
@@ -984,16 +986,16 @@ void QQuickCanvasItem::checkAnimationCallbacks()
}
/*!
- \qmlmethod bool QtQuick::Canvas::save(string filename)
+ \qmlmethod bool QtQuick::Canvas::save(string filename)
- Save the current canvas content into an image file \a filename.
- The saved image format is automatically decided by the \a filename's
- suffix.
+ Saves the current canvas content into an image file \a filename.
+ The saved image format is automatically decided by the \a filename's
+ suffix. Returns \c true on success.
- Note: calling this method will force painting the whole canvas, not just the
- current canvas visible window.
+ \note Calling this method will force painting the whole canvas, not just the
+ current canvas visible window.
- \sa canvasWindow, canvasSize, toDataURL()
+ \sa canvasWindow, canvasSize, toDataURL()
*/
bool QQuickCanvasItem::save(const QString &filename) const
{
@@ -1023,15 +1025,17 @@ QQmlRefPointer<QQuickCanvasPixmap> QQuickCanvasItem::loadedPixmap(const QUrl& ur
*/
/*!
- \qmlmethod QtQuick::Canvas::loadImage(url image)
- Loads the given \c image asynchronously.
+ \qmlmethod QtQuick::Canvas::loadImage(url image)
+
+ Loads the given \a image asynchronously.
- When the image is ready, \l imageLoaded will be emitted.
- The loaded image can be unloaded by the unloadImage() method.
+ Once the image is ready, imageLoaded() signal will be emitted.
+ The loaded image can be unloaded with the unloadImage() method.
- Note: Only loaded images can be painted on the Canvas item.
- \sa unloadImage, imageLoaded, isImageLoaded(),
- Context2D::createImageData(), Context2D::drawImage()
+ \note Only loaded images can be painted on the Canvas item.
+
+ \sa unloadImage(), imageLoaded(), isImageLoaded(),
+ Context2D::createImageData(), Context2D::drawImage()
*/
void QQuickCanvasItem::loadImage(const QUrl& url)
{
@@ -1051,14 +1055,15 @@ void QQuickCanvasItem::loadImage(const QUrl& url)
}
}
/*!
- \qmlmethod QtQuick::Canvas::unloadImage(url image)
- Unloads the \c image.
+ \qmlmethod QtQuick::Canvas::unloadImage(url image)
+
+ Unloads the \a image.
- Once an image is unloaded it cannot be painted by the canvas context
- unless it is loaded again.
+ Once an image is unloaded, it cannot be painted by the canvas context
+ unless it is loaded again.
- \sa loadImage(), imageLoaded, isImageLoaded(),
- Context2D::createImageData(), Context2D::drawImage
+ \sa loadImage(), imageLoaded(), isImageLoaded(),
+ Context2D::createImageData(), Context2D::drawImage
*/
void QQuickCanvasItem::unloadImage(const QUrl& url)
{
@@ -1067,10 +1072,11 @@ void QQuickCanvasItem::unloadImage(const QUrl& url)
}
/*!
- \qmlmethod QtQuick::Canvas::isImageError(url image)
- Returns true if the \a image failed to load.
+ \qmlmethod QtQuick::Canvas::isImageError(url image)
- \sa loadImage()
+ Returns \c true if the \a image failed to load, \c false otherwise.
+
+ \sa loadImage()
*/
bool QQuickCanvasItem::isImageError(const QUrl& url) const
{
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 48e5a4d4a2..54cda72a36 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -1148,6 +1148,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(const QV4::FunctionO
/*!
\qmlmethod object QtQuick::Context2D::setTransform(real a, real b, real c, real d, real e, real f)
+
Changes the transformation matrix to the matrix given by the arguments as described below.
Modifying the transformation matrix directly enables you to perform scaling,
@@ -1160,21 +1161,22 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(const QV4::FunctionO
\image qml-item-canvas-math.png
where:
\list
- \li \c{a} is the scale factor in the horizontal (x) direction
+ \li \a{a} is the scale factor in the horizontal (x) direction
\image qml-item-canvas-scalex.png
- \li \c{c} is the skew factor in the x direction
+ \li \a{c} is the skew factor in the x direction
\image qml-item-canvas-skewx.png
- \li \c{e} is the translation in the x direction
+ \li \a{e} is the translation in the x direction
\image qml-item-canvas-translate.png
- \li \c{b} is the skew factor in the y (vertical) direction
+ \li \a{b} is the skew factor in the y (vertical) direction
\image qml-item-canvas-skewy.png
- \li \c{d} is the scale factor in the y direction
+ \li \a{d} is the scale factor in the y direction
\image qml-item-canvas-scaley.png
- \li \c{f} is the translation in the y direction
+ \li \a{f} is the translation in the y direction
\image qml-item-canvas-translatey.png
\li the last row remains constant
\endlist
- The scale factors and skew factors are multiples; \c{e} and \c{f} are
+
+ The scale factors and skew factors are multiples; \a{e} and \a{f} are
coordinate space units, just like the units in the translate(x,y)
method.
@@ -1202,11 +1204,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(const QV4::Fu
/*!
\qmlmethod object QtQuick::Context2D::transform(real a, real b, real c, real d, real e, real f)
- This method is very similar to setTransform(), but instead of replacing the old
- transform matrix, this method applies the given tranform matrix to the current matrix by multiplying to it.
+ This method is very similar to setTransform(), but instead of replacing
+ the old transform matrix, this method applies the given tranform matrix
+ to the current matrix by multiplying to it.
- The setTransform(a, b, c, d, e, f) method actually resets the current transform to the identity matrix,
- and then invokes the transform(a, b, c, d, e, f) method with the same arguments.
+ The setTransform(\a a, \a b, \a c, \a d, \a e, \a f) method actually
+ resets the current transform to the identity matrix, and then invokes
+ the transform(\a a, \a b, \a c, \a d, \a e, \a f) method with the same
+ arguments.
\sa setTransform()
*/
@@ -1626,9 +1631,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(const
}
/*!
- \qmlmethod object QtQuick::Context2D::createRadialGradient(real x0, real y0, real r0, real x1, real y1, real r1)
- Returns a CanvasGradient object that represents a radial gradient that paints along the cone given by the start circle with
- origin (x0, y0) and radius r0, and the end circle with origin (x1, y1) and radius r1.
+ \qmlmethod object QtQuick::Context2D::createRadialGradient(real x0, real y0, real r0, real x1, real y1, real r1)
+
+ Returns a CanvasGradient object that represents a radial gradient that
+ paints along the cone given by the start circle with origin (\a x0, \a y0)
+ and radius \a r0, and the end circle with origin (\a x1, \a y1) and radius
+ \a r1.
\sa CanvasGradient::addColorStop()
\sa createLinearGradient()
@@ -1679,8 +1687,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(const
/*!
\qmlmethod object QtQuick::Context2D::createConicalGradient(real x, real y, real angle)
- Returns a CanvasGradient object that represents a conical gradient that interpolate colors counter-clockwise around a center point (\c x, \c y)
- with start angle \c angle in units of radians.
+
+ Returns a CanvasGradient object that represents a conical gradient that
+ interpolates colors counter-clockwise around a center point (\a x, \a y)
+ with a start angle \a angle in units of radians.
\sa CanvasGradient::addColorStop()
\sa createLinearGradient()
@@ -2263,8 +2273,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(const QV4::FunctionObject
//rects
/*!
- \qmlmethod object QtQuick::Context2D::clearRect(real x, real y, real w, real h)
- Clears all pixels on the canvas in the given rectangle to transparent black.
+ \qmlmethod object QtQuick::Context2D::clearRect(real x, real y, real w, real h)
+
+ Clears all pixels on the canvas in the rectangle specified by
+ (\a x, \a y, \a w, \a h) to transparent black.
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2283,8 +2295,9 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(const QV4::Funct
}
/*!
- \qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
- Paint the specified rectangular area using the fillStyle.
+ \qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
+
+ Paints a rectangular area specified by (\a x, \a y, \a w, \a h) using fillStyle.
\sa fillStyle
*/
@@ -2301,14 +2314,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(const QV4::Functi
}
/*!
- \qmlmethod object QtQuick::Context2D::strokeRect(real x, real y, real w, real h)
- Stroke the specified rectangle's path using the strokeStyle, lineWidth, lineJoin,
- and (if appropriate) miterLimit attributes.
-
- \sa strokeStyle
- \sa lineWidth
- \sa lineJoin
- \sa miterLimit
+ \qmlmethod object QtQuick::Context2D::strokeRect(real x, real y, real w, real h)
+
+ Strokes the path of the rectangle specified by (\a x, \a y, \a w, \a h) using
+ strokeStyle, lineWidth, lineJoin, and (if appropriate) miterLimit attributes.
+
+ \sa strokeStyle, lineWidth, lineJoin, miterLimit
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2332,7 +2343,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(const QV4::Func
circle whose center is at the point (\a x, \a y) and whose radius is
\a radius.
- Both \c startAngle and \c endAngle are measured from the x-axis in radians.
+ Both \a startAngle and \a endAngle are measured from the x-axis in radians.
\image qml-item-canvas-arc.png
@@ -2439,10 +2450,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(const QV4::Funct
/*!
\qmlmethod object QtQuick::Context2D::bezierCurveTo(real cp1x, real cp1y, real cp2x, real cp2y, real x, real y)
- Adds a cubic bezier curve between the current position and the given endPoint using the control points specified by (\c cp1x, cp1y),
- and (\c cp2x, \c cp2y).
- After the curve is added, the current position is updated to be at the end point (\c x, \c y) of the curve.
+ Adds a cubic bezier curve between the current position and the given endPoint using the control points specified by (\a {cp1x}, \a {cp1y}),
+ and (\a {cp2x}, \a {cp2y}).
+ After the curve is added, the current position is updated to be at the end point (\a {x}, \a {y}) of the curve.
The following code produces the path shown below:
+
\code
ctx.strokeStyle = Qt.rgba(0, 0, 0, 1);
ctx.lineWidth = 1;
@@ -2451,7 +2463,9 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(const QV4::Funct
ctx.bezierCurveTo(-10, 90, 210, 90, 180, 0);
ctx.stroke();
\endcode
+
\image qml-item-canvas-bezierCurveTo.png
+
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto}{W3C 2d context standard for bezierCurveTo}
\sa {http://www.openrise.com/lab/FlowerPower/}{The beautiful flower demo by using bezierCurveTo}
*/
@@ -2550,7 +2564,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(const QV4::FunctionOb
/*!
\qmlmethod object QtQuick::Context2D::lineTo(real x, real y)
- Draws a line from the current position to the point (x, y).
+ Draws a line from the current position to the point at (\a x, \a y).
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2574,7 +2588,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(const QV4::Function
/*!
\qmlmethod object QtQuick::Context2D::moveTo(real x, real y)
- Creates a new subpath with the given point.
+ Creates a new subpath with a point at (\a x, \a y).
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2595,11 +2609,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(const QV4::Function
}
/*!
- \qmlmethod object QtQuick::Context2D::quadraticCurveTo(real cpx, real cpy, real x, real y)
+ \qmlmethod object QtQuick::Context2D::quadraticCurveTo(real cpx, real cpy, real x, real y)
- Adds a quadratic bezier curve between the current point and the endpoint (\c x, \c y) with the control point specified by (\c cpx, \c cpy).
+ Adds a quadratic bezier curve between the current point and the endpoint
+ (\a x, \a y) with the control point specified by (\a cpx, \a cpy).
- See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for quadraticCurveTo}
+ \sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for quadraticCurveTo}
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2623,9 +2638,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(const QV4
}
/*!
- \qmlmethod object QtQuick::Context2D::rect(real x, real y, real w, real h)
+ \qmlmethod object QtQuick::Context2D::rect(real x, real y, real w, real h)
- Adds a rectangle at position (\c x, \c y), with the given width \c w and height \c h, as a closed subpath.
+ Adds a rectangle at position (\a x, \a y), with the given width \a w and
+ height \a h, as a closed subpath.
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2640,10 +2656,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(const QV4::FunctionOb
}
/*!
- \qmlmethod object QtQuick::Context2D::roundedRect(real x, real y, real w, real h, real xRadius, real yRadius)
+ \qmlmethod object QtQuick::Context2D::roundedRect(real x, real y, real w, real h, real xRadius, real yRadius)
- Adds the given rectangle rect with rounded corners to the path. The \c xRadius and \c yRadius arguments specify the radius of the
- ellipses defining the corners of the rounded rectangle.
+ Adds a rounded-corner rectangle, specified by (\a x, \a y, \a w, \a h), to the path.
+ The \a xRadius and \a yRadius arguments specify the radius of the
+ ellipses defining the corners of the rounded rectangle.
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2663,12 +2680,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(const QV4::Fun
}
/*!
- \qmlmethod object QtQuick::Context2D::ellipse(real x, real y, real w, real h)
+ \qmlmethod object QtQuick::Context2D::ellipse(real x, real y, real w, real h)
- Creates an ellipse within the bounding rectangle defined by its top-left corner at (\a x, \ y), width \a w and height \a h,
- and adds it to the path as a closed subpath.
+ Creates an ellipse within the bounding rectangle defined by its top-left
+ corner at (\a x, \a y), width \a w and height \a h, and adds it to the
+ path as a closed subpath.
- The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).
+ The ellipse is composed of a clockwise curve, starting and finishing at
+ zero degrees (the 3 o'clock position).
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2686,8 +2705,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(const QV4::Functio
/*!
\qmlmethod object QtQuick::Context2D::text(string text, real x, real y)
- Adds the given \c text to the path as a set of closed subpaths created from the current context font supplied.
- The subpaths are positioned so that the left end of the text's baseline lies at the point specified by (\c x, \c y).
+ Adds the given \a text to the path as a set of closed subpaths created
+ from the current context font supplied.
+
+ The subpaths are positioned so that the left end of the text's baseline
+ lies at the point specified by (\a x, \a y).
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -2712,9 +2734,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(const QV4::FunctionOb
Strokes the subpaths with the current stroke style.
- See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-stroke}{W3C 2d context standard for stroke}
-
- \sa strokeStyle
+ \sa strokeStyle, {http://www.w3.org/TR/2dcontext/#dom-context-2d-stroke}{W3C 2d context standard for stroke}
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
{
@@ -2730,7 +2750,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(const QV4::Function
/*!
\qmlmethod object QtQuick::Context2D::isPointInPath(real x, real y)
- Returns true if the given point is in the current path.
+ Returns \c true if the point (\a x, \a y) is in the current path.
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-ispointinpath}{W3C 2d context standard for isPointInPath}
*/
@@ -2948,7 +2968,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(const QV4::Functio
/*!
\qmlmethod object QtQuick::Context2D::fillText(text, x, y)
- Fills the given text at the given position.
+
+ Fills the specified \a text at the given position (\a x, \a y).
+
\sa font
\sa textAlign
\sa textBaseline
@@ -2972,13 +2994,15 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(const QV4::Functi
RETURN_RESULT(*thisObject);
}
/*!
- \qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
- Strokes the given text at the given position.
- \sa font
- \sa textAlign
- \sa textBaseline
- \sa fillText
- */
+ \qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
+
+ Strokes the given \a text at a position specified by (\a x, \a y).
+
+ \sa font
+ \sa textAlign
+ \sa textBaseline
+ \sa fillText
+*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
QV4::Scope scope(b);
@@ -3414,8 +3438,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(const QV4:
}
/*!
- \qmlmethod CanvasImageData QtQuick::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.
+ \qmlmethod CanvasImageData QtQuick::Context2D::getImageData(real x, real y, real w, real h)
+
+ Returns an CanvasImageData object containing the image data for the canvas
+ rectangle specified by (\a x, \a y, \a w, \a h).
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -3441,8 +3467,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(const QV4::Fu
}
/*!
- \qmlmethod object QtQuick::Context2D::putImageData(CanvasImageData imageData, real dx, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight)
- Paints the data from the given ImageData object onto the canvas. If a dirty rectangle (\a dirtyX, \a dirtyY, \a dirtyWidth, \a dirtyHeight) is provided, only the pixels from that rectangle are painted.
+ \qmlmethod object QtQuick::Context2D::putImageData(CanvasImageData imageData, real dx, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight)
+
+ Paints the data from the given \a imageData object onto the canvas at
+ (\a dx, \a dy).
+
+ If a dirty rectangle (\a dirtyX, \a dirtyY, \a dirtyWidth, \a dirtyHeight)
+ is provided, only the pixels from that rectangle are painted.
*/
QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
@@ -3535,16 +3566,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(const QV4::Fu
*/
/*!
- \qmlmethod CanvasGradient QtQuick::CanvasGradient::addColorStop(real offsetof, string color)
- Adds a color stop with the given color to the gradient at the given offset.
- 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
+ \qmlmethod CanvasGradient QtQuick::CanvasGradient::addColorStop(real offset, string color)
- For example:
- \code
- var gradient = ctx.createLinearGradient(0, 0, 100, 100);
- gradient.addColorStop(0.3, Qt.rgba(1, 0, 0, 1));
- gradient.addColorStop(0.7, 'rgba(0, 255, 255, 1');
- \endcode
+ Adds a color stop with the given \a color to the gradient at the given \a offset.
+ 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
+
+ For example:
+
+ \code
+ var gradient = ctx.createLinearGradient(0, 0, 100, 100);
+ gradient.addColorStop(0.3, Qt.rgba(1, 0, 0, 1));
+ gradient.addColorStop(0.7, 'rgba(0, 255, 255, 1');
+ \endcode
*/
QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
{
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index bebefc1b22..18d492cd68 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -140,6 +140,7 @@ QQuickAnimatedImage::QQuickAnimatedImage(QQuickItem *parent)
{
connect(this, &QQuickImageBase::cacheChanged, this, &QQuickAnimatedImage::onCacheChanged);
connect(this, &QQuickImageBase::currentFrameChanged, this, &QQuickAnimatedImage::frameChanged);
+ connect(this, &QQuickImageBase::currentFrameChanged, this, &QQuickAnimatedImage::currentFrameChanged);
connect(this, &QQuickImageBase::frameCountChanged, this, &QQuickAnimatedImage::frameCountChanged);
}
@@ -466,7 +467,7 @@ void QQuickAnimatedImage::movieUpdate()
if (d->movie) {
d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this)));
- emit currentFrameChanged();
+ emit QQuickImageBase::currentFrameChanged();
}
}
diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h
index d18e7c43c7..7f2199fd2a 100644
--- a/src/quick/items/qquickanimatedimage_p.h
+++ b/src/quick/items/qquickanimatedimage_p.h
@@ -102,6 +102,7 @@ Q_SIGNALS:
void playingChanged();
void pausedChanged();
void frameChanged();
+ void currentFrameChanged();
void frameCountChanged();
Q_REVISION(11) void speedChanged();
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 430fa1b094..462a44634e 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -327,7 +327,7 @@ void QQuickBorderImage::load()
QNetworkRequest req(d->url);
d->sciReply = qmlEngine(this)->networkAccessManager()->get(req);
qmlobject_connect(d->sciReply, QNetworkReply, SIGNAL(finished()),
- this, QQuickBorderImage, SLOT(sciRequestFinished()))
+ this, QQuickBorderImage, SLOT(sciRequestFinished()));
#endif
}
} else {
diff --git a/src/quick/items/qquickborderimage_p_p.h b/src/quick/items/qquickborderimage_p_p.h
index 0f4e7acc05..17dab7d121 100644
--- a/src/quick/items/qquickborderimage_p_p.h
+++ b/src/quick/items/qquickborderimage_p_p.h
@@ -86,7 +86,7 @@ public:
if (!border) {
border = new QQuickScaleGrid(q);
qmlobject_connect(border, QQuickScaleGrid, SIGNAL(borderChanged()),
- q, QQuickBorderImage, SLOT(doUpdate()))
+ q, QQuickBorderImage, SLOT(doUpdate()));
}
return border;
}
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 4840333923..ff4d9b0fd1 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -754,7 +754,11 @@ void QQuickDragAttached::cancel()
This signal is emitted when a drag finishes and the drag was started with the
\l startDrag() method or started automatically using the \l dragType property.
+ \a dropAction holds the action accepted by the target item.
+
The corresponding handler is \c onDragFinished.
+
+ \sa drop()
*/
Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedActions)
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index f96d6b6244..76be8cc261 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -211,7 +211,7 @@ qreal QQuickDropAreaDrag::y() const
/*!
\qmlsignal QtQuick::DropArea::positionChanged(DragEvent drag)
- This signal is emitted when the position of a drag has changed.
+ This signal is emitted when the position of a \a drag has changed.
The corresponding handler is \c onPositionChanged.
*/
@@ -313,7 +313,7 @@ void QQuickDropArea::dragLeaveEvent(QDragLeaveEvent *)
/*!
\qmlsignal QtQuick::DropArea::dropped(DragEvent drop)
- This signal is emitted when a drop event occurs within the bounds of
+ This signal is emitted when a \a drop event occurs within the bounds of
a DropArea.
The corresponding handler is \c onDropped.
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index b0cfbaad6d..7d51a55a0c 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -41,6 +41,7 @@
#include <QtCore/qmap.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qtouchdevice_p.h>
+#include <QtGui/private/qevent_p.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickpointerhandler_p.h>
#include <QtQuick/private/qquickwindow_p.h>
@@ -1828,6 +1829,7 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i
// but that would require changing tst_qquickwindow::touchEvent_velocity(): it expects transformed velocity
bool anyPressOrReleaseInside = false;
+ bool anyStationaryWithModifiedPropertyInside = false;
bool anyGrabber = false;
QMatrix4x4 transformMatrix(QQuickItemPrivate::get(item)->windowToItemTransform());
for (int i = 0; i < m_pointCount; ++i) {
@@ -1860,6 +1862,8 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i
anyPressOrReleaseInside = true;
const QTouchEvent::TouchPoint *tp = touchPointById(p->pointId());
if (tp) {
+ if (isInside && tp->d->stationaryWithModifiedProperty)
+ anyStationaryWithModifiedPropertyInside = true;
eventStates |= tp->state();
QTouchEvent::TouchPoint tpCopy = *tp;
tpCopy.setPos(item->mapFromScene(tpCopy.scenePos()));
@@ -1873,7 +1877,8 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i
// Now touchPoints will have only points which are inside the item.
// But if none of them were just pressed inside, and the item has no other reason to care, ignore them anyway.
- if (eventStates == Qt::TouchPointStationary || touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering))
+ if ((eventStates == Qt::TouchPointStationary && !anyStationaryWithModifiedPropertyInside) ||
+ touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering))
return nullptr;
// if all points have the same state, set the event type accordingly
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index cf3cd9f48e..d9ec7de611 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -266,9 +266,9 @@ void QQuickFlickablePrivate::init()
QQml_setParent_noEvent(contentItem, q);
contentItem->setParentItem(q);
qmlobject_connect(&timeline, QQuickTimeLine, SIGNAL(completed()),
- q, QQuickFlickable, SLOT(timelineCompleted()))
+ q, QQuickFlickable, SLOT(timelineCompleted()));
qmlobject_connect(&velocityTimeline, QQuickTimeLine, SIGNAL(completed()),
- q, QQuickFlickable, SLOT(velocityTimelineCompleted()))
+ q, QQuickFlickable, SLOT(velocityTimelineCompleted()));
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setAcceptTouchEvents(false); // rely on mouse events synthesized from touch
q->setFiltersChildMouseEvents(true);
diff --git a/src/quick/items/qquickflickablebehavior_p.h b/src/quick/items/qquickflickablebehavior_p.h
index ae7fe71359..fbce62f075 100644
--- a/src/quick/items/qquickflickablebehavior_p.h
+++ b/src/quick/items/qquickflickablebehavior_p.h
@@ -93,6 +93,11 @@
#define QML_FLICK_MULTIFLICK_THRESHOLD 1250
#endif
+// If the time (ms) between the last move and the release exceeds this, then velocity will be zero.
+#ifndef QML_FLICK_VELOCITY_DECAY_TIME
+#define QML_FLICK_VELOCITY_DECAY_TIME 50
+#endif
+
// Multiflick acceleration minimum contentSize/viewSize ratio
#ifndef QML_FLICK_MULTIFLICK_RATIO
#define QML_FLICK_MULTIFLICK_RATIO 10
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index fecfa5fd2d..e69e9cff46 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1761,7 +1761,7 @@ void QQuickGridView::setSnapMode(SnapMode mode)
\list
\li The view is first created
- \li The view's \l model changes
+ \li The view's \l model changes in such a way that the visible delegates are completely replaced
\li The view's \l model is \l {QAbstractItemModel::reset()}{reset}, if the model is a QAbstractItemModel subclass
\endlist
@@ -1779,6 +1779,28 @@ void QQuickGridView::setSnapMode(SnapMode mode)
When the view is initialized, the view will create all the necessary items for the view,
then animate them to their correct positions within the view over one second.
+ However when scrolling the view later, the populate transition does not
+ run, even though delegates are being instantiated as they become visible.
+ When the model changes in a way that new delegates become visible, the
+ \l add transition is the one that runs. So you should not depend on the
+ \c populate transition to initialize properties in the delegate, because it
+ does not apply to every delegate. If your animation sets the \c to value of
+ a property, the property should initially have the \c to value, and the
+ animation should set the \c from value in case it is animated:
+
+ \code
+ GridView {
+ ...
+ delegate: Rectangle {
+ opacity: 1 // not necessary because it's the default; but don't set 0
+ ...
+ }
+ populate: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 }
+ }
+ }
+ \endcode
+
For more details and examples on how to use view transitions, see the ViewTransition
documentation.
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 52a1d59e77..796ab6cdd7 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -5083,7 +5083,7 @@ QQuickStateGroup *QQuickItemPrivate::_states()
if (!componentComplete)
_stateGroup->classBegin();
qmlobject_connect(_stateGroup, QQuickStateGroup, SIGNAL(stateChanged(QString)),
- q, QQuickItem, SIGNAL(stateChanged(QString)))
+ q, QQuickItem, SIGNAL(stateChanged(QString)));
}
return _stateGroup;
@@ -5686,6 +5686,7 @@ void QQuickItem::setRotation(qreal r)
color: "red"
x: 25; y: 25; width: 50; height: 50
scale: 1.4
+ transformOrigin: Item.TopLeft
}
}
\endqml
@@ -8489,7 +8490,7 @@ void QQuickItemLayer::setMipmap(bool mipmap)
\note ShaderEffectSource.RGB and ShaderEffectSource.Alpha should
be used with caution, as support for these formats in the underlying
- hardare and driver is often not present.
+ hardware and driver is often not present.
\sa {Item Layers}
*/
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 6da197c4d0..f7943630c4 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -245,7 +245,6 @@ static void qt_quickitems_defineModule()
// events
qmlRegisterTypesAndRevisions<
QQuickCloseEvent,
- QQuickDropEvent,
QQuickGrabGestureEvent,
QQuickKeyEvent,
QQuickMouseEvent,
@@ -278,7 +277,7 @@ static void qt_quickitems_defineModule()
qmlRegisterTypesAndRevisions<QQuickAnimatedImage>(uri, major);
#else
qmlRegisterTypeNotAvailable(
- uri, major, minor, "AnimatedImage",
+ uri, major, 15, "AnimatedImage",
QCoreApplication::translate("QQuickAnimatedImage",
"Qt was built without support for QMovie"));
#endif
@@ -289,6 +288,7 @@ static void qt_quickitems_defineModule()
#if QT_CONFIG(quick_draganddrop)
qmlRegisterTypesAndRevisions<
+ QQuickDropEvent,
QQuickDrag,
QQuickDropArea,
QQuickDropAreaDrag,
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 95a36ab4d4..725d35f325 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -2744,7 +2744,7 @@ void QQuickListView::setFooterPositioning(QQuickListView::FooterPositioning posi
\list
\li The view is first created
- \li The view's \l model changes
+ \li The view's \l model changes in such a way that the visible delegates are completely replaced
\li The view's \l model is \l {QAbstractItemModel::reset()}{reset}, if the model is a QAbstractItemModel subclass
\endlist
@@ -2762,6 +2762,27 @@ void QQuickListView::setFooterPositioning(QQuickListView::FooterPositioning posi
When the view is initialized, the view will create all the necessary items for the view,
then animate them to their correct positions within the view over one second.
+ However when scrolling the view later, the populate transition does not
+ run, even though delegates are being instantiated as they become visible.
+ When the model changes in a way that new delegates become visible, the
+ \l add transition is the one that runs. So you should not depend on the
+ \c populate transition to initialize properties in the delegate, because it
+ does not apply to every delegate. If your animation sets the \c to value of
+ a property, the property should initially have the \c to value, and the
+ animation should set the \c from value in case it is animated:
+
+ \code
+ ListView {
+ ...
+ delegate: Rectangle {
+ opacity: 1 // not necessary because it's the default
+ }
+ populate: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 }
+ }
+ }
+ \endcode
+
For more details and examples on how to use view transitions, see the ViewTransition
documentation.
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index a8f09dc8be..ddf34798d7 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -431,7 +431,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
This signal is emitted in response to both mouse wheel and trackpad scroll gestures.
- The \l {WheelEvent}{wheel} parameter provides information about the event, including the x and y
+ The \a wheel parameter provides information about the event, including the x and y
position, any buttons currently pressed, and information about the wheel movement, including
angleDelta and pixelDelta.
@@ -1069,7 +1069,7 @@ void QQuickMouseArea::itemChange(ItemChange change, const ItemChangeData &value)
Q_D(QQuickMouseArea);
switch (change) {
case ItemVisibleHasChanged:
- if (acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse())) {
+ if (d->effectiveEnable && d->enabled && acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse())) {
if (!d->hovered) {
QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition;
d->lastScenePos = d->window->mapFromGlobal(cursorPos.toPoint());
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 3eca535a67..b02e58fae4 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -40,6 +40,7 @@
#include "qquickmultipointtoucharea_p.h"
#include <QtQuick/qquickwindow.h>
#include <private/qsgadaptationlayer_p.h>
+#include <private/qevent_p.h>
#include <private/qquickitem_p.h>
#include <private/qguiapplication_p.h>
#include <QEvent>
@@ -410,7 +411,7 @@ void QQuickTouchPoint::setUniqueId(const QPointingDeviceUniqueId &id)
area should grab the current touch points. By default they will not be grabbed; to grab them call \c gesture.grab(). If the
gesture is not grabbed, the nesting Flickable, for example, would also have an opportunity to grab.
- The gesture object also includes information on the current set of \c touchPoints and the \c dragThreshold.
+ The \a gesture object also includes information on the current set of \c touchPoints and the \c dragThreshold.
The corresponding handler is \c onGestureStarted.
*/
@@ -655,7 +656,8 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
// (we may have just obtained enough points to start tracking them -- in that case moved or stationary count as newly pressed)
addTouchPoint(&p);
started = true;
- } else if (touchPointState & Qt::TouchPointMoved) {
+ } else if ((touchPointState & Qt::TouchPointMoved) || p.d->stationaryWithModifiedProperty) {
+ // React to a stationary point with a property change (velocity, pressure) as if the point moved. (QTBUG-77142)
QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id));
Q_ASSERT(dtp);
_movedTouchPoints.append(dtp);
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 4e81573356..6976665134 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -60,8 +60,9 @@
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle)
+Q_LOGGING_CATEGORY(lcPathView, "qt.quick.pathview")
-const qreal MinimumFlickVelocity = 75.0;
+static const qreal MinimumFlickVelocity = 75;
static QQmlOpenMetaObjectType *qPathViewAttachedType = nullptr;
@@ -90,8 +91,8 @@ void QQuickPathViewAttached::setValue(const QByteArray &name, const QVariant &va
}
QQuickPathViewPrivate::QQuickPathViewPrivate()
- : path(nullptr), currentIndex(0), currentItemOffset(0.0), startPc(0)
- , offset(0.0), offsetAdj(0.0), mappedRange(1.0), mappedCache(0.0)
+ : path(nullptr), currentIndex(0), currentItemOffset(0), startPc(0)
+ , offset(0), offsetAdj(0), mappedRange(1), mappedCache(0)
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), layoutScheduled(false)
, moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false)
@@ -117,10 +118,10 @@ void QQuickPathViewPrivate::init()
q->setFlag(QQuickItem::ItemIsFocusScope);
q->setFiltersChildMouseEvents(true);
qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(updated()),
- q, QQuickPathView, SLOT(ticked()))
+ q, QQuickPathView, SLOT(ticked()));
timer.invalidate();
qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(completed()),
- q, QQuickPathView, SLOT(movementEnding()))
+ q, QQuickPathView, SLOT(movementEnding()));
}
QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async)
@@ -163,7 +164,7 @@ void QQuickPathView::createdItem(int index, QObject *object)
att->setOnPath(false);
}
item->setParentItem(this);
- d->updateItem(item, 1.0);
+ d->updateItem(item, 1);
} else {
d->requestedIndex = -1;
if (!d->inRequest)
@@ -184,13 +185,13 @@ void QQuickPathView::initItem(int index, QObject *object)
if (att) {
att->m_view = this;
qreal percent = d->positionOfIndex(index);
- if (percent < 1.0 && d->path) {
+ if (percent < 1 && d->path) {
const auto attributes = d->path->attributes();
for (const QString &attr : attributes)
att->setValue(attr.toUtf8(), d->path->attributeAt(attr, percent));
item->setZ(d->requestedZ);
}
- att->setOnPath(percent < 1.0);
+ att->setOnPath(percent < 1);
}
}
}
@@ -264,17 +265,17 @@ void QQuickPathViewPrivate::updateMappedRange()
mappedRange = qreal(modelCount)/pathItems;
mappedCache = qreal(cacheSize)/pathItems/2; // Half of cache at each end
} else {
- mappedRange = 1.0;
- mappedCache = 0.0;
+ mappedRange = 1;
+ mappedCache = 0;
}
}
qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const
{
- qreal pos = -1.0;
+ qreal pos = -1;
if (model && index >= 0 && index < modelCount) {
- qreal start = 0.0;
+ qreal start = 0;
if (haveHighlightRange && (highlightRangeMode != QQuickPathView::NoHighlightRange
|| snapMode != QQuickPathView::NoSnap))
start = highlightRangeStart;
@@ -282,10 +283,10 @@ qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const
globalPos = std::fmod(globalPos, qreal(modelCount)) / modelCount;
if (pathItems != -1 && pathItems < modelCount) {
globalPos += start / mappedRange;
- globalPos = std::fmod(globalPos, qreal(1.0));
+ globalPos = std::fmod(globalPos, qreal(1));
pos = globalPos * mappedRange;
} else {
- pos = std::fmod(globalPos + start, qreal(1.0));
+ pos = std::fmod(globalPos + start, qreal(1));
}
}
@@ -296,7 +297,7 @@ qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const
// account the circular space.
bool QQuickPathViewPrivate::isInBound(qreal position, qreal lower, qreal upper) const
{
- if (lower == upper)
+ if (qFuzzyCompare(lower, upper))
return true;
if (lower > upper) {
if (position > upper && position > lower)
@@ -358,7 +359,7 @@ void QQuickPathViewPrivate::updateHighlight()
} else {
qreal target = currentIndex;
- offsetAdj = 0.0;
+ offsetAdj = 0;
tl.reset(moveHighlight);
moveHighlight.setValue(highlightPosition);
@@ -367,14 +368,14 @@ void QQuickPathViewPrivate::updateHighlight()
if (target - highlightPosition > modelCount/2) {
highlightUp = false;
qreal distance = modelCount - target + highlightPosition;
- tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance));
+ tl.move(moveHighlight, 0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance));
tl.set(moveHighlight, modelCount-0.01);
tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance));
} else if (target - highlightPosition <= -modelCount/2) {
highlightUp = true;
qreal distance = modelCount - highlightPosition + target;
tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance));
- tl.set(moveHighlight, 0.0);
+ tl.set(moveHighlight, 0);
tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance));
} else {
highlightUp = highlightPosition - target < 0;
@@ -386,9 +387,9 @@ void QQuickPathViewPrivate::updateHighlight()
void QQuickPathViewPrivate::setHighlightPosition(qreal pos)
{
- if (pos != highlightPosition) {
- qreal start = 0.0;
- qreal end = 1.0;
+ if (!(qFuzzyCompare(pos, highlightPosition))) {
+ qreal start = 0;
+ qreal end = 1;
if (haveHighlightRange && highlightRangeMode != QQuickPathView::NoHighlightRange) {
start = highlightRangeStart;
end = highlightRangeEnd;
@@ -399,7 +400,7 @@ void QQuickPathViewPrivate::setHighlightPosition(qreal pos)
qreal relativeHighlight = std::fmod(pos + offset, range) / range;
if (!highlightUp && relativeHighlight > end / mappedRange) {
- qreal diff = 1.0 - relativeHighlight;
+ qreal diff = 1 - relativeHighlight;
setOffset(offset + diff * range);
} else if (highlightUp && relativeHighlight >= (end - start) / mappedRange) {
qreal diff = relativeHighlight - (end - start) / mappedRange;
@@ -410,7 +411,7 @@ void QQuickPathViewPrivate::setHighlightPosition(qreal pos)
qreal pathPos = positionOfIndex(pos);
updateItem(highlightItem, pathPos);
if (QQuickPathViewAttached *att = attached(highlightItem))
- att->setOnPath(pathPos < 1.0);
+ att->setOnPath(pathPos < 1);
}
}
@@ -435,10 +436,10 @@ void QQuickPathViewPrivate::updateItem(QQuickItem *item, qreal percent)
const auto attributes = path->attributes();
for (const QString &attr : attributes)
att->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
- att->setOnPath(percent < 1.0);
+ att->setOnPath(percent < 1);
}
- QQuickItemPrivate::get(item)->setCulled(percent >= 1.0);
- QPointF pf = path->pointAtPercent(qMin(percent, qreal(1.0)));
+ QQuickItemPrivate::get(item)->setCulled(percent >= 1);
+ QPointF pf = path->pointAtPercent(qMin(percent, qreal(1)));
item->setX(pf.x() - item->width()/2);
item->setY(pf.y() - item->height()/2);
}
@@ -668,7 +669,7 @@ void QQuickPathView::setModel(const QVariant &m)
d->currentIndex = 0;
emit currentIndexChanged();
}
- if (d->offset != 0.0) {
+ if (!(qFuzzyIsNull(d->offset))) {
d->offset = 0;
emit offsetChanged();
}
@@ -820,7 +821,7 @@ void QQuickPathView::decrementCurrentIndex()
\qmlproperty real QtQuick::PathView::offset
The offset specifies how far along the path the items are from their initial positions.
- This is a real number that ranges from 0.0 to the count of items in the model.
+ This is a real number that ranges from \c 0 to the count of items in the model.
*/
qreal QQuickPathView::offset() const
{
@@ -839,7 +840,7 @@ void QQuickPathView::setOffset(qreal offset)
void QQuickPathViewPrivate::setOffset(qreal o)
{
Q_Q(QQuickPathView);
- if (offset != o) {
+ if (!qFuzzyCompare(offset, o)) {
if (isValid() && q->isComponentComplete()) {
qreal oldOffset = offset;
offset = std::fmod(o, qreal(modelCount));
@@ -882,7 +883,6 @@ void QQuickPathViewPrivate::setAdjustedOffset(qreal o)
\sa highlightItem, highlightRangeMode
*/
-
QQmlComponent *QQuickPathView::highlight() const
{
Q_D(const QQuickPathView);
@@ -901,25 +901,26 @@ void QQuickPathView::setHighlight(QQmlComponent *highlight)
}
/*!
- \qmlproperty Item QtQuick::PathView::highlightItem
+ \qmlproperty Item QtQuick::PathView::highlightItem
- \c highlightItem holds the highlight item, which was created
- from the \l highlight component.
+ \c highlightItem holds the highlight item, which was created
+ from the \l highlight component.
- \sa highlight
+ \sa highlight
*/
QQuickItem *QQuickPathView::highlightItem() const
{
Q_D(const QQuickPathView);
return d->highlightItem;
}
+
/*!
\qmlproperty real QtQuick::PathView::preferredHighlightBegin
\qmlproperty real QtQuick::PathView::preferredHighlightEnd
\qmlproperty enumeration QtQuick::PathView::highlightRangeMode
These properties set the preferred range of the highlight (current item)
- within the view. The preferred values must be in the range 0.0-1.0.
+ within the view. The preferred values must be in the range from \c 0 to \c 1.
Valid values for \c highlightRangeMode are:
@@ -960,7 +961,7 @@ qreal QQuickPathView::preferredHighlightBegin() const
void QQuickPathView::setPreferredHighlightBegin(qreal start)
{
Q_D(QQuickPathView);
- if (d->highlightRangeStart == start || start < 0 || start > 1.0)
+ if (qFuzzyCompare(d->highlightRangeStart, start) || start < 0 || start > 1)
return;
d->highlightRangeStart = start;
d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd;
@@ -977,7 +978,7 @@ qreal QQuickPathView::preferredHighlightEnd() const
void QQuickPathView::setPreferredHighlightEnd(qreal end)
{
Q_D(QQuickPathView);
- if (d->highlightRangeEnd == end || end < 0 || end > 1.0)
+ if (qFuzzyCompare(d->highlightRangeEnd, end) || end < 0 || end > 1)
return;
d->highlightRangeEnd = end;
d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd;
@@ -1048,7 +1049,7 @@ qreal QQuickPathView::dragMargin() const
void QQuickPathView::setDragMargin(qreal dragMargin)
{
Q_D(QQuickPathView);
- if (d->dragMargin == dragMargin)
+ if (qFuzzyCompare(d->dragMargin, dragMargin))
return;
d->dragMargin = dragMargin;
emit dragMarginChanged();
@@ -1069,7 +1070,7 @@ qreal QQuickPathView::flickDeceleration() const
void QQuickPathView::setFlickDeceleration(qreal dec)
{
Q_D(QQuickPathView);
- if (d->deceleration == dec)
+ if (qFuzzyCompare(d->deceleration, dec))
return;
d->deceleration = dec;
emit flickDecelerationChanged();
@@ -1090,7 +1091,7 @@ qreal QQuickPathView::maximumFlickVelocity() const
void QQuickPathView::setMaximumFlickVelocity(qreal vel)
{
Q_D(QQuickPathView);
- if (vel == d->maximumFlickVelocity)
+ if (qFuzzyCompare(vel, d->maximumFlickVelocity))
return;
d->maximumFlickVelocity = vel;
emit maximumFlickVelocityChanged();
@@ -1580,7 +1581,7 @@ QQuickItem *QQuickPathView::itemAtIndex(int index) const
QPointF QQuickPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const
{
const auto pathLength = path->path().length();
- qreal samples = qMin(pathLength / 5, qreal(500.0));
+ qreal samples = qMin(pathLength / 5, qreal(500));
qreal res = pathLength / samples;
qreal mindist = 1e10; // big number
@@ -1601,7 +1602,7 @@ QPointF QQuickPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercen
// now refine
qreal approxPc = nearPc;
- for (qreal i = approxPc-1.0; i < approxPc+1.0; i += 1/(2*res)) {
+ for (qreal i = approxPc-1; i < approxPc+1; i += 1/(2*res)) {
QPointF pt = path->pointAtPercent(i/samples);
QPointF diff = pt - point;
qreal dist = diff.x()*diff.x() + diff.y()*diff.y();
@@ -1623,6 +1624,7 @@ void QQuickPathViewPrivate::addVelocitySample(qreal v)
velocityBuffer.append(v);
if (velocityBuffer.count() > QML_FLICK_SAMPLEBUFFER)
velocityBuffer.remove(0);
+ qCDebug(lcPathView) << "instantaneous velocity" << v;
}
qreal QQuickPathViewPrivate::calcVelocity() const
@@ -1635,6 +1637,7 @@ qreal QQuickPathViewPrivate::calcVelocity() const
velocity += v;
}
velocity /= count;
+ qCDebug(lcPathView) << "average velocity" << velocity << "based on" << count << "samples";
}
return velocity;
}
@@ -1642,7 +1645,7 @@ qreal QQuickPathViewPrivate::calcVelocity() const
qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) const
{
if (0 != event->timestamp())
- return event->timestamp();
+ return qint64(event->timestamp());
return timer.elapsed();
}
@@ -1669,7 +1672,7 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
if (item->contains(item->mapFromScene(event->windowPos())))
break;
}
- if (idx == items.count() && dragMargin == 0.) // didn't click on an item
+ if (idx == items.count() && qFuzzyIsNull(dragMargin)) // didn't click on an item
return;
startPoint = pointNear(event->localPos(), &startPc);
@@ -1680,11 +1683,12 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
return;
}
-
- if (tl.isActive() && flicking && flickDuration && qreal(tl.time())/flickDuration < 0.8)
+ if (tl.isActive() && flicking && flickDuration && qreal(tl.time()) / flickDuration < 0.8) {
stealMouse = true; // If we've been flicked then steal the click.
- else
+ q->grabMouse(); // grab it right now too, just to be sure (QTBUG-77173)
+ } else {
stealMouse = false;
+ }
q->setKeepMouseGrab(stealMouse);
timer.start();
@@ -1730,7 +1734,7 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
moveReason = QQuickPathViewPrivate::Mouse;
int count = pathItems == -1 ? modelCount : qMin(pathItems, modelCount);
qreal diff = (newPc - startPc)*count;
- if (diff) {
+ if (!qFuzzyIsNull(diff)) {
q->setOffset(offset + diff);
if (diff > modelCount/2)
@@ -1740,7 +1744,7 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
qint64 elapsed = currentTimestamp - lastPosTime;
if (elapsed > 0)
- addVelocitySample(diff / (qreal(elapsed) / 1000.));
+ addVelocitySample(diff / (qreal(elapsed) / 1000));
}
if (!moving) {
moving = true;
@@ -1765,7 +1769,7 @@ void QQuickPathView::mouseReleaseEvent(QMouseEvent *event)
}
}
-void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *)
+void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *event)
{
Q_Q(QQuickPathView);
stealMouse = false;
@@ -1779,6 +1783,12 @@ void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *)
}
qreal velocity = calcVelocity();
+ qint64 elapsed = computeCurrentTime(event) - lastPosTime;
+ // Let the velocity linearly decay such that it becomes 0 if elapsed time > QML_FLICK_VELOCITY_DECAY_TIME
+ // The intention is that if you are flicking at some speed, then stop in one place for some time before releasing,
+ // the previous velocity is lost. (QTBUG-77173, QTBUG-59052)
+ velocity *= qreal(qMax(0LL, QML_FLICK_VELOCITY_DECAY_TIME - elapsed)) / QML_FLICK_VELOCITY_DECAY_TIME;
+ qCDebug(lcPathView) << "after elapsed time" << elapsed << "velocity decayed to" << velocity;
qreal count = pathItems == -1 ? modelCount : qMin(pathItems, modelCount);
const auto averageItemLength = path->path().length() / count;
qreal pixelVelocity = averageItemLength * velocity;
@@ -1796,32 +1806,32 @@ void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *)
|| snapMode != QQuickPathView::NoSnap)) {
if (snapMode == QQuickPathView::SnapOneItem) {
// encourage snapping one item in direction of motion
- if (velocity > 0.)
+ if (velocity > 0)
dist = qRound(0.5 + offset) - offset;
else
dist = qRound(0.5 - offset) + offset;
} else {
// + 0.25 to encourage moving at least one item in the flick direction
- dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25));
+ dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2) + 0.25));
// round to nearest item.
- if (velocity > 0.)
+ if (velocity > 0)
dist = qRound(dist + offset) - offset;
else
dist = qRound(dist - offset) + offset;
}
// Calculate accel required to stop on item boundary
- if (dist <= 0.) {
- dist = 0.;
- accel = 0.;
+ if (dist <= 0) {
+ dist = 0;
+ accel = 0;
} else {
- accel = v2 / (2.0f * qAbs(dist));
+ accel = v2 / (2 * qAbs(dist));
}
} else {
- dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0)));
+ dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2)));
}
- flickDuration = static_cast<int>(1000 * qAbs(velocity) / accel);
- offsetAdj = 0.0;
+ flickDuration = int(1000 * qAbs(velocity) / accel);
+ offsetAdj = 0;
moveOffset.setValue(offset);
tl.accel(moveOffset, velocity, accel, dist);
tl.callback(QQuickTimeLineCallback(&moveOffset, fixOffsetCallback, this));
@@ -1995,7 +2005,7 @@ void QQuickPathView::refill()
else
qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ":" << item;
}
- if (pos < 1.0) {
+ if (pos < 1) {
d->updateItem(item, pos);
if (idx == d->currentIndex) {
currentVisible = true;
@@ -2005,9 +2015,9 @@ void QQuickPathView::refill()
} else {
d->updateItem(item, pos);
if (QQuickPathViewAttached *att = d->attached(item))
- att->setOnPath(pos < 1.0);
- if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) {
- qCDebug(lcItemViewDelegateLifecycle) << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache);
+ att->setOnPath(pos < 1);
+ if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1 + d->mappedCache)) {
+ qCDebug(lcItemViewDelegateLifecycle) << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1 + d->mappedCache);
d->releaseItem(item);
it = d->items.erase(it);
} else {
@@ -2023,12 +2033,12 @@ void QQuickPathView::refill()
int endIdx = 0;
qreal endPos;
int startIdx = 0;
- qreal startPos = 0.0;
+ qreal startPos = 0;
const bool wasEmpty = d->items.isEmpty();
if (!wasEmpty) {
//Find the beginning and end, items may not be in sorted order
- endPos = -1.0;
- startPos = 2.0;
+ endPos = -1;
+ startPos = 2;
for (QQuickItem * item : qAsConst(d->items)) {
int idx = d->model->indexOf(item, nullptr);
@@ -2057,10 +2067,10 @@ void QQuickPathView::refill()
if (idx >= d->modelCount)
idx = 0;
qreal nextPos = d->positionOfIndex(idx);
- while ((d->isInBound(nextPos, endPos, 1.0 + d->mappedCache) || !d->items.count())
+ while ((d->isInBound(nextPos, endPos, 1 + d->mappedCache) || !d->items.count())
&& d->items.count() < count+d->cacheSize) {
qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
- QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);
+ QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1);
if (!item) {
waiting = true;
break;
@@ -2092,7 +2102,7 @@ void QQuickPathView::refill()
while (!waiting && d->isInBound(nextPos, d->mappedRange - d->mappedCache, startPos)
&& d->items.count() < count+d->cacheSize) {
qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
- QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);
+ QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1);
if (!item) {
waiting = true;
break;
@@ -2125,9 +2135,9 @@ void QQuickPathView::refill()
QQuickItem *lastItem = d->items.at(0);
while (idx != endIdx) {
nextPos = d->positionOfIndex(idx);
- if (d->isInBound(nextPos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) {
+ if (d->isInBound(nextPos, d->mappedRange - d->mappedCache, 1 + d->mappedCache)) {
//This gets the reference from the delegate model, and will not re-create
- QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);
+ QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1);
if (!item) {
waiting = true;
break;
@@ -2161,13 +2171,13 @@ void QQuickPathView::refill()
bool currentChanged = false;
if (!currentVisible) {
- d->currentItemOffset = 1.0;
+ d->currentItemOffset = 1;
if (d->currentItem) {
- d->updateItem(d->currentItem, 1.0);
+ d->updateItem(d->currentItem, 1);
} else if (!waiting && d->currentIndex >= 0 && d->currentIndex < d->modelCount) {
if ((d->currentItem = d->getItem(d->currentIndex, d->currentIndex))) {
currentChanged = true;
- d->updateItem(d->currentItem, 1.0);
+ d->updateItem(d->currentItem, 1);
if (QQuickPathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
}
@@ -2361,7 +2371,7 @@ void QQuickPathViewPrivate::createCurrentItem()
}
} else if (currentIndex >= 0 && currentIndex < modelCount) {
if ((currentItem = getItem(currentIndex, currentIndex))) {
- updateItem(currentItem, 1.0);
+ updateItem(currentItem, 1);
if (QQuickPathViewAttached *att = attached(currentItem))
att->setIsCurrentItem(true);
}
@@ -2395,7 +2405,7 @@ void QQuickPathViewPrivate::updateCurrent()
void QQuickPathViewPrivate::fixOffsetCallback(void *d)
{
- ((QQuickPathViewPrivate *)d)->fixOffset();
+ static_cast<QQuickPathViewPrivate *>(d)->fixOffset();
}
void QQuickPathViewPrivate::fixOffset()
@@ -2420,7 +2430,7 @@ void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason)
qreal targetOffset = std::fmod(qreal(modelCount - index), qreal(modelCount));
moveReason = reason;
- offsetAdj = 0.0;
+ offsetAdj = 0;
tl.reset(moveOffset);
moveOffset.setValue(offset);
@@ -2432,20 +2442,20 @@ void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason)
if (!duration || qAbs(offset - targetOffset) < threshold || (qFuzzyIsNull(targetOffset) && qAbs(modelCount - offset) < threshold)) {
tl.set(moveOffset, targetOffset);
- } else if (moveDirection == QQuickPathView::Positive || (moveDirection == QQuickPathView::Shortest && targetOffset - offset > modelCount/2.0)) {
+ } else if (moveDirection == QQuickPathView::Positive || (moveDirection == QQuickPathView::Shortest && targetOffset - offset > modelCount/2)) {
qreal distance = modelCount - targetOffset + offset;
if (targetOffset > moveOffset) {
- tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
+ tl.move(moveOffset, 0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
tl.set(moveOffset, modelCount);
- tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
+ tl.move(moveOffset, targetOffset, QEasingCurve(qFuzzyIsNull(offset) ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
} else {
tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
}
- } else if (moveDirection == QQuickPathView::Negative || targetOffset - offset <= -modelCount/2.0) {
+ } else if (moveDirection == QQuickPathView::Negative || targetOffset - offset <= -modelCount/2) {
qreal distance = modelCount - offset + targetOffset;
if (targetOffset < moveOffset) {
- tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
- tl.set(moveOffset, 0.0);
+ tl.move(moveOffset, modelCount, QEasingCurve(qFuzzyIsNull(targetOffset) ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
+ tl.set(moveOffset, 0);
tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));
} else {
tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 83b3372ed9..addd52cb1d 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -188,8 +188,7 @@ void QQuickRenderControlPrivate::windowDestroyed()
if (window) {
rc->invalidate();
- delete QQuickWindowPrivate::get(window)->animationController;
- QQuickWindowPrivate::get(window)->animationController = nullptr;
+ QQuickWindowPrivate::get(window)->animationController.reset();
#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl)
if (QOpenGLContext::currentContext())
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index b057fd9d8f..b17e505f4f 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -229,7 +229,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlattachedmethod int Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
- Returns the rotation angle, in degrees, between the two specified angles.
+ Returns the rotation angle, in degrees, between the specified screen
+ orientations \a a and \a b.
*/
/*!
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 75e0a1018f..95fac30808 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -54,6 +54,7 @@
/*!
\qmltype TableView
\inqmlmodule QtQuick
+ \since 5.12
\ingroup qtquick-views
\inherits Flickable
\brief Provides a table view of items to display data from a model.
@@ -1823,18 +1824,9 @@ void QQuickTableViewPrivate::beginRebuildTable()
void QQuickTableViewPrivate::layoutAfterLoadingInitialTable()
{
- if (rebuildOptions.testFlag(RebuildOption::LayoutOnly)
- || rowHeightProvider.isUndefined() || columnWidthProvider.isUndefined()) {
- // Since we don't have both size providers, we need to calculate the
- // size of each row and column based on the size of the delegate items.
- // This couldn't be done while we were loading the initial rows and
- // columns, since during the process, we didn't have all the items
- // available yet for the calculation. So we do it now. The exception
- // is if we specifically only requested a relayout.
- clearEdgeSizeCache();
- relayoutTableItems();
- syncLoadedTableRectFromLoadedTable();
- }
+ clearEdgeSizeCache();
+ relayoutTableItems();
+ syncLoadedTableRectFromLoadedTable();
if (syncView || rebuildOptions.testFlag(RebuildOption::All)) {
// We try to limit how often we update the content size. The main reason is that is has a
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index 5c4ecd60aa..ab3b0c4605 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -794,8 +794,6 @@ void QQuickTextControl::timerEvent(QTimerEvent *e)
d->cursorOn = !d->cursorOn;
d->repaintCursor();
- } else if (e->timerId() == d->tripleClickTimer.timerId()) {
- d->tripleClickTimer.stop();
}
}
@@ -1058,7 +1056,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po
commitPreedit();
#endif
- if (tripleClickTimer.isActive()
+ if ((e->timestamp() < (timestampAtLastDoubleClick + QGuiApplication::styleHints()->mouseDoubleClickInterval()))
&& ((pos - tripleClickPoint).toPoint().manhattanLength() < QGuiApplication::styleHints()->startDragDistance())) {
cursor.movePosition(QTextCursor::StartOfBlock);
@@ -1068,7 +1066,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po
anchorOnMousePress = QString();
- tripleClickTimer.stop();
+ timestampAtLastDoubleClick = 0; // do not enter this condition in case of 4(!) rapid clicks
} else {
int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
if (cursorPos == -1) {
@@ -1267,7 +1265,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin
selectedWordOnDoubleClick = cursor;
tripleClickPoint = pos;
- tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q);
+ timestampAtLastDoubleClick = e->timestamp();
if (doEmit) {
selectionChanged();
#if QT_CONFIG(clipboard)
diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h
index 5648c31e21..d52200b49d 100644
--- a/src/quick/items/qquicktextcontrol_p_p.h
+++ b/src/quick/items/qquicktextcontrol_p_p.h
@@ -143,7 +143,7 @@ public:
QTextBlock blockWithMarkerUnderMousePress;
QBasicTimer cursorBlinkTimer;
- QBasicTimer tripleClickTimer;
+ ulong timestampAtLastDoubleClick = 0; // will only be set at a double click
#if QT_CONFIG(im)
int preeditCursor;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 7414d7fd6a..c4e9c0d316 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1074,7 +1074,7 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const
}
/*!
- \qmlmethod QtQuick::TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
+ \qmlmethod QtQuick::TextEdit::moveCursorSelection(int position, SelectionMode mode)
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
@@ -1085,7 +1085,7 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const
text range.
The selection mode specifies whether the selection is updated on a per character or a per word
- basis. If not specified the selection mode will default to TextEdit.SelectCharacters.
+ basis. If not specified the selection mode will default to \c {TextEdit.SelectCharacters}.
\list
\li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
@@ -2828,7 +2828,7 @@ QString QQuickTextEdit::getFormattedText(int start, int end) const
/*!
\qmlmethod QtQuick::TextEdit::insert(int position, string text)
- Inserts \a text into the TextEdit at position.
+ Inserts \a text into the TextEdit at \a position.
*/
void QQuickTextEdit::insert(int position, const QString &text)
{
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 598ebb7a68..b1ad6a1c15 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1359,8 +1359,8 @@ void QQuickTextInput::createCursor()
/*!
\qmlmethod rect QtQuick::TextInput::positionToRectangle(int pos)
- This function takes a character position and returns the rectangle that the
- cursor would occupy, if it was placed at that character position.
+ This function takes a character position \a pos and returns the rectangle
+ that the cursor would occupy, if it was placed at that character position.
This is similar to setting the cursorPosition, and then querying the cursor
rectangle, but the cursorPosition is not changed.
@@ -1390,10 +1390,10 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
}
/*!
- \qmlmethod int QtQuick::TextInput::positionAt(real x, real y, CursorPosition position = CursorBetweenCharacters)
+ \qmlmethod int QtQuick::TextInput::positionAt(real x, real y, CursorPosition position)
This function returns the character position at
- x and y pixels from the top left of the textInput. Position 0 is before the
+ \a x and \a y pixels from the top left of the textInput. Position 0 is before the
first character, position 1 is after the first character but before the second,
and so on until position text.length, which is after all characters.
@@ -1403,12 +1403,13 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const
the first line and if it is below the text the position of the nearest character
on the last line will be returned.
- The cursor position type specifies how the cursor position should be resolved.
+ The cursor \a position parameter specifies how the cursor position should be resolved:
- \list
- \li TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x.
- \li TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.
- \endlist
+ \value TextInput.CursorBetweenCharacters
+ Returns the position between characters that is nearest x.
+ This is the default value.
+ \value TextInput.CursorOnCharacter
+ Returns the position before the character that is nearest x.
*/
void QQuickTextInput::positionAt(QQmlV4Function *args) const
@@ -2132,7 +2133,7 @@ void QQuickTextInput::redo()
/*!
\qmlmethod QtQuick::TextInput::insert(int position, string text)
- Inserts \a text into the TextInput at position.
+ Inserts \a text into the TextInput at \a position.
*/
void QQuickTextInput::insert(int position, const QString &text)
@@ -2539,7 +2540,7 @@ void QQuickTextInput::moveCursorSelection(int position)
}
/*!
- \qmlmethod QtQuick::TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters)
+ \qmlmethod QtQuick::TextInput::moveCursorSelection(int position, SelectionMode mode)
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
@@ -2550,7 +2551,7 @@ void QQuickTextInput::moveCursorSelection(int position)
text range.
The selection mode specifies whether the selection is updated on a per character or a per word
- basis. If not specified the selection mode will default to TextInput.SelectCharacters.
+ basis. If not specified the selection mode will default to \c {TextInput.SelectCharacters}.
\list
\li TextInput.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index c4a8370f34..7af90f0f8e 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -781,8 +781,8 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
for (int i = 0; i < m_backgrounds.size(); ++i) {
const QRectF &rect = m_backgrounds.at(i).first;
const QColor &color = m_backgrounds.at(i).second;
-
- parentNode->addRectangleNode(rect, color);
+ if (color.alpha() != 0)
+ parentNode->addRectangleNode(rect, color);
}
// Add all text with unselected color first
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index d1f4f49abd..e67d531135 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -424,6 +424,13 @@ void QQuickWindowPrivate::syncSceneGraph()
{
Q_Q(QQuickWindow);
+ // Calculate the dpr the same way renderSceneGraph() will.
+ qreal devicePixelRatio = q->effectiveDevicePixelRatio();
+ if (renderTargetId && !QQuickRenderControl::renderWindowFor(q))
+ devicePixelRatio = 1;
+
+ context->prepareSync(devicePixelRatio);
+
animationController->beforeNodeSync();
emit q->beforeSynchronizing();
@@ -500,10 +507,10 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa
renderer->setDeviceRect(rect);
renderer->setViewportRect(rect);
if (QQuickRenderControl::renderWindowFor(q)) {
- renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size), false);
+ renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
renderer->setDevicePixelRatio(devicePixelRatio);
} else {
- renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), rect.size()), false);
+ renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), rect.size()));
renderer->setDevicePixelRatio(1);
}
} else {
@@ -520,7 +527,10 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa
renderer->setDeviceRect(rect);
renderer->setViewportRect(rect);
const bool flipY = rhi ? !rhi->isYUpInNDC() : false;
- renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), logicalSize), flipY);
+ QSGAbstractRenderer::MatrixTransformFlags matrixFlags = 0;
+ if (flipY)
+ matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
+ renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), logicalSize), matrixFlags);
renderer->setDevicePixelRatio(devicePixelRatio);
}
@@ -641,7 +651,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
q->setVulkanInstance(QSGRhiSupport::vulkanInstance());
#endif
- animationController = new QQuickAnimatorController(q);
+ animationController.reset(new QQuickAnimatorController(q));
QObject::connect(context, SIGNAL(initialized()), q, SIGNAL(sceneGraphInitialized()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SIGNAL(sceneGraphInvalidated()), Qt::DirectConnection);
@@ -4749,7 +4759,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \return a pointer to a GraphicsStateInfo struct describing some of the
+ \return a reference to a GraphicsStateInfo struct describing some of the
RHI's internal state, in particular, the double or tripple buffering status
of the backend (such as, the Vulkan or Metal integrations). This is
relevant when the underlying graphics APIs is Vulkan or Metal, and the
@@ -4757,14 +4767,14 @@ void QQuickWindow::resetOpenGLState()
its own often-changing resources, such as, uniform buffers, in order to
avoid stalling the pipeline.
*/
-const QQuickWindow::GraphicsStateInfo *QQuickWindow::graphicsStateInfo()
+const QQuickWindow::GraphicsStateInfo &QQuickWindow::graphicsStateInfo()
{
Q_D(QQuickWindow);
if (d->rhi) {
d->rhiStateInfo.currentFrameSlot = d->rhi->currentFrameSlot();
d->rhiStateInfo.framesInFlight = d->rhi->resourceLimit(QRhi::FramesInFlight);
}
- return &d->rhiStateInfo;
+ return d->rhiStateInfo;
}
/*!
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index db382de459..bec1ace2a6 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -145,10 +145,10 @@ public:
void resetOpenGLState();
#endif
struct GraphicsStateInfo {
- int currentFrameSlot = 0;
- int framesInFlight = 0;
+ int currentFrameSlot;
+ int framesInFlight;
};
- const GraphicsStateInfo *graphicsStateInfo();
+ const GraphicsStateInfo &graphicsStateInfo();
void beginExternalCommands();
void endExternalCommands();
QQmlIncubationController *incubationController() const;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 6876662a81..432ed99a53 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -254,7 +254,7 @@ public:
QSGRenderLoop *windowManager;
QQuickRenderControl *renderControl;
- QQuickAnimatorController *animationController;
+ QScopedPointer<QQuickAnimatorController> animationController;
QScopedPointer<QTouchEvent> delayedTouch;
int pointerEventRecursionGuard;
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index f5a41410ee..c97dcb9326 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -100,7 +100,7 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window)
rc->invalidate();
}
- delete d->animationController;
+ d->animationController.reset();
}
void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index 2d4dcd928d..c6b463bb02 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -292,7 +292,7 @@ bool QSGSoftwareRenderThread::event(QEvent *e)
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
if (wme->destroying)
- delete wd->animationController;
+ wd->animationController.reset();
}
if (wme->destroying)
active = false;
@@ -844,7 +844,8 @@ void QSGSoftwareThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (!w->thread->isRunning()) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "starting render thread");
// Push a few things to the render thread.
- QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController;
+ QQuickAnimatorController *controller
+ = QQuickWindowPrivate::get(w->window)->animationController.get();
if (controller->thread() != w->thread)
controller->moveToThread(w->thread);
if (w->thread->thread() == QThread::currentThread()) {
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
index 679ad1d445..62ed342244 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
@@ -73,6 +73,22 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QSGAbstractRenderer::MatrixTransformFlag
+
+ Used with setProjectionMatrixToRect() to indicate the expectations towards
+ the generated projection matrix.
+
+ \value MatrixTransformFlipY The traditional assumption in Qt Quick is that
+ Y points up in the normalized device coordinate system. There is at least
+ one modern graphics API where this is not the case (Vulkan). This flag can
+ then be used to get a projection that is appropriate for such an API.
+
+ \sa setProjectionMatrixToRect()
+
+ \since 5.14
+ */
+
+/*!
\fn void QSGAbstractRenderer::renderScene(GLuint fboId = 0)
Render the scene to the specified \a fboId
@@ -224,14 +240,38 @@ QRect QSGAbstractRenderer::viewportRect() const
Convenience method that calls setProjectionMatrix() with an
orthographic matrix generated from \a rect.
- \a flipY must be \c true when the graphics API uses Y down in its
- normalized device coordinate system (for example, Vulkan), \c false
- otherwise.
+ \note This function assumes that the graphics API uses Y up in its
+ normalized device coordinate system.
\sa setProjectionMatrix(), projectionMatrix()
*/
-void QSGAbstractRenderer::setProjectionMatrixToRect(const QRectF &rect, bool flipY)
+void QSGAbstractRenderer::setProjectionMatrixToRect(const QRectF &rect)
+{
+ QMatrix4x4 matrix;
+ matrix.ortho(rect.x(),
+ rect.x() + rect.width(),
+ rect.y() + rect.height(),
+ rect.y(),
+ 1,
+ -1);
+ setProjectionMatrix(matrix);
+ setProjectionMatrixWithNativeNDC(matrix);
+}
+
+/*!
+ Convenience method that calls setProjectionMatrix() with an
+ orthographic matrix generated from \a rect.
+
+ Set MatrixTransformFlipY in \a flags when the graphics API uses Y down in
+ its normalized device coordinate system (for example, Vulkan).
+
+ \sa setProjectionMatrix(), projectionMatrix()
+
+ \since 5.14
+ */
+void QSGAbstractRenderer::setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags)
{
+ const bool flipY = flags.testFlag(MatrixTransformFlipY);
QMatrix4x4 matrix;
matrix.ortho(rect.x(),
rect.x() + rect.width(),
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
index 08e600e0b8..1594352dab 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
@@ -63,6 +63,13 @@ public:
Q_DECLARE_FLAGS(ClearMode, ClearModeBit)
Q_FLAG(ClearMode)
+ enum MatrixTransformFlag
+ {
+ MatrixTransformFlipY = 0x01
+ };
+ Q_DECLARE_FLAGS(MatrixTransformFlags, MatrixTransformFlag)
+ Q_FLAG(MatrixTransformFlags)
+
~QSGAbstractRenderer() override;
void setRootNode(QSGRootNode *node);
@@ -75,7 +82,8 @@ public:
inline void setViewportRect(const QSize &size) { setViewportRect(QRect(QPoint(), size)); }
QRect viewportRect() const;
- void setProjectionMatrixToRect(const QRectF &rect, bool flipY = false);
+ void setProjectionMatrixToRect(const QRectF &rect);
+ void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags);
void setProjectionMatrix(const QMatrix4x4 &matrix);
void setProjectionMatrixWithNativeNDC(const QMatrix4x4 &matrix);
QMatrix4x4 projectionMatrix() const;
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index a566a2bed6..9f24bf036b 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -400,14 +400,14 @@ void ShaderManager::clearCachedRendererData()
}
}
-QRhiShaderResourceBindings *ShaderManager::srb(const QVector<QRhiShaderResourceBinding> &bindings)
+QRhiShaderResourceBindings *ShaderManager::srb(const ShaderResourceBindingList &bindings)
{
auto it = srbCache.constFind(bindings);
if (it != srbCache.constEnd())
return *it;
QRhiShaderResourceBindings *srb = context->rhi()->newShaderResourceBindings();
- srb->setBindings(bindings);
+ srb->setBindings(bindings.cbegin(), bindings.cend());
if (srb->build()) {
srbCache.insert(bindings, srb);
} else {
@@ -1123,6 +1123,9 @@ void Renderer::releaseCachedResources()
m_pipelines.clear();
m_samplers.clear();
m_dummyTexture = nullptr;
+
+ if (m_rhi)
+ m_rhi->releaseCachedResources();
}
void Renderer::invalidateAndRecycleBatch(Batch *b)
@@ -2846,8 +2849,10 @@ void Renderer::updateClipState(const QSGClipNode *clipList, Batch *batch) // RHI
else {
if (qsg_topology(g->drawingMode()) != m_stencilClipCommon.topology)
qWarning("updateClipState: Clip list entries have different primitive topologies, this is not currently supported.");
+#if 0 // ### restore once the 5.14 submodule update is done
if (qsg_vertexInputFormat(*a) != m_stencilClipCommon.inputLayout.attributes().first().format())
qWarning("updateClipState: Clip list entries have different vertex input layouts, this is must not happen.");
+#endif
}
#endif
@@ -3250,7 +3255,7 @@ bool Renderer::ensurePipelineState(Element *e, const ShaderManager::Shader *sms)
// Build a new one. This is potentially expensive.
QRhiGraphicsPipeline *ps = m_rhi->newGraphicsPipeline();
- ps->setShaderStages(sms->programRhi.shaderStages);
+ ps->setShaderStages(sms->programRhi.shaderStages.cbegin(), sms->programRhi.shaderStages.cend());
ps->setVertexInputLayout(sms->programRhi.inputLayout);
ps->setShaderResourceBindings(e->srb);
ps->setRenderPassDescriptor(renderPassDescriptor());
@@ -3423,9 +3428,9 @@ static void materialToRendererGraphicsState(GraphicsState *dst,
}
void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms,
- const QSGMaterialRhiShader::RenderState &renderState,
+ QSGMaterialRhiShader::RenderState &renderState,
QSGMaterial *material,
- QVector<QRhiShaderResourceBinding> *bindings,
+ ShaderManager::ShaderResourceBindingList *bindings,
const Batch *batch,
int ubufOffset,
int ubufRegionSize) // RHI only, [prepare step]
@@ -3437,6 +3442,7 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms,
if (pd->ubufBinding >= 0) {
m_current_uniform_data = &pd->masterUniformData;
const bool changed = shader->updateUniformData(renderState, material, m_currentMaterial);
+ m_current_uniform_data = nullptr;
if (changed || !batch->ubufDataValid)
m_resourceUpdates->updateDynamicBuffer(batch->ubuf, ubufOffset, ubufRegionSize, pd->masterUniformData.constData());
@@ -3513,7 +3519,7 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms,
}
void Renderer::updateMaterialStaticData(ShaderManager::Shader *sms,
- const QSGMaterialRhiShader::RenderState &renderState,
+ QSGMaterialRhiShader::RenderState &renderState,
QSGMaterial *material,
Batch *batch,
bool *gstateChanged) // RHI only, [prepare step]
@@ -3621,12 +3627,12 @@ bool Renderer::prepareRenderMergedBatch(Batch *batch, PreparedRenderBatch *rende
}
}
- const QSGMaterialRhiShader::RenderState renderState = rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty)));
+ QSGMaterialRhiShader::RenderState renderState = rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty)));
bool pendingGStatePop = false;
updateMaterialStaticData(sms, renderState, material, batch, &pendingGStatePop);
- QVector<QRhiShaderResourceBinding> bindings;
+ ShaderManager::ShaderResourceBindingList bindings;
updateMaterialDynamicData(sms, renderState, material, &bindings, batch, 0, ubufSize);
#ifndef QT_NO_DEBUG
@@ -3798,8 +3804,9 @@ bool Renderer::prepareRenderUnmergedBatch(Batch *batch, PreparedRenderBatch *ren
}
}
+ QSGMaterialRhiShader::RenderState renderState = rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty)));
bool pendingGStatePop = false;
- updateMaterialStaticData(sms, rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty))),
+ updateMaterialStaticData(sms, renderState,
material, batch, &pendingGStatePop);
int ubufOffset = 0;
@@ -3818,8 +3825,9 @@ bool Renderer::prepareRenderUnmergedBatch(Batch *batch, PreparedRenderBatch *ren
m_current_projection_matrix(2, 3) = 1.0f - e->order * m_zRange;
}
- QVector<QRhiShaderResourceBinding> bindings;
- updateMaterialDynamicData(sms, rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty))),
+ QSGMaterialRhiShader::RenderState renderState = rhiState(QSGMaterialRhiShader::RenderState::DirtyStates(int(dirty)));
+ ShaderManager::ShaderResourceBindingList bindings;
+ updateMaterialDynamicData(sms, renderState,
material, &bindings, batch, ubufOffset, ubufSize);
#ifndef QT_NO_DEBUG
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 4e374522d4..297df2232a 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -642,7 +642,7 @@ public:
struct {
QSGMaterialRhiShader *program = nullptr;
QRhiVertexInputLayout inputLayout;
- QVector<QRhiGraphicsShaderStage> shaderStages;
+ QVarLengthArray<QRhiGraphicsShaderStage, 2> shaderStages;
} programRhi;
float lastOpacity;
@@ -656,7 +656,9 @@ public:
void clearCachedRendererData();
- QRhiShaderResourceBindings *srb(const QVector<QRhiShaderResourceBinding> &bindings);
+ using ShaderResourceBindingList = QVarLengthArray<QRhiShaderResourceBinding, 8>;
+
+ QRhiShaderResourceBindings *srb(const ShaderResourceBindingList &bindings);
public Q_SLOTS:
void invalidated();
@@ -672,7 +674,7 @@ private:
QOpenGLShaderProgram *blitProgram;
QSGDefaultRenderContext *context;
- QHash<QVector<QRhiShaderResourceBinding>, QRhiShaderResourceBindings *> srbCache;
+ QHash<ShaderResourceBindingList, QRhiShaderResourceBindings *> srbCache;
};
struct GraphicsState
@@ -796,10 +798,10 @@ private:
void renderBatches();
bool ensurePipelineState(Element *e, const ShaderManager::Shader *sms);
QRhiTexture *dummyTexture();
- void updateMaterialDynamicData(ShaderManager::Shader *sms, const QSGMaterialRhiShader::RenderState &renderState,
- QSGMaterial *material, QVector<QRhiShaderResourceBinding> *bindings,
+ void updateMaterialDynamicData(ShaderManager::Shader *sms, QSGMaterialRhiShader::RenderState &renderState,
+ QSGMaterial *material, ShaderManager::ShaderResourceBindingList *bindings,
const Batch *batch, int ubufOffset, int ubufRegionSize);
- void updateMaterialStaticData(ShaderManager::Shader *sms, const QSGMaterialRhiShader::RenderState &renderState,
+ void updateMaterialStaticData(ShaderManager::Shader *sms, QSGMaterialRhiShader::RenderState &renderState,
QSGMaterial *material, Batch *batch, bool *gstateChanged);
void checkLineWidth(QSGGeometry *g);
bool prepareRenderMergedBatch(Batch *batch, PreparedRenderBatch *renderBatch);
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 5218b6b1d5..a28eee5288 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -576,6 +576,10 @@ const void *QSGGeometry::indexData() const
\value IntType
\value UnsignedIntType
\value FloatType
+ \value Bytes2Type Added in Qt 5.14.
+ \value Bytes3Type Added in Qt 5.14.
+ \value Bytes4Type Added in Qt 5.14.
+ \value DoubleType Added in Qt 5.14.
*/
/*!
diff --git a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
index 03f74df6b7..117d477f9a 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
@@ -301,9 +301,9 @@ void QSGMaterialRhiShader::setFlag(Flags flags, bool on)
memcpy calls) when updating material states. When \a oldMaterial is null,
this shader was just activated.
*/
-bool QSGMaterialRhiShader::updateUniformData(const RenderState &state,
- QSGMaterial *newMaterial,
- QSGMaterial *oldMaterial)
+bool QSGMaterialRhiShader::updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial,
+ QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
Q_UNUSED(newMaterial);
@@ -334,11 +334,11 @@ bool QSGMaterialRhiShader::updateUniformData(const RenderState &state,
\a oldMaterial can be used to minimize changes. When \a oldMaterial is null,
this shader was just activated.
*/
-void QSGMaterialRhiShader::updateSampledImage(const RenderState &state,
- int binding,
- QSGTexture **texture,
- QSGMaterial *newMaterial,
- QSGMaterial *oldMaterial)
+void QSGMaterialRhiShader::updateSampledImage(RenderState &state,
+ int binding,
+ QSGTexture **texture,
+ QSGMaterial *newMaterial,
+ QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
Q_UNUSED(binding);
@@ -367,8 +367,8 @@ void QSGMaterialRhiShader::updateSampledImage(const RenderState &state,
The subclass specific state can be extracted from \a newMaterial. When \a
oldMaterial is null, this shader was just activated.
*/
-bool QSGMaterialRhiShader::updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
- QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
+bool QSGMaterialRhiShader::updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
Q_UNUSED(ps);
@@ -426,12 +426,77 @@ bool QSGMaterialRhiShader::updateGraphicsPipelineState(const RenderState &state,
*/
/*!
+ \class QSGMaterialRhiShader::GraphicsPipelineState
+
+ \brief Describes state changes that the material wants to apply to the
+ currently active graphics pipeline state.
+
+ \inmodule QtQuick
+ \since 5.14
+
+ Unlike QSGMaterialShader, directly issuing state change commands with the
+ underlying graphics API is not possible with QSGMaterialRhiShader. This is
+ mainly because the concept of individually changeable states is considered
+ deprecated and not supported with modern graphics APIs.
+
+ Therefore, it is up to QSGMaterialRhiShader to expose a data structure with
+ the set of supported states, which the material can change in its
+ updatePipelineState() implementation, if there is one. The scenegraph will
+ then internally apply these changes to the active graphics pipeline state,
+ then rolling them back as appropriate.
+ */
+
+/*!
+ \enum QSGMaterialRhiShader::GraphicsPipelineState::BlendFactor
+ \since 5.14
+
+ \value Zero
+ \value One
+ \value SrcColor
+ \value OneMinusSrcColor
+ \value DstColor
+ \value OneMinusDstColor
+ \value SrcAlpha
+ \value OneMinusSrcAlpha
+ \value DstAlpha
+ \value OneMinusDstAlpha
+ \value ConstantColor
+ \value OneMinusConstantColor
+ \value ConstantAlpha
+ \value OneMinusConstantAlpha
+ \value SrcAlphaSaturate
+ \value Src1Color
+ \value OneMinusSrc1Color
+ \value Src1Alpha
+ \value OneMinusSrc1Alpha
+ */
+
+/*!
+ \enum QSGMaterialRhiShader::GraphicsPipelineState::ColorMaskComponent
+ \since 5.14
+
+ \value R
+ \value G
+ \value B
+ \value A
+ */
+
+/*!
+ \enum QSGMaterialRhiShader::GraphicsPipelineState::CullMode
+ \since 5.14
+
+ \value CullNone
+ \value CullFront
+ \value CullBack
+ */
+
+/*!
Returns the accumulated opacity to be used for rendering.
*/
float QSGMaterialRhiShader::RenderState::opacity() const
{
Q_ASSERT(m_data);
- return static_cast<const QSGRenderer *>(m_data)->currentOpacity();
+ return float(static_cast<const QSGRenderer *>(m_data)->currentOpacity());
}
/*!
@@ -440,7 +505,7 @@ float QSGMaterialRhiShader::RenderState::opacity() const
float QSGMaterialRhiShader::RenderState::determinant() const
{
Q_ASSERT(m_data);
- return static_cast<const QSGRenderer *>(m_data)->determinant();
+ return float(static_cast<const QSGRenderer *>(m_data)->determinant());
}
/*!
@@ -459,7 +524,7 @@ QMatrix4x4 QSGMaterialRhiShader::RenderState::combinedMatrix() const
float QSGMaterialRhiShader::RenderState::devicePixelRatio() const
{
Q_ASSERT(m_data);
- return static_cast<const QSGRenderer *>(m_data)->devicePixelRatio();
+ return float(static_cast<const QSGRenderer *>(m_data)->devicePixelRatio());
}
/*!
@@ -511,7 +576,10 @@ QRect QSGMaterialRhiShader::RenderState::deviceRect() const
/*!
Returns a pointer to the data for the uniform (constant) buffer in the
- shader.
+ shader. Uniform data must only be updated from
+ QSGMaterialRhiShader::updateUniformData(). The return value is null in the
+ other reimplementable functions, such as,
+ QSGMaterialRhiShader::updateSampledImage().
\note It is strongly recommended to declare the uniform block with \c
std140 in the shader, and to carefully study the standard uniform block
@@ -525,11 +593,8 @@ QRect QSGMaterialRhiShader::RenderState::deviceRect() const
\note Avoid copying from C++ POD types, such as, structs, in order to
update multiple members at once, unless it has been verified that the
layouts of the C++ struct and the GLSL uniform block match.
-
- \note Uniform data must only be updated from
- QSGMaterialRhiShader::updateUniformData().
*/
-QByteArray *QSGMaterialRhiShader::RenderState::uniformData() const
+QByteArray *QSGMaterialRhiShader::RenderState::uniformData()
{
Q_ASSERT(m_data);
return static_cast<const QSGRenderer *>(m_data)->currentUniformData();
@@ -541,7 +606,7 @@ QByteArray *QSGMaterialRhiShader::RenderState::uniformData() const
QSGMaterialRhiShader::updateSampledImage() to enqueue texture image
content updates.
*/
-QRhiResourceUpdateBatch *QSGMaterialRhiShader::RenderState::resourceUpdateBatch() const
+QRhiResourceUpdateBatch *QSGMaterialRhiShader::RenderState::resourceUpdateBatch()
{
Q_ASSERT(m_data);
return static_cast<const QSGRenderer *>(m_data)->currentResourceUpdateBatch();
@@ -550,7 +615,7 @@ QRhiResourceUpdateBatch *QSGMaterialRhiShader::RenderState::resourceUpdateBatch(
/*!
Returns the current QRhi.
*/
-QRhi *QSGMaterialRhiShader::RenderState::rhi() const
+QRhi *QSGMaterialRhiShader::RenderState::rhi()
{
Q_ASSERT(m_data);
return static_cast<const QSGRenderer *>(m_data)->currentRhi();
diff --git a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.h b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.h
index 01991135ec..86208516cd 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.h
@@ -76,9 +76,9 @@ public:
float determinant() const;
float devicePixelRatio() const;
- QByteArray *uniformData() const;
- QRhiResourceUpdateBatch *resourceUpdateBatch() const;
- QRhi *rhi() const;
+ QByteArray *uniformData();
+ QRhiResourceUpdateBatch *resourceUpdateBatch();
+ QRhi *rhi();
private:
friend class QSGRenderer;
@@ -146,13 +146,13 @@ public:
QSGMaterialRhiShader();
virtual ~QSGMaterialRhiShader();
- virtual bool updateUniformData(const RenderState &state,
+ virtual bool updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
- virtual void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ virtual void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
- virtual bool updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+ virtual bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
Flags flags() const;
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
index bc68199e08..0fee1486cf 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
@@ -78,11 +78,11 @@ QT_BEGIN_NAMESPACE
\value OpenGL OpenGL ES 2.0 or higher
\value Direct3D12 Direct3D 12
\value OpenVG OpenVG via EGL
- \value OpenGLRhi OpenGL ES 2.0 or higher via a graphics abstraction layer
- \value Direct3D11Rhi Direct3D 11 via a graphics abstraction layer
- \value VulkanRhi Vulkan 1.0 via a graphics abstraction layer
- \value MetalRhi Metal via a graphics abstraction layer
- \value NullRhi Null (no output) via a graphics abstraction layer
+ \value OpenGLRhi OpenGL ES 2.0 or higher via a graphics abstraction layer. This value was introduced in Qt 5.14.
+ \value Direct3D11Rhi Direct3D 11 via a graphics abstraction layer. This value was introduced in Qt 5.14.
+ \value VulkanRhi Vulkan 1.0 via a graphics abstraction layer. This value was introduced in Qt 5.14.
+ \value MetalRhi Metal via a graphics abstraction layer. This value was introduced in Qt 5.14.
+ \value NullRhi Null (no output) via a graphics abstraction layer. This value was introduced in Qt 5.14.
*/
/*!
@@ -111,33 +111,36 @@ QT_BEGIN_NAMESPACE
used by the scenegraph, when running with the software backend.
\value RhiResource The resource is a pointer to the QRhi instance used by
- the scenegraph, when applicable.
+ the scenegraph, when applicable. This value was introduced in Qt 5.14.
\value PhysicalDeviceResource The resource is a pointer to the pysical
device object used by the scenegraph, when applicable. For example, a
\c{VkPhysicalDevice *}. Note that with Vulkan the returned value is a
- pointer to the VkPhysicalDevice, not the handle itself.
+ pointer to the VkPhysicalDevice, not the handle itself. This value was
+ introduced in Qt 5.14.
\value OpenGLContextResource The resource is a pointer to the
QOpenGLContext used by the scenegraph (on the render thread), when
- applicable.
+ applicable. This value was introduced in Qt 5.14.
\value DeviceContextResource The resource is a pointer to the device
context used by the scenegraph, when applicable. For example, a
- \c{ID3D11DeviceContext *}.
+ \c{ID3D11DeviceContext *}. This value was introduced in Qt 5.14.
\value CommandEncoderResource The resource is a pointer to the currently
active render command encoder object used by the scenegraph, when
applicable. For example, a \c{MTLRenderCommandEncoder *}. This object has
limited validity, and is only valid while the scene graph is recording a
- render pass for the next frame.
+ render pass for the next frame. This value was introduced in Qt 5.14.
\value VulkanInstanceResource The resource is a pointer to the
- QVulkanInstance used by the scenegraph, when applicable.
+ QVulkanInstance used by the scenegraph, when applicable. This value was
+ introduced in Qt 5.14.
\value RenderPassResource The resource is a pointer to the render pass used
by the scenegraph, describing the color and depth/stecil attachments and
- how they are used. For example, a \c{VkRenderPass *}.
+ how they are used. For example, a \c{VkRenderPass *}. This value was
+ introduced in Qt 5.14.
*/
/*!
@@ -145,8 +148,9 @@ QT_BEGIN_NAMESPACE
\value UnknownShadingLanguage Not yet known due to no window and scenegraph associated
\value GLSL GLSL or GLSL ES
\value HLSL HLSL
- \value RhiShader Consumes QShader instances containing shader
- variants for multiple target languages and bytecode formats
+ \value RhiShader Consumes QShader instances containing shader variants for
+ multiple target languages and intermediate formats. This value was introduced in
+ Qt 5.14.
*/
/*!
@@ -222,6 +226,8 @@ void *QSGRendererInterface::getResource(QQuickWindow *window, const char *resour
instead of directly calling the native graphics API.
\note This function can be called on any thread.
+
+ \since 5.14
*/
bool QSGRendererInterface::isApiRhiBased(GraphicsApi api)
{
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp
index c47401e5c0..edcee96bdb 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.cpp
+++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp
@@ -717,6 +717,9 @@ void QSGTexture::updateRhiTexture(QRhi *rhi, QRhiResourceUpdateBatch *resourceUp
d->updateRhiTexture(rhi, resourceUpdates);
}
+/*!
+ \internal
+ */
void QSGTexture::setWorkResourceUpdateBatch(QRhiResourceUpdateBatch *resourceUpdates)
{
Q_D(QSGTexture);
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.h b/src/quick/scenegraph/coreapi/qsgtexture.h
index 4cd2a5cddd..2efdd8b7c3 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture.h
@@ -141,6 +141,7 @@ class Q_QUICK_EXPORT QSGDynamicTexture : public QSGTexture
Q_OBJECT
public:
+ QSGDynamicTexture() = default;
virtual bool updateTexture() = 0;
protected:
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 97fd49e4c7..17eb1e312c 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -341,6 +341,11 @@ void QSGRenderContext::invalidate()
{
}
+void QSGRenderContext::prepareSync(qreal devicePixelRatio)
+{
+ Q_UNUSED(devicePixelRatio);
+}
+
void QSGRenderContext::beginNextFrame(QSGRenderer *renderer,
RenderPassCallback mainPassRecordingStart,
RenderPassCallback mainPassRecordingEnd,
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index 4e712ab7c3..244bcfabd1 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -174,6 +174,7 @@ public:
using RenderPassCallback = void (*)(void *);
+ virtual void prepareSync(qreal devicePixelRatio);
virtual void beginNextFrame(QSGRenderer *renderer,
RenderPassCallback mainPassRecordingStart,
RenderPassCallback mainPassRecordingEnd,
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 8fc8c711c6..be6ef25feb 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -410,9 +410,9 @@ class QSGTextMaskRhiShader : public QSGMaterialRhiShader
public:
QSGTextMaskRhiShader(QFontEngine::GlyphFormat glyphFormat);
- bool updateUniformData(const RenderState &state,
+ bool updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
protected:
@@ -428,7 +428,7 @@ QSGTextMaskRhiShader::QSGTextMaskRhiShader(QFontEngine::GlyphFormat glyphFormat)
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/textmask.frag.qsb"));
}
-bool QSGTextMaskRhiShader::updateUniformData(const RenderState &state,
+bool QSGTextMaskRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
@@ -471,7 +471,7 @@ bool QSGTextMaskRhiShader::updateUniformData(const RenderState &state,
return changed;
}
-void QSGTextMaskRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QSGTextMaskRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
Q_UNUSED(state);
@@ -498,10 +498,10 @@ public:
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/8bittextmask.frag.qsb"));
}
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
-bool QSG8BitTextMaskRhiShader::updateUniformData(const RenderState &state,
+bool QSG8BitTextMaskRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSGTextMaskRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -532,8 +532,8 @@ public:
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/24bittextmask.frag.qsb"));
}
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- bool updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
@@ -544,7 +544,7 @@ public:
// framebuffer update and blending always on... Could we do gamma correction in
// the shader for text? (but that's bad for blending?)
-bool QSG24BitTextMaskRhiShader::updateUniformData(const RenderState &state,
+bool QSG24BitTextMaskRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSGTextMaskRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -565,7 +565,7 @@ bool QSG24BitTextMaskRhiShader::updateUniformData(const RenderState &state,
return changed;
}
-bool QSG24BitTextMaskRhiShader::updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+bool QSG24BitTextMaskRhiShader::updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
@@ -596,10 +596,10 @@ public:
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/32bitcolortext.frag.qsb"));
}
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
-bool QSG32BitColorTextRhiShader::updateUniformData(const RenderState &state,
+bool QSG32BitColorTextRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSGTextMaskRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -636,11 +636,11 @@ public:
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/styledtext.frag.qsb"));
}
- bool updateUniformData(const RenderState &state,
+ bool updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
-bool QSGStyledTextRhiShader::updateUniformData(const RenderState &state,
+bool QSGStyledTextRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSG8BitTextMaskRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -751,15 +751,15 @@ void QSGTextMaskMaterial::updateCache(QFontEngine::GlyphFormat glyphFormat)
void *cacheKey;
if (m_rhi) {
cacheKey = m_rhi;
- // ### no idea what the QWindow is (esp. since we are not even
- // rendering at this point), and anyway is the original logic correct
- // even...
- devicePixelRatio = qGuiApp->devicePixelRatio();
+ // Get the dpr the modern way. This value retrieved via the
+ // rendercontext matches what RenderState::devicePixelRatio()
+ // exposes to the material shaders later on.
+ devicePixelRatio = m_rc->currentDevicePixelRatio();
} else {
ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
Q_ASSERT(ctx != nullptr);
cacheKey = ctx;
- devicePixelRatio = qsg_device_pixel_ratio(ctx);
+ devicePixelRatio = qsg_device_pixel_ratio(ctx); // this is technically incorrect, see other branch above
}
QTransform glyphCacheTransform = QTransform::fromScale(devicePixelRatio, devicePixelRatio);
diff --git a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
index d1711f7524..500d4e6e95 100644
--- a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp
@@ -66,7 +66,7 @@ class SmoothTextureMaterialRhiShader : public QSGTextureMaterialRhiShader
public:
SmoothTextureMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
@@ -136,7 +136,7 @@ SmoothTextureMaterialRhiShader::SmoothTextureMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/smoothtexture.frag.qsb"));
}
-bool SmoothTextureMaterialRhiShader::updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
+bool SmoothTextureMaterialRhiShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = false;
QByteArray *buf = state.uniformData();
diff --git a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
index 417b63dee3..5e4affbf90 100644
--- a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp
@@ -111,7 +111,7 @@ class SmoothColorMaterialRhiShader : public QSGMaterialRhiShader
public:
SmoothColorMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
SmoothColorMaterialRhiShader::SmoothColorMaterialRhiShader()
@@ -120,7 +120,7 @@ SmoothColorMaterialRhiShader::SmoothColorMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/smoothcolor.frag.qsb"));
}
-bool SmoothColorMaterialRhiShader::updateUniformData(const RenderState &state, QSGMaterial *, QSGMaterial *oldMaterial)
+bool SmoothColorMaterialRhiShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *oldMaterial)
{
bool changed = false;
QByteArray *buf = state.uniformData();
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index f43b5436a6..e8c3ac4abb 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -200,6 +200,11 @@ void QSGDefaultRenderContext::invalidate()
emit invalidated();
}
+void QSGDefaultRenderContext::prepareSync(qreal devicePixelRatio)
+{
+ m_currentDevicePixelRatio = devicePixelRatio;
+}
+
static QBasicMutex qsg_framerender_mutex;
void QSGDefaultRenderContext::beginNextFrame(QSGRenderer *renderer,
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
index 6a3462ae2b..2fdb3a48dd 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h
+++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
@@ -104,6 +104,7 @@ public:
void initialize(const QSGRenderContext::InitParams *params) override;
void invalidate() override;
+ void prepareSync(qreal devicePixelRatio) override;
void beginNextFrame(QSGRenderer *renderer,
RenderPassCallback mainPassRecordingStart,
RenderPassCallback mainPassRecordingEnd,
@@ -151,6 +152,17 @@ public:
return m_currentFrameRenderPass;
}
+ qreal currentDevicePixelRatio() const
+ {
+ // Valid starting from QQuickWindow::syncSceneGraph(). This takes the
+ // redirections, e.g. QQuickWindow::setRenderTarget(), into account.
+ // This calculation logic matches what the renderer does, so this is
+ // the same value that gets exposed in RenderState::devicePixelRatio()
+ // to material shaders. This getter is useful to perform dpr-related
+ // operations in the sync phase (in updatePaintNode()).
+ return m_currentDevicePixelRatio;
+ }
+
protected:
static QString fontKey(const QRawFont &font);
@@ -166,6 +178,7 @@ protected:
QSGRhiAtlasTexture::Manager *m_rhiAtlasManager;
QRhiCommandBuffer *m_currentFrameCommandBuffer;
QRhiRenderPassDescriptor *m_currentFrameRenderPass;
+ qreal m_currentDevicePixelRatio;
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp
index 4d4d9f6971..6422a252d9 100644
--- a/src/quick/scenegraph/qsgdefaultspritenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp
@@ -141,9 +141,9 @@ class SpriteMaterialRhiShader : public QSGMaterialRhiShader
public:
SpriteMaterialRhiShader();
- bool updateUniformData(const RenderState &state,
+ bool updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
@@ -153,7 +153,7 @@ SpriteMaterialRhiShader::SpriteMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/sprite.frag.qsb"));
}
-bool SpriteMaterialRhiShader::updateUniformData(const RenderState &state,
+bool SpriteMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
#ifdef QT_NO_DEBUG
@@ -186,7 +186,7 @@ bool SpriteMaterialRhiShader::updateUniformData(const RenderState &state,
return changed;
}
-void SpriteMaterialRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void SpriteMaterialRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
if (binding != 1)
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index 9121363159..e8e9f76d04 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -212,10 +212,10 @@ class QSGDistanceFieldTextMaterialRhiShader : public QSGMaterialRhiShader
public:
QSGDistanceFieldTextMaterialRhiShader(bool alphaTexture);
- bool updateUniformData(const RenderState &state,
+ bool updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
protected:
@@ -235,7 +235,7 @@ QSGDistanceFieldTextMaterialRhiShader::QSGDistanceFieldTextMaterialRhiShader(boo
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/distancefieldtext.frag.qsb"));
}
-bool QSGDistanceFieldTextMaterialRhiShader::updateUniformData(const RenderState &state,
+bool QSGDistanceFieldTextMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
@@ -291,7 +291,7 @@ bool QSGDistanceFieldTextMaterialRhiShader::updateUniformData(const RenderState
return changed;
}
-void QSGDistanceFieldTextMaterialRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QSGDistanceFieldTextMaterialRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
Q_UNUSED(state);
@@ -432,7 +432,7 @@ class DistanceFieldStyledTextMaterialRhiShader : public QSGDistanceFieldTextMate
public:
DistanceFieldStyledTextMaterialRhiShader(bool alphaTexture);
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
DistanceFieldStyledTextMaterialRhiShader::DistanceFieldStyledTextMaterialRhiShader(bool alphaTexture)
@@ -440,7 +440,7 @@ DistanceFieldStyledTextMaterialRhiShader::DistanceFieldStyledTextMaterialRhiShad
{
}
-bool DistanceFieldStyledTextMaterialRhiShader::updateUniformData(const RenderState &state,
+bool DistanceFieldStyledTextMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSGDistanceFieldTextMaterialRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -548,7 +548,7 @@ class DistanceFieldOutlineTextMaterialRhiShader : public DistanceFieldStyledText
public:
DistanceFieldOutlineTextMaterialRhiShader(bool alphaTexture);
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
DistanceFieldOutlineTextMaterialRhiShader::DistanceFieldOutlineTextMaterialRhiShader(bool alphaTexture)
@@ -564,7 +564,7 @@ DistanceFieldOutlineTextMaterialRhiShader::DistanceFieldOutlineTextMaterialRhiSh
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb"));
}
-bool DistanceFieldOutlineTextMaterialRhiShader::updateUniformData(const RenderState &state,
+bool DistanceFieldOutlineTextMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = DistanceFieldStyledTextMaterialRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -670,7 +670,7 @@ class DistanceFieldShiftedStyleTextMaterialRhiShader : public DistanceFieldStyle
public:
DistanceFieldShiftedStyleTextMaterialRhiShader(bool alphaTexture);
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
DistanceFieldShiftedStyleTextMaterialRhiShader::DistanceFieldShiftedStyleTextMaterialRhiShader(bool alphaTexture)
@@ -686,7 +686,7 @@ DistanceFieldShiftedStyleTextMaterialRhiShader::DistanceFieldShiftedStyleTextMat
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb"));
}
-bool DistanceFieldShiftedStyleTextMaterialRhiShader::updateUniformData(const RenderState &state,
+bool DistanceFieldShiftedStyleTextMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = DistanceFieldStyledTextMaterialRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -809,8 +809,8 @@ class QSGHiQSubPixelDistanceFieldTextMaterialRhiShader : public QSGDistanceField
public:
QSGHiQSubPixelDistanceFieldTextMaterialRhiShader(bool alphaTexture);
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- bool updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
@@ -829,7 +829,7 @@ QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::QSGHiQSubPixelDistanceFieldTex
QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb"));
}
-bool QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::updateUniformData(const RenderState &state,
+bool QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = QSGDistanceFieldTextMaterialRhiShader::updateUniformData(state, newMaterial, oldMaterial);
@@ -855,7 +855,7 @@ bool QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::updateUniformData(const R
return changed;
}
-bool QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+bool QSGHiQSubPixelDistanceFieldTextMaterialRhiShader::updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
diff --git a/src/quick/scenegraph/qsgopengllayer.cpp b/src/quick/scenegraph/qsgopengllayer.cpp
index 8db4cba58a..ae5032231d 100644
--- a/src/quick/scenegraph/qsgopengllayer.cpp
+++ b/src/quick/scenegraph/qsgopengllayer.cpp
@@ -408,7 +408,7 @@ void QSGOpenGLLayer::grab()
m_mirrorVertical ? m_rect.bottom() : m_rect.top(),
m_mirrorHorizontal ? -m_rect.width() : m_rect.width(),
m_mirrorVertical ? -m_rect.height() : m_rect.height());
- m_renderer->setProjectionMatrixToRect(mirrored, false);
+ m_renderer->setProjectionMatrixToRect(mirrored);
m_renderer->setClearColor(Qt::transparent);
if (m_multisampling) {
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index f15105168e..ba231f8159 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -190,6 +190,7 @@ public:
QSGRenderContext *createRenderContext(QSGContext *) const override { return rc; }
void releaseSwapchain(QQuickWindow *window);
+ void handleDeviceLoss();
bool eventFilter(QObject *watched, QEvent *event) override;
@@ -435,7 +436,26 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
gl->doneCurrent();
}
- delete d->animationController;
+ d->animationController.reset();
+}
+
+void QSGGuiThreadRenderLoop::handleDeviceLoss()
+{
+ if (!rhi || !rhi->isDeviceLost())
+ return;
+
+ qWarning("Graphics device lost, cleaning up scenegraph and releasing RHI");
+
+ for (auto it = m_windows.constBegin(), itEnd = m_windows.constEnd(); it != itEnd; ++it)
+ QQuickWindowPrivate::get(it.key())->cleanupNodesOnShutdown();
+
+ rc->invalidate();
+
+ for (auto it = m_windows.constBegin(), itEnd = m_windows.constEnd(); it != itEnd; ++it)
+ releaseSwapchain(it.key());
+
+ delete rhi;
+ rhi = nullptr;
}
void QSGGuiThreadRenderLoop::releaseSwapchain(QQuickWindow *window)
@@ -488,8 +508,11 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
const bool enableRhi = rhiSupport->isRhiEnabled();
if (enableRhi && !rhi) {
- offscreenSurface = rhiSupport->maybeCreateOffscreenSurface(window);
+ if (!offscreenSurface)
+ offscreenSurface = rhiSupport->maybeCreateOffscreenSurface(window);
+
rhi = rhiSupport->createRhi(window, offscreenSurface);
+
if (rhi) {
if (rhiSupport->isProfilingRequested())
QSGRhiProfileConnection::instance()->initialize(rhi);
@@ -561,6 +584,14 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab
+ // QQ is always premul alpha. Decide based on alphaBufferSize in
+ // requestedFormat(). (the platform plugin can override format() but
+ // what matters here is what the application wanted, hence using the
+ // requested one)
+ const bool alpha = window->requestedFormat().alphaBufferSize() > 0;
+ if (alpha)
+ flags |= QRhiSwapChain::SurfaceHasPreMulAlpha;
+
cd->swapchain = rhi->newSwapChain();
cd->depthStencilForSwapchain = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
QSize(),
@@ -568,7 +599,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QRhiRenderBuffer::UsedWithSwapChainOnly);
cd->swapchain->setWindow(window);
cd->swapchain->setDepthStencil(cd->depthStencilForSwapchain);
- qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d", rhiSampleCount);
+ qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d. Alpha channel requested = %s",
+ rhiSampleCount, alpha ? "yes" : "no");
cd->swapchain->setSampleCount(rhiSampleCount);
cd->swapchain->setFlags(flags);
cd->rpDescForSwapchain = cd->swapchain->newCompatibleRenderPassDescriptor();
@@ -634,17 +666,25 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (previousOutputSize != effectiveOutputSize || cd->swapchainJustBecameRenderable) {
if (cd->swapchainJustBecameRenderable)
qCDebug(QSG_LOG_RENDERLOOP, "just became exposed");
- cd->swapchainJustBecameRenderable = false;
- cd->depthStencilForSwapchain->setPixelSize(effectiveOutputSize);
- cd->depthStencilForSwapchain->build();
cd->hasActiveSwapchain = cd->swapchain->buildOrResize();
+ if (!cd->hasActiveSwapchain && rhi->isDeviceLost()) {
+ handleDeviceLoss();
+ return;
+ }
+ cd->swapchainJustBecameRenderable = false;
cd->hasRenderableSwapchain = cd->hasActiveSwapchain;
- if (!cd->hasActiveSwapchain)
- qWarning("Failed to build or resize swapchain");
- else
+
+ if (cd->hasActiveSwapchain) {
+ // surface size atomicity: now that buildOrResize() succeeded,
+ // query the size that was used in there by the swapchain, and
+ // that is the size we will use while preparing the next frame.
+ effectiveOutputSize = cd->swapchain->currentPixelSize();
qCDebug(QSG_LOG_RENDERLOOP) << "rhi swapchain size" << effectiveOutputSize;
+ } else {
+ qWarning("Failed to build or resize swapchain");
+ }
}
Q_ASSERT(rhi == cd->rhi);
@@ -653,7 +693,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain, frameFlags);
if (frameResult != QRhi::FrameOpSuccess) {
if (frameResult == QRhi::FrameOpDeviceLost)
- qWarning("Device lost");
+ handleDeviceLoss();
else if (frameResult == QRhi::FrameOpError)
qWarning("Failed to start frame");
// out of date is not worth warning about - it may happen even during resizing on some platforms
@@ -692,7 +732,13 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
QRhi::EndFrameFlags flags = 0;
if (!needsPresent)
flags |= QRhi::SkipPresent;
- rhi->endFrame(cd->swapchain, flags);
+ QRhi::FrameOpResult frameResult = rhi->endFrame(cd->swapchain, flags);
+ if (frameResult != QRhi::FrameOpSuccess) {
+ if (frameResult == QRhi::FrameOpDeviceLost)
+ handleDeviceLoss();
+ else if (frameResult == QRhi::FrameOpError)
+ qWarning("Failed to end frame");
+ }
} else if (needsPresent) {
if (!cd->customRenderStage || !cd->customRenderStage->swap())
gl->swapBuffers(window);
diff --git a/src/quick/scenegraph/qsgrhilayer.cpp b/src/quick/scenegraph/qsgrhilayer.cpp
index 80ca40d50a..757410eded 100644
--- a/src/quick/scenegraph/qsgrhilayer.cpp
+++ b/src/quick/scenegraph/qsgrhilayer.cpp
@@ -388,7 +388,10 @@ void QSGRhiLayer::grab()
m_mirrorHorizontal ? -m_rect.width() : m_rect.width(),
m_mirrorVertical ? m_rect.height() : -m_rect.height());
}
- m_renderer->setProjectionMatrixToRect(mirrored, !m_rhi->isYUpInNDC());
+ QSGAbstractRenderer::MatrixTransformFlags matrixFlags = 0;
+ if (!m_rhi->isYUpInNDC())
+ matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
+ m_renderer->setProjectionMatrixToRect(mirrored, matrixFlags);
m_renderer->setClearColor(Qt::transparent);
m_renderer->setRenderTarget(m_rt);
m_renderer->setCommandBuffer(m_context->currentFrameCommandBuffer());
diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
index fe9cecb51b..6f6544548c 100644
--- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp
+++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
@@ -211,9 +211,9 @@ class QSGRhiShaderEffectMaterialShader : public QSGMaterialRhiShader
public:
QSGRhiShaderEffectMaterialShader(const QSGRhiShaderEffectMaterial *material);
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- bool updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
QSGRhiShaderEffectMaterialShader::QSGRhiShaderEffectMaterialShader(const QSGRhiShaderEffectMaterial *material)
@@ -228,7 +228,7 @@ static inline QColor qsg_premultiply_color(const QColor &c)
return QColor::fromRgbF(c.redF() * c.alphaF(), c.greenF() * c.alphaF(), c.blueF() * c.alphaF(), c.alphaF());
}
-bool QSGRhiShaderEffectMaterialShader::updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
+bool QSGRhiShaderEffectMaterialShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(oldMaterial);
QSGRhiShaderEffectMaterial *mat = static_cast<QSGRhiShaderEffectMaterial *>(newMaterial);
@@ -381,7 +381,7 @@ bool QSGRhiShaderEffectMaterialShader::updateUniformData(const RenderState &stat
return changed;
}
-void QSGRhiShaderEffectMaterialShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QSGRhiShaderEffectMaterialShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(oldMaterial);
@@ -426,7 +426,7 @@ void QSGRhiShaderEffectMaterialShader::updateSampledImage(const RenderState &sta
*texture = mat->m_dummyTexture;
}
-bool QSGRhiShaderEffectMaterialShader::updateGraphicsPipelineState(const RenderState &state, GraphicsPipelineState *ps,
+bool QSGRhiShaderEffectMaterialShader::updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_UNUSED(state);
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index e050938cc9..12c6742342 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -101,7 +101,8 @@ QSGRhiSupport::QSGRhiSupport()
m_enableRhi(false),
m_debugLayer(false),
m_profile(false),
- m_shaderEffectDebug(false)
+ m_shaderEffectDebug(false),
+ m_preferSoftwareRenderer(false)
{
}
@@ -140,7 +141,7 @@ void QSGRhiSupport::applySettings()
}
} else {
// check env.vars., fall back to platform-specific defaults when backend is not set
- m_enableRhi = qEnvironmentVariableIntValue("QSG_RHI");
+ m_enableRhi = uint(qEnvironmentVariableIntValue("QSG_RHI"));
const QByteArray rhiBackend = qgetenv("QSG_RHI_BACKEND");
if (rhiBackend == QByteArrayLiteral("gl")
|| rhiBackend == QByteArrayLiteral("gles2")
@@ -171,12 +172,18 @@ void QSGRhiSupport::applySettings()
return;
// validation layers (Vulkan) or debug layer (D3D)
- m_debugLayer = qEnvironmentVariableIntValue("QSG_RHI_DEBUG_LAYER");
+ m_debugLayer = uint(qEnvironmentVariableIntValue("QSG_RHI_DEBUG_LAYER"));
// EnableProfiling + DebugMarkers
- m_profile = qEnvironmentVariableIntValue("QSG_RHI_PROFILE");
+ m_profile = uint(qEnvironmentVariableIntValue("QSG_RHI_PROFILE"));
- m_shaderEffectDebug = qEnvironmentVariableIntValue("QSG_RHI_SHADEREFFECT_DEBUG");
+ m_shaderEffectDebug = uint(qEnvironmentVariableIntValue("QSG_RHI_SHADEREFFECT_DEBUG"));
+
+ m_preferSoftwareRenderer = uint(qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"));
+
+ m_killDeviceFrameCount = qEnvironmentVariableIntValue("QSG_RHI_SIMULATE_DEVICE_LOSS");
+ if (m_killDeviceFrameCount > 0 && m_rhiBackend == QRhi::D3D11)
+ qDebug("Graphics device will be reset every %d frames", m_killDeviceFrameCount);
const char *backendName = "unknown";
switch (m_rhiBackend) {
@@ -201,6 +208,8 @@ void QSGRhiSupport::applySettings()
qCDebug(QSG_LOG_INFO,
"Using QRhi with backend %s\n graphics API debug/validation layers: %d\n QRhi profiling and debug markers: %d",
backendName, m_debugLayer, m_profile);
+ if (m_preferSoftwareRenderer)
+ qCDebug(QSG_LOG_INFO, "Prioritizing software renderers");
}
QSGRhiSupport *QSGRhiSupport::staticInst()
@@ -459,6 +468,8 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf
QRhi::Flags flags = 0;
if (isProfilingRequested())
flags |= QRhi::EnableProfiling | QRhi::EnableDebugMarkers;
+ if (isSoftwareRendererRequested())
+ flags |= QRhi::PreferSoftwareRenderer;
QRhi::Implementation backend = rhiBackend();
if (backend == QRhi::Null) {
@@ -489,6 +500,10 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf
if (backend == QRhi::D3D11) {
QRhiD3D11InitParams rhiParams;
rhiParams.enableDebugLayer = isDebugLayerRequested();
+ if (m_killDeviceFrameCount > 0) {
+ rhiParams.framesUntilKillingDeviceViaTdr = m_killDeviceFrameCount;
+ rhiParams.repeatDeviceKill = true;
+ }
rhi = QRhi::create(backend, &rhiParams, flags);
}
#endif
diff --git a/src/quick/scenegraph/qsgrhisupport_p.h b/src/quick/scenegraph/qsgrhisupport_p.h
index f2d5837bba..d008ecd0af 100644
--- a/src/quick/scenegraph/qsgrhisupport_p.h
+++ b/src/quick/scenegraph/qsgrhisupport_p.h
@@ -114,6 +114,7 @@ public:
bool isDebugLayerRequested() const { return m_debugLayer; }
bool isProfilingRequested() const { return m_profile; }
bool isShaderEffectDebuggingRequested() const { return m_shaderEffectDebug; }
+ bool isSoftwareRendererRequested() const { return m_preferSoftwareRenderer; }
QSurface::SurfaceType windowSurfaceType() const;
@@ -138,11 +139,13 @@ private:
uint rhi : 1;
} m_requested;
QRhi::Implementation m_rhiBackend = QRhi::Null;
+ int m_killDeviceFrameCount;
uint m_set : 1;
uint m_enableRhi : 1;
uint m_debugLayer : 1;
uint m_profile : 1;
uint m_shaderEffectDebug : 1;
+ uint m_preferSoftwareRenderer : 1;
};
// Sends QRhi resource statistics over a QTcpSocket. To be initialized by the
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 9bcb96a65a..86d9590863 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -199,7 +199,7 @@ public:
WMSyncEvent(QQuickWindow *c, bool inExpose, bool force)
: WMWindowEvent(c, WM_RequestSync)
, size(c->size())
- , dpr(c->effectiveDevicePixelRatio())
+ , dpr(float(c->effectiveDevicePixelRatio()))
, syncInExpose(inExpose)
, forceRenderPass(force)
{}
@@ -306,8 +306,7 @@ public:
delete offscreenSurface;
}
- void invalidateOpenGL(QQuickWindow *window, bool inDestructor, QOffscreenSurface *backupSurface);
- void initializeOpenGL();
+ void invalidateGraphics(QQuickWindow *window, bool inDestructor, QOffscreenSurface *backupSurface);
bool event(QEvent *) override;
void run() override;
@@ -340,6 +339,9 @@ public:
ExposeRequest = 0x04 | RepaintRequest | SyncRequest
};
+ void ensureRhi();
+ void handleDeviceLoss();
+
QSGThreadedRenderLoop *wm;
QOpenGLContext *gl;
bool enableRhi;
@@ -419,9 +421,9 @@ bool QSGRenderThread::event(QEvent *e)
WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e);
if (!window || wme->inDestructor) {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- setting exit flag and invalidating OpenGL");
- invalidateOpenGL(wme->window, wme->inDestructor, wme->needsFallback ? offscreenSurface : nullptr);
+ invalidateGraphics(wme->window, wme->inDestructor, wme->needsFallback ? offscreenSurface : nullptr);
active = gl || rhi;
- Q_ASSERT_X(!wme->inDestructor || !active, "QSGRenderThread::invalidateOpenGL()", "Thread's active state is not set to false when shutting down");
+ Q_ASSERT_X(!wme->inDestructor || !active, "QSGRenderThread::invalidateGraphics()", "Thread's active state is not set to false when shutting down");
if (sleeping)
stopEventProcessing = true;
} else {
@@ -512,9 +514,9 @@ bool QSGRenderThread::event(QEvent *e)
return QThread::event(e);
}
-void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, QOffscreenSurface *fallback)
+void QSGRenderThread::invalidateGraphics(QQuickWindow *window, bool inDestructor, QOffscreenSurface *fallback)
{
- qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "invalidateOpenGL()");
+ qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "invalidateGraphics()");
if (!gl && !rhi)
return;
@@ -562,7 +564,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
if (inDestructor)
- delete dd->animationController;
+ dd->animationController.reset();
if (current && gl)
gl->doneCurrent();
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- invalidating scene graph");
@@ -615,7 +617,7 @@ void QSGRenderThread::sync(bool inExpose, bool inGrab)
QSGDefaultRenderContext::InitParams rcParams;
rcParams.sampleCount = qMax(1, gl->format().samples());
rcParams.openGLContext = gl;
- rcParams.initialSurfacePixelSize = windowSize * dpr;
+ rcParams.initialSurfacePixelSize = windowSize * qreal(dpr);
rcParams.maybeSurface = window;
sgrc->initialize(&rcParams);
}
@@ -658,6 +660,19 @@ void QSGRenderThread::sync(bool inExpose, bool inGrab)
}
}
+void QSGRenderThread::handleDeviceLoss()
+{
+ if (!rhi || !rhi->isDeviceLost())
+ return;
+
+ qWarning("Graphics device lost, cleaning up scenegraph and releasing RHI");
+ QQuickWindowPrivate::get(window)->cleanupNodesOnShutdown();
+ sgrc->invalidate();
+ wm->releaseSwapchain(window);
+ delete rhi;
+ rhi = nullptr;
+}
+
void QSGRenderThread::syncAndRender(QImage *grabImage)
{
bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled();
@@ -699,17 +714,21 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
if (previousOutputSize != effectiveOutputSize || cd->swapchainJustBecameRenderable) {
if (cd->swapchainJustBecameRenderable)
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "just became exposed");
- cd->swapchainJustBecameRenderable = false;
- cd->depthStencilForSwapchain->setPixelSize(effectiveOutputSize);
- cd->depthStencilForSwapchain->build();
cd->hasActiveSwapchain = cd->swapchain->buildOrResize();
+ if (!cd->hasActiveSwapchain && rhi->isDeviceLost()) {
+ handleDeviceLoss();
+ QCoreApplication::postEvent(window, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
+ return;
+ }
+ cd->swapchainJustBecameRenderable = false;
cd->hasRenderableSwapchain = cd->hasActiveSwapchain;
+
if (!cd->hasActiveSwapchain)
qWarning("Failed to build or resize swapchain");
else
- qCDebug(QSG_LOG_RENDERLOOP) << "rhi swapchain size" << effectiveOutputSize;
+ qCDebug(QSG_LOG_RENDERLOOP) << "rhi swapchain size" << cd->swapchain->currentPixelSize();
}
Q_ASSERT(rhi == cd->rhi);
@@ -718,13 +737,12 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
QRhi::FrameOpResult frameResult = rhi->beginFrame(cd->swapchain, frameFlags);
if (frameResult != QRhi::FrameOpSuccess) {
if (frameResult == QRhi::FrameOpDeviceLost)
- qWarning("Device lost");
+ handleDeviceLoss();
else if (frameResult == QRhi::FrameOpError)
qWarning("Failed to start frame");
// try again later
if (frameResult == QRhi::FrameOpDeviceLost || frameResult == QRhi::FrameOpSwapChainOutOfDate)
QCoreApplication::postEvent(window, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
-
// Before returning we need to ensure the same wake up logic that
// would have happened if beginFrame() had suceeded.
if (exposeRequested) {
@@ -789,8 +807,9 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
}
}
if (current) {
+ const QSize outputSize = rhi ? cd->swapchain->currentPixelSize() : windowSize;
- d->renderSceneGraph(windowSize);
+ d->renderSceneGraph(outputSize);
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();
@@ -810,7 +829,15 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
QRhi::EndFrameFlags flags = 0;
if (grabImage)
flags |= QRhi::SkipPresent;
- rhi->endFrame(cd->swapchain, flags);
+ QRhi::FrameOpResult frameResult = rhi->endFrame(cd->swapchain, flags);
+ if (frameResult != QRhi::FrameOpSuccess) {
+ if (frameResult == QRhi::FrameOpDeviceLost)
+ handleDeviceLoss();
+ else if (frameResult == QRhi::FrameOpError)
+ qWarning("Failed to end frame");
+ if (frameResult == QRhi::FrameOpDeviceLost || frameResult == QRhi::FrameOpSwapChainOutOfDate)
+ QCoreApplication::postEvent(window, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
+ }
} else {
if (!cd->customRenderStage || !cd->customRenderStage->swap())
gl->swapBuffers(window);
@@ -884,6 +911,57 @@ void QSGRenderThread::processEventsAndWaitForMore()
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "--- done processEventsAndWaitForMore()");
}
+void QSGRenderThread::ensureRhi()
+{
+ if (!rhi) {
+ QSGRhiSupport *rhiSupport = QSGRhiSupport::instance();
+ rhi = rhiSupport->createRhi(window, offscreenSurface);
+ if (rhi) {
+ rhiSampleCount = rhiSupport->chooseSampleCountForWindowWithRhi(window, rhi);
+ if (rhiSupport->isProfilingRequested())
+ QSGRhiProfileConnection::instance()->initialize(rhi); // ### this breaks down with multiple windows
+ } else {
+ qWarning("Failed to create QRhi on the render thread; scenegraph is not functional");
+ return;
+ }
+ }
+ if (!sgrc->rhi() && windowSize.width() > 0 && windowSize.height() > 0) {
+ rhi->makeThreadLocalNativeContextCurrent();
+ QSGDefaultRenderContext::InitParams rcParams;
+ rcParams.rhi = rhi;
+ rcParams.sampleCount = rhiSampleCount;
+ rcParams.openGLContext = nullptr;
+ rcParams.initialSurfacePixelSize = windowSize * qreal(dpr);
+ rcParams.maybeSurface = window;
+ sgrc->initialize(&rcParams);
+ }
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
+ if (rhi && !cd->swapchain) {
+ cd->rhi = rhi;
+ QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab
+ // QQ is always premul alpha. Decide based on alphaBufferSize in
+ // requestedFormat(). (the platform plugin can override format() but
+ // what matters here is what the application wanted, hence using the
+ // requested one)
+ const bool alpha = window->requestedFormat().alphaBufferSize() > 0;
+ if (alpha)
+ flags |= QRhiSwapChain::SurfaceHasPreMulAlpha;
+ cd->swapchain = rhi->newSwapChain();
+ cd->depthStencilForSwapchain = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
+ QSize(),
+ rhiSampleCount,
+ QRhiRenderBuffer::UsedWithSwapChainOnly);
+ cd->swapchain->setWindow(window);
+ cd->swapchain->setDepthStencil(cd->depthStencilForSwapchain);
+ qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d. Alpha channel requested = %s.",
+ rhiSampleCount, alpha ? "yes" : "no");
+ cd->swapchain->setSampleCount(rhiSampleCount);
+ cd->swapchain->setFlags(flags);
+ cd->rpDescForSwapchain = cd->swapchain->newCompatibleRenderPassDescriptor();
+ cd->swapchain->setRenderPassDescriptor(cd->rpDescForSwapchain);
+ }
+}
+
void QSGRenderThread::run()
{
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "run()");
@@ -899,55 +977,20 @@ void QSGRenderThread::run()
if (window) {
if (enableRhi) {
- if (!rhi) {
- QSGRhiSupport *rhiSupport = QSGRhiSupport::instance();
- rhi = rhiSupport->createRhi(window, offscreenSurface);
- if (rhi) {
- rhiSampleCount = rhiSupport->chooseSampleCountForWindowWithRhi(window, rhi);
- if (rhiSupport->isProfilingRequested())
- QSGRhiProfileConnection::instance()->initialize(rhi); // ### this breaks down with multiple windows
- } else {
- qWarning("Failed to create QRhi on the render thread; scenegraph is not functional");
- }
- }
- if (!sgrc->rhi() && windowSize.width() > 0 && windowSize.height() > 0) {
- rhi->makeThreadLocalNativeContextCurrent();
- QSGDefaultRenderContext::InitParams rcParams;
- rcParams.rhi = rhi;
- rcParams.sampleCount = rhiSampleCount;
- rcParams.openGLContext = gl;
- rcParams.initialSurfacePixelSize = windowSize * dpr;
- rcParams.maybeSurface = window;
- sgrc->initialize(&rcParams);
- }
- QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
- if (rhi && !cd->swapchain) {
- cd->rhi = rhi;
- QRhiSwapChain::Flags flags = QRhiSwapChain::UsedAsTransferSource; // may be used in a grab
- cd->swapchain = rhi->newSwapChain();
- cd->depthStencilForSwapchain = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
- QSize(),
- rhiSampleCount,
- QRhiRenderBuffer::UsedWithSwapChainOnly);
- cd->swapchain->setWindow(window);
- cd->swapchain->setDepthStencil(cd->depthStencilForSwapchain);
- qCDebug(QSG_LOG_INFO, "MSAA sample count for the swapchain is %d", rhiSampleCount);
- cd->swapchain->setSampleCount(rhiSampleCount);
- cd->swapchain->setFlags(flags);
- cd->rpDescForSwapchain = cd->swapchain->newCompatibleRenderPassDescriptor();
- cd->swapchain->setRenderPassDescriptor(cd->rpDescForSwapchain);
- }
+ ensureRhi();
+ if (rhi)
+ syncAndRender();
} else {
if (!sgrc->openglContext() && windowSize.width() > 0 && windowSize.height() > 0 && gl->makeCurrent(window)) {
QSGDefaultRenderContext::InitParams rcParams;
rcParams.sampleCount = qMax(1, gl->format().samples());
rcParams.openGLContext = gl;
- rcParams.initialSurfacePixelSize = windowSize * dpr;
+ rcParams.initialSurfacePixelSize = windowSize * qreal(dpr);
rcParams.maybeSurface = window;
sgrc->initialize(&rcParams);
}
+ syncAndRender();
}
- syncAndRender();
}
processEvents();
@@ -1259,7 +1302,8 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
}
}
- QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController;
+ QQuickAnimatorController *controller
+ = QQuickWindowPrivate::get(w->window)->animationController.get();
if (controller->thread() != w->thread)
controller->moveToThread(w->thread);
@@ -1354,6 +1398,8 @@ void QSGThreadedRenderLoop::maybeUpdate(Window *w)
return;
QThread *current = QThread::currentThread();
+ if (current == w->thread && w->thread->rhi && w->thread->rhi->isDeviceLost())
+ return;
if (current != QCoreApplication::instance()->thread() && (current != w->thread || !m_lockedForSync)) {
qWarning() << "Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()";
return;
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 220c70c299..5b48b86568 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -269,7 +269,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
m_gl->doneCurrent();
}
- delete d->animationController;
+ d->animationController.reset();
}
bool QSGWindowsRenderLoop::anyoneShowing() const
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index c345f3b16d..56d97226fb 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -94,7 +94,6 @@ qtConfig(opengl(es1|es2)?) {
# rhi, still tied to OpenGL-enabled Qt builds for now
HEADERS += \
- $$PWD/qsgrhisupport_p.h \
$$PWD/qsgrhitextureglyphcache_p.h \
$$PWD/util/qsgrhiatlastexture_p.h \
$$PWD/qsgrhilayer_p.h \
@@ -102,7 +101,6 @@ qtConfig(opengl(es1|es2)?) {
$$PWD/qsgrhidistancefieldglyphcache_p.h
SOURCES += \
- $$PWD/qsgrhisupport.cpp \
$$PWD/qsgrhitextureglyphcache.cpp \
$$PWD/qsgrhilayer.cpp \
$$PWD/qsgrhishadereffectnode.cpp \
@@ -118,7 +116,8 @@ HEADERS += \
$$PWD/qsgbasicinternalrectanglenode_p.h \
$$PWD/qsgbasicinternalimagenode_p.h \
$$PWD/qsgbasicglyphnode_p.h \
- $$PWD/qsgrenderloop_p.h
+ $$PWD/qsgrenderloop_p.h \
+ $$PWD/qsgrhisupport_p.h
SOURCES += \
$$PWD/qsgadaptationlayer.cpp \
@@ -127,7 +126,8 @@ SOURCES += \
$$PWD/qsgbasicinternalrectanglenode.cpp \
$$PWD/qsgbasicinternalimagenode.cpp \
$$PWD/qsgbasicglyphnode.cpp \
- $$PWD/qsgrenderloop.cpp
+ $$PWD/qsgrenderloop.cpp \
+ $$PWD/qsgrhisupport.cpp
qtConfig(opengl(es1|es2)?) {
SOURCES += \
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index f121d2a9e2..87941bf31a 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -121,7 +121,7 @@ class FlatColorMaterialRhiShader : public QSGMaterialRhiShader
public:
FlatColorMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
FlatColorMaterialRhiShader::FlatColorMaterialRhiShader()
@@ -130,7 +130,7 @@ FlatColorMaterialRhiShader::FlatColorMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/flatcolor.frag.qsb"));
}
-bool FlatColorMaterialRhiShader::updateUniformData(const RenderState &state,
+bool FlatColorMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial,
QSGMaterial *oldMaterial)
{
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index df4e5cfde2..67b8748119 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -125,7 +125,7 @@ QSGOpaqueTextureMaterialRhiShader::QSGOpaqueTextureMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/opaquetexture.frag.qsb"));
}
-bool QSGOpaqueTextureMaterialRhiShader::updateUniformData(const RenderState &state, QSGMaterial *, QSGMaterial *)
+bool QSGOpaqueTextureMaterialRhiShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)
{
bool changed = false;
QByteArray *buf = state.uniformData();
@@ -139,7 +139,7 @@ bool QSGOpaqueTextureMaterialRhiShader::updateUniformData(const RenderState &sta
return changed;
}
-void QSGOpaqueTextureMaterialRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QSGOpaqueTextureMaterialRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
if (binding != 1)
@@ -473,7 +473,7 @@ QSGTextureMaterialRhiShader::QSGTextureMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/texture.frag.qsb"));
}
-bool QSGTextureMaterialRhiShader::updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
+bool QSGTextureMaterialRhiShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
bool changed = false;
QByteArray *buf = state.uniformData();
diff --git a/src/quick/scenegraph/util/qsgtexturematerial_p.h b/src/quick/scenegraph/util/qsgtexturematerial_p.h
index 7ef17af526..d1ef7d1d7f 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial_p.h
+++ b/src/quick/scenegraph/util/qsgtexturematerial_p.h
@@ -75,8 +75,8 @@ class Q_QUICK_PRIVATE_EXPORT QSGOpaqueTextureMaterialRhiShader : public QSGMater
public:
QSGOpaqueTextureMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
class QSGTextureMaterialShader : public QSGOpaqueTextureMaterialShader
@@ -96,7 +96,7 @@ class QSGTextureMaterialRhiShader : public QSGOpaqueTextureMaterialRhiShader
public:
QSGTextureMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
index 23f57141a6..c27dd7d1f0 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
@@ -100,7 +100,7 @@ class QSGVertexColorMaterialRhiShader : public QSGMaterialRhiShader
public:
QSGVertexColorMaterialRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
+ bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
};
QSGVertexColorMaterialRhiShader::QSGVertexColorMaterialRhiShader()
@@ -109,7 +109,7 @@ QSGVertexColorMaterialRhiShader::QSGVertexColorMaterialRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/scenegraph/shaders_ng/vertexcolor.frag.qsb"));
}
-bool QSGVertexColorMaterialRhiShader::updateUniformData(const RenderState &state,
+bool QSGVertexColorMaterialRhiShader::updateUniformData(RenderState &state,
QSGMaterial * /*newEffect*/,
QSGMaterial * /*oldEffect*/)
{
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index 92d62c8d24..0112a4b337 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -207,7 +207,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window)
stop();
} else if (!m_controller && m_job) {
- m_controller = QQuickWindowPrivate::get(window)->animationController;
+ m_controller = QQuickWindowPrivate::get(window)->animationController.get();
if (window->isSceneGraphInitialized())
readyToAnimate();
else
diff --git a/src/quick/util/qquickfontmetrics.cpp b/src/quick/util/qquickfontmetrics.cpp
index 42b3038c48..c9a9008180 100644
--- a/src/quick/util/qquickfontmetrics.cpp
+++ b/src/quick/util/qquickfontmetrics.cpp
@@ -327,10 +327,13 @@ QRectF QQuickFontMetrics::tightBoundingRect(const QString &text) const
/*!
\qmlmethod string QtQuick::FontMetrics::elidedText(string text, enumeration mode, real width, int flags)
- This method returns a returns an elided version of the string (i.e., a
+ This method returns an elided version of the string (i.e., a
string with "..." in it) if the string \a text is wider than \a width.
Otherwise, returns the original string.
+ The \a mode argument specifies the text elide mode; that is, where
+ the ellipsis should appear when displaying text that doesn't fit.
+
The \a flags argument is optional and currently only supports
\l {Qt::TextShowMnemonic}.
@@ -338,7 +341,7 @@ QRectF QQuickFontMetrics::tightBoundingRect(const QString &text) const
\l {QQuickTextMetrics::elidedText}{elidedText} property of
\l {QQuickTextMetrics::elidedText}{TextMetrics}.
- \sa {QFontMetricsF::elidedText()}
+ \sa Qt::TextElideMode, QFontMetricsF::elidedText()
*/
QString QQuickFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags) const
{
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp
index c1deb0dced..a7db65f16f 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -90,7 +90,7 @@ QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
/*!
\qmltype ShapePath
- \instantiates QQuickShapePath
+ //! \instantiates QQuickShapePath
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
@@ -517,7 +517,7 @@ void QQuickShapePath::resetFillGradient()
/*!
\qmltype Shape
- \instantiates QQuickShape
+ //! \instantiates QQuickShape
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
@@ -1142,7 +1142,7 @@ void QQuickShapePrivate::sync()
/*!
\qmltype ShapeGradient
- \instantiates QQuickShapeGradient
+ //! \instantiates QQuickShapeGradient
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
@@ -1193,7 +1193,7 @@ void QQuickShapeGradient::setSpread(SpreadMode mode)
/*!
\qmltype LinearGradient
- \instantiates QQuickShapeLinearGradient
+ //! \instantiates QQuickShapeLinearGradient
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
@@ -1284,7 +1284,7 @@ void QQuickShapeLinearGradient::setY2(qreal v)
/*!
\qmltype RadialGradient
- \instantiates QQuickShapeRadialGradient
+ //! \instantiates QQuickShapeRadialGradient
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
@@ -1437,7 +1437,7 @@ void QQuickShapeRadialGradient::setFocalRadius(qreal v)
/*!
\qmltype ConicalGradient
- \instantiates QQuickShapeConicalGradient
+ //! \instantiates QQuickShapeConicalGradient
\inqmlmodule QtQuick.Shapes
\ingroup qtquick-paths
\ingroup qtquick-views
diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp
index 6ddd055d85..06cc442fc7 100644
--- a/src/quickshapes/qquickshapegenericrenderer.cpp
+++ b/src/quickshapes/qquickshapegenericrenderer.cpp
@@ -795,7 +795,7 @@ QQuickShapeLinearGradientRhiShader::QQuickShapeLinearGradientRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/shapes/shaders_ng/lineargradient.frag.qsb"));
}
-bool QQuickShapeLinearGradientRhiShader::updateUniformData(const RenderState &state,
+bool QQuickShapeLinearGradientRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
@@ -834,7 +834,7 @@ bool QQuickShapeLinearGradientRhiShader::updateUniformData(const RenderState &st
return changed;
}
-void QQuickShapeLinearGradientRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QQuickShapeLinearGradientRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
if (binding != 1)
@@ -968,7 +968,7 @@ QQuickShapeRadialGradientRhiShader::QQuickShapeRadialGradientRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/shapes/shaders_ng/radialgradient.frag.qsb"));
}
-bool QQuickShapeRadialGradientRhiShader::updateUniformData(const RenderState &state,
+bool QQuickShapeRadialGradientRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
@@ -1026,7 +1026,7 @@ bool QQuickShapeRadialGradientRhiShader::updateUniformData(const RenderState &st
return changed;
}
-void QQuickShapeRadialGradientRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QQuickShapeRadialGradientRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
if (binding != 1)
@@ -1158,7 +1158,7 @@ QQuickShapeConicalGradientRhiShader::QQuickShapeConicalGradientRhiShader()
setShaderFileName(FragmentStage, QStringLiteral(":/qt-project.org/shapes/shaders_ng/conicalgradient.frag.qsb"));
}
-bool QQuickShapeConicalGradientRhiShader::updateUniformData(const RenderState &state,
+bool QQuickShapeConicalGradientRhiShader::updateUniformData(RenderState &state,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
Q_ASSERT(oldMaterial == nullptr || newMaterial->type() == oldMaterial->type());
@@ -1200,7 +1200,7 @@ bool QQuickShapeConicalGradientRhiShader::updateUniformData(const RenderState &s
return changed;
}
-void QQuickShapeConicalGradientRhiShader::updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+void QQuickShapeConicalGradientRhiShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
if (binding != 1)
diff --git a/src/quickshapes/qquickshapegenericrenderer_p.h b/src/quickshapes/qquickshapegenericrenderer_p.h
index 3398159bf6..4590c662c1 100644
--- a/src/quickshapes/qquickshapegenericrenderer_p.h
+++ b/src/quickshapes/qquickshapegenericrenderer_p.h
@@ -267,9 +267,9 @@ class QQuickShapeLinearGradientRhiShader : public QSGMaterialRhiShader
public:
QQuickShapeLinearGradientRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial,
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial,
QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
private:
@@ -328,9 +328,9 @@ class QQuickShapeRadialGradientRhiShader : public QSGMaterialRhiShader
public:
QQuickShapeRadialGradientRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial,
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial,
QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
private:
@@ -384,9 +384,9 @@ class QQuickShapeConicalGradientRhiShader : public QSGMaterialRhiShader
public:
QQuickShapeConicalGradientRhiShader();
- bool updateUniformData(const RenderState &state, QSGMaterial *newMaterial,
+ bool updateUniformData(RenderState &state, QSGMaterial *newMaterial,
QSGMaterial *oldMaterial) override;
- void updateSampledImage(const RenderState &state, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
private:
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index b16bfee6a6..f9fbfeb8dc 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1119,6 +1119,13 @@ GLuint QQuickWidgetPrivate::textureId() const
return resolvedFbo ? resolvedFbo->texture()
: (fbo ? fbo->texture() : 0);
}
+
+QPlatformTextureList::Flags QQuickWidgetPrivate::textureListFlags()
+{
+ QPlatformTextureList::Flags flags = QWidgetPrivate::textureListFlags();
+ flags |= QPlatformTextureList::NeedsPremultipliedAlphaBlending;
+ return flags;
+}
#endif
/*!
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index 03571e8dc7..f4f9db7772 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -101,6 +101,7 @@ public:
#if QT_CONFIG(opengl)
GLuint textureId() const override;
+ QPlatformTextureList::Flags textureListFlags() override;
QImage grabFramebuffer() override;
#else
QImage grabFramebuffer();
diff --git a/tests/auto/qml/qmlcachegen/data/module.mjs b/tests/auto/qml/qmlcachegen/data/module.mjs
new file mode 100644
index 0000000000..6838766329
--- /dev/null
+++ b/tests/auto/qml/qmlcachegen/data/module.mjs
@@ -0,0 +1,6 @@
+
+import { helper } from "utils.mjs"
+
+export function entry() {
+ return helper()
+}
diff --git a/tests/auto/qml/qmlcachegen/data/utils.mjs b/tests/auto/qml/qmlcachegen/data/utils.mjs
new file mode 100644
index 0000000000..25a1f38709
--- /dev/null
+++ b/tests/auto/qml/qmlcachegen/data/utils.mjs
@@ -0,0 +1,4 @@
+
+export function helper() {
+ return "ok"
+}
diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
index 18d3abd6bc..1a334b68ce 100644
--- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro
+++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
@@ -15,7 +15,9 @@ RESOURCES += \
data/Enums.qml \
data/componentInItem.qml \
data/jsmoduleimport.qml \
- data/script.mjs
+ data/script.mjs \
+ data/module.mjs \
+ data/utils.mjs
workerscripts_test.files = \
data/worker.js \
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 7441aed11f..5d87c319f3 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -65,6 +65,7 @@ private slots:
void qrcScriptImport();
void fsScriptImport();
void moduleScriptImport();
+ void esModulesViaQJSEngine();
void enums();
@@ -601,6 +602,14 @@ void tst_qmlcachegen::moduleScriptImport()
}
}
+void tst_qmlcachegen::esModulesViaQJSEngine()
+{
+ QJSEngine engine;
+ QJSValue module = engine.importModule(":/data/module.mjs");
+ QJSValue result = module.property("entry").call();
+ QCOMPARE(result.toString(), "ok");
+}
+
void tst_qmlcachegen::enums()
{
QQmlEngine engine;
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index b6cc7fd866..2acc62ca28 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -225,12 +225,12 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent()
QVERIFY(window_item);
QVERIFY(window_window);
- QCOMPARE(qtobject_item->metaObject()->className(), "QQuickItem");
- QCOMPARE(qtobject_window->metaObject()->className(), "QQuickWindow");
- QCOMPARE(item_item->metaObject()->className(), "QQuickItem");
- QCOMPARE(item_window->metaObject()->className(), "QQuickWindow");
- QCOMPARE(window_item->metaObject()->className(), "QQuickItem");
- QCOMPARE(window_window->metaObject()->className(), "QQuickWindow");
+ QVERIFY(QByteArray(qtobject_item->metaObject()->className()).startsWith("QQuickItem"));
+ QVERIFY(QByteArray(qtobject_window->metaObject()->className()).startsWith("QQuickWindow"));
+ QVERIFY(QByteArray(item_item->metaObject()->className()).startsWith("QQuickItem"));
+ QVERIFY(QByteArray(item_window->metaObject()->className()).startsWith("QQuickWindow"));
+ QVERIFY(QByteArray(window_item->metaObject()->className()).startsWith("QQuickItem"));
+ QVERIFY(QByteArray(window_window->metaObject()->className()).startsWith("QQuickWindow"));
QCOMPARE(qtobject_qtobject->parent(), qtobjectParent);
QCOMPARE(qtobject_item->parent(), qtobjectParent);
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index cf0f3c7bb3..07af519a3d 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -470,7 +470,7 @@ void tst_qqmlconnections::noAcceleratedGlobalLookup()
QVERIFY(c.isReady());
QScopedPointer<QObject> object(c.create());
const QVariant val = object->property("testEnum");
- QCOMPARE(val.type(), int(QMetaType::Int));
+ QCOMPARE(val.type(), QVariant::Int);
QCOMPARE(val.toInt(), int(Proxy::EnumValue));
}
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml
index 1f929d311b..f5eaeb442a 100644
--- a/tests/auto/qml/qqmlconsole/data/logging.qml
+++ b/tests/auto/qml/qqmlconsole/data/logging.qml
@@ -31,6 +31,8 @@ import QtQuick 2.0
QtObject {
id:root
+ required property var customObject
+ required property var stringListProperty
function consoleCount() {
console.count("console.count", "Ignore additional argument");
@@ -67,7 +69,7 @@ QtObject {
console.log(1, "pong!", new Object);
console.log(1, ["ping","pong"], new Object, 2);
- console.log(contextStringListProperty);
+ console.log(stringListProperty);
console.log(customObject);
console.log([[1,2,3,[2,2,2,2],4],[5,6,7,8]]);
diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
index b157314071..48613d04f1 100644
--- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
+++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
@@ -95,16 +95,16 @@ void tst_qqmlconsole::logging()
QTest::ignoreMessage(QtDebugMsg, "QVariant(CustomObject, MY OBJECT)");
QTest::ignoreMessage(QtDebugMsg, "[[1,2,3,[2,2,2,2],4],[5,6,7,8]]");
- QScopedPointer<QQmlContext> loggingContext(new QQmlContext(engine.rootContext()));
QStringList stringList; stringList << QStringLiteral("Hello") << QStringLiteral("World");
- loggingContext->setContextProperty("contextStringListProperty", stringList);
CustomObject customObject;
QVERIFY(QMetaType::registerDebugStreamOperator<CustomObject>());
- loggingContext->setContextProperty("customObject", QVariant::fromValue(customObject));
QQmlComponent component(&engine, testUrl);
- QScopedPointer<QObject> object(component.create(loggingContext.data()));
+ QScopedPointer<QObject> object(component.createWithInitialProperties({
+ {"customObject", QVariant::fromValue(customObject)},
+ {"stringListProperty", stringList}
+ }));
QVERIFY(object != nullptr);
}
diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp
index 99cabb4b09..13e4d4c53b 100644
--- a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp
+++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp
@@ -71,7 +71,7 @@ void tst_qqmlcpputils::fastConnect()
{
MyObject obj;
- qmlobject_connect(&obj, MyObject, SIGNAL(signal1()), &obj, MyObject, SLOT(slot1()))
+ qmlobject_connect(&obj, MyObject, SIGNAL(signal1()), &obj, MyObject, SLOT(slot1()));
obj.signal1();
QCOMPARE(obj.slotCount, 1);
diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
index 54d29dfc94..9fdb7f92f3 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
@@ -1,4 +1,5 @@
import Qt.test 1.0
+import QtQuick 2.0 // We need the the QtQuick color provider for colorProperty
MyQmlObject
{
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 730dc7cab8..3233e7f105 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1098,13 +1098,11 @@ class MyItemUsingRevisionedObject : public QObject
Q_PROPERTY(MyRevisionedClass *revisioned READ revisioned)
public:
- MyItemUsingRevisionedObject() {
- m_revisioned = new MyRevisionedClass;
- }
+ MyItemUsingRevisionedObject() : m_revisioned (new MyRevisionedClass) {}
- MyRevisionedClass *revisioned() const { return m_revisioned; }
+ MyRevisionedClass *revisioned() const { return m_revisioned.get(); }
private:
- MyRevisionedClass *m_revisioned;
+ QScopedPointer<MyRevisionedClass> m_revisioned;
};
QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index cfdb15304d..160546fc64 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -1693,10 +1693,10 @@ void tst_qqmlecmascript::componentCreation()
}
QQmlComponent component(&engine, testUrl);
- MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QScopedPointer<MyTypeObject> object(qobject_cast<MyTypeObject*>(component.create()));
QVERIFY(object != nullptr);
- QMetaObject::invokeMethod(object, method.toUtf8());
+ QMetaObject::invokeMethod(object.get(), method.toUtf8());
QQmlComponent *created = object->componentProperty();
if (creationError.isEmpty()) {
@@ -1704,7 +1704,7 @@ void tst_qqmlecmascript::componentCreation()
QObject *expectedParent = reinterpret_cast<QObject *>(quintptr(-1));
if (createdParent == QLatin1String("obj")) {
- expectedParent = object;
+ expectedParent = object.get();
} else if ((createdParent == QLatin1String("null")) || createdParent.isEmpty()) {
expectedParent = nullptr;
}
@@ -2050,7 +2050,7 @@ void tst_qqmlecmascript::functionErrors()
QObject *resource = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
- warning = warning.arg(QString::number((quintptr)resource, 16));
+ warning = warning.arg(QString::number(quintptr(resource), 16));
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
delete object;
@@ -3124,13 +3124,13 @@ void tst_qqmlecmascript::callQtInvokables()
void tst_qqmlecmascript::resolveClashingProperties()
{
- ClashingNames *o = new ClashingNames();
+ QScopedPointer<ClashingNames> o(new ClashingNames());
QQmlEngine qmlengine;
QV4::ExecutionEngine *engine = qmlengine.handle();
QV4::Scope scope(engine);
- QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(engine, o));
+ QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(engine, o.get()));
QV4::ObjectIterator it(scope, object->as<QV4::Object>(), QV4::ObjectIterator::EnumerableOnly);
QV4::ScopedValue name(scope);
QV4::ScopedValue value(scope);
@@ -4575,7 +4575,7 @@ void tst_qqmlecmascript::scarceResources_other()
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
- expectedWarning = expectedWarning.arg(QString::number((quintptr)eo, 16));
+ expectedWarning = expectedWarning.arg(QString::number(quintptr(eo), 16));
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
@@ -4649,7 +4649,7 @@ void tst_qqmlecmascript::scarceResources_other()
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
- expectedWarning = expectedWarning.arg(QString::number((quintptr)eo, 16));
+ expectedWarning = expectedWarning.arg(QString::number(quintptr(eo), 16));
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
QMetaObject::invokeMethod(object, "retrieveScarceResource");
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
@@ -6093,7 +6093,7 @@ void tst_qqmlecmascript::variants()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("variants.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("undefinedVariant").type(), QVariant::Invalid);
@@ -6102,13 +6102,13 @@ void tst_qqmlecmascript::variants()
QCOMPARE(object->property("doubleVariant").type(), QVariant::Double);
QVariant result;
- QMetaObject::invokeMethod(object, "checkNull", Q_RETURN_ARG(QVariant, result));
+ QMetaObject::invokeMethod(object.get(), "checkNull", Q_RETURN_ARG(QVariant, result));
QCOMPARE(result.toBool(), true);
- QMetaObject::invokeMethod(object, "checkUndefined", Q_RETURN_ARG(QVariant, result));
+ QMetaObject::invokeMethod(object.get(), "checkUndefined", Q_RETURN_ARG(QVariant, result));
QCOMPARE(result.toBool(), true);
- QMetaObject::invokeMethod(object, "checkNumber", Q_RETURN_ARG(QVariant, result));
+ QMetaObject::invokeMethod(object.get(), "checkNumber", Q_RETURN_ARG(QVariant, result));
QCOMPARE(result.toBool(), true);
}
@@ -7000,12 +7000,12 @@ void tst_qqmlecmascript::realToInt()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("realToInt.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
- QMetaObject::invokeMethod(object, "test1");
+ QMetaObject::invokeMethod(object.get(), "test1");
QCOMPARE(object->value(), int(4));
- QMetaObject::invokeMethod(object, "test2");
+ QMetaObject::invokeMethod(object.get(), "test2");
QCOMPARE(object->value(), int(7));
}
@@ -7014,7 +7014,7 @@ void tst_qqmlecmascript::urlProperty()
QQmlEngine engine;
{
QQmlComponent component(&engine, testFileUrl("urlProperty.1.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
object->setStringProperty("http://qt-project.org");
QCOMPARE(object->urlProperty(), QUrl("http://qt-project.org/index.html"));
@@ -7029,7 +7029,7 @@ void tst_qqmlecmascript::urlPropertyWithEncoding()
QQmlEngine engine;
{
QQmlComponent component(&engine, testFileUrl("urlProperty.2.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
object->setStringProperty("http://qt-project.org");
const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode);
@@ -7064,7 +7064,7 @@ void tst_qqmlecmascript::dynamicString()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("dynamicString.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("stringProperty").toString(),
QString::fromLatin1("string:Hello World false:0 true:1 uint32:100 int32:-100 double:3.14159 date:2011-02-11 05::30:50!"));
@@ -7074,7 +7074,7 @@ void tst_qqmlecmascript::deleteLaterObjectMethodCall()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("deleteLaterObjectMethodCall.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7082,7 +7082,7 @@ void tst_qqmlecmascript::automaticSemicolon()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("automaticSemicolon.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7090,7 +7090,7 @@ void tst_qqmlecmascript::compatibilitySemicolon()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("compatibilitySemicolon.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7098,7 +7098,7 @@ void tst_qqmlecmascript::incrDecrSemicolon1()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7106,7 +7106,7 @@ void tst_qqmlecmascript::incrDecrSemicolon2()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7122,7 +7122,7 @@ void tst_qqmlecmascript::unaryExpression()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("unaryExpression.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -7262,7 +7262,7 @@ void tst_qqmlecmascript::switchStatement()
QQmlEngine engine;
{
QQmlComponent component(&engine, testFileUrl("switchStatement.1.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7285,7 +7285,7 @@ void tst_qqmlecmascript::switchStatement()
{
QQmlComponent component(&engine, testFileUrl("switchStatement.2.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7308,7 +7308,7 @@ void tst_qqmlecmascript::switchStatement()
{
QQmlComponent component(&engine, testFileUrl("switchStatement.3.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7335,7 +7335,7 @@ void tst_qqmlecmascript::switchStatement()
QString warning = component.url().toString() + ":4:5: Unable to assign [undefined] to int";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7359,7 +7359,7 @@ void tst_qqmlecmascript::switchStatement()
{
QQmlComponent component(&engine, testFileUrl("switchStatement.5.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7382,7 +7382,7 @@ void tst_qqmlecmascript::switchStatement()
{
QQmlComponent component(&engine, testFileUrl("switchStatement.6.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
// `object->value()' is the number of executed statements
@@ -7410,7 +7410,7 @@ void tst_qqmlecmascript::withStatement()
{
QUrl url = testFileUrl("withStatement.1.qml");
QQmlComponent component(&engine, url);
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
QCOMPARE(object->value(), 123);
@@ -7422,7 +7422,7 @@ void tst_qqmlecmascript::tryStatement()
QQmlEngine engine;
{
QQmlComponent component(&engine, testFileUrl("tryStatement.1.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
QCOMPARE(object->value(), 123);
@@ -7430,7 +7430,7 @@ void tst_qqmlecmascript::tryStatement()
{
QQmlComponent component(&engine, testFileUrl("tryStatement.2.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
QCOMPARE(object->value(), 321);
@@ -7438,7 +7438,7 @@ void tst_qqmlecmascript::tryStatement()
{
QQmlComponent component(&engine, testFileUrl("tryStatement.3.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
QVERIFY(object->qjsvalue().isUndefined());
@@ -7446,7 +7446,7 @@ void tst_qqmlecmascript::tryStatement()
{
QQmlComponent component(&engine, testFileUrl("tryStatement.4.qml"));
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject*>(component.create()));
QVERIFY(object != nullptr);
QVERIFY(object->qjsvalue().isUndefined());
@@ -7587,7 +7587,7 @@ void tst_qqmlecmascript::onDestruction()
// component instance. This shouldn't crash.
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("onDestruction.qml"));
- QObject *obj = c.create();
+ QScopedPointer<QObject> obj(c.create());
QVERIFY(obj != nullptr);
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
}
@@ -7928,19 +7928,19 @@ void tst_qqmlecmascript::dateParse()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("date.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
if (object == nullptr)
qDebug() << component.errorString();
QVERIFY(object != nullptr);
QVariant q;
- QMetaObject::invokeMethod(object, "test_is_invalid_jsDateTime", Q_RETURN_ARG(QVariant, q));
+ QMetaObject::invokeMethod(object.get(), "test_is_invalid_jsDateTime", Q_RETURN_ARG(QVariant, q));
QVERIFY(q.toBool());
- QMetaObject::invokeMethod(object, "test_is_invalid_qtDateTime", Q_RETURN_ARG(QVariant, q));
+ QMetaObject::invokeMethod(object.get(), "test_is_invalid_qtDateTime", Q_RETURN_ARG(QVariant, q));
QVERIFY(q.toBool());
- QMetaObject::invokeMethod(object, "test_rfc2822_date", Q_RETURN_ARG(QVariant, q));
+ QMetaObject::invokeMethod(object.get(), "test_rfc2822_date", Q_RETURN_ARG(QVariant, q));
QCOMPARE(q.toLongLong(), 1379512851000LL);
}
@@ -7949,14 +7949,14 @@ void tst_qqmlecmascript::utcDate()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("utcdate.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
if (object == nullptr)
qDebug() << component.errorString();
QVERIFY(object != nullptr);
QVariant q;
QVariant val = QString::fromLatin1("2014-07-16T23:30:31");
- QMetaObject::invokeMethod(object, "check_utc", Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, val));
+ QMetaObject::invokeMethod(object.get(), "check_utc", Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, val));
QVERIFY(q.toBool());
}
@@ -7965,20 +7965,20 @@ void tst_qqmlecmascript::negativeYear()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("negativeyear.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
if (object == nullptr)
qDebug() << component.errorString();
QVERIFY(object != nullptr);
QVariant q;
- QMetaObject::invokeMethod(object, "check_negative_tostring", Q_RETURN_ARG(QVariant, q));
+ QMetaObject::invokeMethod(object.get(), "check_negative_tostring", Q_RETURN_ARG(QVariant, q));
// Only check for the year. We hope that every language writes the year in arabic numerals and
// in relation to a specific dude's date of birth. We also hope that no language adds a "-2001"
// junk string somewhere in the middle.
QVERIFY(q.toString().indexOf(QStringLiteral("-2001")) != -1);
- QMetaObject::invokeMethod(object, "check_negative_toisostring", Q_RETURN_ARG(QVariant, q));
+ QMetaObject::invokeMethod(object.get(), "check_negative_toisostring", Q_RETURN_ARG(QVariant, q));
QCOMPARE(q.toString().left(16), QStringLiteral("result: -002000-"));
}
@@ -8021,6 +8021,7 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy()
QCOMPARE(spy1.count(), 1);
QCOMPARE(spy2.count(), 1);
+ deleteObject.deleteNestedObject();
delete object;
}
@@ -8032,7 +8033,7 @@ void tst_qqmlecmascript::updateCall()
QString file("updateCall.qml");
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl(file));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
@@ -8043,7 +8044,7 @@ void tst_qqmlecmascript::numberParsing()
QString file("numberParsing.%1.qml");
file = file.arg(i);
QQmlComponent component(&engine, testFileUrl(file));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
}
for (int i = 1; i < 3; ++i) {
@@ -8226,8 +8227,8 @@ void tst_qqmlecmascript::idsAsLValues()
QString err = QString(QLatin1String("%1:5: Error: left-hand side of assignment operator is not an lvalue")).arg(testFileUrl("idAsLValue.qml").toString());
QQmlComponent component(&engine, testFileUrl("idAsLValue.qml"));
QTest::ignoreMessage(QtWarningMsg, qPrintable(err));
- MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
- QVERIFY(!object);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!qobject_cast<MyQmlObject*>(object.get()));
}
void tst_qqmlecmascript::qtbug_34792()
@@ -8442,10 +8443,10 @@ void tst_qqmlecmascript::readUnregisteredQObjectProperty()
qmlRegisterType<ObjectContainer>("Test", 1, 0, "ObjectContainer");
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("accessUnregisteredQObjectProperty.qml"));
- QObject *root = component.create();
+ QScopedPointer<QObject> root(component.create());
QVERIFY(root);
- QMetaObject::invokeMethod(root, "readProperty");
+ QMetaObject::invokeMethod(root.get(), "readProperty");
QCOMPARE(root->property("container").value<ObjectContainer*>()->mGetterCalled, true);
}
@@ -8454,10 +8455,10 @@ void tst_qqmlecmascript::writeUnregisteredQObjectProperty()
qmlRegisterType<ObjectContainer>("Test", 1, 0, "ObjectContainer");
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("accessUnregisteredQObjectProperty.qml"));
- QObject *root = component.create();
+ QScopedPointer<QObject> root(component.create());
QVERIFY(root);
- QMetaObject::invokeMethod(root, "writeProperty");
+ QMetaObject::invokeMethod(root.get(), "writeProperty");
QCOMPARE(root->property("container").value<ObjectContainer*>()->mSetterCalled, true);
}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
index 812242f146..a37461a173 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
index a171ee6b28..1dc06ee6ae 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
index de40284452..ea945eebb0 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
index 4939087b31..9a4fc53833 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
index 5cee0341fe..155dbdcb91 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
index 2a13822fab..940d54be90 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
index 2f238175fa..46d20e38bb 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
index d36e95fec3..ffdb30f072 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
index 53dd5a17e9..ca669a9708 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
index e5cd7d60de..a93c3b302c 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
index d98aef2932..5930e12df6 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
index 7f438aa995..8f929c20b2 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
index 83d6226e83..20bde6d0af 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
index 98dfb7241b..10ae369459 100644
--- a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
index 50af9c4f16..422637fe31 100644
--- a/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
+++ b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
index a04ca41c26..67d7ddd1c9 100644
--- a/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
+++ b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testReloadComponent.qml b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
index 74442108cd..79d4f29db0 100644
--- a/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
+++ b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testScriptComponent.qml b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
index b33eb48461..4952a08a6c 100644
--- a/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
+++ b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
index 6cf8ec4203..a6a1f4d4d3 100644
--- a/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
+++ b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
index d3e6ffd7cf..c661cb6fe4 100644
--- a/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
index acb0113e61..8b6c7eda4d 100644
--- a/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
index a5beede469..8c0596eae4 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
index 4c8e52f251..39b604d42f 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
index 983d6e824c..807203b6c7 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
index fc8e5a0cd4..100b287cfd 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
index fcfd05c51f..dddf51b926 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
index f434406eec..fa508f16ac 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
index 1dcaec90e6..b36d6ebf14 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
index fd7d7e454c..fce617046b 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
index d2dab32fc9..39629d47df 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
index 813e43896c..a4c947cc17 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
index c6f0b7928b..a87372cd27 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
index 255138520c..c4b16d8ec9 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
index 0ad59b32d3..a18a88884c 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
index 60f72a92fe..eb042e82f8 100644
--- a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
index 6c7f959f49..1f97e587e0 100644
--- a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
index 86060c3998..794686494b 100644
--- a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
index c50fd70dec..f442500c7f 100644
--- a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
index 120d249bc0..d57cd8a739 100644
--- a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Item {
property bool success: false
+ required property QtObject componentCache
function reportError(s) { console.warn(s) }
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index aae42e9ebb..de99e8c37d 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -424,12 +424,13 @@ void tst_qqmlengine::trimComponentCache()
QQmlEngine engine;
ComponentCacheFunctions componentCache(engine);
- engine.rootContext()->setContextProperty("componentCache", &componentCache);
engine.setIncubationController(&componentCache);
QQmlComponent component(&engine, testFileUrl(file));
QVERIFY2(component.isReady(), qPrintable(component.errorString()));
- QScopedPointer<QObject> object(component.create());
+ QScopedPointer<QObject> object(component.createWithInitialProperties({
+ {"componentCache", QVariant::fromValue(&componentCache)}
+ }));
QVERIFY(object != nullptr);
QCOMPARE(object->property("success").toBool(), true);
}
@@ -511,6 +512,7 @@ void tst_qqmlengine::failedCompilation()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl(file));
+ QTest::ignoreMessage(QtMsgType::QtWarningMsg, "QQmlComponent: Component is not ready");
QVERIFY(!component.isReady());
QScopedPointer<QObject> object(component.create());
QVERIFY(object.isNull());
@@ -601,11 +603,10 @@ void tst_qqmlengine::objectOwnership()
{
QQmlEngine engine;
QQmlComponent c(&engine);
- engine.rootContext()->setContextProperty("test", this);
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::JavaScriptOwnership);
- c.setData("import QtQuick 2.0; Item { property int data: test.createAQObjectForOwnershipTest() ? 0 : 1 }", QUrl());
+ c.setData("import QtQuick 2.0; Item { required property QtObject test; property int data: test.createAQObjectForOwnershipTest() ? 0 : 1 }", QUrl());
QVERIFY(c.isReady());
- QObject *o = c.create();
+ QObject *o = c.createWithInitialProperties( {{"test", QVariant::fromValue(this)}} );
QVERIFY(o != nullptr);
}
QTRY_VERIFY(spy.count());
@@ -616,13 +617,13 @@ void tst_qqmlengine::objectOwnership()
{
QQmlEngine engine;
QQmlComponent c(&engine);
- engine.rootContext()->setContextProperty("test", ptr);
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::JavaScriptOwnership);
- c.setData("import QtQuick 2.0; QtObject { property var object: { var i = test; test ? 0 : 1 } }", QUrl());
+ c.setData("import QtQuick 2.0; QtObject { required property QtObject test; property var object: { var i = test; test ? 0 : 1 } }", QUrl());
QVERIFY(c.isReady());
- QObject *o = c.create();
+ QObject *o = c.createWithInitialProperties({{"test", QVariant::fromValue(ptr)}});
QVERIFY(o != nullptr);
- engine.rootContext()->setContextProperty("test", nullptr);
+ QQmlProperty testProp(o, "test");
+ testProp.write(QVariant::fromValue<QObject*>(nullptr));
}
QTRY_VERIFY(spy.count());
}
@@ -772,6 +773,7 @@ public:
};
Q_DECLARE_METATYPE(QList<QQmlAbstractUrlInterceptor::DataType>);
+
void tst_qqmlengine::urlInterceptor_data()
{
QTest::addColumn<QUrl>("testFile");
@@ -940,14 +942,15 @@ void tst_qqmlengine::cppSignalAndEval()
{
ObjectCaller objectCaller;
QQmlEngine engine;
- engine.rootContext()->setContextProperty(QLatin1String("CallerCpp"), &objectCaller);
+ qmlRegisterSingletonInstance("Test", 1, 0, "CallerCpp", &objectCaller);
QQmlComponent c(&engine);
c.setData("import QtQuick 2.9\n"
+ "import Test 1.0\n"
"Item {\n"
" property var r: 0\n"
" Connections {\n"
" target: CallerCpp;\n"
- " onDoubleReply: {\n"
+ " function onDoubleReply() {\n"
" eval('var z = 1');\n"
" r = a;\n"
" }\n"
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 4474f504af..ed3f7a5658 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -244,12 +244,11 @@ private slots:
void compositeSingletonModuleQualified();
void compositeSingletonInstantiateError();
void compositeSingletonDynamicPropertyError();
- void compositeSingletonDynamicSignal();
+ void compositeSingletonDynamicSignalAndJavaScriptPragma();
void compositeSingletonQmlRegisterTypeError();
void compositeSingletonQmldirNoPragmaError();
void compositeSingletonQmlDirError();
void compositeSingletonRemote();
- void compositeSingletonJavaScriptPragma();
void compositeSingletonSelectors();
void compositeSingletonRegistered();
void compositeSingletonCircular();
@@ -2522,7 +2521,15 @@ void tst_qqmllanguage::testType(const QString& qml, const QString& type, const Q
VERIFY_ERRORS(0);
QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
- QCOMPARE(QString(object->metaObject()->className()), type);
+ const QMetaObject *meta = object->metaObject();
+ for (; meta; meta = meta->superClass()) {
+ const QString className(meta->className());
+ if (!className.contains("_QMLTYPE_") && !className.contains("_QML_")) {
+ QCOMPARE(className, type);
+ break;
+ }
+ }
+ QVERIFY(meta != nullptr);
}
engine.setImportPathList(defaultImportPathList);
@@ -4065,10 +4072,12 @@ void tst_qqmllanguage::implicitImportsLast()
VERIFY_ERRORS(0);
QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
- QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QQuickMouseArea")));
+ QVERIFY(QString(object->metaObject()->superClass()->superClass()->className())
+ .startsWith(QLatin1String("QQuickMouseArea")));
QObject* object2 = object->property("item").value<QObject*>();
QVERIFY(object2 != nullptr);
- QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QQuickRectangle"));
+ QCOMPARE(QString(object2->metaObject()->superClass()->className()),
+ QLatin1String("QQuickRectangle"));
engine.setImportPathList(defaultImportPathList);
}
@@ -4289,16 +4298,35 @@ void tst_qqmllanguage::compositeSingletonDynamicPropertyError()
VERIFY_ERRORS(0);
}
-// Having a composite singleton type as dynamic signal parameter succeeds
-// (like C++ singleton)
-void tst_qqmllanguage::compositeSingletonDynamicSignal()
+void tst_qqmllanguage::compositeSingletonDynamicSignalAndJavaScriptPragma()
{
- QQmlComponent component(&engine, testFileUrl("singletonTest11.qml"));
- VERIFY_ERRORS(0);
- QScopedPointer<QObject> o(component.create());
- QVERIFY(o != nullptr);
+ {
+ // Having a composite singleton type as dynamic signal parameter succeeds
+ // (like C++ singleton)
+
+ QQmlComponent component(&engine, testFileUrl("singletonTest11.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != nullptr);
+
+ verifyCompositeSingletonPropertyValues(o.data(), "value1", 99, "value2", -55);
+ }
+ {
+ // Load a composite singleton type and a javascript file that has .pragma library
+ // in it. This will make sure that the javascript .pragma does not get mixed with
+ // the pragma Singleton changes.
- verifyCompositeSingletonPropertyValues(o.data(), "value1", 99, "value2", -55);
+ QQmlComponent component(&engine, testFileUrl("singletonTest16.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != nullptr);
+
+ // The value1 that is read from the SingletonType was changed from 125 to 99
+ // above. As the type is a singleton and
+ // the engine has not been destroyed, we just retrieve the old instance and
+ // the value is still 99.
+ verifyCompositeSingletonPropertyValues(o.data(), "value1", 99, "value2", 333);
+ }
}
// Use qmlRegisterType to register a qml composite type with pragma Singleton defined in it.
@@ -4350,23 +4378,6 @@ void tst_qqmllanguage::compositeSingletonRemote()
verifyCompositeSingletonPropertyValues(o.data(), "value1", 525, "value2", 355);
}
-// Load a composite singleton type and a javascript file that has .pragma library
-// in it. This will make sure that the javascript .pragma does not get mixed with
-// the pragma Singleton changes.
-void tst_qqmllanguage::compositeSingletonJavaScriptPragma()
-{
- QQmlComponent component(&engine, testFileUrl("singletonTest16.qml"));
- VERIFY_ERRORS(0);
- QScopedPointer<QObject> o(component.create());
- QVERIFY(o != nullptr);
-
- // The value1 that is read from the SingletonType was changed from 125 to 99
- // in compositeSingletonDynamicSignal() above. As the type is a singleton and
- // the engine has not been destroyed, we just retrieve the old instance and
- // the value is still 99.
- verifyCompositeSingletonPropertyValues(o.data(), "value1", 99, "value2", 333);
-}
-
// Reads values from a Singleton accessed through selectors.
void tst_qqmllanguage::compositeSingletonSelectors()
{
@@ -5052,7 +5063,6 @@ void tst_qqmllanguage::instanceof()
if (QTest::currentDataTag() == QLatin1String("customRectangleWithPropInstance instanceof CustomRectangle") ||
QTest::currentDataTag() == QLatin1String("customRectangleWithPropInstance instanceof CustomImport.CustomRectangle"))
- QEXPECT_FAIL("", "QTBUG-58477: QML type rules are a little lax", Continue);
QCOMPARE(returnValue, expectedValue.toBool());
} else {
QVERIFY(expr.hasError());
@@ -5088,7 +5098,8 @@ void tst_qqmllanguage::accessDeletedObject()
{
QQmlEngine engine;
- engine.rootContext()->setContextProperty("objectCreator", new ObjectCreator);
+ QScopedPointer<ObjectCreator> creator(new ObjectCreator);
+ engine.rootContext()->setContextProperty("objectCreator", creator.get());
QQmlComponent component(&engine, testFileUrl("accessDeletedObject.qml"));
VERIFY_ERRORS(0);
diff --git a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml
index 9789be8191..258667be18 100644
--- a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml
@@ -1,5 +1,6 @@
pragma Singleton
import QtQuick 2.0
+import Test 1.0
QtObject {
property Loader _loader: Loader {
@@ -7,10 +8,10 @@ QtObject {
}
Component.onCompleted: {
- if (tracker.objectName === "first")
- tracker.objectName = "second"
+ if (Tracker.objectName === "first")
+ Tracker.objectName = "second"
else
- tracker.objectName = "first"
+ Tracker.objectName = "first"
//console.log("created singleton", this)
}
}
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index a3d1858d6b..54c08c8880 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -796,7 +796,7 @@ void tst_qqmlmoduleplugin::multiSingleton()
{
QQmlEngine engine;
QObject obj;
- engine.rootContext()->setContextProperty("tracker", &obj);
+ qmlRegisterSingletonInstance("Test", 1, 0, "Tracker", &obj);
engine.addImportPath(m_importsDirectory);
QQmlComponent component(&engine, testFileUrl("multiSingleton.qml"));
QObject *object = component.create();
diff --git a/tests/auto/qml/qqmlnotifier/data/connectnotify.qml b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
index 35226ee5ab..34e70e6afe 100644
--- a/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
+++ b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
@@ -3,6 +3,7 @@ import Test 1.0
Item {
id: root
+ required property ExportedClass exportedObject
ExportedClass {
id: exportedClass
objectName: "exportedClass"
@@ -22,7 +23,7 @@ Item {
}
property int foo: exportedClass.qmlObjectProp
- property int baz: _exportedObject.cppObjectProp
+ property int baz: exportedObject.cppObjectProp
// v4 bindings that could share a subscription. They don't, though, and the code
// relies on that
diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
index de762d66c5..836b94ad45 100644
--- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
+++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
@@ -185,8 +185,7 @@ void tst_qqmlnotifier::createObjects()
QQmlComponent component(&engine, testFileUrl("connectnotify.qml"));
exportedObject = new ExportedClass();
exportedObject->setObjectName("exportedObject");
- engine.rootContext()->setContextProperty("_exportedObject", exportedObject);
- root = component.create();
+ root = component.createWithInitialProperties({{"exportedObject", QVariant::fromValue(exportedObject)}});
QVERIFY(root != nullptr);
exportedClass = qobject_cast<ExportedClass *>(
@@ -324,12 +323,12 @@ void tst_qqmlnotifier::lotsOfBindings()
TestObject o;
QQmlEngine *e = new QQmlEngine;
- e->rootContext()->setContextProperty(QStringLiteral("test"), &o);
+ qmlRegisterSingletonInstance("Test", 1, 0, "Test", &o);
QList<QQmlComponent *> components;
for (int i = 0; i < 20000; ++i) {
QQmlComponent *component = new QQmlComponent(e);
- component->setData("import QtQuick 2.0; Item { width: test.a; }", QUrl());
+ component->setData("import QtQuick 2.0; import Test 1.0; Item {width: Test.a; }", QUrl());
component->create(e->rootContext());
components.append(component);
}
diff --git a/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml b/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml
new file mode 100644
index 0000000000..d23ea43e74
--- /dev/null
+++ b/tests/auto/qml/qqmlpromise/data/promisehandlerthrows.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.12
+
+Item {
+ id: root
+ property string errorMessage
+ Component.onCompleted: () => {
+ let prom = Promise.reject("Some error")
+ .then(
+ o => {console.log("Never reached");},
+ err => {
+ console.log("Rethrowing err");
+ throw err;
+ }
+ )
+ .catch(err => root.errorMessage = err)
+ }
+}
diff --git a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp
index 41850d0263..b430434526 100644
--- a/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp
+++ b/tests/auto/qml/qqmlpromise/tst_qqmlpromise.cpp
@@ -83,6 +83,7 @@ private slots:
void then_reject_non_callable();
void then_resolve_multiple_then();
void promiseChain();
+ void promiseHandlerThrows();
private:
void execute_test(QString testName);
@@ -285,6 +286,17 @@ void tst_qqmlpromise::promiseChain()
}
+void tst_qqmlpromise::promiseHandlerThrows()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("promisehandlerthrows.qml"));
+ QVERIFY(component.isReady());
+ QTest::ignoreMessage(QtDebugMsg, "Rethrowing err");
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(root);
+ QTRY_VERIFY(root->property("errorMessage") == QLatin1String("Some error"));
+}
+
QTEST_MAIN(tst_qqmlpromise)
diff --git a/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml
index a9e51c1255..440f07ac87 100644
--- a/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml
+++ b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
Item {
+ required property QtObject o
Component.onCompleted: { o.variantMap = {}; }
}
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index ad901c4eba..1a5927fa74 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -35,6 +35,9 @@
#include <private/qqmlboundsignal_p.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
+#if QT_CONFIG(regularexpression)
+#include <QtCore/qregularexpression.h>
+#endif
#include <QtCore/private/qobject_p.h>
#include "../../shared/util.h"
@@ -1991,11 +1994,9 @@ void tst_qqmlproperty::assignEmptyVariantMap()
QCOMPARE(o.variantMap().count(), 1);
QCOMPARE(o.variantMap().isEmpty(), false);
- QQmlContext context(&engine);
- context.setContextProperty("o", &o);
QQmlComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml"));
- QObject *obj = component.create(&context);
+ QObject *obj = component.createWithInitialProperties({{"o", QVariant::fromValue(&o)}});
QVERIFY(obj);
QCOMPARE(o.variantMap().count(), 0);
@@ -2017,9 +2018,13 @@ void tst_qqmlproperty::warnOnInvalidBinding()
expectedWarning = testUrl.toString() + QString::fromLatin1(":7:5: Unable to assign QQuickText to QQuickRectangle");
QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData());
+#if QT_CONFIG(regularexpression)
// V8 error message for invalid binding to anchor
- expectedWarning = testUrl.toString() + QString::fromLatin1(":14:9: Unable to assign QQuickItem_QML_8 to QQuickAnchorLine");
- QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData());
+ const QRegularExpression warning(
+ "^" + testUrl.toString()
+ + ":14:9: Unable to assign QQuickItem_QML_\\d+ to QQuickAnchorLine$");
+ QTest::ignoreMessage(QtWarningMsg, warning);
+#endif
QQmlComponent component(&engine, testUrl);
QObject *obj = component.create();
diff --git a/tests/auto/qml/qqmlpropertycache/data/SpecialObject1.qml b/tests/auto/qml/qqmlpropertycache/data/SpecialObject1.qml
new file mode 100644
index 0000000000..9559bc0b5f
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/data/SpecialObject1.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ readonly property bool fakeProperty: false
+}
diff --git a/tests/auto/qml/qqmlpropertycache/data/SpecialObject2.qml b/tests/auto/qml/qqmlpropertycache/data/SpecialObject2.qml
new file mode 100644
index 0000000000..ed4ad04fef
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/data/SpecialObject2.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ objectName: "special"
+}
diff --git a/tests/auto/qml/qqmlpropertycache/data/noDuckType.qml b/tests/auto/qml/qqmlpropertycache/data/noDuckType.qml
new file mode 100644
index 0000000000..5e1ea233b9
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/data/noDuckType.qml
@@ -0,0 +1,7 @@
+import QtQml 2.9
+
+QtObject {
+ property SpecialObject1 obj1: SpecialObject1 {}
+ property SpecialObject2 obj2: SpecialObject2 {}
+ property string result: (obj1 instanceof SpecialObject2) ? "bad" : "good"
+}
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index 9a1e4667dd..c9e92cd3c9 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -54,6 +54,7 @@ private slots:
void metaObjectSize_data();
void metaObjectSize();
void metaObjectChecksum();
+ void metaObjectsForRootElements();
private:
QQmlEngine engine;
@@ -543,4 +544,14 @@ void tst_qqmlpropertycache::metaObjectChecksum()
}
}
+void tst_qqmlpropertycache::metaObjectsForRootElements()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("noDuckType.qml"));
+ QVERIFY(c.isReady());
+ QScopedPointer<QObject> obj(c.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("result").toString(), QString::fromLatin1("good"));
+}
+
QTEST_MAIN(tst_qqmlpropertycache)
diff --git a/tests/auto/qml/qqmlqt/data/formatting.qml b/tests/auto/qml/qqmlqt/data/formatting.qml
index 7a462c8eeb..f2d1e1b5c8 100644
--- a/tests/auto/qml/qqmlqt/data/formatting.qml
+++ b/tests/auto/qml/qqmlqt/data/formatting.qml
@@ -41,4 +41,9 @@ QtObject {
property string err_dateTime1: Qt.formatDateTime()
property string err_dateTime2: Qt.formatDateTime(new Date, new Object)
+
+ property var qdate
+ property var qtime
+ property var qdatetime
+ property var qvariant
}
diff --git a/tests/auto/qml/qqmlqt/data/timeRoundtrip.qml b/tests/auto/qml/qqmlqt/data/timeRoundtrip.qml
index 9d73640c87..65732442af 100644
--- a/tests/auto/qml/qqmlqt/data/timeRoundtrip.qml
+++ b/tests/auto/qml/qqmlqt/data/timeRoundtrip.qml
@@ -1,6 +1,8 @@
import QtQuick 2.0
+import Test 1.0
QtObject {
+ required property TimeProvider tp
Component.onCompleted: {
var t = tp.time;
tp.time = t;
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index 2d8115e867..15ef31464b 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -777,10 +777,6 @@ void tst_qqmlqt::dateTimeFormatting()
QQmlEngine eng;
- eng.rootContext()->setContextProperty("qdate", date);
- eng.rootContext()->setContextProperty("qtime", time);
- eng.rootContext()->setContextProperty("qdatetime", dateTime);
-
QQmlComponent component(&eng, testFileUrl("formatting.qml"));
QStringList warnings;
@@ -794,7 +790,11 @@ void tst_qqmlqt::dateTimeFormatting()
foreach (const QString &warning, warnings)
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- QObject *object = component.create();
+ QObject *object = component.createWithInitialProperties({
+ {"qdate", date},
+ {"qtime", time},
+ {"qdatetime", dateTime}
+ });
QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
QVERIFY(object != nullptr);
@@ -853,7 +853,6 @@ void tst_qqmlqt::dateTimeFormattingVariants()
QFETCH(QStringList, expectedResults);
QQmlEngine eng;
- eng.rootContext()->setContextProperty("qvariant", variant);
QQmlComponent component(&eng, testFileUrl("formatting.qml"));
QStringList warnings;
@@ -867,7 +866,7 @@ void tst_qqmlqt::dateTimeFormattingVariants()
foreach (const QString &warning, warnings)
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- QObject *object = component.create();
+ QObject *object = component.createWithInitialProperties({{"qvariant", variant}});
QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
QVERIFY(object != nullptr);
@@ -1174,6 +1173,7 @@ void tst_qqmlqt::qtObjectContents()
class TimeProvider: public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(TimeProvider)
Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged)
public:
@@ -1254,13 +1254,14 @@ void tst_qqmlqt::timeRoundtrip()
TimeZoneSwitch tzs(QTest::currentDataTag());
QFETCH(QTime, time);
+ qmlRegisterTypesAndRevisions<TimeProvider>("Test", 1);
TimeProvider tp(time);
QQmlEngine eng;
- eng.rootContext()->setContextProperty(QLatin1String("tp"), &tp);
+ //qmlRegisterSingletonInstance("Test", 1, 0, "TimeProvider", &tp);
QQmlComponent component(&eng, testFileUrl("timeRoundtrip.qml"));
- QObject *obj = component.create();
+ QObject *obj = component.createWithInitialProperties({{"tp", QVariant::fromValue(&tp)}});
QVERIFY(obj != nullptr);
// QML reads m_getTime and saves the result as m_putTime; this should come out the same, without
diff --git a/tests/auto/qml/qqmltypeloader/data/Com/Orga/BaseStyle.qml b/tests/auto/qml/qqmltypeloader/data/Com/Orga/BaseStyle.qml
new file mode 100644
index 0000000000..28521e3af2
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/Com/Orga/BaseStyle.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.6
+
+Item {
+
+}
diff --git a/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/Handler.qml b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/Handler.qml
new file mode 100644
index 0000000000..b20a2def11
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/Handler.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.6
+import Com.Orga 1.0
+
+Rectangle {
+ color: Style.name
+ Text {text: "Hello world!"}
+}
diff --git a/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/qmldir b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/qmldir
new file mode 100644
index 0000000000..368cb65b35
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Handlers/qmldir
@@ -0,0 +1,2 @@
+module Com.Orga.Handlers
+Handler 1.0 Handler.qml
diff --git a/tests/auto/qml/qqmltypeloader/data/Com/Orga/Style.qml b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Style.qml
new file mode 100644
index 0000000000..7951f5e768
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/Com/Orga/Style.qml
@@ -0,0 +1,6 @@
+pragma Singleton
+import QtQuick 2.6
+
+BaseStyle {
+ property color name: "black"
+}
diff --git a/tests/auto/qml/qqmltypeloader/data/Com/Orga/qmldir b/tests/auto/qml/qqmltypeloader/data/Com/Orga/qmldir
new file mode 100644
index 0000000000..9c5560b323
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/Com/Orga/qmldir
@@ -0,0 +1,2 @@
+singleton Style 1.0 Style.qml
+BaseStyle 1.0 BaseStyle.qml
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 63a43eebad..07f67c7843 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -60,6 +60,7 @@ private slots:
void implicitComponentModule();
void qrcRootPathUrl();
void implicitImport();
+ void compositeSingletonCycle();
private:
void checkSingleton(const QString & dataDirectory);
@@ -443,7 +444,7 @@ void tst_QQMLTypeLoader::redirect()
component.loadUrl(server.urlString("/Load.qml"), QQmlComponent::Asynchronous);
QTRY_VERIFY2(component.isReady(), qPrintable(component.errorString()));
- QObject *object = component.create();
+ QScopedPointer<QObject> object {component.create()};
QTRY_COMPARE(object->property("xy").toInt(), 323232);
}
@@ -539,6 +540,23 @@ void tst_QQMLTypeLoader::implicitImport()
QVERIFY(!obj.isNull());
}
+void tst_QQMLTypeLoader::compositeSingletonCycle()
+{
+ TestHTTPServer server;
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ QVERIFY(server.serveDirectory(dataDirectory()));
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ engine.addImportPath(server.baseUrl().toString());
+ component.loadUrl(server.urlString("Com/Orga/Handlers/Handler.qml"), QQmlComponent::Asynchronous);
+ QTRY_VERIFY2(component.isReady(), qPrintable(component.errorString()));
+
+ QScopedPointer<QObject> object {component.create()};
+ QVERIFY(object);
+ QCOMPARE(qvariant_cast<QColor>(object->property("color")), QColorConstants::Black);
+}
+
QTEST_MAIN(tst_QQMLTypeLoader)
#include "tst_qqmltypeloader.moc"
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml
index d2f748c4c4..2aa03ed39f 100644
--- a/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
import Test 1.0
Item {
+ required property TestValueExporter testValueExporter
property bool success: false
// Test user value type stored as both var and variant
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp
index 22074602b7..b44889798c 100644
--- a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp
+++ b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp
@@ -256,6 +256,7 @@ class TestValueExporter : public QObject
{
Q_OBJECT
Q_PROPERTY(TestValue testValue READ testValue WRITE setTestValue)
+ QML_NAMED_ELEMENT(TestValueExporter)
public:
TestValue testValue() const { return m_testValue; }
void setTestValue(const TestValue &v) { m_testValue = v; }
@@ -275,15 +276,14 @@ void tst_qqmlvaluetypeproviders::userType()
qRegisterMetaType<TestValue>();
QMetaType::registerComparators<TestValue>();
- qmlRegisterType<TestValueExporter>("Test", 1, 0, "TestValueExporter");
+ qmlRegisterTypesAndRevisions<TestValueExporter>("Test", 1);
TestValueExporter exporter;
QQmlEngine e;
- e.rootContext()->setContextProperty("testValueExporter", &exporter);
QQmlComponent component(&e, testFileUrl("userType.qml"));
- QScopedPointer<QObject> obj(component.create());
+ QScopedPointer<QObject> obj(component.createWithInitialProperties({{"testValueExporter", QVariant::fromValue(&exporter)}}));
QVERIFY(obj != nullptr);
QCOMPARE(obj->property("success").toBool(), true);
}
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
index b7600351b7..ae99e35467 100644
--- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
+++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
@@ -75,6 +75,7 @@ private slots:
void introspectQrc();
void sortCaseSensitive_data();
void sortCaseSensitive();
+ void updateProperties();
private:
void checkNoErrors(const QQmlComponent& component);
QQmlEngine engine;
@@ -425,6 +426,47 @@ void tst_qquickfolderlistmodel::sortCaseSensitive()
QTRY_COMPARE(flm->data(flm->index(i),FileNameRole).toString(), expectedOrder.at(i));
}
+void tst_qquickfolderlistmodel::updateProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("basic.qml"));
+ checkNoErrors(component);
+
+ QObject *folderListModel = component.create();
+ QVERIFY(folderListModel);
+
+ QVariant caseSensitive = folderListModel->property("caseSensitive");
+ QVERIFY(caseSensitive.isValid());
+ QCOMPARE(caseSensitive.toBool(), true);
+ folderListModel->setProperty("caseSensitive", false);
+ caseSensitive = folderListModel->property("caseSensitive");
+ QVERIFY(caseSensitive.isValid());
+ QCOMPARE(caseSensitive.toBool(), false);
+
+ QVariant showOnlyReadable = folderListModel->property("showOnlyReadable");
+ QVERIFY(showOnlyReadable.isValid());
+ QCOMPARE(showOnlyReadable.toBool(), false);
+ folderListModel->setProperty("showOnlyReadable", true);
+ showOnlyReadable = folderListModel->property("showOnlyReadable");
+ QVERIFY(showOnlyReadable.isValid());
+ QCOMPARE(showOnlyReadable.toBool(), true);
+
+ QVariant showDotAndDotDot = folderListModel->property("showDotAndDotDot");
+ QVERIFY(showDotAndDotDot.isValid());
+ QCOMPARE(showDotAndDotDot.toBool(), false);
+ folderListModel->setProperty("showDotAndDotDot", true);
+ showDotAndDotDot = folderListModel->property("showDotAndDotDot");
+ QVERIFY(showDotAndDotDot.isValid());
+ QCOMPARE(showDotAndDotDot.toBool(), true);
+
+ QVariant showHidden = folderListModel->property("showHidden");
+ QVERIFY(showHidden.isValid());
+ QCOMPARE(showHidden.toBool(), false);
+ folderListModel->setProperty("showHidden", true);
+ showHidden = folderListModel->property("showHidden");
+ QVERIFY(showHidden.isValid());
+ QCOMPARE(showHidden.toBool(), true);
+}
+
QTEST_MAIN(tst_qquickfolderlistmodel)
#include "tst_qquickfolderlistmodel.moc"
diff --git a/tests/auto/quick/qquickanimatedimage/data/currentframe.qml b/tests/auto/quick/qquickanimatedimage/data/currentframe.qml
new file mode 100644
index 0000000000..b679da2a99
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/currentframe.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ property int currentFrameChangeCount: 0
+ property int frameChangeCount: 0
+ source: "stickman.gif"
+ onCurrentFrameChanged: if (currentFrame > 0) ++currentFrameChangeCount;
+ onFrameChanged: if (currentFrame > 0) ++frameChangeCount;
+ function scriptedSetCurrentFrame(frame) {
+ currentFrame = frame;
+ }
+}
+
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
index 8026bafb9e..31c3fb9946 100644
--- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include <qtest.h>
#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQuick/qquickview.h>
#include <QtQuick/private/qquickrectangle_p.h>
@@ -40,6 +41,23 @@
Q_DECLARE_METATYPE(QQuickImageBase::Status)
+template <typename T> static T evaluate(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ QVariant result = expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+ return result.value<T>();
+}
+
+template <> void evaluate<void>(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+}
+
class tst_qquickanimatedimage : public QQmlDataTest
{
Q_OBJECT
@@ -68,6 +86,7 @@ private slots:
void playingAndPausedChanges();
void noCaching();
void sourceChangesOnFrameChanged();
+ void currentFrame();
};
void tst_qquickanimatedimage::cleanup()
@@ -618,6 +637,33 @@ void tst_qquickanimatedimage::sourceChangesOnFrameChanged()
qDeleteAll(images);
}
+void tst_qquickanimatedimage::currentFrame()
+{
+ QQuickView window;
+ window.setSource(testFileUrl("currentframe.qml"));
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject());
+ QVERIFY(anim);
+ QSignalSpy frameChangedSpy(anim, SIGNAL(frameChanged()));
+ QSignalSpy currentFrameChangedSpy(anim, SIGNAL(currentFrameChanged()));
+
+ anim->setCurrentFrame(1);
+ QCOMPARE(anim->currentFrame(), 1);
+ QCOMPARE(frameChangedSpy.count(), 1);
+ QCOMPARE(currentFrameChangedSpy.count(), 1);
+ QCOMPARE(anim->property("currentFrameChangeCount"), 1);
+ QCOMPARE(anim->property("frameChangeCount"), 1);
+
+ evaluate<void>(anim, "scriptedSetCurrentFrame(2)");
+ QCOMPARE(anim->currentFrame(), 2);
+ QCOMPARE(frameChangedSpy.count(), 2);
+ QCOMPARE(currentFrameChangedSpy.count(), 2);
+ QCOMPARE(anim->property("currentFrameChangeCount"), 2);
+ QCOMPARE(anim->property("frameChangeCount"), 2);
+}
+
QTEST_MAIN(tst_qquickanimatedimage)
#include "tst_qquickanimatedimage.moc"
diff --git a/tests/auto/quick/qquickflickable/data/resize.qml b/tests/auto/quick/qquickflickable/data/resize.qml
index 2f7ae7b8bb..131691d012 100644
--- a/tests/auto/quick/qquickflickable/data/resize.qml
+++ b/tests/auto/quick/qquickflickable/data/resize.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
Rectangle {
+ required property bool setRebound
function resizeContent() {
flick.resizeContent(600, 600, Qt.point(100, 100))
}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index c104eecbcd..5364530ca8 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -226,7 +226,7 @@ void tst_qquickflickable::create()
{
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("flickable01.qml"));
- QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create());
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.createWithInitialProperties({{"setRebound", false}}));
QVERIFY(obj != nullptr);
QCOMPARE(obj->isAtXBeginning(), true);
@@ -782,9 +782,8 @@ void tst_qquickflickable::flickableDirection()
void tst_qquickflickable::resizeContent()
{
QQmlEngine engine;
- engine.rootContext()->setContextProperty("setRebound", QVariant::fromValue(false));
QQmlComponent c(&engine, testFileUrl("resize.qml"));
- QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.createWithInitialProperties({{"setRebound", false}}));
QQuickFlickable *obj = findItem<QQuickFlickable>(root, "flick");
QVERIFY(obj != nullptr);
@@ -816,7 +815,7 @@ void tst_qquickflickable::returnToBounds()
QScopedPointer<QQuickView> window(new QQuickView);
- window->rootContext()->setContextProperty("setRebound", setRebound);
+ window->setInitialProperties({{"setRebound", setRebound}});
window->setSource(testFileUrl("resize.qml"));
window->show();
QVERIFY(QTest::qWaitForWindowActive(window.data()));
diff --git a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
index 6a1c0632ad..49838c4fd5 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml
@@ -60,8 +60,8 @@ Item {
id: testCase
name: "Tests_GridLayout"
when: windowShown
- width: 200
- height: 200
+ width: parent.width
+ height: parent.height
Component {
id: layout_flow_Component
@@ -84,7 +84,7 @@ Item {
function test_flow()
{
- var layout = layout_flow_Component.createObject(container);
+ var layout = createTemporaryObject(layout_flow_Component, container);
tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
tryCompare(layout.children[1], "itemRect", [10, 0, 10, 10])
tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
@@ -102,8 +102,6 @@ Item {
tryCompare(layout.children[4], "itemRect", [10, 0, 10, 10])
tryCompare(layout.children[5], "itemRect", [10, 10, 10, 10])
-
- layout.destroy()
}
Component {
@@ -178,7 +176,7 @@ Item {
}
function test_flowLeftToRight() {
- var layout = layout_flowLeftToRight_Component.createObject(container);
+ var layout = createTemporaryObject(layout_flowLeftToRight_Component, container);
compare(layout.implicitWidth, 80);
compare(layout.children[0].x, 0);
compare(layout.children[0].y, 0);
@@ -208,8 +206,6 @@ Item {
compare(layout.children[11].y, 60);
compare(layout.children[12].x, 40);
compare(layout.children[12].y, 80);
-
- layout.destroy();
}
@@ -259,7 +255,7 @@ Item {
function test_flowLeftToRightDefaultPositions() {
ignoreWarning("QGridLayoutEngine::addItem: Cell (1, 0) already taken");
- var layout = layout_flowLeftToRightDefaultPositions_Component.createObject(container);
+ var layout = createTemporaryObject(layout_flowLeftToRightDefaultPositions_Component, container);
compare(layout.implicitWidth, 40);
compare(layout.children[0].x, 0);
compare(layout.children[0].y, 0);
@@ -267,7 +263,6 @@ Item {
compare(layout.children[1].y, 20);
compare(layout.children[2].x, 20);
compare(layout.children[2].y, 20);
- layout.destroy();
}
@@ -342,7 +337,7 @@ Item {
}
function test_flowTopToBottom() {
- var layout = layout_flowTopToBottom_Component.createObject(container);
+ var layout = createTemporaryObject(layout_flowTopToBottom_Component, container);
compare(layout.children[0].x, 0);
compare(layout.children[0].y, 0);
compare(layout.children[1].x, 20);
@@ -371,8 +366,6 @@ Item {
compare(layout.children[11].y, 60);
compare(layout.children[12].x, 80);
compare(layout.children[12].y, 0);
-
- layout.destroy();
}
Component {
@@ -432,7 +425,7 @@ Item {
}
function test_spanAcrossEmptyRows() {
- var layout = layout_spanAcrossEmptyRows_Component.createObject(container);
+ var layout = createTemporaryObject(layout_spanAcrossEmptyRows_Component, container);
compare(layout.children[0].x, 0);
compare(layout.children[0].y, 0);
compare(layout.children[1].x, 20);
@@ -442,8 +435,6 @@ Item {
compare(layout.implicitWidth, 60);
compare(layout.Layout.maximumWidth, 120);
-
- layout.destroy();
}
Component {
@@ -463,14 +454,13 @@ Item {
}
function test_spanIsMoreThanColumns() {
- var layout = layout_spanIsMoreThanColumns_Component.createObject(container);
+ var layout = createTemporaryObject(layout_spanIsMoreThanColumns_Component, container);
// item was not added, therefore implicit width is 0
compare(layout.implicitWidth, 0);
- layout.destroy();
}
function test_sizeHints() {
- var layout = layout_spanAcrossEmptyRows_Component.createObject(container);
+ var layout = createTemporaryObject(layout_spanAcrossEmptyRows_Component, container);
compare(layout.visible, true)
var minWidth = layout.Layout.minimumWidth
@@ -489,8 +479,6 @@ Item {
compare(prefHeight, layout.implicitHeight)
compare(maxWidth, layout.Layout.maximumWidth)
compare(maxHeight, layout.Layout.maximumHeight)
-
- layout.destroy();
}
Component {
@@ -567,7 +555,7 @@ Item {
function test_alignment()
{
- var layout = layout_alignment_Component.createObject(container);
+ var layout = createTemporaryObject(layout_alignment_Component, container);
layout.width = 60;
layout.height = 100;
@@ -596,8 +584,6 @@ Item {
layout.children[4].Layout.alignment = Qt.AlignLeft
tryCompare(layout.children[4], "x", 0);
tryCompare(layout.children[4], "y", 60);
-
- layout.destroy();
}
@@ -648,7 +634,7 @@ Item {
function test_rightToLeft()
{
- var layout = layout_rightToLeft_Component.createObject(container);
+ var layout = createTemporaryObject(layout_rightToLeft_Component, container);
layout.width = 180;
layout.height = 50;
@@ -674,8 +660,6 @@ Item {
layout.LayoutMirroring.enabled = true
verifyIsRightToLeft(layout)
-
- layout.destroy();
}
Component {
@@ -698,7 +682,7 @@ Item {
function test_columnsChanged()
{
- var layout = layout_columnsOrRowsChanged_Component.createObject(container);
+ var layout = createTemporaryObject(layout_columnsOrRowsChanged_Component, container);
layout.width = 40;
layout.height = 20;
tryCompare(layout.children[0], "itemRect", [ 0, 5, 10, 10])
@@ -711,13 +695,11 @@ Item {
tryCompare(layout.children[1], "itemRect", [20, 0, 10, 10])
tryCompare(layout.children[2], "itemRect", [ 0, 10, 10, 10])
tryCompare(layout.children[3], "itemRect", [20, 10, 10, 10])
-
- layout.destroy()
}
function test_rowsChanged()
{
- var layout = layout_columnsOrRowsChanged_Component.createObject(container);
+ var layout = createTemporaryObject(layout_columnsOrRowsChanged_Component, container);
layout.flow = GridLayout.TopToBottom
layout.width = 20;
layout.height = 40;
@@ -731,8 +713,6 @@ Item {
tryCompare(layout.children[1], "itemRect", [ 0, 25, 10, 10])
tryCompare(layout.children[2], "itemRect", [10, 5, 10, 10])
tryCompare(layout.children[3], "itemRect", [10, 25, 10, 10])
-
- layout.destroy()
}
Component {
@@ -767,7 +747,7 @@ Item {
function test_columnOrRowChanged()
{
- var layout = layout_columnOrRowChanged_Component.createObject(container);
+ var layout = createTemporaryObject(layout_columnOrRowChanged_Component, container);
layout.width = layout.implicitWidth
layout.height = layout.implicitHeight
// c0-c1-c2
@@ -795,8 +775,6 @@ Item {
tryCompare(layout.children[0], "itemRect", [10, 10, 10, 10])
tryCompare(layout.children[1], "itemRect", [ 0, 0, 10, 10])
tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
-
- layout.destroy()
}
Component {
@@ -819,7 +797,7 @@ Item {
}
function test_baselines()
{
- var layout = layout_baselines_Component.createObject(container);
+ var layout = createTemporaryObject(layout_baselines_Component, container);
tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
tryCompare(layout.children[1], "itemRect", [10, 0, 10, 10])
compare(layout.implicitWidth, 20)
@@ -832,8 +810,6 @@ Item {
tryCompare(layout.children[1], "itemRect", [10, 10, 10, 10])
compare(layout.implicitWidth, 20)
compare(layout.implicitHeight, 20)
-
- layout.destroy();
}
Component {
@@ -851,30 +827,42 @@ Item {
}
}
- function test_spacings()
+ function test_spacings_data()
+ {
+ let data = [
+ { spacing: Number.NaN },
+ { spacing: 0 },
+ { spacing: 10 },
+ { spacing: -5 },
+ { spacing: -19 }
+ ]
+ for (let i = 0; i < data.length; ++i) {
+ data[i].tag = data[i].spacing.toString()
+ }
+ return data
+ }
+
+ function test_spacings(data)
{
- var layout = layout_spacings_Component.createObject(container);
+ var layout = createTemporaryObject(layout_spacings_Component, container);
// breaks down below -19. This is acceptable, since it means that the implicit size of the layout is negative
var testSpacings = [Number.NaN, 0, 10, -5, -19]
layout.rowSpacing = 0
- for (var i = 0; i < testSpacings.length; ++i) {
- var sp = testSpacings[i]
- if (isNaN(sp)) {
- sp = 5 // Test defaults
- } else {
- layout.columnSpacing = sp
- }
- tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
- tryCompare(layout.children[1], "itemRect", [10 + sp, 0, 10, 10])
- compare(layout.implicitWidth, 20 + sp)
+ var spacing = data.spacing
+ if (isNaN(spacing)) {
+ spacing = 5 // Test defaults
+ } else {
+ layout.columnSpacing = spacing
}
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10 + spacing, 0, 10, 10])
+ compare(layout.implicitWidth, 20 + spacing)
// do not crash
layout.columnSpacing = -100
waitForRendering(layout)
verify(isFinite(layout.implicitWidth))
- layout.destroy();
}
Component {
@@ -1026,11 +1014,10 @@ Item {
function test_invalidateWhileRearranging_QTBUG_44139()
{
- var layout = layout_invalidateWhileRearranging_Component.createObject(container)
+ var layout = createTemporaryObject(layout_invalidateWhileRearranging_Component, container)
waitForRendering(layout);
verify(layout.children[1].visible == false);
- layout.destroy()
}
}
}
diff --git a/tests/auto/quick/qquickmousearea/BLACKLIST b/tests/auto/quick/qquickmousearea/BLACKLIST
new file mode 100644
index 0000000000..f2cb00225b
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/BLACKLIST
@@ -0,0 +1,4 @@
+# QTBUG-78153
+[nestedStopAtBounds]
+opensuse-leap
+
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 5844720aa4..17553ee6c4 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -1359,6 +1359,34 @@ void tst_QQuickMouseArea::hoverVisible()
QCOMPARE(enteredSpy.count(), 1);
QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(11,33));
+
+ // QTBUG-77983
+ mouseTracker->setVisible(false);
+ mouseTracker->setEnabled(false);
+
+ QCOMPARE(mouseTracker->hovered(), false);
+ mouseTracker->setVisible(true);
+ // if the enabled property is false, the containsMouse property shouldn't become true
+ // when an invisible mousearea become visible
+ QCOMPARE(mouseTracker->hovered(), false);
+
+ mouseTracker->parentItem()->setEnabled(false);
+ mouseTracker->setVisible(false);
+ mouseTracker->setEnabled(true);
+
+ QCOMPARE(mouseTracker->hovered(), false);
+ mouseTracker->setVisible(true);
+ // if the parent item is not enabled, the containsMouse property will be false, even if
+ // the mousearea is enabled
+ QCOMPARE(mouseTracker->hovered(), false);
+
+ mouseTracker->parentItem()->setEnabled(true);
+ mouseTracker->setVisible(false);
+ mouseTracker->setEnabled(true);
+
+ QCOMPARE(mouseTracker->hovered(), false);
+ mouseTracker->setVisible(true);
+ QCOMPARE(mouseTracker->hovered(), true);
}
void tst_QQuickMouseArea::hoverAfterPress()
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index cd66fc4ede..e96b892b54 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -72,6 +72,7 @@ private slots:
void mouseGestureStarted_data();
void mouseGestureStarted();
void cancel();
+ void stationaryTouchWithChangingPressure();
private:
QQuickView *createAndShowView(const QString &file);
@@ -1305,6 +1306,42 @@ void tst_QQuickMultiPointTouchArea::cancel()
}
+void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTBUG-77142
+{
+ QScopedPointer<QQuickView> window(createAndShowView("basic.qml"));
+ QVERIFY(window->rootObject() != nullptr);
+
+ QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
+ QCOMPARE(point1->pressed(), false);
+
+ QPoint p1(20,100);
+ QTouchEvent::TouchPoint tp1(1);
+
+ tp1.setScreenPos(window->mapToGlobal(p1));
+ tp1.setState(Qt::TouchPointPressed);
+ tp1.setPressure(0.5);
+ qt_handleTouchEvent(window.data(), device, {tp1});
+ QQuickTouchUtils::flush(window.data());
+
+ QCOMPARE(point1->pressed(), true);
+ QCOMPARE(point1->pressure(), 0.5);
+
+ tp1.setState(Qt::TouchPointStationary);
+ tp1.setPressure(0.6);
+ qt_handleTouchEvent(window.data(), device, {tp1});
+ QQuickTouchUtils::flush(window.data());
+
+ QCOMPARE(point1->pressure(), 0.6);
+
+ tp1.setState(Qt::TouchPointReleased);
+ tp1.setPressure(0);
+ qt_handleTouchEvent(window.data(), device, {tp1});
+ QQuickTouchUtils::flush(window.data());
+
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point1->pressure(), 0);
+}
+
QTEST_MAIN(tst_QQuickMultiPointTouchArea)
diff --git a/tests/auto/quick/qquickpathview/data/nestedmousearea2.qml b/tests/auto/quick/qquickpathview/data/nestedmousearea2.qml
new file mode 100644
index 0000000000..ff11002552
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/nestedmousearea2.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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 The Qt Company Ltd 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
+
+PathView {
+ id: view
+ width: 400; height: 240
+ highlight: Rectangle { width: 80; height: 80; color: "lightsteelblue" }
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ model: ListModel {
+ id: appModel
+ ListElement { name: "Music" }
+ ListElement { name: "Movies" }
+ ListElement { name: "Camera" }
+ ListElement { name: "Calendar" }
+ ListElement { name: "Messaging" }
+ ListElement { name: "Todo List" }
+ ListElement { name: "Contacts" }
+ }
+ delegate: Rectangle {
+ width: 100; height: 100
+ scale: PathView.iconScale
+ border.color: "lightgrey"
+ color: "transparent"
+ Text {
+ anchors { horizontalCenter: parent.horizontalCenter }
+ text: name
+ smooth: true
+ color: ma.pressed ? "red" : "black"
+ }
+
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ onClicked: view.currentIndex = index
+ }
+ }
+ path: Path {
+ startX: 10
+ startY: 50
+ PathAttribute { name: "iconScale"; value: 0.5 }
+ PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 }
+ PathAttribute { name: "iconScale"; value: 1.0 }
+ PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 }
+ PathAttribute { name: "iconScale"; value: 0.5 }
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: 20
+ text: view.currentIndex + " @ " + offset.toFixed(2)
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index d2058cc8b3..48d6c257a6 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -120,6 +120,7 @@ private slots:
void undefinedPath();
void mouseDrag();
void nestedMouseAreaDrag();
+ void flickNClick();
void treeModel();
void changePreferredHighlight();
void missingPercent();
@@ -1603,6 +1604,32 @@ void tst_QQuickPathView::nestedMouseAreaDrag()
QVERIFY(pathview->isMoving());
}
+void tst_QQuickPathView::flickNClick() // QTBUG-77173
+{
+ QScopedPointer<QQuickView> window(createView());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->setSource(testFileUrl("nestedmousearea2.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != nullptr);
+
+ for (int duration = 100; duration > 0; duration -= 20) {
+ // Dragging the child mouse area should animate the PathView (MA has no drag target)
+ flick(window.data(), QPoint(200,200), QPoint(400,200), duration);
+ QVERIFY(pathview->isMoving());
+
+ // Now while it's still moving, click it.
+ // The PathView should stop at a position such that offset is a whole number.
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200));
+ QTRY_VERIFY(!pathview->isMoving());
+ QVERIFY(qFuzzyIsNull(pathview->offset() - int(pathview->offset())));
+ }
+}
+
void tst_QQuickPathView::treeModel()
{
QScopedPointer<QQuickView> window(createView());
diff --git a/tests/auto/quick/qquickpositioners/data/transitions-padding.qml b/tests/auto/quick/qquickpositioners/data/transitions-padding.qml
index e3175c480c..eda9ce628e 100644
--- a/tests/auto/quick/qquickpositioners/data/transitions-padding.qml
+++ b/tests/auto/quick/qquickpositioners/data/transitions-padding.qml
@@ -5,6 +5,16 @@ Rectangle {
width: 500
height: 500
+ required property bool usePopulateTransition
+ required property bool enableAddTransition
+ required property bool dynamicallyPopulate
+ required property var testModel
+ required property var model_targetItems_transitionFrom
+ required property var model_displacedItems_transitionVia
+ required property point targetItems_transitionFrom
+ required property point displacedItems_transitionVia
+ required property string testedPositioner
+
property int duration: 50
property real incrementalSize: 5
diff --git a/tests/auto/quick/qquickpositioners/data/transitions.qml b/tests/auto/quick/qquickpositioners/data/transitions.qml
index a1f27bb06e..988a01e373 100644
--- a/tests/auto/quick/qquickpositioners/data/transitions.qml
+++ b/tests/auto/quick/qquickpositioners/data/transitions.qml
@@ -5,6 +5,16 @@ Rectangle {
width: 500
height: 500
+ required property bool usePopulateTransition
+ required property bool enableAddTransition
+ required property bool dynamicallyPopulate
+ required property var testModel
+ required property var model_targetItems_transitionFrom
+ required property var model_displacedItems_transitionVia
+ required property point targetItems_transitionFrom
+ required property point displacedItems_transitionVia
+ required property string testedPositioner
+
property int duration: 50
property real incrementalSize: 5
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index d3c0f345b9..e6bbd8c215 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -1025,16 +1025,17 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN
QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
- QQmlContext *ctxt = window->rootContext();
- ctxt->setContextProperty("usePopulateTransition", usePopulateTransition);
- ctxt->setContextProperty("enableAddTransition", true);
- ctxt->setContextProperty("dynamicallyPopulate", dynamicallyPopulate);
- ctxt->setContextProperty("testModel", &model);
- ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
- ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
- ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
- ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- ctxt->setContextProperty("testedPositioner", positionerObjectName);
+ window->setInitialProperties({
+ {"usePopulateTransition", usePopulateTransition},
+ {"enableAddTransition", true},
+ {"dynamicallyPopulate", dynamicallyPopulate},
+ {"testModel", QVariant::fromValue(&model)},
+ {"model_targetItems_transitionFrom", QVariant::fromValue(&model_targetItems_transitionFrom)},
+ {"model_displacedItems_transitionVia", QVariant::fromValue(&model_displacedItems_transitionVia)},
+ {"targetItems_transitionFrom", targetItems_transitionFrom},
+ {"displacedItems_transitionVia", displacedItems_transitionVia},
+ {"testedPositioner", positionerObjectName}
+ });
window->setSource(testFileUrl(qmlFile));
QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
@@ -1111,16 +1112,17 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
QaimModel model_displacedItems_transitionVia;
QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
- QQmlContext *ctxt = window->rootContext();
- ctxt->setContextProperty("usePopulateTransition", QVariant(false));
- ctxt->setContextProperty("enableAddTransition", QVariant(true));
- ctxt->setContextProperty("dynamicallyPopulate", QVariant(false));
- ctxt->setContextProperty("testModel", &model);
- ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
- ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
- ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
- ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- ctxt->setContextProperty("testedPositioner", QString());
+ window->setInitialProperties({
+ {"usePopulateTransition", QVariant(false)},
+ {"enableAddTransition", QVariant(true)},
+ {"dynamicallyPopulate", QVariant(false)},
+ {"testModel", QVariant::fromValue(&model)},
+ {"model_targetItems_transitionFrom", QVariant::fromValue(&model_targetItems_transitionFrom)},
+ {"model_displacedItems_transitionVia", QVariant::fromValue(&model_displacedItems_transitionVia)},
+ {"targetItems_transitionFrom", targetItems_transitionFrom},
+ {"displacedItems_transitionVia", displacedItems_transitionVia},
+ {"testedPositioner", QString()}
+ });
window->setSource(testFileUrl(qmlFile));
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
@@ -1234,16 +1236,17 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
QaimModel model_displacedItems_transitionVia;
QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
- QQmlContext *ctxt = window->rootContext();
- ctxt->setContextProperty("usePopulateTransition", QVariant(false));
- ctxt->setContextProperty("enableAddTransition", QVariant(false));
- ctxt->setContextProperty("dynamicallyPopulate", QVariant(false));
- ctxt->setContextProperty("testModel", &model);
- ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
- ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
- ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
- ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- ctxt->setContextProperty("testedPositioner", QString());
+ window->setInitialProperties({
+ {"usePopulateTransition", QVariant(false)},
+ {"enableAddTransition", QVariant(false)},
+ {"dynamicallyPopulate", QVariant(false)},
+ {"testModel", QVariant::fromValue(&model)},
+ {"model_targetItems_transitionFrom", QVariant::fromValue(&model_targetItems_transitionFrom)},
+ {"model_displacedItems_transitionVia", QVariant::fromValue(&model_displacedItems_transitionVia)},
+ {"targetItems_transitionFrom", targetItems_transitionFrom},
+ {"displacedItems_transitionVia", displacedItems_transitionVia},
+ {"testedPositioner", QString()}
+ });
window->setSource(testFileUrl(qmlFile));
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
diff --git a/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml b/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml
new file mode 100644
index 0000000000..ecc79a9368
--- /dev/null
+++ b/tests/auto/quick/qquicktableview/data/tweakimplicitsize.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Window 2.3
+
+Item {
+ width: 640
+ height: 450
+
+ property alias tableView: tableView
+ property real delegateSize: 10
+ property int hideRow: -1
+
+ TableView {
+ id: tableView
+ width: 600
+ height: 400
+ anchors.margins: 1
+ clip: true
+ delegate: tableViewDelegate
+ columnSpacing: 1
+ rowSpacing: 1
+ columnWidthProvider: function(column) {
+ return -1
+ }
+ rowHeightProvider: function(row) {
+ if (row === hideRow)
+ return 0
+ return -1
+ }
+ }
+
+ Component {
+ id: tableViewDelegate
+ Rectangle {
+ objectName: "tableViewDelegate"
+ implicitWidth: row === 0 ? 10 : delegateSize
+ implicitHeight: column === 0 ? 10 : delegateSize
+ color: "lightgray"
+ border.width: 1
+
+ Text {
+ id: textItem
+ anchors.centerIn: parent
+ text: model.display
+ renderType: Text.NativeRendering
+ }
+ }
+ }
+
+}
+
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index e3f79995d2..230dcc9446 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -119,6 +119,7 @@ private slots:
void checkRowHeightProviderNegativeReturnValue();
void checkRowHeightProviderNotCallable();
void checkForceLayoutFunction();
+ void checkForceLayoutEndUpDoingALayout();
void checkContentWidthAndHeight();
void checkPageFlicking();
void checkExplicitContentWidthAndHeight();
@@ -561,6 +562,32 @@ void tst_QQuickTableView::checkForceLayoutFunction()
QCOMPARE(fxItem->item->width(), newColumnWidth);
}
+void tst_QQuickTableView::checkForceLayoutEndUpDoingALayout()
+{
+ // QTBUG-77074
+ // Check that we change the implicit size of the delegate after
+ // the initial loading, and at the same time hide some rows or
+ // columns, and then do a forceLayout(), we end up with a
+ // complete relayout that respects the new implicit size.
+ LOAD_TABLEVIEW("tweakimplicitsize.qml");
+
+ auto model = TestModelAsVariant(10, 10);
+
+ tableView->setModel(model);
+
+ WAIT_UNTIL_POLISHED;
+
+ const qreal newDelegateSize = 20;
+ view->rootObject()->setProperty("delegateSize", newDelegateSize);
+ // Hide a row, just to force the following relayout to
+ // do a complete reload (and not just a relayout)
+ view->rootObject()->setProperty("hideRow", 1);
+ tableView->forceLayout();
+
+ for (auto fxItem : tableViewPrivate->loadedItems)
+ QCOMPARE(fxItem->item->height(), newDelegateSize);
+}
+
void tst_QQuickTableView::checkContentWidthAndHeight()
{
// Check that contentWidth/Height reports the correct size of the
diff --git a/tests/auto/quick/qquicktext/data/transparentBackground.qml b/tests/auto/quick/qquicktext/data/transparentBackground.qml
new file mode 100644
index 0000000000..a10a1779bb
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/transparentBackground.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "white"
+ Text {
+ objectName: "text"
+ textFormat: Text.RichText
+ anchors.fill: parent
+ color: "black"
+ text: "<h1 style=\"background-color:rgba(255,255,255,0.00)\">foo</h1>"
+ verticalAlignment: Text.AlignTop
+ horizontalAlignment: Text.AlignLeft
+ }
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 97107694bd..e62db81d27 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -164,6 +164,8 @@ private slots:
void verticallyAlignedImageInTable();
+ void transparentBackground();
+
private:
QStringList standard;
QStringList richText;
@@ -4429,6 +4431,26 @@ void tst_qquicktext::verticallyAlignedImageInTable()
// Don't crash
}
+void tst_qquicktext::transparentBackground()
+{
+ if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
+ || (QGuiApplication::platformName() == QLatin1String("minimal")))
+ QSKIP("Skipping due to grabToImage not functional on offscreen/minimimal platforms");
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("transparentBackground.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QImage img = window->grabWindow();
+ QCOMPARE(img.isNull(), false);
+
+ QColor color = img.pixelColor(0, 0);
+ QCOMPARE(color.red(), 255);
+ QCOMPARE(color.blue(), 255);
+ QCOMPARE(color.green(), 255);
+}
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 33a6b829bc..facd63027e 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2106,30 +2106,31 @@ void tst_qquicktextedit::mouseSelection()
textEditObject->setFocus(focus);
textEditObject->setFocusOnPress(focusOnPress);
+ // Avoid that the last click from the previous test data and the first click in the
+ // current test data happens so close in time that they are interpreted as a double click.
+ static const int moreThanDoubleClickInterval = QGuiApplication::styleHints()->mouseDoubleClickInterval() + 1;
+
// press-and-drag-and-release from x1 to x2
QPoint p1 = textEditObject->positionToRectangle(from).center().toPoint();
QPoint p2 = textEditObject->positionToRectangle(to).center().toPoint();
if (clicks == 2)
- QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval);
else if (clicks == 3)
- QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1, moreThanDoubleClickInterval);
+ // cancel the 500ms delta QTestLib adds in order to properly synthesize a triple click within the required interval
+ QTest::lastMouseTimestamp -= QTest::mouseDoubleClickInterval;
QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
- if (clicks == 2) {
- // QTBUG-50022: Since qtbase commit beef975, QTestLib avoids generating
- // double click events by adding 500ms delta to release event timestamps.
- // Send a double click event by hand to ensure the correct sequence:
- // press, release, press, _dbl click_, move, release.
- QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, p1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QGuiApplication::sendEvent(textEditObject, &dblClickEvent);
- }
QTest::mouseMove(&window, p2);
QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2);
QTRY_COMPARE(textEditObject->selectedText(), selectedText);
// Clicking and shift to clicking between the same points should select the same text.
textEditObject->setCursorPosition(0);
- if (clicks > 1)
+ if (clicks > 1) {
QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ // cancel the 500ms delta QTestLib adds in order to properly synthesize a triple click within the required interval
+ QTest::lastMouseTimestamp -= QTest::mouseDoubleClickInterval;
+ }
if (clicks != 2)
QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
QTest::mouseClick(&window, Qt::LeftButton, Qt::ShiftModifier, p2);
diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST
new file mode 100644
index 0000000000..ada7c57c75
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-78162
+[mouseSelectionMode]
+opensuse-leap
diff --git a/tests/manual/nodetypes_ng/nodetypes_ng.cpp b/tests/manual/nodetypes_ng/nodetypes_ng.cpp
index 829002b538..8fe0e0dc98 100644
--- a/tests/manual/nodetypes_ng/nodetypes_ng.cpp
+++ b/tests/manual/nodetypes_ng/nodetypes_ng.cpp
@@ -301,6 +301,13 @@ int main(int argc, char **argv)
fmt.setProfile(QSurfaceFormat::CoreProfile);
view.setFormat(fmt);
}
+ if (app.arguments().contains(QLatin1String("--transparent"))) {
+ qDebug("Requesting alpha channel for the window and using Qt::transparent as background");
+ QSurfaceFormat fmt = view.format();
+ fmt.setAlphaBufferSize(8);
+ view.setFormat(fmt);
+ view.setColor(Qt::transparent);
+ }
view.engine()->rootContext()->setContextProperty(QLatin1String("helper"), &helper);
diff --git a/tests/manual/pointer/tapWithModifiers.qml b/tests/manual/pointer/tapWithModifiers.qml
index 8ca1c1bd63..da3c0cb30a 100644
--- a/tests/manual/pointer/tapWithModifiers.qml
+++ b/tests/manual/pointer/tapWithModifiers.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the manual tests of the Qt Toolkit.
@@ -40,6 +40,16 @@ Item {
onTapped: console.log("tapped with no modifiers")
}
TapHandler {
- onTapped: console.log("tapped with modifiers " + point.event.modifiers)
+ onTapped:
+ switch (point.modifiers) {
+ case Qt.ControlModifier | Qt.AltModifier:
+ console.log("CTRL+ALT");
+ break;
+ case Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier:
+ console.log("CTRL+META+ALT");
+ break;
+ default:
+ console.log("other modifiers", point.modifiers)
+ }
}
}
diff --git a/tests/manual/scenegraph_lancelot/hostinfo.sh b/tests/manual/scenegraph_lancelot/hostinfo.sh
deleted file mode 100644
index 6bad2ba467..0000000000
--- a/tests/manual/scenegraph_lancelot/hostinfo.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the QtQml module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## 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 The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-# printProperty(): prints a key-value pair from given key and cmd list.
-# If running cmd fails, or does not produce any stdout, nothing is printed.
-# Arguments: $1: key, $2: cmd, $3: optional, field specification as to cut(1) -f
-printProperty ()
-{
- key=$1
- val=`{ eval $2 ; } 2>/dev/null`
- [ -n "$3" ] && val=`echo $val | tr -s '[:blank:]' '\t' | cut -f$3`
- [ -n "$val" ] && echo $key: $val
-}
-
-# printEnvVar(): prints a key-value pair from given environment variable name.
-# key is printed as "Env_<varname>".
-# If the variable is undefined, nothing is printed.
-# Arguments: $1: varname
-
-printEnvVar ()
-{
- key=Env_$1
- val=`eval 'echo $'$1`
- [ -n "$val" ] && echo $key: $val
-}
-
-
-# printOnOff(): prints a key-value pair from given environment variable name.
-# If variable is defined, value is printed as "<key>-On"; otherwise "<key>-Off".
-# Arguments: $1: key $2: varname
-
-printOnOff ()
-{
- key=$1
- val=`eval 'echo $'$2`
- if [ -z "$val" ] ; then
- val=Off
- else
- val=On
- fi
- echo $key: $key-$val
-}
-
-# ------------
-
-printProperty Uname "uname -a"
-
-printProperty WlanMAC "ifconfig wlan0 | grep HWaddr" 5
-
-printEnvVar QMLSCENE_DEVICE
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
index 6da0799bbc..23c678380c 100644
--- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
+++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
@@ -36,6 +36,11 @@
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
+#ifdef Q_OS_WIN
+# include <fcntl.h>
+# include <io.h>
+#endif // Q_OS_WIN
+
// Timeout values:
// A valid screen grab requires the scene to not change
@@ -101,6 +106,10 @@ private slots:
#endif
if (ofile == "-") { // Write to stdout
QFile of;
+#ifdef Q_OS_WIN
+ // Make sure write to stdout doesn't do LF->CRLF
+ _setmode(_fileno(stdout), _O_BINARY);
+#endif // Q_OS_WIN
if (!of.open(1, QIODevice::WriteOnly) || !lastGrab.save(&of, "ppm")) {
qWarning() << "Error: failed to write grabbed image to stdout.";
QGuiApplication::exit(2);
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro
index 65819ab5bf..dd0ef268b1 100644
--- a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro
+++ b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro
@@ -9,3 +9,7 @@ SOURCES += tst_scenegraph.cpp
# Include Lancelot protocol code to communicate with baseline server.
# Assuming that we are in a normal Qt5 source code tree
include(../../../../../qtbase/tests/baselineserver/shared/qbaselinetest.pri)
+
+TEST_HELPER_INSTALLS += .././qmlscenegrabber
+
+TESTDATA += ../data
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
index 3f28d90e7b..40b17ec2a2 100644
--- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
+++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
@@ -68,6 +68,7 @@ private:
bool renderAndGrab(const QString& qmlFile, const QStringList& extraArgs, QImage *screenshot, QString *errMsg);
quint16 checksumFileOrDir(const QString &path);
+ QString testSuitePath;
int consecutiveErrors; // Not test failures (image mismatches), but system failures (so no image at all)
bool aborted; // This run given up because of too many system failures
};
@@ -81,6 +82,18 @@ tst_Scenegraph::tst_Scenegraph()
void tst_Scenegraph::initTestCase()
{
+ QString dataDir = QFINDTESTDATA("../data/.");
+ if (dataDir.isEmpty())
+ dataDir = QStringLiteral("data");
+ QFileInfo fi(dataDir);
+ if (!fi.exists() || !fi.isDir() || !fi.isReadable())
+ QSKIP("Test suite data directory missing or unreadable: " + fi.canonicalFilePath().toLatin1());
+ testSuitePath = fi.canonicalFilePath();
+
+ const char *backendVarName = "QT_QUICK_BACKEND";
+ const QString backend = qEnvironmentVariable(backendVarName, QString::fromLatin1("default"));
+ QBaselineTest::addClientProperty(QString::fromLatin1(backendVarName), backend);
+
QByteArray msg;
if (!QBaselineTest::connectToBaselineServer(&msg))
QSKIP(msg);
@@ -91,7 +104,7 @@ void tst_Scenegraph::cleanup()
{
// Allow subsystems time to settle
if (!aborted)
- QTest::qWait(200);
+ QTest::qWait(20);
}
void tst_Scenegraph::testNoTextRendering_data()
@@ -127,13 +140,6 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter)
QTest::addColumn<QString>("qmlFile");
int numItems = 0;
- QString testSuiteDir = QLatin1String("data");
- QString testSuiteLocation = QCoreApplication::applicationDirPath();
- QString testSuitePath = testSuiteLocation + QDir::separator() + testSuiteDir;
- QFileInfo fi(testSuitePath);
- if (!fi.exists() || !fi.isDir() || !fi.isReadable())
- QSKIP("Test suite data directory missing or unreadable: " + testSuitePath.toLatin1());
-
QStringList ignoreItems;
QFile ignoreFile(testSuitePath + "/Ignore");
if (ignoreFile.open(QIODevice::ReadOnly)) {
@@ -233,7 +239,7 @@ quint16 tst_Scenegraph::checksumFileOrDir(const QString &path)
QFile f(path);
f.open(QIODevice::ReadOnly);
QByteArray contents = f.readAll();
- return qChecksum(contents.constData(), contents.size());
+ return qChecksum(contents.constData(), uint(contents.size()));
}
if (fi.isDir()) {
static const QStringList nameFilters = QStringList() << "*.qml" << "*.cpp" << "*.png" << "*.jpg";
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index a57b2c0db2..f7d7b98277 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -60,6 +60,7 @@
#include <qqml.h>
#include <qqmldebug.h>
+#include <private/qmemory_p.h>
#include <private/qtqmlglobal_p.h>
#if QT_CONFIG(qml_animation)
#include <private/qabstractanimation_p.h>
@@ -68,6 +69,7 @@
#include <cstdio>
#include <cstring>
#include <cstdlib>
+#include <memory>
#define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms
@@ -398,23 +400,23 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
int main(int argc, char *argv[])
{
getAppFlags(argc, argv);
- QCoreApplication *app = nullptr;
+ std::unique_ptr<QCoreApplication> app;
switch (applicationType) {
#ifdef QT_GUI_LIB
case QmlApplicationTypeGui:
- app = new LoaderApplication(argc, argv);
+ app = qt_make_unique<LoaderApplication>(argc, argv);
break;
#ifdef QT_WIDGETS_LIB
case QmlApplicationTypeWidget:
- app = new QApplication(argc, argv);
- static_cast<QApplication *>(app)->setWindowIcon(QIcon(iconResourcePath));
+ app = qt_make_unique<QApplication>(argc, argv);
+ static_cast<QApplication *>(app.get())->setWindowIcon(QIcon(iconResourcePath));
break;
#endif // QT_WIDGETS_LIB
#endif // QT_GUI_LIB
case QmlApplicationTypeCore:
Q_FALLTHROUGH();
default: // QmlApplicationTypeUnknown: not allowed, but we'll exit after checking apptypeOption below
- app = new QCoreApplication(argc, argv);
+ app = qt_make_unique<QCoreApplication>(argc, argv);
break;
}
@@ -597,7 +599,7 @@ int main(int argc, char *argv[])
if (files.count() <= 0) {
#if defined(Q_OS_DARWIN)
if (applicationType == QmlApplicationTypeGui)
- exitTimerId = static_cast<LoaderApplication *>(app)->startTimer(FILE_OPEN_EVENT_WAIT_TIME);
+ exitTimerId = static_cast<LoaderApplication *>(app.get())->startTimer(FILE_OPEN_EVENT_WAIT_TIME);
else
#endif
noFilesGiven();
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index f0ed1f8ebe..5e999c557a 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -105,12 +105,18 @@ struct QmlVersionInfo
QString pluginImportUri;
int majorVersion;
int minorVersion;
+ bool strict;
};
static bool matchingImportUri(const QQmlType &ty, const QmlVersionInfo& versionInfo) {
- return (versionInfo.pluginImportUri == ty.module()
- && (ty.majorVersion() == versionInfo.majorVersion || ty.majorVersion() == -1))
- || ty.module().isEmpty();
+ if (versionInfo.strict) {
+ return (versionInfo.pluginImportUri == ty.module()
+ && (ty.majorVersion() == versionInfo.majorVersion || ty.majorVersion() == -1))
+ || ty.module().isEmpty();
+ }
+ return ty.module().isEmpty()
+ || versionInfo.pluginImportUri == ty.module()
+ || ty.module().startsWith(versionInfo.pluginImportUri + QLatin1Char('.'));
}
void collectReachableMetaObjects(const QMetaObject *meta, QSet<const QMetaObject *> *metas, const QmlVersionInfo &info, bool extended = false, bool alreadyChangedModule = false)
@@ -230,14 +236,14 @@ QByteArray convertToId(const QMetaObject *mo)
// Collect all metaobjects for types registered with qmlRegisterType() without parameters
void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas,
- QMap<QString, QSet<QQmlType>> &compositeTypes, const QmlVersionInfo &info) {
+ QMap<QString, QList<QQmlType>> &compositeTypes, const QmlVersionInfo &info) {
const auto qmlAllTypes = QQmlMetaType::qmlAllTypes();
for (const QQmlType &ty : qmlAllTypes) {
if (!metas.contains(ty.baseMetaObject())) {
if (!ty.isComposite()) {
collectReachableMetaObjects(engine, ty, &metas, info);
} else if (matchingImportUri(ty, info)) {
- compositeTypes[ty.elementName()].insert(ty);
+ compositeTypes[ty.elementName()].append(ty);
}
}
}
@@ -246,7 +252,7 @@ void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<c
QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
QSet<const QMetaObject *> &noncreatables,
QSet<const QMetaObject *> &singletons,
- QMap<QString, QSet<QQmlType>> &compositeTypes,
+ QMap<QString, QList<QQmlType>> &compositeTypes,
const QmlVersionInfo &info,
const QList<QQmlType> &skip = QList<QQmlType>()
)
@@ -266,7 +272,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
qmlTypesByCppName[ty.baseMetaObject()->className()].insert(ty);
collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas, info);
} else {
- compositeTypes[ty.elementName()].insert(ty);
+ compositeTypes[ty.elementName()].append(ty);
}
}
@@ -436,10 +442,11 @@ public:
}
QString getPrototypeNameForCompositeType(const QMetaObject *metaObject, QSet<QByteArray> &defaultReachableNames,
- QList<const QMetaObject *> *objectsToMerge)
+ QList<const QMetaObject *> *objectsToMerge, const QmlVersionInfo &versionInfo)
{
+ auto ty = QQmlMetaType::qmlType(metaObject);
QString prototypeName;
- if (!defaultReachableNames.contains(metaObject->className())) {
+ if (matchingImportUri(ty, versionInfo)) {
// dynamic meta objects can break things badly
// but extended types are usually fine
const QMetaObjectPrivate *mop = reinterpret_cast<const QMetaObjectPrivate *>(metaObject->d.data);
@@ -451,20 +458,20 @@ public:
prototypeName = "QObject";
else
prototypeName = getPrototypeNameForCompositeType(
- superMetaObject, defaultReachableNames, objectsToMerge);
+ superMetaObject, defaultReachableNames, objectsToMerge, versionInfo);
} else {
prototypeName = convertToId(metaObject->className());
}
return prototypeName;
}
- void dumpComposite(QQmlEngine *engine, const QSet<QQmlType> &compositeType, QSet<QByteArray> &defaultReachableNames)
+ void dumpComposite(QQmlEngine *engine, const QList<QQmlType> &compositeType, QSet<QByteArray> &defaultReachableNames, const QmlVersionInfo &versionInfo)
{
for (const QQmlType &type : compositeType)
- dumpCompositeItem(engine, type, defaultReachableNames);
+ dumpCompositeItem(engine, type, defaultReachableNames, versionInfo);
}
- void dumpCompositeItem(QQmlEngine *engine, const QQmlType &compositeType, QSet<QByteArray> &defaultReachableNames)
+ void dumpCompositeItem(QQmlEngine *engine, const QQmlType &compositeType, QSet<QByteArray> &defaultReachableNames, const QmlVersionInfo &versionInfo)
{
QQmlComponent e(engine, compositeType.sourceUrl());
if (!e.isReady()) {
@@ -486,7 +493,7 @@ public:
KnownAttributes knownAttributes;
// Get C++ base class name for the composite type
QString prototypeName = getPrototypeNameForCompositeType(mainMeta, defaultReachableNames,
- &objectsToMerge);
+ &objectsToMerge, versionInfo);
qml->writeScriptBinding(QLatin1String("prototype"), enquote(prototypeName));
QString qmlTyName = compositeType.qmlTypeName();
@@ -991,6 +998,16 @@ void printDebugMessage(QtMsgType, const QMessageLogContext &, const QString &msg
// In case of QtFatalMsg the calling code will abort() when appropriate.
}
+QT_BEGIN_NAMESPACE
+static bool operator<(const QQmlType &a, const QQmlType &b)
+{
+ return a.qmlTypeName() < b.qmlTypeName()
+ || (a.qmlTypeName() == b.qmlTypeName()
+ && ((a.majorVersion() < b.majorVersion())
+ || (a.majorVersion() == b.majorVersion()
+ && a.minorVersion() < b.minorVersion())));
+}
+QT_END_NAMESPACE
int main(int argc, char *argv[])
{
@@ -1056,6 +1073,7 @@ int main(int argc, char *argv[])
QString dependenciesFile;
QString mergeFile;
bool forceQtQuickDependency = true;
+ bool strict = false;
enum Action { Uri, Path, Builtins };
Action action = Uri;
{
@@ -1120,6 +1138,10 @@ int main(int argc, char *argv[])
} else if (arg == QLatin1String("--qapp")
|| arg == QLatin1String("-qapp")) {
continue;
+ } else if (arg == QLatin1String("--strict")
+ || arg == QLatin1String("-strict")) {
+ strict = true;
+ continue;
} else {
std::cerr << "Invalid argument: " << qPrintable(arg) << std::endl;
return EXIT_INVALIDARGUMENTS;
@@ -1216,7 +1238,6 @@ int main(int argc, char *argv[])
// find all QMetaObjects reachable from the builtin module
QSet<const QMetaObject *> uncreatableMetas;
QSet<const QMetaObject *> singletonMetas;
- QMap<QString, QSet<QQmlType>> defaultCompositeTypes;
// QQuickKeyEvent, QQuickPinchEvent, QQuickDropEvent are not exported
QSet<QByteArray> defaultReachableNames;
@@ -1225,11 +1246,13 @@ int main(int argc, char *argv[])
QSet<const QMetaObject *> metas;
// composite types we want to dump information of
- QMap<QString, QSet<QQmlType>> compositeTypes;
+ QMap<QString, QList<QQmlType>> compositeTypes;
int majorVersion = qtQmlMajorVersion, minorVersion = qtQmlMinorVersion;
+ QmlVersionInfo info;
if (action == Builtins) {
- QSet<const QMetaObject *> builtins = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, defaultCompositeTypes, {QLatin1String("Qt"), majorVersion, minorVersion});
+ QMap<QString, QList<QQmlType>> defaultCompositeTypes;
+ QSet<const QMetaObject *> builtins = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, defaultCompositeTypes, {QLatin1String("Qt"), majorVersion, minorVersion, strict});
Q_ASSERT(builtins.size() == 1);
metas.insert(*builtins.begin());
} else {
@@ -1289,15 +1312,12 @@ int main(int argc, char *argv[])
return EXIT_IMPORTERROR;
}
}
+ info = {pluginImportUri, majorVersion, minorVersion, strict};
+ QSet<const QMetaObject *> candidates = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, compositeTypes, info, defaultTypes);
- QSet<const QMetaObject *> candidates = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, compositeTypes, {pluginImportUri, majorVersion, minorVersion}, defaultTypes);
-
- for (QString iter: compositeTypes.keys()) {
- if (defaultCompositeTypes.contains(iter)) {
- QSet<QQmlType> compositeTypesByName = compositeTypes.value(iter);
- compositeTypesByName.subtract(defaultCompositeTypes.value(iter));
- compositeTypes[iter] = compositeTypesByName;
- }
+ for (auto it = compositeTypes.begin(), end = compositeTypes.end(); it != end; ++it) {
+ std::sort(it->begin(), it->end());
+ it->erase(std::unique(it->begin(), it->end()), it->end());
}
for (const QMetaObject *mo : qAsConst(candidates)) {
@@ -1348,9 +1368,9 @@ int main(int argc, char *argv[])
dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta));
}
- QMap<QString, QSet<QQmlType> >::const_iterator iter = compositeTypes.constBegin();
+ QMap<QString, QList<QQmlType>>::const_iterator iter = compositeTypes.constBegin();
for (; iter != compositeTypes.constEnd(); ++iter)
- dumper.dumpComposite(&engine, iter.value(), defaultReachableNames);
+ dumper.dumpComposite(&engine, iter.value(), defaultReachableNames, info);
// define QEasingCurve as an extension of QQmlEasingValueType, this way
// properties using the QEasingCurve type get useful type information.