aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-01-16 16:25:06 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-16 16:25:06 +0100
commit1d333d3375874efb8d37df37dc5ef561573794ad (patch)
tree2d8c995f64c05c84c1fcceb2c5cb40fcae69855f /src
parentb106d86c433706928b0b0c206a0d9f831681e1bf (diff)
parente79a2658cde899d6ee11ec3c0d0a3768eb2c864b (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/llvm/LICENSE.TXT68
-rw-r--r--src/3rdparty/llvm/include/llvm-c/DataTypes.h90
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/PointerIntPair.h233
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist.h431
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist_base.h93
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist_iterator.h199
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist_node.h306
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist_node_base.h53
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/ilist_node_options.h133
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/iterator.h339
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/iterator_range.h68
-rw-r--r--src/3rdparty/llvm/include/llvm/ADT/simple_ilist.h315
-rw-r--r--src/3rdparty/llvm/include/llvm/Demangle/Compiler.h524
-rw-r--r--src/3rdparty/llvm/include/llvm/Support/Compiler.h19
-rw-r--r--src/3rdparty/llvm/include/llvm/Support/DataTypes.h17
-rw-r--r--src/3rdparty/llvm/include/llvm/Support/PointerLikeTypeTraits.h116
-rw-r--r--src/3rdparty/llvm/llvm.pri18
-rw-r--r--src/3rdparty/llvm/qt_attribution.json14
-rw-r--r--src/3rdparty/masm/assembler/LinkBuffer.h29
-rw-r--r--src/3rdparty/masm/disassembler/Disassembler.cpp2
-rw-r--r--src/3rdparty/masm/stubs/wtf/Optional.h2
-rw-r--r--src/imports/folderlistmodel/folderlistmodel.pro3
-rw-r--r--src/imports/folderlistmodel/plugin.cpp4
-rw-r--r--src/imports/folderlistmodel/plugins.qmltypes351
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp2
-rw-r--r--src/imports/labsanimation/labsanimation.pro1
-rw-r--r--src/imports/labsanimation/plugin.cpp12
-rw-r--r--src/imports/labsanimation/plugins.qmltypes36
-rw-r--r--src/imports/labsmodels/labsmodels.pro1
-rw-r--r--src/imports/labsmodels/plugin.cpp21
-rw-r--r--src/imports/labsmodels/plugins.qmltypes414
-rw-r--r--src/imports/layouts/layouts.pro4
-rw-r--r--src/imports/layouts/plugin.cpp15
-rw-r--r--src/imports/layouts/plugins.qmltypes131
-rw-r--r--src/imports/layouts/qquickgridlayoutengine.cpp2
-rw-r--r--src/imports/layouts/qquickgridlayoutengine_p.h2
-rw-r--r--src/imports/layouts/qquicklayout.cpp3
-rw-r--r--src/imports/layouts/qquicklinearlayout.cpp22
-rw-r--r--src/imports/localstorage/localstorage.pro3
-rw-r--r--src/imports/localstorage/plugin.cpp13
-rw-r--r--src/imports/localstorage/plugins.qmltypes23
-rw-r--r--src/imports/models/models.pro2
-rw-r--r--src/imports/models/plugin.cpp41
-rw-r--r--src/imports/models/plugins.qmltypes710
-rw-r--r--src/imports/particles/particles.pro2
-rw-r--r--src/imports/particles/plugin.cpp4
-rw-r--r--src/imports/particles/plugins.qmltypes1359
-rw-r--r--src/imports/qtqml/plugin.cpp13
-rw-r--r--src/imports/qtqml/plugins.qmltypes245
-rw-r--r--src/imports/qtqml/qtqml.pro2
-rw-r--r--src/imports/qtquick2/plugin.cpp2
-rw-r--r--src/imports/qtquick2/plugins.qmltypes5921
-rw-r--r--src/imports/qtquick2/qtquick2.pro2
-rw-r--r--src/imports/settings/plugin.cpp12
-rw-r--r--src/imports/settings/plugins.qmltypes36
-rw-r--r--src/imports/settings/settings.pro2
-rw-r--r--src/imports/shapes/plugin.cpp8
-rw-r--r--src/imports/shapes/plugins.qmltypes172
-rw-r--r--src/imports/shapes/shapes.pro2
-rw-r--r--src/imports/sharedimage/plugin.cpp12
-rw-r--r--src/imports/sharedimage/plugins.qmltypes11
-rw-r--r--src/imports/sharedimage/sharedimage.pro1
-rw-r--r--src/imports/statemachine/plugin.cpp16
-rw-r--r--src/imports/statemachine/plugins.qmltypes179
-rw-r--r--src/imports/statemachine/statemachine.pro4
-rw-r--r--src/imports/testlib/TestCase.qml26
-rw-r--r--src/imports/testlib/main.cpp20
-rw-r--r--src/imports/testlib/plugins.qmltypes368
-rw-r--r--src/imports/testlib/quicktestevent.cpp (renamed from src/qmltest/quicktestevent.cpp)2
-rw-r--r--src/imports/testlib/quicktestevent_p.h (renamed from src/qmltest/quicktestevent_p.h)5
-rw-r--r--src/imports/testlib/quicktestresultforeign_p.h (renamed from src/qmlworkerscript/qqmlworkerscriptmodule_p.h)20
-rw-r--r--src/imports/testlib/quicktestutil.cpp (renamed from src/qmltest/quicktestutil.cpp)0
-rw-r--r--src/imports/testlib/quicktestutil_p.h (renamed from src/qmltest/quicktestutil_p.h)3
-rw-r--r--src/imports/testlib/testlib.pro15
-rw-r--r--src/imports/wavefrontmesh/plugin.cpp14
-rw-r--r--src/imports/wavefrontmesh/plugins.qmltypes37
-rw-r--r--src/imports/wavefrontmesh/wavefrontmesh.pro3
-rw-r--r--src/imports/window/plugin.cpp20
-rw-r--r--src/imports/window/plugins.qmltypes378
-rw-r--r--src/imports/window/window.pro3
-rw-r--r--src/imports/workerscript/plugin.cpp26
-rw-r--r--src/imports/workerscript/plugins.qmltypes26
-rw-r--r--src/imports/workerscript/workerscript.pro2
-rw-r--r--src/particles/particles.pro6
-rw-r--r--src/particles/qquickitemparticle.cpp98
-rw-r--r--src/particles/qquickitemparticle_p.h6
-rw-r--r--src/particles/qquickparticleextruder.cpp2
-rw-r--r--src/particles/qquickparticlesmodule.cpp42
-rw-r--r--src/particles/qquickparticlesystem.cpp7
-rw-r--r--src/particles/qquickparticlesystem_p.h2
-rw-r--r--src/particles/shaders_ng/imageparticle_colored.frag.qsbbin1990 -> 1572 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_colored.vert.qsbbin3677 -> 3329 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_deformed.frag.qsbbin2028 -> 1601 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_deformed.vert.qsbbin5044 -> 4712 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_simple.frag.qsbbin2000 -> 1581 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_simple.vert.qsbbin3639 -> 3261 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_sprite.frag.qsbbin2369 -> 1918 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_sprite.vert.qsbbin5964 -> 5367 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_tabled.frag.qsbbin2240 -> 1777 bytes
-rw-r--r--src/particles/shaders_ng/imageparticle_tabled.vert.qsbbin5462 -> 4929 bytes
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp1
-rw-r--r--src/plugins/scenegraph/d3d12/d3d12.json3
-rw-r--r--src/plugins/scenegraph/d3d12/d3d12.pro61
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp87
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h81
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp737
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h253
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context.cpp143
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context_p.h84
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp3280
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h394
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h455
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp197
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h88
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp90
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h74
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp123
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h82
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp72
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h74
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp370
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h129
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12material.cpp49
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12material_p.h96
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp255
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h120
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp250
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h136
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp169
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h90
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp785
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h137
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp536
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h130
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp995
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h176
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp314
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12spritenode_p.h90
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp157
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h96
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp1186
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop_p.h129
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/flatcolor.hlsl27
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl60
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/shadereffectdefault.hlsl27
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/shaders.pri141
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl64
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl77
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/sprite.hlsl43
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl26
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/tdr.hlsl11
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/textmask.hlsl104
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/texture.hlsl33
-rw-r--r--src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl32
-rw-r--r--src/plugins/scenegraph/openvg/openvg.pro12
-rw-r--r--src/plugins/scenegraph/openvg/openvg.tracepoints0
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp12
-rw-r--r--src/plugins/scenegraph/scenegraph.pro1
-rw-r--r--src/qml/common/qv4compileddata_p.h42
-rw-r--r--src/qml/common/qv4stringtoarrayindex_p.h2
-rw-r--r--src/qml/compiler/qv4codegen.cpp38
-rw-r--r--src/qml/compiler/qv4compiler.cpp14
-rw-r--r--src/qml/dependencies.json1
-rw-r--r--src/qml/doc/qtqml.qdocconf12
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc13
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc19
-rw-r--r--src/qml/doc/src/qmldiskcache.qdoc77
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc1
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc2
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/imports.qdoc7
-rw-r--r--src/qml/doc/src/qtqml.qdoc2
-rw-r--r--src/qml/jit/qv4assemblercommon.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp53
-rw-r--r--src/qml/jsruntime/qv4arraybuffer_p.h27
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp8
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp30
-rw-r--r--src/qml/jsruntime/qv4engine.cpp101
-rw-r--r--src/qml/jsruntime/qv4engine_p.h11
-rw-r--r--src/qml/jsruntime/qv4enginebase_p.h2
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp6
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4object_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp2
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp1
-rw-r--r--src/qml/jsruntime/qv4proxy.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp4
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp9
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4string.cpp46
-rw-r--r--src/qml/jsruntime/qv4string_p.h32
-rw-r--r--src/qml/jsruntime/qv4symbol.cpp5
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp185
-rw-r--r--src/qml/jsruntime/qv4typedarray_p.h5
-rw-r--r--src/qml/jsruntime/qv4value_p.h2
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp37
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/qml/parser/qqmljs.g82
-rw-r--r--src/qml/parser/qqmljsast_p.h4
-rw-r--r--src/qml/parser/qqmljslexer.cpp9
-rw-r--r--src/qml/qml.pro8
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp2
-rw-r--r--src/qml/qml/ftw/qstringhash_p.h60
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp2
-rw-r--r--src/qml/qml/qqmlbinding.cpp4
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp5
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp8
-rw-r--r--src/qml/qml/qqmldata_p.h2
-rw-r--r--src/qml/qml/qqmldatablob.cpp3
-rw-r--r--src/qml/qml/qqmlengine.cpp47
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp2
-rw-r--r--src/qml/qml/qqmlimport.cpp67
-rw-r--r--src/qml/qml/qqmlimport_p.h12
-rw-r--r--src/qml/qml/qqmlinfo.cpp3
-rw-r--r--src/qml/qml/qqmllocale.cpp30
-rw-r--r--src/qml/qml/qqmllocale_p.h13
-rw-r--r--src/qml/qml/qqmlmetaobject.cpp8
-rw-r--r--src/qml/qml/qqmlmetatype.cpp35
-rw-r--r--src/qml/qml/qqmlmetatype_p.h2
-rw-r--r--src/qml/qml/qqmlmetatypedata_p.h4
-rw-r--r--src/qml/qml/qqmlmoduleregistration.cpp18
-rw-r--r--src/qml/qml/qqmlmoduleregistration.h7
-rw-r--r--src/qml/qml/qqmlnotifier.cpp4
-rw-r--r--src/qml/qml/qqmlproperty.cpp4
-rw-r--r--src/qml/qml/qqmlproperty_p.h4
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp11
-rw-r--r--src/qml/qml/qqmltype.cpp36
-rw-r--r--src/qml/qml/qqmltype_p.h1
-rw-r--r--src/qml/qml/qqmltype_p_p.h12
-rw-r--r--src/qml/qml/qqmltypecompiler.cpp10
-rw-r--r--src/qml/qml/qqmltypeloader.cpp19
-rw-r--r--src/qml/qml/qqmltypeloaderqmldircontent.cpp1
-rw-r--r--src/qml/qml/qqmltypemodule.cpp8
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp145
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h20
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp42
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp21
-rw-r--r--src/qml/qmldirparser/qqmldirparser.cpp33
-rw-r--r--src/qml/qmldirparser/qqmldirparser_p.h9
-rw-r--r--src/qml/qtqml.tracepoints7
-rw-r--r--src/qmlmodels/doc/images/listmodel-nested.png (renamed from src/qml/doc/images/listmodel-nested.png)bin7493 -> 7493 bytes
-rw-r--r--src/qmlmodels/doc/images/listmodel.png (renamed from src/qml/doc/images/listmodel.png)bin3407 -> 3407 bytes
-rw-r--r--src/qmlmodels/doc/images/objectmodel.png (renamed from src/qml/doc/images/objectmodel.png)bin347 -> 347 bytes
-rw-r--r--src/qmlmodels/doc/qtqmlmodels.qdocconf13
-rw-r--r--src/qmlmodels/qmlmodels.pro9
-rw-r--r--src/qmlmodels/qqmladaptormodel.cpp76
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp324
-rw-r--r--src/qmlmodels/qqmldelegatemodel_p.h7
-rw-r--r--src/qmlmodels/qqmldelegatemodel_p_p.h30
-rw-r--r--src/qmlmodels/qqmllistmodel.cpp64
-rw-r--r--src/qmlmodels/qqmllistmodel_p_p.h15
-rw-r--r--src/qmlmodels/qqmlmodelsmodule.cpp82
-rw-r--r--src/qmlmodels/qqmlmodelsmodule_p.h7
-rw-r--r--src/qmlmodels/qqmlobjectmodel.cpp4
-rw-r--r--src/qmlmodels/qqmlobjectmodel_p.h14
-rw-r--r--src/qmlmodels/qqmltableinstancemodel.cpp101
-rw-r--r--src/qmlmodels/qqmltableinstancemodel_p.h21
-rw-r--r--src/qmltest/dependencies.json1
-rw-r--r--src/qmltest/qmltest.pro10
-rw-r--r--src/qmltest/quicktestresult_p.h1
-rw-r--r--src/qmltyperegistrar/qmltyperegistrar.cpp39
-rw-r--r--src/qmltyperegistrar/qmltypes.prf10
-rw-r--r--src/qmltyperegistrar/qmltypescreator.cpp4
-rw-r--r--src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf6
-rw-r--r--src/qmlworkerscript/doc/snippets/qml/workerscript/script.mjs (renamed from src/qml/doc/snippets/qml/workerscript/script.mjs)0
-rw-r--r--src/qmlworkerscript/doc/snippets/qml/workerscript/workerscript.qml (renamed from src/qml/doc/snippets/qml/workerscript/workerscript.qml)0
-rw-r--r--src/qmlworkerscript/qmlworkerscript.pro8
-rw-r--r--src/qmlworkerscript/qqmlworkerscriptmodule.cpp51
-rw-r--r--src/qmlworkerscript/qquickworkerscript.cpp24
-rw-r--r--src/qmlworkerscript/qquickworkerscript_p.h8
-rw-r--r--src/qmlworkerscript/qv4serialize.cpp49
-rw-r--r--src/quick/configure.json21
-rw-r--r--src/quick/dependencies.json1
-rw-r--r--src/quick/designer/qquickdesignercustomobjectdata.cpp2
-rw-r--r--src/quick/doc/qtquick.qdocconf5
-rw-r--r--src/quick/doc/snippets/cmake-macros/examples.cmake2
-rw-r--r--src/quick/doc/snippets/qml/listview/ReusableDelegate.qml82
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc250
-rw-r--r--src/quick/doc/src/examples.qdoc1
-rw-r--r--src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc37
-rw-r--r--src/quick/handlers/qquickmultipointhandler_p.h1
-rw-r--r--src/quick/handlers/qquickpointerhandler.cpp19
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp9
-rw-r--r--src/quick/handlers/qquickwheelhandler.cpp25
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp13
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h5
-rw-r--r--src/quick/items/qquickevents.cpp133
-rw-r--r--src/quick/items/qquickevents_p_p.h11
-rw-r--r--src/quick/items/qquickflickable.cpp2
-rw-r--r--src/quick/items/qquickgenericshadereffect.cpp3
-rw-r--r--src/quick/items/qquickgraphicsinfo.cpp1
-rw-r--r--src/quick/items/qquickgraphicsinfo_p.h1
-rw-r--r--src/quick/items/qquickgridview.cpp4
-rw-r--r--src/quick/items/qquickimage.cpp8
-rw-r--r--src/quick/items/qquickimage_p_p.h13
-rw-r--r--src/quick/items/qquickitem.cpp6
-rw-r--r--src/quick/items/qquickitem_p.h6
-rw-r--r--src/quick/items/qquickitemsmodule.cpp202
-rw-r--r--src/quick/items/qquickitemview.cpp130
-rw-r--r--src/quick/items/qquickitemview_p.h12
-rw-r--r--src/quick/items/qquickitemview_p_p.h23
-rw-r--r--src/quick/items/qquicklistview.cpp126
-rw-r--r--src/quick/items/qquicklistview_p.h2
-rw-r--r--src/quick/items/qquickmousearea.cpp8
-rw-r--r--src/quick/items/qquickmousearea_p.h1
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp48
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h4
-rw-r--r--src/quick/items/qquickpainteditem.cpp1
-rw-r--r--src/quick/items/qquickpathview.cpp5
-rw-r--r--src/quick/items/qquickscreen.cpp3
-rw-r--r--src/quick/items/qquickscreen_p.h4
-rw-r--r--src/quick/items/qquickshadereffect.cpp239
-rw-r--r--src/quick/items/qquickstateoperations.cpp5
-rw-r--r--src/quick/items/qquicktableview.cpp177
-rw-r--r--src/quick/items/qquicktableview_p_p.h23
-rw-r--r--src/quick/items/qquicktextinput.cpp7
-rw-r--r--src/quick/items/qquickview.cpp9
-rw-r--r--src/quick/items/qquickwindow.cpp28
-rw-r--r--src/quick/items/qquickwindow_p.h13
-rw-r--r--src/quick/qtquick.tracepoints48
-rw-r--r--src/quick/qtquick2.cpp11
-rw-r--r--src/quick/quick.pro9
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp6
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h1
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp4
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp12
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp23
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp33
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h109
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp1
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp3
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgopenglvisualizer.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp11
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.cpp9
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendernode.cpp13
-rw-r--r--src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.cpp57
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.h6
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp9
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp1
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp66
-rw-r--r--src/quick/scenegraph/qsgrenderloop_p.h5
-rw-r--r--src/quick/scenegraph/qsgrhilayer.cpp2
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp60
-rw-r--r--src/quick/scenegraph/qsgrhisupport_p.h3
-rw-r--r--src/quick/scenegraph/qsgrhitextureglyphcache.cpp2
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp107
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp20
-rw-r--r--src/quick/scenegraph/scenegraph.pri2
-rw-r--r--src/quick/scenegraph/shaders/outlinedtext.vert4
-rw-r--r--src/quick/scenegraph/shaders/outlinedtext_core.vert4
-rw-r--r--src/quick/scenegraph/shaders/styledtext.vert3
-rw-r--r--src/quick/scenegraph/shaders/styledtext_core.vert3
-rw-r--r--src/quick/scenegraph/shaders/textmask.vert3
-rw-r--r--src/quick/scenegraph/shaders/textmask_core.vert3
-rw-r--r--src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsbbin1873 -> 1537 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsbbin1754 -> 1399 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsbbin1753 -> 1405 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsbbin1280 -> 909 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsbbin2209 -> 1820 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsbbin2209 -> 1851 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsbbin2210 -> 1814 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsbbin2319 -> 1905 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsbbin2340 -> 1951 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsbbin2334 -> 1914 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsbbin1883 -> 1538 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsbbin2048 -> 1709 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsbbin1883 -> 1542 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/flatcolor.frag.qsbbin1149 -> 917 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/flatcolor.vert.qsbbin1597 -> 1334 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsbbin3314 -> 2898 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsbbin3675 -> 3288 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsbbin3304 -> 2909 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsbbin2411 -> 2015 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsbbin3028 -> 2675 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsbbin2412 -> 2024 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsbbin1173 -> 967 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsbbin1791 -> 1500 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsbbin2549 -> 2162 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.vert3
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsbbin2728 -> 2599 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsbbin1859 -> 1436 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/shadereffect.frag.qsbbin1622 -> 1307 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/shadereffect.vert.qsbbin1860 -> 1561 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsbbin838 -> 700 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsbbin3682 -> 3390 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsbbin1299 -> 1073 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsbbin4350 -> 3957 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/sprite.frag.qsbbin1908 -> 1571 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/sprite.vert.qsbbin2437 -> 2127 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/stencilclip.frag.qsbbin853 -> 737 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/stencilclip.vert.qsbbin1510 -> 1279 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext.frag.qsbbin2210 -> 1805 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext.vert3
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext.vert.qsbbin2460 -> 2209 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsbbin1631 -> 1212 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/textmask.frag.qsbbin1873 -> 1533 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/textmask.vert3
-rw-r--r--src/quick/scenegraph/shaders_ng/textmask.vert.qsbbin2142 -> 1961 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/texture.frag.qsbbin1618 -> 1302 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/texture.vert.qsbbin1865 -> 1561 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsbbin851 -> 700 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsbbin1837 -> 1542 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/visualization.frag.qsbbin1877 -> 1569 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/visualization.vert.qsbbin2099 -> 1762 bytes
-rw-r--r--src/quick/scenegraph/util/qsgopenglatlastexture.cpp5
-rw-r--r--src/quick/scenegraph/util/qsgplaintexture.cpp19
-rw-r--r--src/quick/scenegraph/util/qsgrhiatlastexture.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgrhinativetextureimporter.cpp104
-rw-r--r--src/quick/scenegraph/util/qsgrhinativetextureimporter_p.h70
-rw-r--r--src/quick/util/qquickbehavior.cpp2
-rw-r--r--src/quick/util/qquickpath.cpp8
-rw-r--r--src/quick/util/qquickpixmapcache.cpp8
-rw-r--r--src/quick/util/qquickstyledtext.cpp18
-rw-r--r--src/quick/util/qquickutilmodule.cpp131
-rw-r--r--src/quick/util/qquickutilmodule_p.h66
-rw-r--r--src/quick/util/qquickvaluetypes.cpp1
-rw-r--r--src/quick/util/util.pri2
-rw-r--r--src/quickshapes/qquickshape.cpp24
-rw-r--r--src/quickshapes/qquickshape_p.h6
-rw-r--r--src/quickshapes/qquickshape_p_p.h2
-rw-r--r--src/quickshapes/qquickshapegenericrenderer.cpp6
-rw-r--r--src/quickshapes/qquickshapesoftwarerenderer.cpp2
-rw-r--r--src/quickshapes/quickshapes.pro6
-rw-r--r--src/quickshapes/shaders_ng/conicalgradient.frag.qsbbin2228 -> 1889 bytes
-rw-r--r--src/quickshapes/shaders_ng/conicalgradient.vert.qsbbin1994 -> 1684 bytes
-rw-r--r--src/quickshapes/shaders_ng/lineargradient.frag.qsbbin1762 -> 1423 bytes
-rw-r--r--src/quickshapes/shaders_ng/lineargradient.vert.qsbbin2225 -> 1895 bytes
-rw-r--r--src/quickshapes/shaders_ng/radialgradient.frag.qsbbin2931 -> 2579 bytes
-rw-r--r--src/quickshapes/shaders_ng/radialgradient.vert.qsbbin2115 -> 1774 bytes
-rw-r--r--src/quickwidgets/qquickwidget.cpp13
-rw-r--r--src/quickwidgets/qquickwidget_p.h2
441 files changed, 3356 insertions, 29653 deletions
diff --git a/src/3rdparty/llvm/LICENSE.TXT b/src/3rdparty/llvm/LICENSE.TXT
deleted file mode 100644
index ff63f2b6aa..0000000000
--- a/src/3rdparty/llvm/LICENSE.TXT
+++ /dev/null
@@ -1,68 +0,0 @@
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
- LLVM Team
-
- University of Illinois at Urbana-Champaign
-
- http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimers.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimers in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the names of the LLVM Team, University of Illinois at
- Urbana-Champaign, nor the names of its contributors may be used to
- endorse or promote products derived from this Software without specific
- prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties. Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program Directory
-------- ---------
-Google Test llvm/utils/unittest/googletest
-OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
-pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
-ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
-md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
diff --git a/src/3rdparty/llvm/include/llvm-c/DataTypes.h b/src/3rdparty/llvm/include/llvm-c/DataTypes.h
deleted file mode 100644
index 7081c83ffc..0000000000
--- a/src/3rdparty/llvm/include/llvm-c/DataTypes.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*===-- include/llvm-c/DataTypes.h - Define fixed size types ------*- C -*-===*\
-|* *|
-|* The LLVM Compiler Infrastructure *|
-|* *|
-|* This file is distributed under the University of Illinois Open Source *|
-|* License. See LICENSE.TXT for details. *|
-|* *|
-|*===----------------------------------------------------------------------===*|
-|* *|
-|* This file contains definitions to figure out the size of _HOST_ data types.*|
-|* This file is important because different host OS's define different macros,*|
-|* which makes portability tough. This file exports the following *|
-|* definitions: *|
-|* *|
-|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
-|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
-|* *|
-|* No library is required when using these functions. *|
-|* *|
-|*===----------------------------------------------------------------------===*/
-
-/* Please leave this file C-compatible. */
-
-#ifndef LLVM_C_DATATYPES_H
-#define LLVM_C_DATATYPES_H
-
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-
-#include <inttypes.h>
-#include <stdint.h>
-
-#ifndef _MSC_VER
-
-#if !defined(UINT32_MAX)
-# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
- "__STDC_LIMIT_MACROS before #including llvm-c/DataTypes.h"
-#endif
-
-#if !defined(UINT32_C)
-# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
- "__STDC_CONSTANT_MACROS before #including llvm-c/DataTypes.h"
-#endif
-
-/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
-#include <sys/types.h>
-
-#ifdef _AIX
-// GCC is strict about defining large constants: they must have LL modifier.
-#undef INT64_MAX
-#undef INT64_MIN
-#endif
-
-#else /* _MSC_VER */
-#ifdef __cplusplus
-#include <cstddef>
-#include <cstdlib>
-#else
-#include <stddef.h>
-#include <stdlib.h>
-#endif
-#include <sys/types.h>
-
-#if defined(_WIN64)
-typedef signed __int64 ssize_t;
-#else
-typedef signed int ssize_t;
-#endif /* _WIN64 */
-
-#endif /* _MSC_VER */
-
-/* Set defaults for constants which we cannot find. */
-#if !defined(INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-#endif
-#if !defined(INT64_MIN)
-# define INT64_MIN ((-INT64_MAX)-1)
-#endif
-#if !defined(UINT64_MAX)
-# define UINT64_MAX 0xffffffffffffffffULL
-#endif
-
-#ifndef HUGE_VALF
-#define HUGE_VALF (float)HUGE_VAL
-#endif
-
-#endif /* LLVM_C_DATATYPES_H */
diff --git a/src/3rdparty/llvm/include/llvm/ADT/PointerIntPair.h b/src/3rdparty/llvm/include/llvm/ADT/PointerIntPair.h
deleted file mode 100644
index 884d05155b..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/PointerIntPair.h
+++ /dev/null
@@ -1,233 +0,0 @@
-//===- llvm/ADT/PointerIntPair.h - Pair for pointer and int -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the PointerIntPair class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_POINTERINTPAIR_H
-#define LLVM_ADT_POINTERINTPAIR_H
-
-#include "llvm/Support/PointerLikeTypeTraits.h"
-#include <cassert>
-#include <cstdint>
-#include <limits>
-
-namespace llvm {
-
-template <typename T> struct DenseMapInfo;
-template <typename PointerT, unsigned IntBits, typename PtrTraits>
-struct PointerIntPairInfo;
-
-/// PointerIntPair - This class implements a pair of a pointer and small
-/// integer. It is designed to represent this in the space required by one
-/// pointer by bitmangling the integer into the low part of the pointer. This
-/// can only be done for small integers: typically up to 3 bits, but it depends
-/// on the number of bits available according to PointerLikeTypeTraits for the
-/// type.
-///
-/// Note that PointerIntPair always puts the IntVal part in the highest bits
-/// possible. For example, PointerIntPair<void*, 1, bool> will put the bit for
-/// the bool into bit #2, not bit #0, which allows the low two bits to be used
-/// for something else. For example, this allows:
-/// PointerIntPair<PointerIntPair<void*, 1, bool>, 1, bool>
-/// ... and the two bools will land in different bits.
-template <typename PointerTy, unsigned IntBits, typename IntType = unsigned,
- typename PtrTraits = PointerLikeTypeTraits<PointerTy>,
- typename Info = PointerIntPairInfo<PointerTy, IntBits, PtrTraits>>
-class PointerIntPair {
- intptr_t Value = 0;
-
-public:
- constexpr PointerIntPair() = default;
-
- PointerIntPair(PointerTy PtrVal, IntType IntVal) {
- setPointerAndInt(PtrVal, IntVal);
- }
-
- explicit PointerIntPair(PointerTy PtrVal) { initWithPointer(PtrVal); }
-
- PointerTy getPointer() const { return Info::getPointer(Value); }
-
- IntType getInt() const { return (IntType)Info::getInt(Value); }
-
- void setPointer(PointerTy PtrVal) {
- Value = Info::updatePointer(Value, PtrVal);
- }
-
- void setInt(IntType IntVal) {
- Value = Info::updateInt(Value, static_cast<intptr_t>(IntVal));
- }
-
- void initWithPointer(PointerTy PtrVal) {
- Value = Info::updatePointer(0, PtrVal);
- }
-
- void setPointerAndInt(PointerTy PtrVal, IntType IntVal) {
- Value = Info::updateInt(Info::updatePointer(0, PtrVal),
- static_cast<intptr_t>(IntVal));
- }
-
- PointerTy const *getAddrOfPointer() const {
- return const_cast<PointerIntPair *>(this)->getAddrOfPointer();
- }
-
- PointerTy *getAddrOfPointer() {
- assert(Value == reinterpret_cast<intptr_t>(getPointer()) &&
- "Can only return the address if IntBits is cleared and "
- "PtrTraits doesn't change the pointer");
- return reinterpret_cast<PointerTy *>(&Value);
- }
-
- void *getOpaqueValue() const { return reinterpret_cast<void *>(Value); }
-
- void setFromOpaqueValue(void *Val) {
- Value = reinterpret_cast<intptr_t>(Val);
- }
-
- static PointerIntPair getFromOpaqueValue(void *V) {
- PointerIntPair P;
- P.setFromOpaqueValue(V);
- return P;
- }
-
- // Allow PointerIntPairs to be created from const void * if and only if the
- // pointer type could be created from a const void *.
- static PointerIntPair getFromOpaqueValue(const void *V) {
- (void)PtrTraits::getFromVoidPointer(V);
- return getFromOpaqueValue(const_cast<void *>(V));
- }
-
- bool operator==(const PointerIntPair &RHS) const {
- return Value == RHS.Value;
- }
-
- bool operator!=(const PointerIntPair &RHS) const {
- return Value != RHS.Value;
- }
-
- bool operator<(const PointerIntPair &RHS) const { return Value < RHS.Value; }
- bool operator>(const PointerIntPair &RHS) const { return Value > RHS.Value; }
-
- bool operator<=(const PointerIntPair &RHS) const {
- return Value <= RHS.Value;
- }
-
- bool operator>=(const PointerIntPair &RHS) const {
- return Value >= RHS.Value;
- }
-};
-
-template <typename PointerT, unsigned IntBits, typename PtrTraits>
-struct PointerIntPairInfo {
- static_assert(PtrTraits::NumLowBitsAvailable <
- std::numeric_limits<uintptr_t>::digits,
- "cannot use a pointer type that has all bits free");
- static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
- "PointerIntPair with integer size too large for pointer");
- enum : uintptr_t {
- /// PointerBitMask - The bits that come from the pointer.
- PointerBitMask =
- ~(uintptr_t)(((intptr_t)1 << PtrTraits::NumLowBitsAvailable) - 1),
-
- /// IntShift - The number of low bits that we reserve for other uses, and
- /// keep zero.
- IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable - IntBits,
-
- /// IntMask - This is the unshifted mask for valid bits of the int type.
- IntMask = (uintptr_t)(((intptr_t)1 << IntBits) - 1),
-
- // ShiftedIntMask - This is the bits for the integer shifted in place.
- ShiftedIntMask = (uintptr_t)(IntMask << IntShift)
- };
-
- static PointerT getPointer(intptr_t Value) {
- return PtrTraits::getFromVoidPointer(
- reinterpret_cast<void *>(Value & PointerBitMask));
- }
-
- static intptr_t getInt(intptr_t Value) {
- return (Value >> IntShift) & IntMask;
- }
-
- static intptr_t updatePointer(intptr_t OrigValue, PointerT Ptr) {
- intptr_t PtrWord =
- reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
- assert((PtrWord & ~PointerBitMask) == 0 &&
- "Pointer is not sufficiently aligned");
- // Preserve all low bits, just update the pointer.
- return PtrWord | (OrigValue & ~PointerBitMask);
- }
-
- static intptr_t updateInt(intptr_t OrigValue, intptr_t Int) {
- intptr_t IntWord = static_cast<intptr_t>(Int);
- assert((IntWord & ~IntMask) == 0 && "Integer too large for field");
-
- // Preserve all bits other than the ones we are updating.
- return (OrigValue & ~ShiftedIntMask) | IntWord << IntShift;
- }
-};
-
-template <typename T> struct isPodLike;
-template <typename PointerTy, unsigned IntBits, typename IntType>
-struct isPodLike<PointerIntPair<PointerTy, IntBits, IntType>> {
- static const bool value = true;
-};
-
-// Provide specialization of DenseMapInfo for PointerIntPair.
-template <typename PointerTy, unsigned IntBits, typename IntType>
-struct DenseMapInfo<PointerIntPair<PointerTy, IntBits, IntType>> {
- using Ty = PointerIntPair<PointerTy, IntBits, IntType>;
-
- static Ty getEmptyKey() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<Ty>::NumLowBitsAvailable;
- return Ty::getFromOpaqueValue(reinterpret_cast<void *>(Val));
- }
-
- static Ty getTombstoneKey() {
- uintptr_t Val = static_cast<uintptr_t>(-2);
- Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
- return Ty::getFromOpaqueValue(reinterpret_cast<void *>(Val));
- }
-
- static unsigned getHashValue(Ty V) {
- uintptr_t IV = reinterpret_cast<uintptr_t>(V.getOpaqueValue());
- return unsigned(IV) ^ unsigned(IV >> 9);
- }
-
- static bool isEqual(const Ty &LHS, const Ty &RHS) { return LHS == RHS; }
-};
-
-// Teach SmallPtrSet that PointerIntPair is "basically a pointer".
-template <typename PointerTy, unsigned IntBits, typename IntType,
- typename PtrTraits>
-struct PointerLikeTypeTraits<
- PointerIntPair<PointerTy, IntBits, IntType, PtrTraits>> {
- static inline void *
- getAsVoidPointer(const PointerIntPair<PointerTy, IntBits, IntType> &P) {
- return P.getOpaqueValue();
- }
-
- static inline PointerIntPair<PointerTy, IntBits, IntType>
- getFromVoidPointer(void *P) {
- return PointerIntPair<PointerTy, IntBits, IntType>::getFromOpaqueValue(P);
- }
-
- static inline PointerIntPair<PointerTy, IntBits, IntType>
- getFromVoidPointer(const void *P) {
- return PointerIntPair<PointerTy, IntBits, IntType>::getFromOpaqueValue(P);
- }
-
- enum { NumLowBitsAvailable = PtrTraits::NumLowBitsAvailable - IntBits };
-};
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_POINTERINTPAIR_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist.h b/src/3rdparty/llvm/include/llvm/ADT/ilist.h
deleted file mode 100644
index 7e346e1260..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist.h
+++ /dev/null
@@ -1,431 +0,0 @@
-//==-- llvm/ADT/ilist.h - Intrusive Linked List Template ---------*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines classes to implement an intrusive doubly linked list class
-// (i.e. each node of the list must contain a next and previous field for the
-// list.
-//
-// The ilist class itself should be a plug in replacement for list. This list
-// replacement does not provide a constant time size() method, so be careful to
-// use empty() when you really want to know if it's empty.
-//
-// The ilist class is implemented as a circular list. The list itself contains
-// a sentinel node, whose Next points at begin() and whose Prev points at
-// rbegin(). The sentinel node itself serves as end() and rend().
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_H
-#define LLVM_ADT_ILIST_H
-
-#include "llvm/ADT/simple_ilist.h"
-#include <cassert>
-#include <cstddef>
-#include <iterator>
-
-namespace llvm {
-
-/// Use delete by default for iplist and ilist.
-///
-/// Specialize this to get different behaviour for ownership-related API. (If
-/// you really want ownership semantics, consider using std::list or building
-/// something like \a BumpPtrList.)
-///
-/// \see ilist_noalloc_traits
-template <typename NodeTy> struct ilist_alloc_traits {
- static void deleteNode(NodeTy *V) { delete V; }
-};
-
-/// Custom traits to do nothing on deletion.
-///
-/// Specialize ilist_alloc_traits to inherit from this to disable the
-/// non-intrusive deletion in iplist (which implies ownership).
-///
-/// If you want purely intrusive semantics with no callbacks, consider using \a
-/// simple_ilist instead.
-///
-/// \code
-/// template <>
-/// struct ilist_alloc_traits<MyType> : ilist_noalloc_traits<MyType> {};
-/// \endcode
-template <typename NodeTy> struct ilist_noalloc_traits {
- static void deleteNode(NodeTy *) {}
-};
-
-/// Callbacks do nothing by default in iplist and ilist.
-///
-/// Specialize this for to use callbacks for when nodes change their list
-/// membership.
-template <typename NodeTy> struct ilist_callback_traits {
- void addNodeToList(NodeTy *) {}
- void removeNodeFromList(NodeTy *) {}
-
- /// Callback before transferring nodes to this list.
- ///
- /// \pre \c this!=&OldList
- template <class Iterator>
- void transferNodesFromList(ilist_callback_traits &OldList, Iterator /*first*/,
- Iterator /*last*/) {
- (void)OldList;
- }
-};
-
-/// A fragment for template traits for intrusive list that provides default
-/// node related operations.
-///
-/// TODO: Remove this layer of indirection. It's not necessary.
-template <typename NodeTy>
-struct ilist_node_traits : ilist_alloc_traits<NodeTy>,
- ilist_callback_traits<NodeTy> {};
-
-/// Default template traits for intrusive list.
-///
-/// By inheriting from this, you can easily use default implementations for all
-/// common operations.
-///
-/// TODO: Remove this customization point. Specializing ilist_traits is
-/// already fully general.
-template <typename NodeTy>
-struct ilist_default_traits : public ilist_node_traits<NodeTy> {};
-
-/// Template traits for intrusive list.
-///
-/// Customize callbacks and allocation semantics.
-template <typename NodeTy>
-struct ilist_traits : public ilist_default_traits<NodeTy> {};
-
-/// Const traits should never be instantiated.
-template <typename Ty> struct ilist_traits<const Ty> {};
-
-namespace ilist_detail {
-
-template <class T> T &make();
-
-/// Type trait to check for a traits class that has a getNext member (as a
-/// canary for any of the ilist_nextprev_traits API).
-template <class TraitsT, class NodeT> struct HasGetNext {
- typedef char Yes[1];
- typedef char No[2];
- template <size_t N> struct SFINAE {};
-
- template <class U>
- static Yes &test(U *I, decltype(I->getNext(&make<NodeT>())) * = 0);
- template <class> static No &test(...);
-
-public:
- static const bool value = sizeof(test<TraitsT>(nullptr)) == sizeof(Yes);
-};
-
-/// Type trait to check for a traits class that has a createSentinel member (as
-/// a canary for any of the ilist_sentinel_traits API).
-template <class TraitsT> struct HasCreateSentinel {
- typedef char Yes[1];
- typedef char No[2];
-
- template <class U>
- static Yes &test(U *I, decltype(I->createSentinel()) * = 0);
- template <class> static No &test(...);
-
-public:
- static const bool value = sizeof(test<TraitsT>(nullptr)) == sizeof(Yes);
-};
-
-/// Type trait to check for a traits class that has a createNode member.
-/// Allocation should be managed in a wrapper class, instead of in
-/// ilist_traits.
-template <class TraitsT, class NodeT> struct HasCreateNode {
- typedef char Yes[1];
- typedef char No[2];
- template <size_t N> struct SFINAE {};
-
- template <class U>
- static Yes &test(U *I, decltype(I->createNode(make<NodeT>())) * = 0);
- template <class> static No &test(...);
-
-public:
- static const bool value = sizeof(test<TraitsT>(nullptr)) == sizeof(Yes);
-};
-
-template <class TraitsT, class NodeT> struct HasObsoleteCustomization {
- static const bool value = HasGetNext<TraitsT, NodeT>::value ||
- HasCreateSentinel<TraitsT>::value ||
- HasCreateNode<TraitsT, NodeT>::value;
-};
-
-} // end namespace ilist_detail
-
-//===----------------------------------------------------------------------===//
-//
-/// A wrapper around an intrusive list with callbacks and non-intrusive
-/// ownership.
-///
-/// This wraps a purely intrusive list (like simple_ilist) with a configurable
-/// traits class. The traits can implement callbacks and customize the
-/// ownership semantics.
-///
-/// This is a subset of ilist functionality that can safely be used on nodes of
-/// polymorphic types, i.e. a heterogeneous list with a common base class that
-/// holds the next/prev pointers. The only state of the list itself is an
-/// ilist_sentinel, which holds pointers to the first and last nodes in the
-/// list.
-template <class IntrusiveListT, class TraitsT>
-class iplist_impl : public TraitsT, IntrusiveListT {
- typedef IntrusiveListT base_list_type;
-
-public:
- typedef typename base_list_type::pointer pointer;
- typedef typename base_list_type::const_pointer const_pointer;
- typedef typename base_list_type::reference reference;
- typedef typename base_list_type::const_reference const_reference;
- typedef typename base_list_type::value_type value_type;
- typedef typename base_list_type::size_type size_type;
- typedef typename base_list_type::difference_type difference_type;
- typedef typename base_list_type::iterator iterator;
- typedef typename base_list_type::const_iterator const_iterator;
- typedef typename base_list_type::reverse_iterator reverse_iterator;
- typedef
- typename base_list_type::const_reverse_iterator const_reverse_iterator;
-
-private:
- // TODO: Drop this assertion and the transitive type traits anytime after
- // v4.0 is branched (i.e,. keep them for one release to help out-of-tree code
- // update).
- static_assert(
- !ilist_detail::HasObsoleteCustomization<TraitsT, value_type>::value,
- "ilist customization points have changed!");
-
- static bool op_less(const_reference L, const_reference R) { return L < R; }
- static bool op_equal(const_reference L, const_reference R) { return L == R; }
-
-public:
- iplist_impl() = default;
-
- iplist_impl(const iplist_impl &) = delete;
- iplist_impl &operator=(const iplist_impl &) = delete;
-
- iplist_impl(iplist_impl &&X)
- : TraitsT(std::move(X)), IntrusiveListT(std::move(X)) {}
- iplist_impl &operator=(iplist_impl &&X) {
- *static_cast<TraitsT *>(this) = std::move(X);
- *static_cast<IntrusiveListT *>(this) = std::move(X);
- return *this;
- }
-
- ~iplist_impl() { clear(); }
-
- // Miscellaneous inspection routines.
- size_type max_size() const { return size_type(-1); }
-
- using base_list_type::begin;
- using base_list_type::end;
- using base_list_type::rbegin;
- using base_list_type::rend;
- using base_list_type::empty;
- using base_list_type::front;
- using base_list_type::back;
-
- void swap(iplist_impl &RHS) {
- assert(0 && "Swap does not use list traits callback correctly yet!");
- base_list_type::swap(RHS);
- }
-
- iterator insert(iterator where, pointer New) {
- this->addNodeToList(New); // Notify traits that we added a node...
- return base_list_type::insert(where, *New);
- }
-
- iterator insert(iterator where, const_reference New) {
- return this->insert(where, new value_type(New));
- }
-
- iterator insertAfter(iterator where, pointer New) {
- if (empty())
- return insert(begin(), New);
- else
- return insert(++where, New);
- }
-
- /// Clone another list.
- template <class Cloner> void cloneFrom(const iplist_impl &L2, Cloner clone) {
- clear();
- for (const_reference V : L2)
- push_back(clone(V));
- }
-
- pointer remove(iterator &IT) {
- pointer Node = &*IT++;
- this->removeNodeFromList(Node); // Notify traits that we removed a node...
- base_list_type::remove(*Node);
- return Node;
- }
-
- pointer remove(const iterator &IT) {
- iterator MutIt = IT;
- return remove(MutIt);
- }
-
- pointer remove(pointer IT) { return remove(iterator(IT)); }
- pointer remove(reference IT) { return remove(iterator(IT)); }
-
- // erase - remove a node from the controlled sequence... and delete it.
- iterator erase(iterator where) {
- this->deleteNode(remove(where));
- return where;
- }
-
- iterator erase(pointer IT) { return erase(iterator(IT)); }
- iterator erase(reference IT) { return erase(iterator(IT)); }
-
- /// Remove all nodes from the list like clear(), but do not call
- /// removeNodeFromList() or deleteNode().
- ///
- /// This should only be used immediately before freeing nodes in bulk to
- /// avoid traversing the list and bringing all the nodes into cache.
- void clearAndLeakNodesUnsafely() { base_list_type::clear(); }
-
-private:
- // transfer - The heart of the splice function. Move linked list nodes from
- // [first, last) into position.
- //
- void transfer(iterator position, iplist_impl &L2, iterator first, iterator last) {
- if (position == last)
- return;
-
- if (this != &L2) // Notify traits we moved the nodes...
- this->transferNodesFromList(L2, first, last);
-
- base_list_type::splice(position, L2, first, last);
- }
-
-public:
- //===----------------------------------------------------------------------===
- // Functionality derived from other functions defined above...
- //
-
- using base_list_type::size;
-
- iterator erase(iterator first, iterator last) {
- while (first != last)
- first = erase(first);
- return last;
- }
-
- void clear() { erase(begin(), end()); }
-
- // Front and back inserters...
- void push_front(pointer val) { insert(begin(), val); }
- void push_back(pointer val) { insert(end(), val); }
- void pop_front() {
- assert(!empty() && "pop_front() on empty list!");
- erase(begin());
- }
- void pop_back() {
- assert(!empty() && "pop_back() on empty list!");
- iterator t = end(); erase(--t);
- }
-
- // Special forms of insert...
- template<class InIt> void insert(iterator where, InIt first, InIt last) {
- for (; first != last; ++first) insert(where, *first);
- }
-
- // Splice members - defined in terms of transfer...
- void splice(iterator where, iplist_impl &L2) {
- if (!L2.empty())
- transfer(where, L2, L2.begin(), L2.end());
- }
- void splice(iterator where, iplist_impl &L2, iterator first) {
- iterator last = first; ++last;
- if (where == first || where == last) return; // No change
- transfer(where, L2, first, last);
- }
- void splice(iterator where, iplist_impl &L2, iterator first, iterator last) {
- if (first != last) transfer(where, L2, first, last);
- }
- void splice(iterator where, iplist_impl &L2, reference N) {
- splice(where, L2, iterator(N));
- }
- void splice(iterator where, iplist_impl &L2, pointer N) {
- splice(where, L2, iterator(N));
- }
-
- template <class Compare>
- void merge(iplist_impl &Right, Compare comp) {
- if (this == &Right)
- return;
- this->transferNodesFromList(Right, Right.begin(), Right.end());
- base_list_type::merge(Right, comp);
- }
- void merge(iplist_impl &Right) { return merge(Right, op_less); }
-
- using base_list_type::sort;
-
- /// \brief Get the previous node, or \c nullptr for the list head.
- pointer getPrevNode(reference N) const {
- auto I = N.getIterator();
- if (I == begin())
- return nullptr;
- return &*std::prev(I);
- }
- /// \brief Get the previous node, or \c nullptr for the list head.
- const_pointer getPrevNode(const_reference N) const {
- return getPrevNode(const_cast<reference >(N));
- }
-
- /// \brief Get the next node, or \c nullptr for the list tail.
- pointer getNextNode(reference N) const {
- auto Next = std::next(N.getIterator());
- if (Next == end())
- return nullptr;
- return &*Next;
- }
- /// \brief Get the next node, or \c nullptr for the list tail.
- const_pointer getNextNode(const_reference N) const {
- return getNextNode(const_cast<reference >(N));
- }
-};
-
-/// An intrusive list with ownership and callbacks specified/controlled by
-/// ilist_traits, only with API safe for polymorphic types.
-///
-/// The \p Options parameters are the same as those for \a simple_ilist. See
-/// there for a description of what's available.
-template <class T, class... Options>
-class iplist
- : public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
- using iplist_impl_type = typename iplist::iplist_impl;
-
-public:
- iplist() = default;
-
- iplist(const iplist &X) = delete;
- iplist &operator=(const iplist &X) = delete;
-
- iplist(iplist &&X) : iplist_impl_type(std::move(X)) {}
- iplist &operator=(iplist &&X) {
- *static_cast<iplist_impl_type *>(this) = std::move(X);
- return *this;
- }
-};
-
-template <class T, class... Options> using ilist = iplist<T, Options...>;
-
-} // end namespace llvm
-
-namespace std {
-
- // Ensure that swap uses the fast list swap...
- template<class Ty>
- void swap(llvm::iplist<Ty> &Left, llvm::iplist<Ty> &Right) {
- Left.swap(Right);
- }
-
-} // end namespace std
-
-#endif // LLVM_ADT_ILIST_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist_base.h b/src/3rdparty/llvm/include/llvm/ADT/ilist_base.h
deleted file mode 100644
index 3d818a48d4..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist_base.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//===- llvm/ADT/ilist_base.h - Intrusive List Base --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_BASE_H
-#define LLVM_ADT_ILIST_BASE_H
-
-#include "llvm/ADT/ilist_node_base.h"
-#include <cassert>
-
-namespace llvm {
-
-/// Implementations of list algorithms using ilist_node_base.
-template <bool EnableSentinelTracking> class ilist_base {
-public:
- using node_base_type = ilist_node_base<EnableSentinelTracking>;
-
- static void insertBeforeImpl(node_base_type &Next, node_base_type &N) {
- node_base_type &Prev = *Next.getPrev();
- N.setNext(&Next);
- N.setPrev(&Prev);
- Prev.setNext(&N);
- Next.setPrev(&N);
- }
-
- static void removeImpl(node_base_type &N) {
- node_base_type *Prev = N.getPrev();
- node_base_type *Next = N.getNext();
- Next->setPrev(Prev);
- Prev->setNext(Next);
-
- // Not strictly necessary, but helps catch a class of bugs.
- N.setPrev(nullptr);
- N.setNext(nullptr);
- }
-
- static void removeRangeImpl(node_base_type &First, node_base_type &Last) {
- node_base_type *Prev = First.getPrev();
- node_base_type *Final = Last.getPrev();
- Last.setPrev(Prev);
- Prev->setNext(&Last);
-
- // Not strictly necessary, but helps catch a class of bugs.
- First.setPrev(nullptr);
- Final->setNext(nullptr);
- }
-
- static void transferBeforeImpl(node_base_type &Next, node_base_type &First,
- node_base_type &Last) {
- if (&Next == &Last || &First == &Last)
- return;
-
- // Position cannot be contained in the range to be transferred.
- assert(&Next != &First &&
- // Check for the most common mistake.
- "Insertion point can't be one of the transferred nodes");
-
- node_base_type &Final = *Last.getPrev();
-
- // Detach from old list/position.
- First.getPrev()->setNext(&Last);
- Last.setPrev(First.getPrev());
-
- // Splice [First, Final] into its new list/position.
- node_base_type &Prev = *Next.getPrev();
- Final.setNext(&Next);
- First.setPrev(&Prev);
- Prev.setNext(&First);
- Next.setPrev(&Final);
- }
-
- template <class T> static void insertBefore(T &Next, T &N) {
- insertBeforeImpl(Next, N);
- }
-
- template <class T> static void remove(T &N) { removeImpl(N); }
- template <class T> static void removeRange(T &First, T &Last) {
- removeRangeImpl(First, Last);
- }
-
- template <class T> static void transferBefore(T &Next, T &First, T &Last) {
- transferBeforeImpl(Next, First, Last);
- }
-};
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_ILIST_BASE_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist_iterator.h b/src/3rdparty/llvm/include/llvm/ADT/ilist_iterator.h
deleted file mode 100644
index 671e644e01..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist_iterator.h
+++ /dev/null
@@ -1,199 +0,0 @@
-//===- llvm/ADT/ilist_iterator.h - Intrusive List Iterator ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_ITERATOR_H
-#define LLVM_ADT_ILIST_ITERATOR_H
-
-#include "llvm/ADT/ilist_node.h"
-#include <cassert>
-#include <cstddef>
-#include <iterator>
-#include <type_traits>
-
-namespace llvm {
-
-namespace ilist_detail {
-
-/// Find const-correct node types.
-template <class OptionsT, bool IsConst> struct IteratorTraits;
-template <class OptionsT> struct IteratorTraits<OptionsT, false> {
- using value_type = typename OptionsT::value_type;
- using pointer = typename OptionsT::pointer;
- using reference = typename OptionsT::reference;
- using node_pointer = ilist_node_impl<OptionsT> *;
- using node_reference = ilist_node_impl<OptionsT> &;
-};
-template <class OptionsT> struct IteratorTraits<OptionsT, true> {
- using value_type = const typename OptionsT::value_type;
- using pointer = typename OptionsT::const_pointer;
- using reference = typename OptionsT::const_reference;
- using node_pointer = const ilist_node_impl<OptionsT> *;
- using node_reference = const ilist_node_impl<OptionsT> &;
-};
-
-template <bool IsReverse> struct IteratorHelper;
-template <> struct IteratorHelper<false> : ilist_detail::NodeAccess {
- using Access = ilist_detail::NodeAccess;
-
- template <class T> static void increment(T *&I) { I = Access::getNext(*I); }
- template <class T> static void decrement(T *&I) { I = Access::getPrev(*I); }
-};
-template <> struct IteratorHelper<true> : ilist_detail::NodeAccess {
- using Access = ilist_detail::NodeAccess;
-
- template <class T> static void increment(T *&I) { I = Access::getPrev(*I); }
- template <class T> static void decrement(T *&I) { I = Access::getNext(*I); }
-};
-
-} // end namespace ilist_detail
-
-/// Iterator for intrusive lists based on ilist_node.
-template <class OptionsT, bool IsReverse, bool IsConst>
-class ilist_iterator : ilist_detail::SpecificNodeAccess<OptionsT> {
- friend ilist_iterator<OptionsT, IsReverse, !IsConst>;
- friend ilist_iterator<OptionsT, !IsReverse, IsConst>;
- friend ilist_iterator<OptionsT, !IsReverse, !IsConst>;
-
- using Traits = ilist_detail::IteratorTraits<OptionsT, IsConst>;
- using Access = ilist_detail::SpecificNodeAccess<OptionsT>;
-
-public:
- using value_type = typename Traits::value_type;
- using pointer = typename Traits::pointer;
- using reference = typename Traits::reference;
- using difference_type = ptrdiff_t;
- using iterator_category = std::bidirectional_iterator_tag;
- using const_pointer = typename OptionsT::const_pointer;
- using const_reference = typename OptionsT::const_reference;
-
-private:
- using node_pointer = typename Traits::node_pointer;
- using node_reference = typename Traits::node_reference;
-
- node_pointer NodePtr = nullptr;
-
-public:
- /// Create from an ilist_node.
- explicit ilist_iterator(node_reference N) : NodePtr(&N) {}
-
- explicit ilist_iterator(pointer NP) : NodePtr(Access::getNodePtr(NP)) {}
- explicit ilist_iterator(reference NR) : NodePtr(Access::getNodePtr(&NR)) {}
- ilist_iterator() = default;
-
- // This is templated so that we can allow constructing a const iterator from
- // a nonconst iterator...
- template <bool RHSIsConst>
- ilist_iterator(
- const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS,
- typename std::enable_if<IsConst || !RHSIsConst, void *>::type = nullptr)
- : NodePtr(RHS.NodePtr) {}
-
- // This is templated so that we can allow assigning to a const iterator from
- // a nonconst iterator...
- template <bool RHSIsConst>
- typename std::enable_if<IsConst || !RHSIsConst, ilist_iterator &>::type
- operator=(const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS) {
- NodePtr = RHS.NodePtr;
- return *this;
- }
-
- /// Explicit conversion between forward/reverse iterators.
- ///
- /// Translate between forward and reverse iterators without changing range
- /// boundaries. The resulting iterator will dereference (and have a handle)
- /// to the previous node, which is somewhat unexpected; but converting the
- /// two endpoints in a range will give the same range in reverse.
- ///
- /// This matches std::reverse_iterator conversions.
- explicit ilist_iterator(
- const ilist_iterator<OptionsT, !IsReverse, IsConst> &RHS)
- : ilist_iterator(++RHS.getReverse()) {}
-
- /// Get a reverse iterator to the same node.
- ///
- /// Gives a reverse iterator that will dereference (and have a handle) to the
- /// same node. Converting the endpoint iterators in a range will give a
- /// different range; for range operations, use the explicit conversions.
- ilist_iterator<OptionsT, !IsReverse, IsConst> getReverse() const {
- if (NodePtr)
- return ilist_iterator<OptionsT, !IsReverse, IsConst>(*NodePtr);
- return ilist_iterator<OptionsT, !IsReverse, IsConst>();
- }
-
- /// Const-cast.
- ilist_iterator<OptionsT, IsReverse, false> getNonConst() const {
- if (NodePtr)
- return ilist_iterator<OptionsT, IsReverse, false>(
- const_cast<typename ilist_iterator<OptionsT, IsReverse,
- false>::node_reference>(*NodePtr));
- return ilist_iterator<OptionsT, IsReverse, false>();
- }
-
- // Accessors...
- reference operator*() const {
- assert(!NodePtr->isKnownSentinel());
- return *Access::getValuePtr(NodePtr);
- }
- pointer operator->() const { return &operator*(); }
-
- // Comparison operators
- friend bool operator==(const ilist_iterator &LHS, const ilist_iterator &RHS) {
- return LHS.NodePtr == RHS.NodePtr;
- }
- friend bool operator!=(const ilist_iterator &LHS, const ilist_iterator &RHS) {
- return LHS.NodePtr != RHS.NodePtr;
- }
-
- // Increment and decrement operators...
- ilist_iterator &operator--() {
- NodePtr = IsReverse ? NodePtr->getNext() : NodePtr->getPrev();
- return *this;
- }
- ilist_iterator &operator++() {
- NodePtr = IsReverse ? NodePtr->getPrev() : NodePtr->getNext();
- return *this;
- }
- ilist_iterator operator--(int) {
- ilist_iterator tmp = *this;
- --*this;
- return tmp;
- }
- ilist_iterator operator++(int) {
- ilist_iterator tmp = *this;
- ++*this;
- return tmp;
- }
-
- /// Get the underlying ilist_node.
- node_pointer getNodePtr() const { return static_cast<node_pointer>(NodePtr); }
-
- /// Check for end. Only valid if ilist_sentinel_tracking<true>.
- bool isEnd() const { return NodePtr ? NodePtr->isSentinel() : false; }
-};
-
-template <typename From> struct simplify_type;
-
-/// Allow ilist_iterators to convert into pointers to a node automatically when
-/// used by the dyn_cast, cast, isa mechanisms...
-///
-/// FIXME: remove this, since there is no implicit conversion to NodeTy.
-template <class OptionsT, bool IsConst>
-struct simplify_type<ilist_iterator<OptionsT, false, IsConst>> {
- using iterator = ilist_iterator<OptionsT, false, IsConst>;
- using SimpleType = typename iterator::pointer;
-
- static SimpleType getSimplifiedValue(const iterator &Node) { return &*Node; }
-};
-template <class OptionsT, bool IsConst>
-struct simplify_type<const ilist_iterator<OptionsT, false, IsConst>>
- : simplify_type<ilist_iterator<OptionsT, false, IsConst>> {};
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_ILIST_ITERATOR_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist_node.h b/src/3rdparty/llvm/include/llvm/ADT/ilist_node.h
deleted file mode 100644
index 3362611697..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist_node.h
+++ /dev/null
@@ -1,306 +0,0 @@
-//===- llvm/ADT/ilist_node.h - Intrusive Linked List Helper -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the ilist_node class template, which is a convenient
-// base class for creating classes that can be used with ilists.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_NODE_H
-#define LLVM_ADT_ILIST_NODE_H
-
-#include "llvm/ADT/ilist_node_base.h"
-#include "llvm/ADT/ilist_node_options.h"
-
-namespace llvm {
-
-namespace ilist_detail {
-
-struct NodeAccess;
-
-} // end namespace ilist_detail
-
-template <class OptionsT, bool IsReverse, bool IsConst> class ilist_iterator;
-template <class OptionsT> class ilist_sentinel;
-
-/// Implementation for an ilist node.
-///
-/// Templated on an appropriate \a ilist_detail::node_options, usually computed
-/// by \a ilist_detail::compute_node_options.
-///
-/// This is a wrapper around \a ilist_node_base whose main purpose is to
-/// provide type safety: you can't insert nodes of \a ilist_node_impl into the
-/// wrong \a simple_ilist or \a iplist.
-template <class OptionsT> class ilist_node_impl : OptionsT::node_base_type {
- using value_type = typename OptionsT::value_type;
- using node_base_type = typename OptionsT::node_base_type;
- using list_base_type = typename OptionsT::list_base_type;
-
- friend typename OptionsT::list_base_type;
- friend struct ilist_detail::NodeAccess;
- friend class ilist_sentinel<OptionsT>;
- friend class ilist_iterator<OptionsT, false, false>;
- friend class ilist_iterator<OptionsT, false, true>;
- friend class ilist_iterator<OptionsT, true, false>;
- friend class ilist_iterator<OptionsT, true, true>;
-
-protected:
- using self_iterator = ilist_iterator<OptionsT, false, false>;
- using const_self_iterator = ilist_iterator<OptionsT, false, true>;
- using reverse_self_iterator = ilist_iterator<OptionsT, true, false>;
- using const_reverse_self_iterator = ilist_iterator<OptionsT, true, true>;
-
- ilist_node_impl() = default;
-
-private:
- ilist_node_impl *getPrev() {
- return static_cast<ilist_node_impl *>(node_base_type::getPrev());
- }
-
- ilist_node_impl *getNext() {
- return static_cast<ilist_node_impl *>(node_base_type::getNext());
- }
-
- const ilist_node_impl *getPrev() const {
- return static_cast<ilist_node_impl *>(node_base_type::getPrev());
- }
-
- const ilist_node_impl *getNext() const {
- return static_cast<ilist_node_impl *>(node_base_type::getNext());
- }
-
- void setPrev(ilist_node_impl *N) { node_base_type::setPrev(N); }
- void setNext(ilist_node_impl *N) { node_base_type::setNext(N); }
-
-public:
- self_iterator getIterator() { return self_iterator(*this); }
- const_self_iterator getIterator() const { return const_self_iterator(*this); }
-
- reverse_self_iterator getReverseIterator() {
- return reverse_self_iterator(*this);
- }
-
- const_reverse_self_iterator getReverseIterator() const {
- return const_reverse_self_iterator(*this);
- }
-
- // Under-approximation, but always available for assertions.
- using node_base_type::isKnownSentinel;
-
- /// Check whether this is the sentinel node.
- ///
- /// This requires sentinel tracking to be explicitly enabled. Use the
- /// ilist_sentinel_tracking<true> option to get this API.
- bool isSentinel() const {
- static_assert(OptionsT::is_sentinel_tracking_explicit,
- "Use ilist_sentinel_tracking<true> to enable isSentinel()");
- return node_base_type::isSentinel();
- }
-};
-
-/// An intrusive list node.
-///
-/// A base class to enable membership in intrusive lists, including \a
-/// simple_ilist, \a iplist, and \a ilist. The first template parameter is the
-/// \a value_type for the list.
-///
-/// An ilist node can be configured with compile-time options to change
-/// behaviour and/or add API.
-///
-/// By default, an \a ilist_node knows whether it is the list sentinel (an
-/// instance of \a ilist_sentinel) if and only if
-/// LLVM_ENABLE_ABI_BREAKING_CHECKS. The function \a isKnownSentinel() always
-/// returns \c false tracking is off. Sentinel tracking steals a bit from the
-/// "prev" link, which adds a mask operation when decrementing an iterator, but
-/// enables bug-finding assertions in \a ilist_iterator.
-///
-/// To turn sentinel tracking on all the time, pass in the
-/// ilist_sentinel_tracking<true> template parameter. This also enables the \a
-/// isSentinel() function. The same option must be passed to the intrusive
-/// list. (ilist_sentinel_tracking<false> turns sentinel tracking off all the
-/// time.)
-///
-/// A type can inherit from ilist_node multiple times by passing in different
-/// \a ilist_tag options. This allows a single instance to be inserted into
-/// multiple lists simultaneously, where each list is given the same tag.
-///
-/// \example
-/// struct A {};
-/// struct B {};
-/// struct N : ilist_node<N, ilist_tag<A>>, ilist_node<N, ilist_tag<B>> {};
-///
-/// void foo() {
-/// simple_ilist<N, ilist_tag<A>> ListA;
-/// simple_ilist<N, ilist_tag<B>> ListB;
-/// N N1;
-/// ListA.push_back(N1);
-/// ListB.push_back(N1);
-/// }
-/// \endexample
-///
-/// See \a is_valid_option for steps on adding a new option.
-template <class T, class... Options>
-class ilist_node
- : public ilist_node_impl<
- typename ilist_detail::compute_node_options<T, Options...>::type> {
- static_assert(ilist_detail::check_options<Options...>::value,
- "Unrecognized node option!");
-};
-
-namespace ilist_detail {
-
-/// An access class for ilist_node private API.
-///
-/// This gives access to the private parts of ilist nodes. Nodes for an ilist
-/// should friend this class if they inherit privately from ilist_node.
-///
-/// Using this class outside of the ilist implementation is unsupported.
-struct NodeAccess {
-protected:
- template <class OptionsT>
- static ilist_node_impl<OptionsT> *getNodePtr(typename OptionsT::pointer N) {
- return N;
- }
-
- template <class OptionsT>
- static const ilist_node_impl<OptionsT> *
- getNodePtr(typename OptionsT::const_pointer N) {
- return N;
- }
-
- template <class OptionsT>
- static typename OptionsT::pointer getValuePtr(ilist_node_impl<OptionsT> *N) {
- return static_cast<typename OptionsT::pointer>(N);
- }
-
- template <class OptionsT>
- static typename OptionsT::const_pointer
- getValuePtr(const ilist_node_impl<OptionsT> *N) {
- return static_cast<typename OptionsT::const_pointer>(N);
- }
-
- template <class OptionsT>
- static ilist_node_impl<OptionsT> *getPrev(ilist_node_impl<OptionsT> &N) {
- return N.getPrev();
- }
-
- template <class OptionsT>
- static ilist_node_impl<OptionsT> *getNext(ilist_node_impl<OptionsT> &N) {
- return N.getNext();
- }
-
- template <class OptionsT>
- static const ilist_node_impl<OptionsT> *
- getPrev(const ilist_node_impl<OptionsT> &N) {
- return N.getPrev();
- }
-
- template <class OptionsT>
- static const ilist_node_impl<OptionsT> *
- getNext(const ilist_node_impl<OptionsT> &N) {
- return N.getNext();
- }
-};
-
-template <class OptionsT> struct SpecificNodeAccess : NodeAccess {
-protected:
- using pointer = typename OptionsT::pointer;
- using const_pointer = typename OptionsT::const_pointer;
- using node_type = ilist_node_impl<OptionsT>;
-
- static node_type *getNodePtr(pointer N) {
- return NodeAccess::getNodePtr<OptionsT>(N);
- }
-
- static const node_type *getNodePtr(const_pointer N) {
- return NodeAccess::getNodePtr<OptionsT>(N);
- }
-
- static pointer getValuePtr(node_type *N) {
- return NodeAccess::getValuePtr<OptionsT>(N);
- }
-
- static const_pointer getValuePtr(const node_type *N) {
- return NodeAccess::getValuePtr<OptionsT>(N);
- }
-};
-
-} // end namespace ilist_detail
-
-template <class OptionsT>
-class ilist_sentinel : public ilist_node_impl<OptionsT> {
-public:
- ilist_sentinel() {
- this->initializeSentinel();
- reset();
- }
-
- void reset() {
- this->setPrev(this);
- this->setNext(this);
- }
-
- bool empty() const { return this == this->getPrev(); }
-};
-
-/// An ilist node that can access its parent list.
-///
-/// Requires \c NodeTy to have \a getParent() to find the parent node, and the
-/// \c ParentTy to have \a getSublistAccess() to get a reference to the list.
-template <typename NodeTy, typename ParentTy, class... Options>
-class ilist_node_with_parent : public ilist_node<NodeTy, Options...> {
-protected:
- ilist_node_with_parent() = default;
-
-private:
- /// Forward to NodeTy::getParent().
- ///
- /// Note: do not use the name "getParent()". We want a compile error
- /// (instead of recursion) when the subclass fails to implement \a
- /// getParent().
- const ParentTy *getNodeParent() const {
- return static_cast<const NodeTy *>(this)->getParent();
- }
-
-public:
- /// @name Adjacent Node Accessors
- /// @{
- /// \brief Get the previous node, or \c nullptr for the list head.
- NodeTy *getPrevNode() {
- // Should be separated to a reused function, but then we couldn't use auto
- // (and would need the type of the list).
- const auto &List =
- getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)nullptr));
- return List.getPrevNode(*static_cast<NodeTy *>(this));
- }
-
- /// \brief Get the previous node, or \c nullptr for the list head.
- const NodeTy *getPrevNode() const {
- return const_cast<ilist_node_with_parent *>(this)->getPrevNode();
- }
-
- /// \brief Get the next node, or \c nullptr for the list tail.
- NodeTy *getNextNode() {
- // Should be separated to a reused function, but then we couldn't use auto
- // (and would need the type of the list).
- const auto &List =
- getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)nullptr));
- return List.getNextNode(*static_cast<NodeTy *>(this));
- }
-
- /// \brief Get the next node, or \c nullptr for the list tail.
- const NodeTy *getNextNode() const {
- return const_cast<ilist_node_with_parent *>(this)->getNextNode();
- }
- /// @}
-};
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_ILIST_NODE_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist_node_base.h b/src/3rdparty/llvm/include/llvm/ADT/ilist_node_base.h
deleted file mode 100644
index e5062ac4ea..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist_node_base.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===- llvm/ADT/ilist_node_base.h - Intrusive List Node Base -----*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_NODE_BASE_H
-#define LLVM_ADT_ILIST_NODE_BASE_H
-
-#include "llvm/ADT/PointerIntPair.h"
-
-namespace llvm {
-
-/// Base class for ilist nodes.
-///
-/// Optionally tracks whether this node is the sentinel.
-template <bool EnableSentinelTracking> class ilist_node_base;
-
-template <> class ilist_node_base<false> {
- ilist_node_base *Prev = nullptr;
- ilist_node_base *Next = nullptr;
-
-public:
- void setPrev(ilist_node_base *Prev) { this->Prev = Prev; }
- void setNext(ilist_node_base *Next) { this->Next = Next; }
- ilist_node_base *getPrev() const { return Prev; }
- ilist_node_base *getNext() const { return Next; }
-
- bool isKnownSentinel() const { return false; }
- void initializeSentinel() {}
-};
-
-template <> class ilist_node_base<true> {
- PointerIntPair<ilist_node_base *, 1> PrevAndSentinel;
- ilist_node_base *Next = nullptr;
-
-public:
- void setPrev(ilist_node_base *Prev) { PrevAndSentinel.setPointer(Prev); }
- void setNext(ilist_node_base *Next) { this->Next = Next; }
- ilist_node_base *getPrev() const { return PrevAndSentinel.getPointer(); }
- ilist_node_base *getNext() const { return Next; }
-
- bool isSentinel() const { return PrevAndSentinel.getInt(); }
- bool isKnownSentinel() const { return isSentinel(); }
- void initializeSentinel() { PrevAndSentinel.setInt(true); }
-};
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_ILIST_NODE_BASE_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/ilist_node_options.h b/src/3rdparty/llvm/include/llvm/ADT/ilist_node_options.h
deleted file mode 100644
index a09fdda31c..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/ilist_node_options.h
+++ /dev/null
@@ -1,133 +0,0 @@
-//===- llvm/ADT/ilist_node_options.h - ilist_node Options -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ILIST_NODE_OPTIONS_H
-#define LLVM_ADT_ILIST_NODE_OPTIONS_H
-
-//#include "llvm/Config/abi-breaking.h"
-//#include "llvm/Config/llvm-config.h"
-
-#include <type_traits>
-
-namespace llvm {
-
-template <bool EnableSentinelTracking> class ilist_node_base;
-template <bool EnableSentinelTracking> class ilist_base;
-
-/// Option to choose whether to track sentinels.
-///
-/// This option affects the ABI for the nodes. When not specified explicitly,
-/// the ABI depends on LLVM_ENABLE_ABI_BREAKING_CHECKS. Specify explicitly to
-/// enable \a ilist_node::isSentinel().
-template <bool EnableSentinelTracking> struct ilist_sentinel_tracking {};
-
-/// Option to specify a tag for the node type.
-///
-/// This option allows a single value type to be inserted in multiple lists
-/// simultaneously. See \a ilist_node for usage examples.
-template <class Tag> struct ilist_tag {};
-
-namespace ilist_detail {
-
-/// Helper trait for recording whether an option is specified explicitly.
-template <bool IsExplicit> struct explicitness {
- static const bool is_explicit = IsExplicit;
-};
-typedef explicitness<true> is_explicit;
-typedef explicitness<false> is_implicit;
-
-/// Check whether an option is valid.
-///
-/// The steps for adding and enabling a new ilist option include:
-/// \li define the option, ilist_foo<Bar>, above;
-/// \li add new parameters for Bar to \a ilist_detail::node_options;
-/// \li add an extraction meta-function, ilist_detail::extract_foo;
-/// \li call extract_foo from \a ilist_detail::compute_node_options and pass it
-/// into \a ilist_detail::node_options; and
-/// \li specialize \c is_valid_option<ilist_foo<Bar>> to inherit from \c
-/// std::true_type to get static assertions passing in \a simple_ilist and \a
-/// ilist_node.
-template <class Option> struct is_valid_option : std::false_type {};
-
-/// Extract sentinel tracking option.
-///
-/// Look through \p Options for the \a ilist_sentinel_tracking option, with the
-/// default depending on LLVM_ENABLE_ABI_BREAKING_CHECKS.
-template <class... Options> struct extract_sentinel_tracking;
-template <bool EnableSentinelTracking, class... Options>
-struct extract_sentinel_tracking<
- ilist_sentinel_tracking<EnableSentinelTracking>, Options...>
- : std::integral_constant<bool, EnableSentinelTracking>, is_explicit {};
-template <class Option1, class... Options>
-struct extract_sentinel_tracking<Option1, Options...>
- : extract_sentinel_tracking<Options...> {};
-#if LLVM_ENABLE_ABI_BREAKING_CHECKS
-template <> struct extract_sentinel_tracking<> : std::true_type, is_implicit {};
-#else
-template <>
-struct extract_sentinel_tracking<> : std::false_type, is_implicit {};
-#endif
-template <bool EnableSentinelTracking>
-struct is_valid_option<ilist_sentinel_tracking<EnableSentinelTracking>>
- : std::true_type {};
-
-/// Extract custom tag option.
-///
-/// Look through \p Options for the \a ilist_tag option, pulling out the
-/// custom tag type, using void as a default.
-template <class... Options> struct extract_tag;
-template <class Tag, class... Options>
-struct extract_tag<ilist_tag<Tag>, Options...> {
- typedef Tag type;
-};
-template <class Option1, class... Options>
-struct extract_tag<Option1, Options...> : extract_tag<Options...> {};
-template <> struct extract_tag<> { typedef void type; };
-template <class Tag> struct is_valid_option<ilist_tag<Tag>> : std::true_type {};
-
-/// Check whether options are valid.
-///
-/// The conjunction of \a is_valid_option on each individual option.
-template <class... Options> struct check_options;
-template <> struct check_options<> : std::true_type {};
-template <class Option1, class... Options>
-struct check_options<Option1, Options...>
- : std::integral_constant<bool, is_valid_option<Option1>::value &&
- check_options<Options...>::value> {};
-
-/// Traits for options for \a ilist_node.
-///
-/// This is usually computed via \a compute_node_options.
-template <class T, bool EnableSentinelTracking, bool IsSentinelTrackingExplicit,
- class TagT>
-struct node_options {
- typedef T value_type;
- typedef T *pointer;
- typedef T &reference;
- typedef const T *const_pointer;
- typedef const T &const_reference;
-
- static const bool enable_sentinel_tracking = EnableSentinelTracking;
- static const bool is_sentinel_tracking_explicit = IsSentinelTrackingExplicit;
- typedef TagT tag;
- typedef ilist_node_base<enable_sentinel_tracking> node_base_type;
- typedef ilist_base<enable_sentinel_tracking> list_base_type;
-};
-
-template <class T, class... Options> struct compute_node_options {
- typedef node_options<T, extract_sentinel_tracking<Options...>::value,
- extract_sentinel_tracking<Options...>::is_explicit,
- typename extract_tag<Options...>::type>
- type;
-};
-
-} // end namespace ilist_detail
-} // end namespace llvm
-
-#endif // LLVM_ADT_ILIST_NODE_OPTIONS_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/iterator.h b/src/3rdparty/llvm/include/llvm/ADT/iterator.h
deleted file mode 100644
index 711f8f2216..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/iterator.h
+++ /dev/null
@@ -1,339 +0,0 @@
-//===- iterator.h - Utilities for using and defining iterators --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ITERATOR_H
-#define LLVM_ADT_ITERATOR_H
-
-#include "llvm/ADT/iterator_range.h"
-#include <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <type_traits>
-#include <utility>
-
-namespace llvm {
-
-/// \brief CRTP base class which implements the entire standard iterator facade
-/// in terms of a minimal subset of the interface.
-///
-/// Use this when it is reasonable to implement most of the iterator
-/// functionality in terms of a core subset. If you need special behavior or
-/// there are performance implications for this, you may want to override the
-/// relevant members instead.
-///
-/// Note, one abstraction that this does *not* provide is implementing
-/// subtraction in terms of addition by negating the difference. Negation isn't
-/// always information preserving, and I can see very reasonable iterator
-/// designs where this doesn't work well. It doesn't really force much added
-/// boilerplate anyways.
-///
-/// Another abstraction that this doesn't provide is implementing increment in
-/// terms of addition of one. These aren't equivalent for all iterator
-/// categories, and respecting that adds a lot of complexity for little gain.
-///
-/// Classes wishing to use `iterator_facade_base` should implement the following
-/// methods:
-///
-/// Forward Iterators:
-/// (All of the following methods)
-/// - DerivedT &operator=(const DerivedT &R);
-/// - bool operator==(const DerivedT &R) const;
-/// - const T &operator*() const;
-/// - T &operator*();
-/// - DerivedT &operator++();
-///
-/// Bidirectional Iterators:
-/// (All methods of forward iterators, plus the following)
-/// - DerivedT &operator--();
-///
-/// Random-access Iterators:
-/// (All methods of bidirectional iterators excluding the following)
-/// - DerivedT &operator++();
-/// - DerivedT &operator--();
-/// (and plus the following)
-/// - bool operator<(const DerivedT &RHS) const;
-/// - DifferenceTypeT operator-(const DerivedT &R) const;
-/// - DerivedT &operator+=(DifferenceTypeT N);
-/// - DerivedT &operator-=(DifferenceTypeT N);
-///
-template <typename DerivedT, typename IteratorCategoryT, typename T,
- typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
- typename ReferenceT = T &>
-class iterator_facade_base
- : public std::iterator<IteratorCategoryT, T, DifferenceTypeT, PointerT,
- ReferenceT> {
-protected:
- enum {
- IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,
- IteratorCategoryT>::value,
- IsBidirectional = std::is_base_of<std::bidirectional_iterator_tag,
- IteratorCategoryT>::value,
- };
-
- /// A proxy object for computing a reference via indirecting a copy of an
- /// iterator. This is used in APIs which need to produce a reference via
- /// indirection but for which the iterator object might be a temporary. The
- /// proxy preserves the iterator internally and exposes the indirected
- /// reference via a conversion operator.
- class ReferenceProxy {
- friend iterator_facade_base;
-
- DerivedT I;
-
- ReferenceProxy(DerivedT I) : I(std::move(I)) {}
-
- public:
- operator ReferenceT() const { return *I; }
- };
-
-public:
- DerivedT operator+(DifferenceTypeT n) const {
- static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
- "Must pass the derived type to this template!");
- static_assert(
- IsRandomAccess,
- "The '+' operator is only defined for random access iterators.");
- DerivedT tmp = *static_cast<const DerivedT *>(this);
- tmp += n;
- return tmp;
- }
- friend DerivedT operator+(DifferenceTypeT n, const DerivedT &i) {
- static_assert(
- IsRandomAccess,
- "The '+' operator is only defined for random access iterators.");
- return i + n;
- }
- DerivedT operator-(DifferenceTypeT n) const {
- static_assert(
- IsRandomAccess,
- "The '-' operator is only defined for random access iterators.");
- DerivedT tmp = *static_cast<const DerivedT *>(this);
- tmp -= n;
- return tmp;
- }
-
- DerivedT &operator++() {
- static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
- "Must pass the derived type to this template!");
- return static_cast<DerivedT *>(this)->operator+=(1);
- }
- DerivedT operator++(int) {
- DerivedT tmp = *static_cast<DerivedT *>(this);
- ++*static_cast<DerivedT *>(this);
- return tmp;
- }
- DerivedT &operator--() {
- static_assert(
- IsBidirectional,
- "The decrement operator is only defined for bidirectional iterators.");
- return static_cast<DerivedT *>(this)->operator-=(1);
- }
- DerivedT operator--(int) {
- static_assert(
- IsBidirectional,
- "The decrement operator is only defined for bidirectional iterators.");
- DerivedT tmp = *static_cast<DerivedT *>(this);
- --*static_cast<DerivedT *>(this);
- return tmp;
- }
-
- bool operator!=(const DerivedT &RHS) const {
- return !static_cast<const DerivedT *>(this)->operator==(RHS);
- }
-
- bool operator>(const DerivedT &RHS) const {
- static_assert(
- IsRandomAccess,
- "Relational operators are only defined for random access iterators.");
- return !static_cast<const DerivedT *>(this)->operator<(RHS) &&
- !static_cast<const DerivedT *>(this)->operator==(RHS);
- }
- bool operator<=(const DerivedT &RHS) const {
- static_assert(
- IsRandomAccess,
- "Relational operators are only defined for random access iterators.");
- return !static_cast<const DerivedT *>(this)->operator>(RHS);
- }
- bool operator>=(const DerivedT &RHS) const {
- static_assert(
- IsRandomAccess,
- "Relational operators are only defined for random access iterators.");
- return !static_cast<const DerivedT *>(this)->operator<(RHS);
- }
-
- PointerT operator->() { return &static_cast<DerivedT *>(this)->operator*(); }
- PointerT operator->() const {
- return &static_cast<const DerivedT *>(this)->operator*();
- }
- ReferenceProxy operator[](DifferenceTypeT n) {
- static_assert(IsRandomAccess,
- "Subscripting is only defined for random access iterators.");
- return ReferenceProxy(static_cast<DerivedT *>(this)->operator+(n));
- }
- ReferenceProxy operator[](DifferenceTypeT n) const {
- static_assert(IsRandomAccess,
- "Subscripting is only defined for random access iterators.");
- return ReferenceProxy(static_cast<const DerivedT *>(this)->operator+(n));
- }
-};
-
-/// \brief CRTP base class for adapting an iterator to a different type.
-///
-/// This class can be used through CRTP to adapt one iterator into another.
-/// Typically this is done through providing in the derived class a custom \c
-/// operator* implementation. Other methods can be overridden as well.
-template <
- typename DerivedT, typename WrappedIteratorT,
- typename IteratorCategoryT =
- typename std::iterator_traits<WrappedIteratorT>::iterator_category,
- typename T = typename std::iterator_traits<WrappedIteratorT>::value_type,
- typename DifferenceTypeT =
- typename std::iterator_traits<WrappedIteratorT>::difference_type,
- typename PointerT = typename std::conditional<
- std::is_same<T, typename std::iterator_traits<
- WrappedIteratorT>::value_type>::value,
- typename std::iterator_traits<WrappedIteratorT>::pointer, T *>::type,
- typename ReferenceT = typename std::conditional<
- std::is_same<T, typename std::iterator_traits<
- WrappedIteratorT>::value_type>::value,
- typename std::iterator_traits<WrappedIteratorT>::reference, T &>::type,
- // Don't provide these, they are mostly to act as aliases below.
- typename WrappedTraitsT = std::iterator_traits<WrappedIteratorT>>
-class iterator_adaptor_base
- : public iterator_facade_base<DerivedT, IteratorCategoryT, T,
- DifferenceTypeT, PointerT, ReferenceT> {
- using BaseT = typename iterator_adaptor_base::iterator_facade_base;
-
-protected:
- WrappedIteratorT I;
-
- iterator_adaptor_base() = default;
-
- explicit iterator_adaptor_base(WrappedIteratorT u) : I(std::move(u)) {
- static_assert(std::is_base_of<iterator_adaptor_base, DerivedT>::value,
- "Must pass the derived type to this template!");
- }
-
- const WrappedIteratorT &wrapped() const { return I; }
-
-public:
- using difference_type = DifferenceTypeT;
-
- DerivedT &operator+=(difference_type n) {
- static_assert(
- BaseT::IsRandomAccess,
- "The '+=' operator is only defined for random access iterators.");
- I += n;
- return *static_cast<DerivedT *>(this);
- }
- DerivedT &operator-=(difference_type n) {
- static_assert(
- BaseT::IsRandomAccess,
- "The '-=' operator is only defined for random access iterators.");
- I -= n;
- return *static_cast<DerivedT *>(this);
- }
- using BaseT::operator-;
- difference_type operator-(const DerivedT &RHS) const {
- static_assert(
- BaseT::IsRandomAccess,
- "The '-' operator is only defined for random access iterators.");
- return I - RHS.I;
- }
-
- // We have to explicitly provide ++ and -- rather than letting the facade
- // forward to += because WrappedIteratorT might not support +=.
- using BaseT::operator++;
- DerivedT &operator++() {
- ++I;
- return *static_cast<DerivedT *>(this);
- }
- using BaseT::operator--;
- DerivedT &operator--() {
- static_assert(
- BaseT::IsBidirectional,
- "The decrement operator is only defined for bidirectional iterators.");
- --I;
- return *static_cast<DerivedT *>(this);
- }
-
- bool operator==(const DerivedT &RHS) const { return I == RHS.I; }
- bool operator<(const DerivedT &RHS) const {
- static_assert(
- BaseT::IsRandomAccess,
- "Relational operators are only defined for random access iterators.");
- return I < RHS.I;
- }
-
- ReferenceT operator*() const { return *I; }
-};
-
-/// \brief An iterator type that allows iterating over the pointees via some
-/// other iterator.
-///
-/// The typical usage of this is to expose a type that iterates over Ts, but
-/// which is implemented with some iterator over T*s:
-///
-/// \code
-/// using iterator = pointee_iterator<SmallVectorImpl<T *>::iterator>;
-/// \endcode
-template <typename WrappedIteratorT,
- typename T = typename std::remove_reference<
- decltype(**std::declval<WrappedIteratorT>())>::type>
-struct pointee_iterator
- : iterator_adaptor_base<
- pointee_iterator<WrappedIteratorT>, WrappedIteratorT,
- typename std::iterator_traits<WrappedIteratorT>::iterator_category,
- T> {
- pointee_iterator() = default;
- template <typename U>
- pointee_iterator(U &&u)
- : pointee_iterator::iterator_adaptor_base(std::forward<U &&>(u)) {}
-
- T &operator*() const { return **this->I; }
-};
-
-template <typename RangeT, typename WrappedIteratorT =
- decltype(std::begin(std::declval<RangeT>()))>
-iterator_range<pointee_iterator<WrappedIteratorT>>
-make_pointee_range(RangeT &&Range) {
- using PointeeIteratorT = pointee_iterator<WrappedIteratorT>;
- return make_range(PointeeIteratorT(std::begin(std::forward<RangeT>(Range))),
- PointeeIteratorT(std::end(std::forward<RangeT>(Range))));
-}
-
-template <typename WrappedIteratorT,
- typename T = decltype(&*std::declval<WrappedIteratorT>())>
-class pointer_iterator
- : public iterator_adaptor_base<pointer_iterator<WrappedIteratorT>,
- WrappedIteratorT, T> {
- mutable T Ptr;
-
-public:
- pointer_iterator() = default;
-
- explicit pointer_iterator(WrappedIteratorT u)
- : pointer_iterator::iterator_adaptor_base(std::move(u)) {}
-
- T &operator*() { return Ptr = &*this->I; }
- const T &operator*() const { return Ptr = &*this->I; }
-};
-
-template <typename RangeT, typename WrappedIteratorT =
- decltype(std::begin(std::declval<RangeT>()))>
-iterator_range<pointer_iterator<WrappedIteratorT>>
-make_pointer_range(RangeT &&Range) {
- using PointerIteratorT = pointer_iterator<WrappedIteratorT>;
- return make_range(PointerIteratorT(std::begin(std::forward<RangeT>(Range))),
- PointerIteratorT(std::end(std::forward<RangeT>(Range))));
-}
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_ITERATOR_H
diff --git a/src/3rdparty/llvm/include/llvm/ADT/iterator_range.h b/src/3rdparty/llvm/include/llvm/ADT/iterator_range.h
deleted file mode 100644
index 3cbf6198eb..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/iterator_range.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===- iterator_range.h - A range adaptor for iterators ---------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-/// \file
-/// This provides a very simple, boring adaptor for a begin and end iterator
-/// into a range type. This should be used to build range views that work well
-/// with range based for loops and range based constructors.
-///
-/// Note that code here follows more standards-based coding conventions as it
-/// is mirroring proposed interfaces for standardization.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_ITERATOR_RANGE_H
-#define LLVM_ADT_ITERATOR_RANGE_H
-
-#include <iterator>
-#include <utility>
-
-namespace llvm {
-
-/// \brief A range adaptor for a pair of iterators.
-///
-/// This just wraps two iterators into a range-compatible interface. Nothing
-/// fancy at all.
-template <typename IteratorT>
-class iterator_range {
- IteratorT begin_iterator, end_iterator;
-
-public:
- //TODO: Add SFINAE to test that the Container's iterators match the range's
- // iterators.
- template <typename Container>
- iterator_range(Container &&c)
- //TODO: Consider ADL/non-member begin/end calls.
- : begin_iterator(c.begin()), end_iterator(c.end()) {}
- iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
- : begin_iterator(std::move(begin_iterator)),
- end_iterator(std::move(end_iterator)) {}
-
- IteratorT begin() const { return begin_iterator; }
- IteratorT end() const { return end_iterator; }
-};
-
-/// \brief Convenience function for iterating over sub-ranges.
-///
-/// This provides a bit of syntactic sugar to make using sub-ranges
-/// in for loops a bit easier. Analogous to std::make_pair().
-template <class T> iterator_range<T> make_range(T x, T y) {
- return iterator_range<T>(std::move(x), std::move(y));
-}
-
-template <typename T> iterator_range<T> make_range(std::pair<T, T> p) {
- return iterator_range<T>(std::move(p.first), std::move(p.second));
-}
-
-template<typename T>
-iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t, int n) {
- return make_range(std::next(begin(t), n), end(t));
-}
-}
-
-#endif
diff --git a/src/3rdparty/llvm/include/llvm/ADT/simple_ilist.h b/src/3rdparty/llvm/include/llvm/ADT/simple_ilist.h
deleted file mode 100644
index 4c7598a1ac..0000000000
--- a/src/3rdparty/llvm/include/llvm/ADT/simple_ilist.h
+++ /dev/null
@@ -1,315 +0,0 @@
-//===- llvm/ADT/simple_ilist.h - Simple Intrusive List ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_SIMPLE_ILIST_H
-#define LLVM_ADT_SIMPLE_ILIST_H
-
-#include "llvm/ADT/ilist_base.h"
-#include "llvm/ADT/ilist_iterator.h"
-#include "llvm/ADT/ilist_node.h"
-#include "llvm/ADT/ilist_node_options.h"
-#include "llvm/Support/Compiler.h"
-#include <algorithm>
-#include <cassert>
-#include <cstddef>
-#include <functional>
-#include <iterator>
-#include <utility>
-
-namespace llvm {
-
-/// A simple intrusive list implementation.
-///
-/// This is a simple intrusive list for a \c T that inherits from \c
-/// ilist_node<T>. The list never takes ownership of anything inserted in it.
-///
-/// Unlike \a iplist<T> and \a ilist<T>, \a simple_ilist<T> never allocates or
-/// deletes values, and has no callback traits.
-///
-/// The API for adding nodes include \a push_front(), \a push_back(), and \a
-/// insert(). These all take values by reference (not by pointer), except for
-/// the range version of \a insert().
-///
-/// There are three sets of API for discarding nodes from the list: \a
-/// remove(), which takes a reference to the node to remove, \a erase(), which
-/// takes an iterator or iterator range and returns the next one, and \a
-/// clear(), which empties out the container. All three are constant time
-/// operations. None of these deletes any nodes; in particular, if there is a
-/// single node in the list, then these have identical semantics:
-/// \li \c L.remove(L.front());
-/// \li \c L.erase(L.begin());
-/// \li \c L.clear();
-///
-/// As a convenience for callers, there are parallel APIs that take a \c
-/// Disposer (such as \c std::default_delete<T>): \a removeAndDispose(), \a
-/// eraseAndDispose(), and \a clearAndDispose(). These have different names
-/// because the extra semantic is otherwise non-obvious. They are equivalent
-/// to calling \a std::for_each() on the range to be discarded.
-///
-/// The currently available \p Options customize the nodes in the list. The
-/// same options must be specified in the \a ilist_node instantation for
-/// compatibility (although the order is irrelevant).
-/// \li Use \a ilist_tag to designate which ilist_node for a given \p T this
-/// list should use. This is useful if a type \p T is part of multiple,
-/// independent lists simultaneously.
-/// \li Use \a ilist_sentinel_tracking to always (or never) track whether a
-/// node is a sentinel. Specifying \c true enables the \a
-/// ilist_node::isSentinel() API. Unlike \a ilist_node::isKnownSentinel(),
-/// which is only appropriate for assertions, \a ilist_node::isSentinel() is
-/// appropriate for real logic.
-///
-/// Here are examples of \p Options usage:
-/// \li \c simple_ilist<T> gives the defaults. \li \c
-/// simple_ilist<T,ilist_sentinel_tracking<true>> enables the \a
-/// ilist_node::isSentinel() API.
-/// \li \c simple_ilist<T,ilist_tag<A>,ilist_sentinel_tracking<false>>
-/// specifies a tag of A and that tracking should be off (even when
-/// LLVM_ENABLE_ABI_BREAKING_CHECKS are enabled).
-/// \li \c simple_ilist<T,ilist_sentinel_tracking<false>,ilist_tag<A>> is
-/// equivalent to the last.
-///
-/// See \a is_valid_option for steps on adding a new option.
-template <typename T, class... Options>
-class simple_ilist
- : ilist_detail::compute_node_options<T, Options...>::type::list_base_type,
- ilist_detail::SpecificNodeAccess<
- typename ilist_detail::compute_node_options<T, Options...>::type> {
- static_assert(ilist_detail::check_options<Options...>::value,
- "Unrecognized node option!");
- using OptionsT =
- typename ilist_detail::compute_node_options<T, Options...>::type;
- using list_base_type = typename OptionsT::list_base_type;
- ilist_sentinel<OptionsT> Sentinel;
-
-public:
- using value_type = typename OptionsT::value_type;
- using pointer = typename OptionsT::pointer;
- using reference = typename OptionsT::reference;
- using const_pointer = typename OptionsT::const_pointer;
- using const_reference = typename OptionsT::const_reference;
- using iterator = ilist_iterator<OptionsT, false, false>;
- using const_iterator = ilist_iterator<OptionsT, false, true>;
- using reverse_iterator = ilist_iterator<OptionsT, true, false>;
- using const_reverse_iterator = ilist_iterator<OptionsT, true, true>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
-
- simple_ilist() = default;
- ~simple_ilist() = default;
-
- // No copy constructors.
- simple_ilist(const simple_ilist &) = delete;
- simple_ilist &operator=(const simple_ilist &) = delete;
-
- // Move constructors.
- simple_ilist(simple_ilist &&X) { splice(end(), X); }
- simple_ilist &operator=(simple_ilist &&X) {
- clear();
- splice(end(), X);
- return *this;
- }
-
- iterator begin() { return ++iterator(Sentinel); }
- const_iterator begin() const { return ++const_iterator(Sentinel); }
- iterator end() { return iterator(Sentinel); }
- const_iterator end() const { return const_iterator(Sentinel); }
- reverse_iterator rbegin() { return ++reverse_iterator(Sentinel); }
- const_reverse_iterator rbegin() const {
- return ++const_reverse_iterator(Sentinel);
- }
- reverse_iterator rend() { return reverse_iterator(Sentinel); }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(Sentinel);
- }
-
- /// Check if the list is empty in constant time.
- LLVM_NODISCARD bool empty() const { return Sentinel.empty(); }
-
- /// Calculate the size of the list in linear time.
- LLVM_NODISCARD size_type size() const {
- return std::distance(begin(), end());
- }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *rbegin(); }
- const_reference back() const { return *rbegin(); }
-
- /// Insert a node at the front; never copies.
- void push_front(reference Node) { insert(begin(), Node); }
-
- /// Insert a node at the back; never copies.
- void push_back(reference Node) { insert(end(), Node); }
-
- /// Remove the node at the front; never deletes.
- void pop_front() { erase(begin()); }
-
- /// Remove the node at the back; never deletes.
- void pop_back() { erase(--end()); }
-
- /// Swap with another list in place using std::swap.
- void swap(simple_ilist &X) { std::swap(*this, X); }
-
- /// Insert a node by reference; never copies.
- iterator insert(iterator I, reference Node) {
- list_base_type::insertBefore(*I.getNodePtr(), *this->getNodePtr(&Node));
- return iterator(&Node);
- }
-
- /// Insert a range of nodes; never copies.
- template <class Iterator>
- void insert(iterator I, Iterator First, Iterator Last) {
- for (; First != Last; ++First)
- insert(I, *First);
- }
-
- /// Clone another list.
- template <class Cloner, class Disposer>
- void cloneFrom(const simple_ilist &L2, Cloner clone, Disposer dispose) {
- clearAndDispose(dispose);
- for (const_reference V : L2)
- push_back(*clone(V));
- }
-
- /// Remove a node by reference; never deletes.
- ///
- /// \see \a erase() for removing by iterator.
- /// \see \a removeAndDispose() if the node should be deleted.
- void remove(reference N) { list_base_type::remove(*this->getNodePtr(&N)); }
-
- /// Remove a node by reference and dispose of it.
- template <class Disposer>
- void removeAndDispose(reference N, Disposer dispose) {
- remove(N);
- dispose(&N);
- }
-
- /// Remove a node by iterator; never deletes.
- ///
- /// \see \a remove() for removing by reference.
- /// \see \a eraseAndDispose() it the node should be deleted.
- iterator erase(iterator I) {
- assert(I != end() && "Cannot remove end of list!");
- remove(*I++);
- return I;
- }
-
- /// Remove a range of nodes; never deletes.
- ///
- /// \see \a eraseAndDispose() if the nodes should be deleted.
- iterator erase(iterator First, iterator Last) {
- list_base_type::removeRange(*First.getNodePtr(), *Last.getNodePtr());
- return Last;
- }
-
- /// Remove a node by iterator and dispose of it.
- template <class Disposer>
- iterator eraseAndDispose(iterator I, Disposer dispose) {
- auto Next = std::next(I);
- erase(I);
- dispose(&*I);
- return Next;
- }
-
- /// Remove a range of nodes and dispose of them.
- template <class Disposer>
- iterator eraseAndDispose(iterator First, iterator Last, Disposer dispose) {
- while (First != Last)
- First = eraseAndDispose(First, dispose);
- return Last;
- }
-
- /// Clear the list; never deletes.
- ///
- /// \see \a clearAndDispose() if the nodes should be deleted.
- void clear() { Sentinel.reset(); }
-
- /// Clear the list and dispose of the nodes.
- template <class Disposer> void clearAndDispose(Disposer dispose) {
- eraseAndDispose(begin(), end(), dispose);
- }
-
- /// Splice in another list.
- void splice(iterator I, simple_ilist &L2) {
- splice(I, L2, L2.begin(), L2.end());
- }
-
- /// Splice in a node from another list.
- void splice(iterator I, simple_ilist &L2, iterator Node) {
- splice(I, L2, Node, std::next(Node));
- }
-
- /// Splice in a range of nodes from another list.
- void splice(iterator I, simple_ilist &, iterator First, iterator Last) {
- list_base_type::transferBefore(*I.getNodePtr(), *First.getNodePtr(),
- *Last.getNodePtr());
- }
-
- /// Merge in another list.
- ///
- /// \pre \c this and \p RHS are sorted.
- ///@{
- void merge(simple_ilist &RHS) { merge(RHS, std::less<T>()); }
- template <class Compare> void merge(simple_ilist &RHS, Compare comp);
- ///@}
-
- /// Sort the list.
- ///@{
- void sort() { sort(std::less<T>()); }
- template <class Compare> void sort(Compare comp);
- ///@}
-};
-
-template <class T, class... Options>
-template <class Compare>
-void simple_ilist<T, Options...>::merge(simple_ilist &RHS, Compare comp) {
- if (this == &RHS || RHS.empty())
- return;
- iterator LI = begin(), LE = end();
- iterator RI = RHS.begin(), RE = RHS.end();
- while (LI != LE) {
- if (comp(*RI, *LI)) {
- // Transfer a run of at least size 1 from RHS to LHS.
- iterator RunStart = RI++;
- RI = std::find_if(RI, RE, [&](reference RV) { return !comp(RV, *LI); });
- splice(LI, RHS, RunStart, RI);
- if (RI == RE)
- return;
- }
- ++LI;
- }
- // Transfer the remaining RHS nodes once LHS is finished.
- splice(LE, RHS, RI, RE);
-}
-
-template <class T, class... Options>
-template <class Compare>
-void simple_ilist<T, Options...>::sort(Compare comp) {
- // Vacuously sorted.
- if (empty() || std::next(begin()) == end())
- return;
-
- // Split the list in the middle.
- iterator Center = begin(), End = begin();
- while (End != end() && ++End != end()) {
- ++Center;
- ++End;
- }
- simple_ilist RHS;
- RHS.splice(RHS.end(), *this, Center, end());
-
- // Sort the sublists and merge back together.
- sort(comp);
- RHS.sort(comp);
- merge(RHS, comp);
-}
-
-} // end namespace llvm
-
-#endif // LLVM_ADT_SIMPLE_ILIST_H
diff --git a/src/3rdparty/llvm/include/llvm/Demangle/Compiler.h b/src/3rdparty/llvm/include/llvm/Demangle/Compiler.h
deleted file mode 100644
index 963482c64f..0000000000
--- a/src/3rdparty/llvm/include/llvm/Demangle/Compiler.h
+++ /dev/null
@@ -1,524 +0,0 @@
-//===-- llvm/Demangle/Compiler.h - Compiler abstraction support -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines several macros, based on the current compiler. This allows
-// use of compiler-specific features in a way that remains portable.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_COMPILER_H
-#define LLVM_SUPPORT_COMPILER_H
-
-//#include "llvm/Config/llvm-config.h"
-
-#if defined(_MSC_VER)
-#include <sal.h>
-#endif
-
-#ifndef __has_feature
-# define __has_feature(x) 0
-#endif
-
-#ifndef __has_extension
-# define __has_extension(x) 0
-#endif
-
-#ifndef __has_attribute
-# define __has_attribute(x) 0
-#endif
-
-#ifndef __has_cpp_attribute
-# define __has_cpp_attribute(x) 0
-#endif
-
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/// \macro LLVM_GNUC_PREREQ
-/// \brief Extend the default __GNUC_PREREQ even if glibc's features.h isn't
-/// available.
-#ifndef LLVM_GNUC_PREREQ
-# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
-# define LLVM_GNUC_PREREQ(maj, min, patch) \
- ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
- ((maj) << 20) + ((min) << 10) + (patch))
-# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
-# define LLVM_GNUC_PREREQ(maj, min, patch) \
- ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
-# else
-# define LLVM_GNUC_PREREQ(maj, min, patch) 0
-# endif
-#endif
-
-/// \macro LLVM_MSC_PREREQ
-/// \brief Is the compiler MSVC of at least the specified version?
-/// The common \param version values to check for are:
-/// * 1900: Microsoft Visual Studio 2015 / 14.0
-#ifdef _MSC_VER
-#define LLVM_MSC_PREREQ(version) (_MSC_VER >= (version))
-
-// We require at least MSVC 2015.
-#if !LLVM_MSC_PREREQ(1900)
-#error LLVM requires at least MSVC 2015.
-#endif
-
-#else
-#define LLVM_MSC_PREREQ(version) 0
-#endif
-
-/// \brief Does the compiler support ref-qualifiers for *this?
-///
-/// Sadly, this is separate from just rvalue reference support because GCC
-/// and MSVC implemented this later than everything else.
-#if __has_feature(cxx_rvalue_references) || LLVM_GNUC_PREREQ(4, 8, 1)
-#define LLVM_HAS_RVALUE_REFERENCE_THIS 1
-#else
-#define LLVM_HAS_RVALUE_REFERENCE_THIS 0
-#endif
-
-/// Expands to '&' if ref-qualifiers for *this are supported.
-///
-/// This can be used to provide lvalue/rvalue overrides of member functions.
-/// The rvalue override should be guarded by LLVM_HAS_RVALUE_REFERENCE_THIS
-#if LLVM_HAS_RVALUE_REFERENCE_THIS
-#define LLVM_LVALUE_FUNCTION &
-#else
-#define LLVM_LVALUE_FUNCTION
-#endif
-
-/// LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked
-/// into a shared library, then the class should be private to the library and
-/// not accessible from outside it. Can also be used to mark variables and
-/// functions, making them private to any shared library they are linked into.
-/// On PE/COFF targets, library visibility is the default, so this isn't needed.
-#if (__has_attribute(visibility) || LLVM_GNUC_PREREQ(4, 0, 0)) && \
- !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(LLVM_ON_WIN32)
-#define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
-#else
-#define LLVM_LIBRARY_VISIBILITY
-#endif
-
-#if defined(__GNUC__)
-#define LLVM_PREFETCH(addr, rw, locality) __builtin_prefetch(addr, rw, locality)
-#else
-#define LLVM_PREFETCH(addr, rw, locality)
-#endif
-
-#if __has_attribute(used) || LLVM_GNUC_PREREQ(3, 1, 0)
-#define LLVM_ATTRIBUTE_USED __attribute__((__used__))
-#else
-#define LLVM_ATTRIBUTE_USED
-#endif
-
-/// LLVM_NODISCARD - Warn if a type or return value is discarded.
-#if __cplusplus > 201402L && __has_cpp_attribute(nodiscard)
-#define LLVM_NODISCARD [[nodiscard]]
-#elif !__cplusplus
-// Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious
-// error when __has_cpp_attribute is given a scoped attribute in C mode.
-#define LLVM_NODISCARD
-#elif __has_cpp_attribute(clang::warn_unused_result)
-#define LLVM_NODISCARD [[clang::warn_unused_result]]
-#else
-#define LLVM_NODISCARD
-#endif
-
-// Some compilers warn about unused functions. When a function is sometimes
-// used or not depending on build settings (e.g. a function only called from
-// within "assert"), this attribute can be used to suppress such warnings.
-//
-// However, it shouldn't be used for unused *variables*, as those have a much
-// more portable solution:
-// (void)unused_var_name;
-// Prefer cast-to-void wherever it is sufficient.
-#if __has_attribute(unused) || LLVM_GNUC_PREREQ(3, 1, 0)
-#define LLVM_ATTRIBUTE_UNUSED __attribute__((__unused__))
-#else
-#define LLVM_ATTRIBUTE_UNUSED
-#endif
-
-// FIXME: Provide this for PE/COFF targets.
-#if (__has_attribute(weak) || LLVM_GNUC_PREREQ(4, 0, 0)) && \
- (!defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(LLVM_ON_WIN32))
-#define LLVM_ATTRIBUTE_WEAK __attribute__((__weak__))
-#else
-#define LLVM_ATTRIBUTE_WEAK
-#endif
-
-// Prior to clang 3.2, clang did not accept any spelling of
-// __has_attribute(const), so assume it is supported.
-#if defined(__clang__) || defined(__GNUC__)
-// aka 'CONST' but following LLVM Conventions.
-#define LLVM_READNONE __attribute__((__const__))
-#else
-#define LLVM_READNONE
-#endif
-
-#if __has_attribute(pure) || defined(__GNUC__)
-// aka 'PURE' but following LLVM Conventions.
-#define LLVM_READONLY __attribute__((__pure__))
-#else
-#define LLVM_READONLY
-#endif
-
-#if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0)
-#define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
-#define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
-#else
-#define LLVM_LIKELY(EXPR) (EXPR)
-#define LLVM_UNLIKELY(EXPR) (EXPR)
-#endif
-
-/// LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so,
-/// mark a method "not for inlining".
-#if __has_attribute(noinline) || LLVM_GNUC_PREREQ(3, 4, 0)
-#define LLVM_ATTRIBUTE_NOINLINE __attribute__((noinline))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_NOINLINE __declspec(noinline)
-#else
-#define LLVM_ATTRIBUTE_NOINLINE
-#endif
-
-/// LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do
-/// so, mark a method "always inline" because it is performance sensitive. GCC
-/// 3.4 supported this but is buggy in various cases and produces unimplemented
-/// errors, just use it in GCC 4.0 and later.
-#if __has_attribute(always_inline) || LLVM_GNUC_PREREQ(4, 0, 0)
-#define LLVM_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline
-#else
-#define LLVM_ATTRIBUTE_ALWAYS_INLINE
-#endif
-
-#ifdef __GNUC__
-#define LLVM_ATTRIBUTE_NORETURN __attribute__((noreturn))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_NORETURN __declspec(noreturn)
-#else
-#define LLVM_ATTRIBUTE_NORETURN
-#endif
-
-#if __has_attribute(returns_nonnull) || LLVM_GNUC_PREREQ(4, 9, 0)
-#define LLVM_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_RETURNS_NONNULL _Ret_notnull_
-#else
-#define LLVM_ATTRIBUTE_RETURNS_NONNULL
-#endif
-
-/// \macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a
-/// pointer that does not alias any other valid pointer.
-#ifdef __GNUC__
-#define LLVM_ATTRIBUTE_RETURNS_NOALIAS __attribute__((__malloc__))
-#elif defined(_MSC_VER)
-#define LLVM_ATTRIBUTE_RETURNS_NOALIAS __declspec(restrict)
-#else
-#define LLVM_ATTRIBUTE_RETURNS_NOALIAS
-#endif
-
-/// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
-#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
-#define LLVM_FALLTHROUGH [[fallthrough]]
-#elif __has_cpp_attribute(gnu::fallthrough)
-#define LLVM_FALLTHROUGH [[gnu::fallthrough]]
-#elif !__cplusplus
-// Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious
-// error when __has_cpp_attribute is given a scoped attribute in C mode.
-#define LLVM_FALLTHROUGH
-#elif __has_cpp_attribute(clang::fallthrough)
-#define LLVM_FALLTHROUGH [[clang::fallthrough]]
-#else
-#define LLVM_FALLTHROUGH
-#endif
-
-/// LLVM_EXTENSION - Support compilers where we have a keyword to suppress
-/// pedantic diagnostics.
-#ifdef __GNUC__
-#define LLVM_EXTENSION __extension__
-#else
-#define LLVM_EXTENSION
-#endif
-
-// LLVM_ATTRIBUTE_DEPRECATED(decl, "message")
-#if __has_feature(attribute_deprecated_with_message)
-# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
- decl __attribute__((deprecated(message)))
-#elif defined(__GNUC__)
-# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
- decl __attribute__((deprecated))
-#elif defined(_MSC_VER)
-# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
- __declspec(deprecated(message)) decl
-#else
-# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
- decl
-#endif
-
-/// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
-/// to an expression which states that it is undefined behavior for the
-/// compiler to reach this point. Otherwise is not defined.
-#if __has_builtin(__builtin_unreachable) || LLVM_GNUC_PREREQ(4, 5, 0)
-# define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
-#elif defined(_MSC_VER)
-# define LLVM_BUILTIN_UNREACHABLE __assume(false)
-#endif
-
-/// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression
-/// which causes the program to exit abnormally.
-#if __has_builtin(__builtin_trap) || LLVM_GNUC_PREREQ(4, 3, 0)
-# define LLVM_BUILTIN_TRAP __builtin_trap()
-#elif defined(_MSC_VER)
-// The __debugbreak intrinsic is supported by MSVC, does not require forward
-// declarations involving platform-specific typedefs (unlike RaiseException),
-// results in a call to vectored exception handlers, and encodes to a short
-// instruction that still causes the trapping behavior we want.
-# define LLVM_BUILTIN_TRAP __debugbreak()
-#else
-# define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0
-#endif
-
-/// LLVM_BUILTIN_DEBUGTRAP - On compilers which support it, expands to
-/// an expression which causes the program to break while running
-/// under a debugger.
-#if __has_builtin(__builtin_debugtrap)
-# define LLVM_BUILTIN_DEBUGTRAP __builtin_debugtrap()
-#elif defined(_MSC_VER)
-// The __debugbreak intrinsic is supported by MSVC and breaks while
-// running under the debugger, and also supports invoking a debugger
-// when the OS is configured appropriately.
-# define LLVM_BUILTIN_DEBUGTRAP __debugbreak()
-#else
-// Just continue execution when built with compilers that have no
-// support. This is a debugging aid and not intended to force the
-// program to abort if encountered.
-# define LLVM_BUILTIN_DEBUGTRAP
-#endif
-
-/// \macro LLVM_ASSUME_ALIGNED
-/// \brief Returns a pointer with an assumed alignment.
-#if __has_builtin(__builtin_assume_aligned) || LLVM_GNUC_PREREQ(4, 7, 0)
-# define LLVM_ASSUME_ALIGNED(p, a) __builtin_assume_aligned(p, a)
-#elif defined(LLVM_BUILTIN_UNREACHABLE)
-// As of today, clang does not support __builtin_assume_aligned.
-# define LLVM_ASSUME_ALIGNED(p, a) \
- (((uintptr_t(p) % (a)) == 0) ? (p) : (LLVM_BUILTIN_UNREACHABLE, (p)))
-#else
-# define LLVM_ASSUME_ALIGNED(p, a) (p)
-#endif
-
-/// \macro LLVM_ALIGNAS
-/// \brief Used to specify a minimum alignment for a structure or variable.
-#if __GNUC__ && !__has_feature(cxx_alignas) && !LLVM_GNUC_PREREQ(4, 8, 1)
-# define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
-#else
-# define LLVM_ALIGNAS(x) alignas(x)
-#endif
-
-/// \macro LLVM_PACKED
-/// \brief Used to specify a packed structure.
-/// LLVM_PACKED(
-/// struct A {
-/// int i;
-/// int j;
-/// int k;
-/// long long l;
-/// });
-///
-/// LLVM_PACKED_START
-/// struct B {
-/// int i;
-/// int j;
-/// int k;
-/// long long l;
-/// };
-/// LLVM_PACKED_END
-#ifdef _MSC_VER
-# define LLVM_PACKED(d) __pragma(pack(push, 1)) d __pragma(pack(pop))
-# define LLVM_PACKED_START __pragma(pack(push, 1))
-# define LLVM_PACKED_END __pragma(pack(pop))
-#else
-# define LLVM_PACKED(d) d __attribute__((packed))
-# define LLVM_PACKED_START _Pragma("pack(push, 1)")
-# define LLVM_PACKED_END _Pragma("pack(pop)")
-#endif
-
-/// \macro LLVM_PTR_SIZE
-/// \brief A constant integer equivalent to the value of sizeof(void*).
-/// Generally used in combination with LLVM_ALIGNAS or when doing computation in
-/// the preprocessor.
-#ifdef __SIZEOF_POINTER__
-# define LLVM_PTR_SIZE __SIZEOF_POINTER__
-#elif defined(_WIN64)
-# define LLVM_PTR_SIZE 8
-#elif defined(_WIN32)
-# define LLVM_PTR_SIZE 4
-#elif defined(_MSC_VER)
-# error "could not determine LLVM_PTR_SIZE as a constant int for MSVC"
-#else
-# define LLVM_PTR_SIZE sizeof(void *)
-#endif
-
-/// \macro LLVM_MEMORY_SANITIZER_BUILD
-/// \brief Whether LLVM itself is built with MemorySanitizer instrumentation.
-#if __has_feature(memory_sanitizer)
-# define LLVM_MEMORY_SANITIZER_BUILD 1
-# include <sanitizer/msan_interface.h>
-#else
-# define LLVM_MEMORY_SANITIZER_BUILD 0
-# define __msan_allocated_memory(p, size)
-# define __msan_unpoison(p, size)
-#endif
-
-/// \macro LLVM_ADDRESS_SANITIZER_BUILD
-/// \brief Whether LLVM itself is built with AddressSanitizer instrumentation.
-#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
-# define LLVM_ADDRESS_SANITIZER_BUILD 1
-# include <sanitizer/asan_interface.h>
-#else
-# define LLVM_ADDRESS_SANITIZER_BUILD 0
-# define __asan_poison_memory_region(p, size)
-# define __asan_unpoison_memory_region(p, size)
-#endif
-
-/// \macro LLVM_THREAD_SANITIZER_BUILD
-/// \brief Whether LLVM itself is built with ThreadSanitizer instrumentation.
-#if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
-# define LLVM_THREAD_SANITIZER_BUILD 1
-#else
-# define LLVM_THREAD_SANITIZER_BUILD 0
-#endif
-
-#if LLVM_THREAD_SANITIZER_BUILD
-// Thread Sanitizer is a tool that finds races in code.
-// See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations .
-// tsan detects these exact functions by name.
-#ifdef __cplusplus
-extern "C" {
-#endif
-void AnnotateHappensAfter(const char *file, int line, const volatile void *cv);
-void AnnotateHappensBefore(const char *file, int line, const volatile void *cv);
-void AnnotateIgnoreWritesBegin(const char *file, int line);
-void AnnotateIgnoreWritesEnd(const char *file, int line);
-#ifdef __cplusplus
-}
-#endif
-
-// This marker is used to define a happens-before arc. The race detector will
-// infer an arc from the begin to the end when they share the same pointer
-// argument.
-# define TsanHappensBefore(cv) AnnotateHappensBefore(__FILE__, __LINE__, cv)
-
-// This marker defines the destination of a happens-before arc.
-# define TsanHappensAfter(cv) AnnotateHappensAfter(__FILE__, __LINE__, cv)
-
-// Ignore any races on writes between here and the next TsanIgnoreWritesEnd.
-# define TsanIgnoreWritesBegin() AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
-
-// Resume checking for racy writes.
-# define TsanIgnoreWritesEnd() AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
-#else
-# define TsanHappensBefore(cv)
-# define TsanHappensAfter(cv)
-# define TsanIgnoreWritesBegin()
-# define TsanIgnoreWritesEnd()
-#endif
-
-/// \macro LLVM_NO_SANITIZE
-/// \brief Disable a particular sanitizer for a function.
-#if __has_attribute(no_sanitize)
-#define LLVM_NO_SANITIZE(KIND) __attribute__((no_sanitize(KIND)))
-#else
-#define LLVM_NO_SANITIZE(KIND)
-#endif
-
-/// \brief Mark debug helper function definitions like dump() that should not be
-/// stripped from debug builds.
-/// Note that you should also surround dump() functions with
-/// `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` so they do always
-/// get stripped in release builds.
-// FIXME: Move this to a private config.h as it's not usable in public headers.
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
-#else
-#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE
-#endif
-
-/// \macro LLVM_PRETTY_FUNCTION
-/// \brief Gets a user-friendly looking function signature for the current scope
-/// using the best available method on each platform. The exact format of the
-/// resulting string is implementation specific and non-portable, so this should
-/// only be used, for example, for logging or diagnostics.
-#if defined(_MSC_VER)
-#define LLVM_PRETTY_FUNCTION __FUNCSIG__
-#elif defined(__GNUC__) || defined(__clang__)
-#define LLVM_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#else
-#define LLVM_PRETTY_FUNCTION __func__
-#endif
-
-/// \macro LLVM_THREAD_LOCAL
-/// \brief A thread-local storage specifier which can be used with globals,
-/// extern globals, and static globals.
-///
-/// This is essentially an extremely restricted analog to C++11's thread_local
-/// support, and uses that when available. However, it falls back on
-/// platform-specific or vendor-provided extensions when necessary. These
-/// extensions don't support many of the C++11 thread_local's features. You
-/// should only use this for PODs that you can statically initialize to
-/// some constant value. In almost all circumstances this is most appropriate
-/// for use with a pointer, integer, or small aggregation of pointers and
-/// integers.
-#if LLVM_ENABLE_THREADS
-#if __has_feature(cxx_thread_local)
-#define LLVM_THREAD_LOCAL thread_local
-#elif defined(_MSC_VER)
-// MSVC supports this with a __declspec.
-#define LLVM_THREAD_LOCAL __declspec(thread)
-#else
-// Clang, GCC, and other compatible compilers used __thread prior to C++11 and
-// we only need the restricted functionality that provides.
-#define LLVM_THREAD_LOCAL __thread
-#endif
-#else // !LLVM_ENABLE_THREADS
-// If threading is disabled entirely, this compiles to nothing and you get
-// a normal global variable.
-#define LLVM_THREAD_LOCAL
-#endif
-
-/// \macro LLVM_ENABLE_EXCEPTIONS
-/// \brief Whether LLVM is built with exception support.
-#if __has_feature(cxx_exceptions)
-#define LLVM_ENABLE_EXCEPTIONS 1
-#elif defined(__GNUC__) && defined(__EXCEPTIONS)
-#define LLVM_ENABLE_EXCEPTIONS 1
-#elif defined(_MSC_VER) && defined(_CPPUNWIND)
-#define LLVM_ENABLE_EXCEPTIONS 1
-#endif
-
-/// \macro LLVM_PLUGIN_IMPORT
-/// \brief Used to import the well-known entry point for registering loaded pass
-/// plugins
-#ifdef WIN32
-#define LLVM_PLUGIN_IMPORT __declspec(dllimport)
-#else
-#define LLVM_PLUGIN_IMPORT
-#endif
-
-/// \macro LLVM_PLUGIN_EXPORT
-/// \brief Used to export the well-known entry point for registering loaded pass
-/// plugins
-#ifdef WIN32
-#define LLVM_PLUGIN_EXPORT __declspec(dllexport)
-#else
-#define LLVM_PLUGIN_EXPORT
-#endif
-
-#endif
diff --git a/src/3rdparty/llvm/include/llvm/Support/Compiler.h b/src/3rdparty/llvm/include/llvm/Support/Compiler.h
deleted file mode 100644
index 43a96e49ce..0000000000
--- a/src/3rdparty/llvm/include/llvm/Support/Compiler.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Due to layering constraints (Support depends on Demangler) this is a thin
-// wrapper around the implementation that lives in llvm-c, though most clients
-// can/should think of this as being provided by Support for simplicity (not
-// many clients are aware of their dependency on Demangler/it's a weird place to
-// own this - but didn't seem to justify splitting Support into "lower support"
-// and "upper support").
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Demangle/Compiler.h"
diff --git a/src/3rdparty/llvm/include/llvm/Support/DataTypes.h b/src/3rdparty/llvm/include/llvm/Support/DataTypes.h
deleted file mode 100644
index ad60a5b3f3..0000000000
--- a/src/3rdparty/llvm/include/llvm/Support/DataTypes.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- llvm/Support/DataTypes.h - Define fixed size types ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Due to layering constraints (Support depends on llvm-c) this is a thin
-// wrapper around the implementation that lives in llvm-c, though most clients
-// can/should think of this as being provided by Support for simplicity (not
-// many clients are aware of their dependency on llvm-c).
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm-c/DataTypes.h"
diff --git a/src/3rdparty/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/src/3rdparty/llvm/include/llvm/Support/PointerLikeTypeTraits.h
deleted file mode 100644
index 794230d606..0000000000
--- a/src/3rdparty/llvm/include/llvm/Support/PointerLikeTypeTraits.h
+++ /dev/null
@@ -1,116 +0,0 @@
-//===- llvm/Support/PointerLikeTypeTraits.h - Pointer Traits ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the PointerLikeTypeTraits class. This allows data
-// structures to reason about pointers and other things that are pointer sized.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
-#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
-
-#include "llvm/Support/DataTypes.h"
-#include <type_traits>
-
-namespace llvm {
-
-/// A traits type that is used to handle pointer types and things that are just
-/// wrappers for pointers as a uniform entity.
-template <typename T> struct PointerLikeTypeTraits;
-
-namespace detail {
-/// A tiny meta function to compute the log2 of a compile time constant.
-template <size_t N>
-struct ConstantLog2
- : std::integral_constant<size_t, ConstantLog2<N / 2>::value + 1> {};
-template <> struct ConstantLog2<1> : std::integral_constant<size_t, 0> {};
-
-// Provide a trait to check if T is pointer-like.
-template <typename T, typename U = void> struct HasPointerLikeTypeTraits {
- static const bool value = false;
-};
-
-// sizeof(T) is valid only for a complete T.
-template <typename T> struct HasPointerLikeTypeTraits<
- T, decltype((sizeof(PointerLikeTypeTraits<T>) + sizeof(T)), void())> {
- static const bool value = true;
-};
-
-template <typename T> struct IsPointerLike {
- static const bool value = HasPointerLikeTypeTraits<T>::value;
-};
-
-template <typename T> struct IsPointerLike<T *> {
- static const bool value = true;
-};
-} // namespace detail
-
-// Provide PointerLikeTypeTraits for non-cvr pointers.
-template <typename T> struct PointerLikeTypeTraits<T *> {
- static inline void *getAsVoidPointer(T *P) { return P; }
- static inline T *getFromVoidPointer(void *P) { return static_cast<T *>(P); }
-
- enum { NumLowBitsAvailable = detail::ConstantLog2<alignof(T)>::value };
-};
-
-template <> struct PointerLikeTypeTraits<void *> {
- static inline void *getAsVoidPointer(void *P) { return P; }
- static inline void *getFromVoidPointer(void *P) { return P; }
-
- /// Note, we assume here that void* is related to raw malloc'ed memory and
- /// that malloc returns objects at least 4-byte aligned. However, this may be
- /// wrong, or pointers may be from something other than malloc. In this case,
- /// you should specify a real typed pointer or avoid this template.
- ///
- /// All clients should use assertions to do a run-time check to ensure that
- /// this is actually true.
- enum { NumLowBitsAvailable = 2 };
-};
-
-// Provide PointerLikeTypeTraits for const things.
-template <typename T> struct PointerLikeTypeTraits<const T> {
- typedef PointerLikeTypeTraits<T> NonConst;
-
- static inline const void *getAsVoidPointer(const T P) {
- return NonConst::getAsVoidPointer(P);
- }
- static inline const T getFromVoidPointer(const void *P) {
- return NonConst::getFromVoidPointer(const_cast<void *>(P));
- }
- enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
-};
-
-// Provide PointerLikeTypeTraits for const pointers.
-template <typename T> struct PointerLikeTypeTraits<const T *> {
- typedef PointerLikeTypeTraits<T *> NonConst;
-
- static inline const void *getAsVoidPointer(const T *P) {
- return NonConst::getAsVoidPointer(const_cast<T *>(P));
- }
- static inline const T *getFromVoidPointer(const void *P) {
- return NonConst::getFromVoidPointer(const_cast<void *>(P));
- }
- enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
-};
-
-// Provide PointerLikeTypeTraits for uintptr_t.
-template <> struct PointerLikeTypeTraits<uintptr_t> {
- static inline void *getAsVoidPointer(uintptr_t P) {
- return reinterpret_cast<void *>(P);
- }
- static inline uintptr_t getFromVoidPointer(void *P) {
- return reinterpret_cast<uintptr_t>(P);
- }
- // No bits are available!
- enum { NumLowBitsAvailable = 0 };
-};
-
-} // end namespace llvm
-
-#endif
diff --git a/src/3rdparty/llvm/llvm.pri b/src/3rdparty/llvm/llvm.pri
deleted file mode 100644
index 6b3b0689ec..0000000000
--- a/src/3rdparty/llvm/llvm.pri
+++ /dev/null
@@ -1,18 +0,0 @@
-INCLUDEPATH += $$PWD/include
-
-HEADERS += \
- $$PWD/include/llvm/ADT/ilist_node.h \
- $$PWD/include/llvm/ADT/iterator_range.h \
- $$PWD/include/llvm/ADT/simple_ilist.h \
- $$PWD/include/llvm/ADT/ilist_base.h \
- $$PWD/include/llvm/ADT/ilist_node_options.h \
- $$PWD/include/llvm/ADT/ilist_iterator.h \
- $$PWD/include/llvm/ADT/ilist_node_base.h \
- $$PWD/include/llvm/ADT/PointerIntPair.h \
- $$PWD/include/llvm/ADT/iterator.h \
- $$PWD/include/llvm/ADT/ilist.h \
- $$PWD/include/llvm/Demangle/Compiler.h \
- $$PWD/include/llvm/Support/Compiler.h \
- $$PWD/include/llvm/Support/PointerLikeTypeTraits.h \
- $$PWD/include/llvm/Support/DataTypes.h \
- $$PWD/include/llvm-c/DataTypes.h
diff --git a/src/3rdparty/llvm/qt_attribution.json b/src/3rdparty/llvm/qt_attribution.json
deleted file mode 100644
index 5924f16ac3..0000000000
--- a/src/3rdparty/llvm/qt_attribution.json
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "Id": "llvm-adt",
- "Name": "LLVM: ADT",
- "QDocModule": "qtqml",
- "QtUsage": "An intrusively linked list, used in the tracing JIT to hold lists of instructions",
-
- "Path": "src/3rdparty/llvm",
- "License": "UIUC 3-clause \"New\" or \"Revised\" License",
- "LicenseId": "BSD-3-Clause",
- "LicenseFile": "LICENSE.TXT",
- "Copyright": "Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign."
- }
-]
diff --git a/src/3rdparty/masm/assembler/LinkBuffer.h b/src/3rdparty/masm/assembler/LinkBuffer.h
index 8e9a3d9c7a..ba57564a1d 100644
--- a/src/3rdparty/masm/assembler/LinkBuffer.h
+++ b/src/3rdparty/masm/assembler/LinkBuffer.h
@@ -209,9 +209,9 @@ public:
// complete generation of the code. Alternatively, call
// finalizeCodeWithoutDisassembly() directly if you have your own way of
// displaying disassembly.
-
+
inline CodeRef finalizeCodeWithoutDisassembly();
- inline CodeRef finalizeCodeWithDisassembly(const char *jitKind, const char* format, ...) WTF_ATTRIBUTE_PRINTF(3, 4);
+ inline CodeRef finalizeCodeWithDisassembly(const char *jitKind, const char* func);
CodePtr trampolineAt(Label label)
{
@@ -267,9 +267,9 @@ protected:
#endif
};
-#define FINALIZE_CODE_IF(condition, linkBufferReference, jitKind, dataLogFArgumentsForHeading) \
+#define FINALIZE_CODE_IF(condition, linkBufferReference, jitKind, func) \
(UNLIKELY((condition)) \
- ? ((linkBufferReference).finalizeCodeWithDisassembly (jitKind, dataLogFArgumentsForHeading)) \
+ ? ((linkBufferReference).finalizeCodeWithDisassembly (jitKind, func)) \
: (linkBufferReference).finalizeCodeWithoutDisassembly())
// Use this to finalize code, like so:
@@ -288,11 +288,11 @@ protected:
// Note that the dataLogFArgumentsForHeading are only evaluated when showDisassembly
// is true, so you can hide expensive disassembly-only computations inside there.
-#define FINALIZE_CODE(linkBufferReference, jitKind, dataLogFArgumentsForHeading) \
- FINALIZE_CODE_IF(Options::showDisassembly(), linkBufferReference, jitKind, dataLogFArgumentsForHeading)
+#define FINALIZE_CODE(linkBufferReference, jitKind, func) \
+ FINALIZE_CODE_IF(Options::showDisassembly(), linkBufferReference, jitKind, func)
-#define FINALIZE_DFG_CODE(linkBufferReference, jitKind, dataLogFArgumentsForHeading) \
- FINALIZE_CODE_IF((Options::showDisassembly() || Options::showDFGDisassembly()), linkBufferReference, jitKind, dataLogFArgumentsForHeading)
+#define FINALIZE_DFG_CODE(linkBufferReference, jitKind, func) \
+ FINALIZE_CODE_IF((Options::showDisassembly() || Options::showDFGDisassembly()), linkBufferReference, jitKind, func)
template <typename MacroAssembler, template <typename T> class ExecutableOffsetCalculator>
@@ -304,24 +304,19 @@ inline typename LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::Code
}
template <typename MacroAssembler, template <typename T> class ExecutableOffsetCalculator>
-inline typename LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::CodeRef LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::finalizeCodeWithDisassembly(const char *jitKind, const char* format, ...)
+inline typename LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::CodeRef LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::finalizeCodeWithDisassembly(const char *jitKind, const char* func)
{
ASSERT(Options::showDisassembly() || Options::showDFGDisassembly());
CodeRef result = finalizeCodeWithoutDisassembly();
- dataLogF("Generated %s code for ", jitKind);
- va_list argList;
- va_start(argList, format);
- WTF::dataLogFV(format, argList);
- va_end(argList);
- dataLogF(":\n");
+ dataLogF("Generated %s code for function %s:", jitKind, func);
dataLogF(
#if OS(WINDOWS)
- " Code at [0x%p, 0x%p):\n",
+ " Code at [0x%p, 0x%p):",
#else
- " Code at [%p, %p):\n",
+ " Code at [%p, %p):",
#endif
result.code().executableAddress(), static_cast<char*>(result.code().executableAddress()) + result.size());
disassemble(result.code(), m_size, " ", WTF::dataFile());
diff --git a/src/3rdparty/masm/disassembler/Disassembler.cpp b/src/3rdparty/masm/disassembler/Disassembler.cpp
index 3fed2cdab8..50fe2e23d5 100644
--- a/src/3rdparty/masm/disassembler/Disassembler.cpp
+++ b/src/3rdparty/masm/disassembler/Disassembler.cpp
@@ -36,7 +36,7 @@ void disassemble(const MacroAssemblerCodePtr& codePtr, size_t size, const char*
if (tryToDisassemble(codePtr, size, prefix, out))
return;
- out.printf("%sdisassembly not available for range %p...%p\n", prefix, codePtr.executableAddress(), static_cast<char*>(codePtr.executableAddress()) + size);
+ out.printf("%sdisassembly not available for range %p...%p", prefix, codePtr.executableAddress(), static_cast<char*>(codePtr.executableAddress()) + size);
}
} // namespace JSC
diff --git a/src/3rdparty/masm/stubs/wtf/Optional.h b/src/3rdparty/masm/stubs/wtf/Optional.h
index 602dbc1b43..e0fd4421a9 100644
--- a/src/3rdparty/masm/stubs/wtf/Optional.h
+++ b/src/3rdparty/masm/stubs/wtf/Optional.h
@@ -43,7 +43,7 @@
#include <QtQml/private/qtqmlglobal_p.h>
#include <memory>
-#if __cplusplus > 201402L && QT_HAS_INCLUDE(<optional>)
+#if __cplusplus > 201402L && __has_include(<optional>)
#include <optional>
#else
diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro
index 54ef107e45..8eaf9de6b9 100644
--- a/src/imports/folderlistmodel/folderlistmodel.pro
+++ b/src/imports/folderlistmodel/folderlistmodel.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmlfolderlistmodelplugin
TARGETPATH = Qt/labs/folderlistmodel
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
QT = core-private qml-private
@@ -11,4 +11,5 @@ HEADERS += qquickfolderlistmodel.h \
fileproperty_p.h \
fileinfothread_p.h
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index cbe4f9353d..28837655ef 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -58,10 +58,6 @@ public:
// Major version 1 only has a single revision, 0.
qmlRegisterType<QQuickFolderListModel>(uri, 1, 0, "FolderListModel");
-
- qmlRegisterTypesAndRevisions<QQuickFolderListModel>(uri, 2);
-
- qmlRegisterModule(uri, 2, 15);
}
};
//![class decl]
diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes
deleted file mode 100644
index 7c53c99665..0000000000
--- a/src/imports/folderlistmodel/plugins.qmltypes
+++ /dev/null
@@ -1,351 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.folderlistmodel 2.14'
-
-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: [
- "Qt.labs.folderlistmodel/FolderListModel 1.0",
- "Qt.labs.folderlistmodel/FolderListModel 2.0",
- "Qt.labs.folderlistmodel/FolderListModel 2.1",
- "Qt.labs.folderlistmodel/FolderListModel 2.11",
- "Qt.labs.folderlistmodel/FolderListModel 2.12",
- "Qt.labs.folderlistmodel/FolderListModel 2.2"
- ]
- exportMetaObjectRevisions: [0, 0, 1, 11, 12, 2]
- Enum {
- name: "SortField"
- values: {
- "Unsorted": 0,
- "Name": 1,
- "Time": 2,
- "Size": 3,
- "Type": 4
- }
- }
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2
- }
- }
- Property { name: "folder"; type: "QUrl" }
- Property { name: "rootFolder"; type: "QUrl" }
- Property { name: "parentFolder"; type: "QUrl"; isReadonly: true }
- Property { name: "nameFilters"; type: "QStringList" }
- Property { name: "sortField"; type: "SortField" }
- Property { name: "sortReversed"; type: "bool" }
- Property { name: "showFiles"; revision: 1; type: "bool" }
- Property { name: "showDirs"; type: "bool" }
- Property { name: "showDirsFirst"; type: "bool" }
- Property { name: "showDotAndDotDot"; type: "bool" }
- Property { name: "showHidden"; revision: 1; type: "bool" }
- Property { name: "showOnlyReadable"; type: "bool" }
- Property { name: "caseSensitive"; revision: 2; type: "bool" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "status"; revision: 11; type: "Status"; isReadonly: true }
- Property { name: "sortCaseSensitive"; revision: 12; type: "bool" }
- Signal { name: "rowCountChanged" }
- Signal { name: "countChanged"; revision: 1 }
- Signal { name: "statusChanged"; revision: 11 }
- Method {
- name: "isFolder"
- type: "bool"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "get"
- type: "QVariant"
- Parameter { name: "idx"; type: "int" }
- Parameter { name: "property"; type: "string" }
- }
- Method {
- name: "indexOf"
- type: "int"
- Parameter { name: "file"; type: "QUrl" }
- }
- }
-}
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index f5acfd86b7..26c6d4032f 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -107,7 +107,7 @@ void QQuickFolderListModelPrivate::updateSorting()
{
Q_Q(QQuickFolderListModel);
- QDir::SortFlags flags = nullptr;
+ QDir::SortFlags flags;
switch (sortField) {
case QQuickFolderListModel::Unsorted:
diff --git a/src/imports/labsanimation/labsanimation.pro b/src/imports/labsanimation/labsanimation.pro
index 128bc28ddb..f64ae775c6 100644
--- a/src/imports/labsanimation/labsanimation.pro
+++ b/src/imports/labsanimation/labsanimation.pro
@@ -12,4 +12,5 @@ HEADERS += \
QT = qml-private quick-private
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/labsanimation/plugin.cpp b/src/imports/labsanimation/plugin.cpp
index a74a30663a..bd732a6aba 100644
--- a/src/imports/labsanimation/plugin.cpp
+++ b/src/imports/labsanimation/plugin.cpp
@@ -61,18 +61,12 @@ QT_BEGIN_NAMESPACE
*/
//![class decl]
-class QtLabsAnimationPlugin : public QQmlExtensionPlugin
+class QtLabsAnimationPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.animation"));
- qmlRegisterTypesAndRevisions<QQuickBoundaryRule>(uri, 1);
- qmlRegisterModule(uri, 1, 0);
- }
+ QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
};
//![class decl]
diff --git a/src/imports/labsanimation/plugins.qmltypes b/src/imports/labsanimation/plugins.qmltypes
deleted file mode 100644
index 2ecc5e6f5d..0000000000
--- a/src/imports/labsanimation/plugins.qmltypes
+++ /dev/null
@@ -1,36 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.animation 1.0'
-
-Module {
- dependencies: []
- Component {
- name: "QQuickBoundaryRule"
- prototype: "QObject"
- exports: ["Qt.labs.animation/BoundaryRule 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "OvershootFilter"
- values: {
- "None": 0,
- "Peak": 1
- }
- }
- Property { name: "enabled"; type: "bool" }
- Property { name: "minimum"; type: "double" }
- Property { name: "minimumOvershoot"; type: "double" }
- Property { name: "maximum"; type: "double" }
- Property { name: "maximumOvershoot"; type: "double" }
- Property { name: "overshootScale"; type: "double" }
- Property { name: "currentOvershoot"; type: "double"; isReadonly: true }
- Property { name: "peakOvershoot"; type: "double"; isReadonly: true }
- Property { name: "overshootFilter"; type: "OvershootFilter" }
- Property { name: "easing"; type: "QEasingCurve" }
- Property { name: "returnDuration"; type: "int" }
- Method { name: "returnToBounds"; type: "bool" }
- }
-}
diff --git a/src/imports/labsmodels/labsmodels.pro b/src/imports/labsmodels/labsmodels.pro
index c35e5f963d..13468348cb 100644
--- a/src/imports/labsmodels/labsmodels.pro
+++ b/src/imports/labsmodels/labsmodels.pro
@@ -26,4 +26,5 @@ qtConfig(qml-delegate-model) {
qqmldelegatecomponent_p.h
}
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/labsmodels/plugin.cpp b/src/imports/labsmodels/plugin.cpp
index f1d1dd20b0..feb4f3ba0a 100644
--- a/src/imports/labsmodels/plugin.cpp
+++ b/src/imports/labsmodels/plugin.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
\qmlmodule Qt.labs.qmlmodels 1.0
\title Qt QML Models experimental QML Types
\ingroup qmlmodules
- \brief Provides QML experimental types for data models
+ \brief Provides QML experimental types for data models.
\since 5.12
This QML module contains experimental QML types related to data models.
@@ -69,25 +69,12 @@ QT_BEGIN_NAMESPACE
*/
//![class decl]
-class QtQmlLabsModelsPlugin : public QQmlExtensionPlugin
+class QtQmlLabsModelsPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.qmlmodels"));
-
-#if QT_CONFIG(qml_delegate_model)
- qmlRegisterTypesAndRevisions<QQmlDelegateChooser, QQmlDelegateChoice>(uri, 1);
-#endif
-#if QT_CONFIG(qml_table_model)
- qmlRegisterTypesAndRevisions<QQmlTableModel, QQmlTableModelColumn>(uri, 1);
-#endif
-
- qmlRegisterModule(uri, 1, 0);
- }
+ QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
};
//![class decl]
diff --git a/src/imports/labsmodels/plugins.qmltypes b/src/imports/labsmodels/plugins.qmltypes
deleted file mode 100644
index f2a5752422..0000000000
--- a/src/imports/labsmodels/plugins.qmltypes
+++ /dev/null
@@ -1,414 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.qmlmodels 1.0'
-
-Module {
- dependencies: []
- 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: "QAbstractTableModel"; prototype: "QAbstractItemModel" }
- Component {
- name: "QQmlAbstractDelegateComponent"
- prototype: "QQmlComponent"
- exports: ["Qt.labs.qmlmodels/AbstractDelegateComponent 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Signal { name: "delegateChanged" }
- }
- Component {
- name: "QQmlDelegateChoice"
- defaultProperty: "delegate"
- prototype: "QObject"
- exports: ["Qt.labs.qmlmodels/DelegateChoice 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "roleValue"; type: "QVariant" }
- Property { name: "row"; type: "int" }
- Property { name: "index"; type: "int" }
- Property { name: "column"; type: "int" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "changed" }
- }
- Component {
- name: "QQmlDelegateChooser"
- defaultProperty: "choices"
- prototype: "QQmlAbstractDelegateComponent"
- exports: ["Qt.labs.qmlmodels/DelegateChooser 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "role"; type: "string" }
- Property { name: "choices"; type: "QQmlDelegateChoice"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQmlTableModel"
- defaultProperty: "columns"
- prototype: "QAbstractTableModel"
- exports: ["Qt.labs.qmlmodels/TableModel 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "columnCount"; type: "int"; isReadonly: true }
- Property { name: "rowCount"; type: "int"; isReadonly: true }
- Property { name: "rows"; type: "QVariant" }
- Property { name: "columns"; type: "QQmlTableModelColumn"; isList: true; isReadonly: true }
- Method {
- name: "appendRow"
- Parameter { name: "row"; type: "QVariant" }
- }
- Method { name: "clear" }
- Method {
- name: "getRow"
- type: "QVariant"
- Parameter { name: "rowIndex"; type: "int" }
- }
- Method {
- name: "insertRow"
- Parameter { name: "rowIndex"; type: "int" }
- Parameter { name: "row"; type: "QVariant" }
- }
- Method {
- name: "moveRow"
- Parameter { name: "fromRowIndex"; type: "int" }
- Parameter { name: "toRowIndex"; type: "int" }
- Parameter { name: "rows"; type: "int" }
- }
- Method {
- name: "moveRow"
- Parameter { name: "fromRowIndex"; type: "int" }
- Parameter { name: "toRowIndex"; type: "int" }
- }
- Method {
- name: "removeRow"
- Parameter { name: "rowIndex"; type: "int" }
- Parameter { name: "rows"; type: "int" }
- }
- Method {
- name: "removeRow"
- Parameter { name: "rowIndex"; type: "int" }
- }
- Method {
- name: "setRow"
- Parameter { name: "rowIndex"; type: "int" }
- Parameter { name: "row"; type: "QVariant" }
- }
- Method {
- name: "data"
- type: "QVariant"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "role"; type: "string" }
- }
- Method {
- name: "setData"
- type: "bool"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "role"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- }
- Component {
- name: "QQmlTableModelColumn"
- prototype: "QObject"
- exports: ["Qt.labs.qmlmodels/TableModelColumn 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "display"; type: "QJSValue" }
- Property { name: "setDisplay"; type: "QJSValue" }
- Property { name: "decoration"; type: "QJSValue" }
- Property { name: "setDecoration"; type: "QJSValue" }
- Property { name: "edit"; type: "QJSValue" }
- Property { name: "setEdit"; type: "QJSValue" }
- Property { name: "toolTip"; type: "QJSValue" }
- Property { name: "setToolTip"; type: "QJSValue" }
- Property { name: "statusTip"; type: "QJSValue" }
- Property { name: "setStatusTip"; type: "QJSValue" }
- Property { name: "whatsThis"; type: "QJSValue" }
- Property { name: "setWhatsThis"; type: "QJSValue" }
- Property { name: "font"; type: "QJSValue" }
- Property { name: "setFont"; type: "QJSValue" }
- Property { name: "textAlignment"; type: "QJSValue" }
- Property { name: "setTextAlignment"; type: "QJSValue" }
- Property { name: "background"; type: "QJSValue" }
- Property { name: "setBackground"; type: "QJSValue" }
- Property { name: "foreground"; type: "QJSValue" }
- Property { name: "setForeground"; type: "QJSValue" }
- Property { name: "checkState"; type: "QJSValue" }
- Property { name: "setCheckState"; type: "QJSValue" }
- Property { name: "accessibleText"; type: "QJSValue" }
- Property { name: "setAccessibleText"; type: "QJSValue" }
- Property { name: "accessibleDescription"; type: "QJSValue" }
- Property { name: "setAccessibleDescription"; type: "QJSValue" }
- Property { name: "sizeHint"; type: "QJSValue" }
- Property { name: "setSizeHint"; type: "QJSValue" }
- Signal { name: "indexChanged" }
- }
-}
diff --git a/src/imports/layouts/layouts.pro b/src/imports/layouts/layouts.pro
index addf396746..c52046094e 100644
--- a/src/imports/layouts/layouts.pro
+++ b/src/imports/layouts/layouts.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qquicklayoutsplugin
TARGETPATH = QtQuick/Layouts
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+IMPORT_VERSION = 1.15
QT *= qml-private quick-private gui-private core-private
@@ -19,4 +19,6 @@ HEADERS += \
qquickgridlayoutengine_p.h \
qquicklayoutstyleinfo_p.h
+CONFIG += qmltypes install_qmltypes
+
load(qml_plugin)
diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp
index 28592213a8..c302b79164 100644
--- a/src/imports/layouts/plugin.cpp
+++ b/src/imports/layouts/plugin.cpp
@@ -45,23 +45,14 @@
QT_BEGIN_NAMESPACE
//![class decl]
-class QtQuickLayoutsPlugin : public QQmlExtensionPlugin
+class QtQuickLayoutsPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent)
+ QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
{
}
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Layouts"));
-
- qmlRegisterTypesAndRevisions<QQuickRowLayout, QQuickColumnLayout, QQuickGridLayout,
- QQuickStackLayout, QQuickLayout, QQuickGridLayoutBase>(uri, 1);
-
- qmlRegisterModule(uri, 1, 15);
- }
};
//![class decl]
diff --git a/src/imports/layouts/plugins.qmltypes b/src/imports/layouts/plugins.qmltypes
deleted file mode 100644
index 4ebef4ac51..0000000000
--- a/src/imports/layouts/plugins.qmltypes
+++ /dev/null
@@ -1,131 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Layouts 1.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QQuickColumnLayout"
- defaultProperty: "data"
- prototype: "QQuickLinearLayout"
- exports: [
- "QtQuick.Layouts/ColumnLayout 1.0",
- "QtQuick.Layouts/ColumnLayout 1.1",
- "QtQuick.Layouts/ColumnLayout 1.11",
- "QtQuick.Layouts/ColumnLayout 1.4",
- "QtQuick.Layouts/ColumnLayout 1.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- }
- Component {
- name: "QQuickGridLayout"
- defaultProperty: "data"
- prototype: "QQuickGridLayoutBase"
- exports: [
- "QtQuick.Layouts/GridLayout 1.0",
- "QtQuick.Layouts/GridLayout 1.1",
- "QtQuick.Layouts/GridLayout 1.11",
- "QtQuick.Layouts/GridLayout 1.4",
- "QtQuick.Layouts/GridLayout 1.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Flow"
- values: {
- "LeftToRight": 0,
- "TopToBottom": 1
- }
- }
- Property { name: "columnSpacing"; type: "double" }
- Property { name: "rowSpacing"; type: "double" }
- Property { name: "columns"; type: "int" }
- Property { name: "rows"; type: "int" }
- Property { name: "flow"; type: "Flow" }
- }
- Component {
- name: "QQuickGridLayoutBase"
- defaultProperty: "data"
- prototype: "QQuickLayout"
- Property { name: "layoutDirection"; revision: 1; type: "Qt::LayoutDirection" }
- Signal { name: "layoutDirectionChanged"; revision: 1 }
- }
- Component {
- name: "QQuickLayout"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Layouts/Layout 1.0",
- "QtQuick.Layouts/Layout 1.1",
- "QtQuick.Layouts/Layout 1.11",
- "QtQuick.Layouts/Layout 1.4",
- "QtQuick.Layouts/Layout 1.7"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- attachedType: "QQuickLayoutAttached"
- }
- Component {
- name: "QQuickLayoutAttached"
- prototype: "QObject"
- Property { name: "minimumWidth"; type: "double" }
- Property { name: "minimumHeight"; type: "double" }
- Property { name: "preferredWidth"; type: "double" }
- Property { name: "preferredHeight"; type: "double" }
- Property { name: "maximumWidth"; type: "double" }
- Property { name: "maximumHeight"; type: "double" }
- Property { name: "fillHeight"; type: "bool" }
- Property { name: "fillWidth"; type: "bool" }
- Property { name: "row"; type: "int" }
- Property { name: "column"; type: "int" }
- Property { name: "rowSpan"; type: "int" }
- Property { name: "columnSpan"; type: "int" }
- Property { name: "alignment"; type: "Qt::Alignment" }
- Property { name: "margins"; type: "double" }
- Property { name: "leftMargin"; type: "double" }
- Property { name: "topMargin"; type: "double" }
- Property { name: "rightMargin"; type: "double" }
- Property { name: "bottomMargin"; type: "double" }
- }
- Component {
- name: "QQuickLinearLayout"
- defaultProperty: "data"
- prototype: "QQuickGridLayoutBase"
- Property { name: "spacing"; type: "double" }
- }
- Component {
- name: "QQuickRowLayout"
- defaultProperty: "data"
- prototype: "QQuickLinearLayout"
- exports: [
- "QtQuick.Layouts/RowLayout 1.0",
- "QtQuick.Layouts/RowLayout 1.1",
- "QtQuick.Layouts/RowLayout 1.11",
- "QtQuick.Layouts/RowLayout 1.4",
- "QtQuick.Layouts/RowLayout 1.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- }
- Component {
- name: "QQuickStackLayout"
- defaultProperty: "data"
- prototype: "QQuickLayout"
- exports: [
- "QtQuick.Layouts/StackLayout 1.11",
- "QtQuick.Layouts/StackLayout 1.3",
- "QtQuick.Layouts/StackLayout 1.4",
- "QtQuick.Layouts/StackLayout 1.7"
- ]
- exportMetaObjectRevisions: [11, 3, 4, 7]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "currentIndex"; type: "int" }
- Method {
- name: "itemAt"
- type: "QQuickItem*"
- Parameter { name: "index"; type: "int" }
- }
- }
-}
diff --git a/src/imports/layouts/qquickgridlayoutengine.cpp b/src/imports/layouts/qquickgridlayoutengine.cpp
index 6004bb92ca..5275d70c39 100644
--- a/src/imports/layouts/qquickgridlayoutengine.cpp
+++ b/src/imports/layouts/qquickgridlayoutengine.cpp
@@ -55,7 +55,7 @@ Qt::Alignment QQuickGridLayoutEngine::alignment(QQuickItem *quickItem) const
{
if (QGridLayoutItem *item = findLayoutItem(quickItem))
return item->alignment();
- return nullptr;
+ return {};
}
QT_END_NAMESPACE
diff --git a/src/imports/layouts/qquickgridlayoutengine_p.h b/src/imports/layouts/qquickgridlayoutengine_p.h
index 2810e2e5d0..c53be89477 100644
--- a/src/imports/layouts/qquickgridlayoutengine_p.h
+++ b/src/imports/layouts/qquickgridlayoutengine_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
class QQuickGridLayoutItem : public QGridLayoutItem {
public:
QQuickGridLayoutItem(QQuickItem *item, int row, int column,
- int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0)
+ int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = { })
: QGridLayoutItem(row, column, rowSpan, columnSpan, alignment), m_item(item), sizeHintCacheDirty(true), useFallbackToWidthOrHeight(true) {}
diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp
index 450cf26cea..1ca4056ba9 100644
--- a/src/imports/layouts/qquicklayout.cpp
+++ b/src/imports/layouts/qquicklayout.cpp
@@ -117,8 +117,7 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent)
m_isLeftMarginSet(false),
m_isTopMarginSet(false),
m_isRightMarginSet(false),
- m_isBottomMarginSet(false),
- m_alignment(nullptr)
+ m_isBottomMarginSet(false)
{
}
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp
index c6c9685ae2..344ea7237c 100644
--- a/src/imports/layouts/qquicklinearlayout.cpp
+++ b/src/imports/layouts/qquicklinearlayout.cpp
@@ -645,6 +645,7 @@ void QQuickGridLayout::insertLayoutItems()
int &nextColumn = nextCellPos[0];
int &nextRow = nextCellPos[1];
+ const QSize gridSize(columns(), rows());
const int flowOrientation = flow();
int &flowColumn = nextCellPos[flowOrientation];
int &flowRow = nextCellPos[1 - flowOrientation];
@@ -664,7 +665,7 @@ void QQuickGridLayout::insertLayoutItems()
if (shouldIgnoreItem(child, info, sizeHints))
continue;
- Qt::Alignment alignment = nullptr;
+ Qt::Alignment alignment;
int row = -1;
int column = -1;
int span[2] = {1,1};
@@ -677,8 +678,21 @@ void QQuickGridLayout::insertLayoutItems()
// the unspecified component of the cell position should default to 0
// The getters do this for us, as they will return 0 for an
// unset (or negative) value.
- row = info->row();
- column = info->column();
+ // In addition, if \a rows is less than Layout.row, treat Layout.row as if it was not set
+ // This will basically make it find the next available cell (potentially wrapping to
+ // the next line). Likewise for an invalid Layout.column
+
+ if (gridSize.height() >= 0 && row >= gridSize.height()) {
+ qmlWarning(child) << QString::fromLatin1("Layout: row (%1) should be less than the number of rows (%2)").arg(info->row()).arg(rows());
+ } else {
+ row = info->row();
+ }
+
+ if (gridSize.width() >= 0 && info->column() >= gridSize.width()) {
+ qmlWarning(child) << QString::fromLatin1("Layout: column (%1) should be less than the number of columns (%2)").arg(info->column()).arg(columns());
+ } else {
+ column = info->column();
+ }
}
rowSpan = info->rowSpan();
columnSpan = info->columnSpan();
@@ -840,7 +854,7 @@ void QQuickLinearLayout::insertLayoutItems()
if (shouldIgnoreItem(child, info, sizeHints))
continue;
- Qt::Alignment alignment = nullptr;
+ Qt::Alignment alignment;
if (info)
alignment = info->alignment();
diff --git a/src/imports/localstorage/localstorage.pro b/src/imports/localstorage/localstorage.pro
index 607a6cbbdd..d189808f49 100644
--- a/src/imports/localstorage/localstorage.pro
+++ b/src/imports/localstorage/localstorage.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmllocalstorageplugin
TARGETPATH = QtQuick/LocalStorage
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
QT = sql qml-private core-private
@@ -14,4 +14,5 @@ HEADERS += \
load(qml_plugin)
+CONFIG += qmltypes install_qmltypes
OTHER_FILES += localstorage.json
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 6366c51b47..ae9f37784d 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -44,22 +44,15 @@
QT_BEGIN_NAMESPACE
-class QQmlLocalStoragePlugin : public QQmlExtensionPlugin
+class QQmlLocalStoragePlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent)
+ QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
{
}
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.LocalStorage"));
- qmlRegisterTypesAndRevisions<QQuickLocalStorage>(uri, 2);
-
- qmlRegisterModule(uri, 2, 15);
- }
};
QT_END_NAMESPACE
diff --git a/src/imports/localstorage/plugins.qmltypes b/src/imports/localstorage/plugins.qmltypes
deleted file mode 100644
index 6ed334cc9d..0000000000
--- a/src/imports/localstorage/plugins.qmltypes
+++ /dev/null
@@ -1,23 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.LocalStorage 2.14'
-
-Module {
- dependencies: []
- Component {
- name: "QQuickLocalStorage"
- prototype: "QObject"
- exports: ["QtQuick.LocalStorage/LocalStorage 2.0"]
- isCreatable: false
- isSingleton: true
- exportMetaObjectRevisions: [0]
- Method {
- name: "openDatabaseSync"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- }
-}
diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro
index fd13b12401..0eb9958631 100644
--- a/src/imports/models/models.pro
+++ b/src/imports/models/models.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = modelsplugin
TARGETPATH = QtQml/Models.2
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp
index fd99f243b0..4aa9f27766 100644
--- a/src/imports/models/plugin.cpp
+++ b/src/imports/models/plugin.cpp
@@ -37,13 +37,17 @@
**
****************************************************************************/
+#include <QtQmlModels/private/qqmlobjectmodel_p.h>
+
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
-#include <private/qqmlmodelsmodule_p.h>
+#include <QtCore/qloggingcategory.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(qmlModelsPlugin, "qt.qmlModelsPlugin")
+
/*!
\qmlmodule QtQml.Models 2.\QtMinorVersion
\title Qt QML Models QML Types
@@ -59,25 +63,42 @@ QT_BEGIN_NAMESPACE
import QtQml.Models 2.\1
\endqml
- Note that QtQml.Models module started at version 2.1 to match the version
+ \note QtQml.Models module started at version 2.1 to match the version
of the parent module, \l{Qt QML}.
+
+ In addition, Qt.labs.qmlmodels provides experimental QML types for models.
+ To use these experimental types, import the module with the following line:
+
+ \qml
+ import Qt.labs.qmlmodels 1.0
+ \endqml
+
+ \section1 QML Types
+ \generatelist qmltypesbymodule QtQml.Models
+
+ \section1 Experimental QML Types
+ \generatelist qmltypesbymodule Qt.labs.qmlmodels
+
+ \noautolist
*/
//![class decl]
-class QtQmlModelsPlugin : public QQmlExtensionPlugin
+class QtQmlModelsPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
+ QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.Models"));
- QQmlModelsModule::defineModule();
-
- qmlRegisterModule(uri, 2, 15);
+ if (qmlModelsPlugin().isDebugEnabled()) {
+ // Superficial debug message that causes the dependency between QtQmlWorkerScript
+ // and the workerscript plugin to be retained.
+ // As qCDebug() can be a noop, retrieve the className in a separate step.
+ const QString className = QQmlObjectModel::staticMetaObject.className();
+ qCDebug(qmlModelsPlugin) << "Loading QmlModels plugin:" << className;
+ }
}
};
//![class decl]
diff --git a/src/imports/models/plugins.qmltypes b/src/imports/models/plugins.qmltypes
deleted file mode 100644
index 89a839e502..0000000000
--- a/src/imports/models/plugins.qmltypes
+++ /dev/null
@@ -1,710 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml.Models 2.14'
-
-Module {
- dependencies: []
- 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: "QItemSelectionModel"
- prototype: "QObject"
- exports: ["QtQml.Models/ItemSelectionModel 2.2"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "SelectionFlags"
- values: {
- "NoUpdate": 0,
- "Clear": 1,
- "Select": 2,
- "Deselect": 4,
- "Toggle": 8,
- "Current": 16,
- "Rows": 32,
- "Columns": 64,
- "SelectCurrent": 18,
- "ToggleCurrent": 24,
- "ClearAndSelect": 3
- }
- }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "hasSelection"; type: "bool"; isReadonly: true }
- Property { name: "currentIndex"; type: "QModelIndex"; isReadonly: true }
- Property { name: "selection"; type: "QItemSelection"; isReadonly: true }
- Property { name: "selectedIndexes"; type: "QModelIndexList"; isReadonly: true }
- Signal {
- name: "selectionChanged"
- Parameter { name: "selected"; type: "QItemSelection" }
- Parameter { name: "deselected"; type: "QItemSelection" }
- }
- Signal {
- name: "currentChanged"
- Parameter { name: "current"; type: "QModelIndex" }
- Parameter { name: "previous"; type: "QModelIndex" }
- }
- Signal {
- name: "currentRowChanged"
- Parameter { name: "current"; type: "QModelIndex" }
- Parameter { name: "previous"; type: "QModelIndex" }
- }
- Signal {
- name: "currentColumnChanged"
- Parameter { name: "current"; type: "QModelIndex" }
- Parameter { name: "previous"; type: "QModelIndex" }
- }
- Signal {
- name: "modelChanged"
- Parameter { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- }
- Method {
- name: "setCurrentIndex"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "command"; type: "QItemSelectionModel::SelectionFlags" }
- }
- Method {
- name: "select"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "command"; type: "QItemSelectionModel::SelectionFlags" }
- }
- Method {
- name: "select"
- Parameter { name: "selection"; type: "QItemSelection" }
- Parameter { name: "command"; type: "QItemSelectionModel::SelectionFlags" }
- }
- Method { name: "clear" }
- Method { name: "reset" }
- Method { name: "clearSelection" }
- Method { name: "clearCurrentIndex" }
- Method {
- name: "isSelected"
- type: "bool"
- Parameter { name: "index"; type: "QModelIndex" }
- }
- Method {
- name: "isRowSelected"
- type: "bool"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "isColumnSelected"
- type: "bool"
- Parameter { name: "column"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "rowIntersectsSelection"
- type: "bool"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "columnIntersectsSelection"
- type: "bool"
- Parameter { name: "column"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "selectedRows"
- type: "QModelIndexList"
- Parameter { name: "column"; type: "int" }
- }
- Method { name: "selectedRows"; type: "QModelIndexList" }
- Method {
- name: "selectedColumns"
- type: "QModelIndexList"
- Parameter { name: "row"; type: "int" }
- }
- Method { name: "selectedColumns"; type: "QModelIndexList" }
- }
- Component {
- name: "QQmlDelegateModel"
- defaultProperty: "delegate"
- prototype: "QQmlInstanceModel"
- exports: ["QtQml.Models/DelegateModel 2.1"]
- exportMetaObjectRevisions: [1]
- attachedType: "QQmlDelegateModelAttached"
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "filterOnGroup"; type: "string" }
- Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
- Property {
- name: "persistedItems"
- type: "QQmlDelegateModelGroup"
- isReadonly: true
- isPointer: true
- }
- Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
- Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "rootIndex"; type: "QVariant" }
- Signal { name: "filterGroupChanged" }
- Signal { name: "defaultGroupsChanged" }
- Method {
- name: "modelIndex"
- type: "QVariant"
- Parameter { name: "idx"; type: "int" }
- }
- Method { name: "parentModelIndex"; type: "QVariant" }
- }
- Component {
- name: "QQmlDelegateModelAttached"
- prototype: "QObject"
- Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
- Property { name: "groups"; type: "QStringList" }
- Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
- Signal { name: "unresolvedChanged" }
- }
- Component {
- name: "QQmlDelegateModelGroup"
- prototype: "QObject"
- exports: ["QtQml.Models/DelegateModelGroup 2.1"]
- exportMetaObjectRevisions: [1]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "name"; type: "string" }
- Property { name: "includeByDefault"; type: "bool" }
- Signal { name: "defaultIncludeChanged" }
- Signal {
- name: "changed"
- Parameter { name: "removed"; type: "QJSValue" }
- Parameter { name: "inserted"; type: "QJSValue" }
- }
- Method {
- name: "insert"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "create"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "resolve"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "remove"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "addGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "removeGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "setGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "move"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- }
- 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"]
- exportMetaObjectRevisions: [1]
- }
- Component {
- name: "QQmlListModel"
- prototype: "QAbstractListModel"
- exports: ["QtQml.Models/ListModel 2.1", "QtQml.Models/ListModel 2.14"]
- exportMetaObjectRevisions: [1, 14]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "dynamicRoles"; type: "bool" }
- Property { name: "agent"; revision: 14; type: "QObject"; isReadonly: true; isPointer: true }
- Method { name: "clear" }
- Method {
- name: "remove"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "append"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "insert"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "QJSValue" }
- }
- Method {
- name: "setProperty"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "property"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "move"
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method { name: "sync" }
- }
- Component {
- name: "QQmlListModelWorkerAgent"
- prototype: "QObject"
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "engine"; type: "QV4::ExecutionEngine"; isPointer: true }
- Signal {
- name: "engineChanged"
- Parameter { name: "engine"; type: "QV4::ExecutionEngine"; isPointer: true }
- }
- Method { name: "addref" }
- Method { name: "release" }
- Method { name: "clear" }
- Method {
- name: "remove"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "append"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "insert"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "QJSValue" }
- }
- Method {
- name: "setProperty"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "property"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "move"
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method { name: "sync" }
- }
- Component {
- name: "QQmlObjectModel"
- defaultProperty: "children"
- prototype: "QQmlInstanceModel"
- exports: [
- "QtQml.Models/ObjectModel 2.1",
- "QtQml.Models/ObjectModel 2.3"
- ]
- exportMetaObjectRevisions: [1, 3]
- attachedType: "QQmlObjectModelAttached"
- Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
- Method { name: "clear"; revision: 3 }
- Method {
- name: "get"
- revision: 3
- type: "QObject*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- revision: 3
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "insert"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "move"
- revision: 3
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "n"; type: "int" }
- }
- Method {
- name: "move"
- revision: 3
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "n"; type: "int" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QQmlObjectModelAttached"
- prototype: "QObject"
- Property { name: "index"; type: "int"; isReadonly: true }
- }
- Component {
- name: "QQuickPackage"
- defaultProperty: "data"
- prototype: "QObject"
- exports: ["QtQml.Models/Package 2.14"]
- exportMetaObjectRevisions: [14]
- attachedType: "QQuickPackageAttached"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickPackageAttached"
- prototype: "QObject"
- Property { name: "name"; type: "string" }
- }
-}
diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro
index 41146c75b0..d13babf30c 100644
--- a/src/imports/particles/particles.pro
+++ b/src/imports/particles/particles.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = particlesplugin
TARGETPATH = QtQuick/Particles.2
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp
index 704eb0ffbe..4f319db9f1 100644
--- a/src/imports/particles/plugin.cpp
+++ b/src/imports/particles/plugin.cpp
@@ -53,10 +53,8 @@ public:
QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
void registerTypes(const char *uri) override
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Particles"));
+ Q_UNUSED(uri);
QQuickParticlesModule::defineModule();
-
- qmlRegisterModule(uri, 2, 15);
}
};
//![class decl]
diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes
deleted file mode 100644
index 48da0b26ed..0000000000
--- a/src/imports/particles/plugins.qmltypes
+++ /dev/null
@@ -1,1359 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Particles 2.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QQuickAgeAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Age 2.0",
- "QtQuick.Particles/Age 2.1",
- "QtQuick.Particles/Age 2.11",
- "QtQuick.Particles/Age 2.4",
- "QtQuick.Particles/Age 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "lifeLeft"; type: "int" }
- Property { name: "advancePosition"; type: "bool" }
- Signal {
- name: "lifeLeftChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "advancePositionChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setLifeLeft"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setAdvancePosition"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAngleDirection"
- prototype: "QQuickDirection"
- exports: ["QtQuick.Particles/AngleDirection 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "angle"; type: "double" }
- Property { name: "magnitude"; type: "double" }
- Property { name: "angleVariation"; type: "double" }
- Property { name: "magnitudeVariation"; type: "double" }
- Signal {
- name: "angleChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "magnitudeChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "angleVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "magnitudeVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAngle"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setMagnitude"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAngleVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setMagnitudeVariation"
- Parameter { name: "arg"; type: "double" }
- }
- }
- Component {
- name: "QQuickAttractorAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Attractor 2.0",
- "QtQuick.Particles/Attractor 2.1",
- "QtQuick.Particles/Attractor 2.11",
- "QtQuick.Particles/Attractor 2.4",
- "QtQuick.Particles/Attractor 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Proportion"
- values: {
- "Constant": 0,
- "Linear": 1,
- "Quadratic": 2,
- "InverseLinear": 3,
- "InverseQuadratic": 4
- }
- }
- Enum {
- name: "AffectableParameters"
- values: {
- "Position": 0,
- "Velocity": 1,
- "Acceleration": 2
- }
- }
- Property { name: "strength"; type: "double" }
- Property { name: "pointX"; type: "double" }
- Property { name: "pointY"; type: "double" }
- Property { name: "affectedParameter"; type: "AffectableParameters" }
- Property { name: "proportionalToDistance"; type: "Proportion" }
- Signal {
- name: "strengthChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "pointXChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "pointYChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "affectedParameterChanged"
- Parameter { name: "arg"; type: "AffectableParameters" }
- }
- Signal {
- name: "proportionalToDistanceChanged"
- Parameter { name: "arg"; type: "Proportion" }
- }
- Method {
- name: "setStrength"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setPointX"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setPointY"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAffectedParameter"
- Parameter { name: "arg"; type: "AffectableParameters" }
- }
- Method {
- name: "setProportionalToDistance"
- Parameter { name: "arg"; type: "Proportion" }
- }
- }
- Component {
- name: "QQuickCumulativeDirection"
- defaultProperty: "directions"
- prototype: "QQuickDirection"
- exports: ["QtQuick.Particles/CumulativeDirection 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "directions"; type: "QQuickDirection"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickCustomAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Affector 2.0",
- "QtQuick.Particles/Affector 2.1",
- "QtQuick.Particles/Affector 2.11",
- "QtQuick.Particles/Affector 2.4",
- "QtQuick.Particles/Affector 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "relative"; type: "bool" }
- Property { name: "position"; type: "QQuickDirection"; isPointer: true }
- Property { name: "velocity"; type: "QQuickDirection"; isPointer: true }
- Property { name: "acceleration"; type: "QQuickDirection"; isPointer: true }
- Signal {
- name: "affectParticles"
- Parameter { name: "particles"; type: "QJSValue" }
- Parameter { name: "dt"; type: "double" }
- }
- Signal {
- name: "positionChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "velocityChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "accelerationChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "relativeChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setPosition"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setVelocity"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setAcceleration"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setRelative"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickCustomParticle"
- defaultProperty: "data"
- prototype: "QQuickParticlePainter"
- exports: [
- "QtQuick.Particles/CustomParticle 2.0",
- "QtQuick.Particles/CustomParticle 2.1",
- "QtQuick.Particles/CustomParticle 2.11",
- "QtQuick.Particles/CustomParticle 2.4",
- "QtQuick.Particles/CustomParticle 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "fragmentShader"; type: "QByteArray" }
- Property { name: "vertexShader"; type: "QByteArray" }
- }
- Component {
- name: "QQuickDirection"
- prototype: "QObject"
- exports: ["QtQuick.Particles/NullVector 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickEllipseExtruder"
- prototype: "QQuickParticleExtruder"
- exports: ["QtQuick.Particles/EllipseShape 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "fill"; type: "bool" }
- Signal {
- name: "fillChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setFill"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickFrictionAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Friction 2.0",
- "QtQuick.Particles/Friction 2.1",
- "QtQuick.Particles/Friction 2.11",
- "QtQuick.Particles/Friction 2.4",
- "QtQuick.Particles/Friction 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "factor"; type: "double" }
- Property { name: "threshold"; type: "double" }
- Signal {
- name: "factorChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "thresholdChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setFactor"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setThreshold"
- Parameter { name: "arg"; type: "double" }
- }
- }
- Component {
- name: "QQuickGravityAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Gravity 2.0",
- "QtQuick.Particles/Gravity 2.1",
- "QtQuick.Particles/Gravity 2.11",
- "QtQuick.Particles/Gravity 2.4",
- "QtQuick.Particles/Gravity 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "magnitude"; type: "double" }
- Property { name: "acceleration"; type: "double" }
- Property { name: "angle"; type: "double" }
- Signal {
- name: "magnitudeChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "angleChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setMagnitude"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAcceleration"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAngle"
- Parameter { name: "arg"; type: "double" }
- }
- }
- Component {
- name: "QQuickGroupGoalAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/GroupGoal 2.0",
- "QtQuick.Particles/GroupGoal 2.1",
- "QtQuick.Particles/GroupGoal 2.11",
- "QtQuick.Particles/GroupGoal 2.4",
- "QtQuick.Particles/GroupGoal 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "goalState"; type: "string" }
- Property { name: "jump"; type: "bool" }
- Signal {
- name: "goalStateChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Signal {
- name: "jumpChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setGoalState"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setJump"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickImageParticle"
- defaultProperty: "data"
- prototype: "QQuickParticlePainter"
- exports: [
- "QtQuick.Particles/ImageParticle 2.0",
- "QtQuick.Particles/ImageParticle 2.1",
- "QtQuick.Particles/ImageParticle 2.11",
- "QtQuick.Particles/ImageParticle 2.4",
- "QtQuick.Particles/ImageParticle 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2,
- "Error": 3
- }
- }
- Enum {
- name: "EntryEffect"
- values: {
- "None": 0,
- "Fade": 1,
- "Scale": 2
- }
- }
- Property { name: "source"; type: "QUrl" }
- Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "colorTable"; type: "QUrl" }
- Property { name: "sizeTable"; type: "QUrl" }
- Property { name: "opacityTable"; type: "QUrl" }
- Property { name: "color"; type: "QColor" }
- Property { name: "colorVariation"; type: "double" }
- Property { name: "redVariation"; type: "double" }
- Property { name: "greenVariation"; type: "double" }
- Property { name: "blueVariation"; type: "double" }
- Property { name: "alpha"; type: "double" }
- Property { name: "alphaVariation"; type: "double" }
- Property { name: "rotation"; type: "double" }
- Property { name: "rotationVariation"; type: "double" }
- Property { name: "rotationVelocity"; type: "double" }
- Property { name: "rotationVelocityVariation"; type: "double" }
- Property { name: "autoRotation"; type: "bool" }
- Property { name: "xVector"; type: "QQuickDirection"; isPointer: true }
- Property { name: "yVector"; type: "QQuickDirection"; isPointer: true }
- Property { name: "spritesInterpolate"; type: "bool" }
- Property { name: "entryEffect"; type: "EntryEffect" }
- Signal { name: "imageChanged" }
- Signal { name: "colortableChanged" }
- Signal { name: "sizetableChanged" }
- Signal { name: "opacitytableChanged" }
- Signal {
- name: "alphaVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "alphaChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "redVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "greenVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "blueVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "rotationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "rotationVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "rotationVelocityChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "rotationVelocityVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "autoRotationChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "xVectorChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "yVectorChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "spritesInterpolateChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "bypassOptimizationsChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "entryEffectChanged"
- Parameter { name: "arg"; type: "EntryEffect" }
- }
- Signal {
- name: "statusChanged"
- Parameter { name: "arg"; type: "Status" }
- }
- Method {
- name: "reloadColor"
- Parameter { name: "c"; type: "Color4ub" }
- Parameter { name: "d"; type: "QQuickParticleData"; isPointer: true }
- }
- Method {
- name: "setAlphaVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAlpha"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setRedVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setGreenVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setBlueVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setRotation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setRotationVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setRotationVelocity"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setRotationVelocityVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAutoRotation"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setXVector"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setYVector"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setSpritesInterpolate"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setBypassOptimizations"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setEntryEffect"
- Parameter { name: "arg"; type: "EntryEffect" }
- }
- }
- Component {
- name: "QQuickItemParticle"
- defaultProperty: "data"
- prototype: "QQuickParticlePainter"
- exports: [
- "QtQuick.Particles/ItemParticle 2.0",
- "QtQuick.Particles/ItemParticle 2.1",
- "QtQuick.Particles/ItemParticle 2.11",
- "QtQuick.Particles/ItemParticle 2.4",
- "QtQuick.Particles/ItemParticle 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- attachedType: "QQuickItemParticleAttached"
- Property { name: "fade"; type: "bool" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Signal {
- name: "delegateChanged"
- Parameter { name: "arg"; type: "QQmlComponent"; isPointer: true }
- }
- Method {
- name: "freeze"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "unfreeze"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "take"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- Parameter { name: "prioritize"; type: "bool" }
- }
- Method {
- name: "take"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "give"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "setFade"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setDelegate"
- Parameter { name: "arg"; type: "QQmlComponent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickItemParticleAttached"
- prototype: "QObject"
- Property { name: "particle"; type: "QQuickItemParticle"; isReadonly: true; isPointer: true }
- Signal { name: "detached" }
- Signal { name: "attached" }
- }
- Component {
- name: "QQuickLineExtruder"
- prototype: "QQuickParticleExtruder"
- exports: ["QtQuick.Particles/LineShape 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "mirrored"; type: "bool" }
- Signal {
- name: "mirroredChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setMirrored"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickMaskExtruder"
- prototype: "QQuickParticleExtruder"
- exports: ["QtQuick.Particles/MaskShape 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "source"; type: "QUrl" }
- Signal {
- name: "sourceChanged"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Method {
- name: "setSource"
- Parameter { name: "arg"; type: "QUrl" }
- }
- }
- Component {
- name: "QQuickParticleAffector"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Particles/ParticleAffector 2.0",
- "QtQuick.Particles/ParticleAffector 2.1",
- "QtQuick.Particles/ParticleAffector 2.11",
- "QtQuick.Particles/ParticleAffector 2.4",
- "QtQuick.Particles/ParticleAffector 2.7"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
- Property { name: "groups"; type: "QStringList" }
- Property { name: "whenCollidingWith"; type: "QStringList" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "once"; type: "bool" }
- Property { name: "shape"; type: "QQuickParticleExtruder"; isPointer: true }
- Signal {
- name: "systemChanged"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Signal {
- name: "groupsChanged"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Signal {
- name: "enabledChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "onceChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "shapeChanged"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- Signal {
- name: "affected"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Signal {
- name: "whenCollidingWithChanged"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Method {
- name: "setSystem"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Method {
- name: "setGroups"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Method {
- name: "setEnabled"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setOnceOff"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setShape"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- Method {
- name: "setWhenCollidingWith"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Method { name: "updateOffsets" }
- }
- Component {
- name: "QQuickParticleEmitter"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Particles/Emitter 2.0",
- "QtQuick.Particles/Emitter 2.1",
- "QtQuick.Particles/Emitter 2.11",
- "QtQuick.Particles/Emitter 2.4",
- "QtQuick.Particles/Emitter 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Lifetime"
- values: {
- "InfiniteLife": 600000
- }
- }
- Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
- Property { name: "group"; type: "string" }
- Property { name: "shape"; type: "QQuickParticleExtruder"; isPointer: true }
- Property { name: "enabled"; type: "bool" }
- Property { name: "startTime"; type: "int" }
- Property { name: "emitRate"; type: "double" }
- Property { name: "lifeSpan"; type: "int" }
- Property { name: "lifeSpanVariation"; type: "int" }
- Property { name: "maximumEmitted"; type: "int" }
- Property { name: "size"; type: "double" }
- Property { name: "endSize"; type: "double" }
- Property { name: "sizeVariation"; type: "double" }
- Property { name: "velocity"; type: "QQuickDirection"; isPointer: true }
- Property { name: "acceleration"; type: "QQuickDirection"; isPointer: true }
- Property { name: "velocityFromMovement"; type: "double" }
- Signal {
- name: "emitParticles"
- Parameter { name: "particles"; type: "QJSValue" }
- }
- Signal {
- name: "particlesPerSecondChanged"
- Parameter { type: "double" }
- }
- Signal {
- name: "particleDurationChanged"
- Parameter { type: "int" }
- }
- Signal {
- name: "enabledChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "systemChanged"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Signal {
- name: "groupChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Signal {
- name: "particleDurationVariationChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "extruderChanged"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- Signal {
- name: "particleSizeChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "particleEndSizeChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "particleSizeVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "velocityChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "accelerationChanged"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Signal {
- name: "maximumEmittedChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal { name: "particleCountChanged" }
- Signal {
- name: "startTimeChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "pulse"
- Parameter { name: "milliseconds"; type: "int" }
- }
- Method {
- name: "burst"
- Parameter { name: "num"; type: "int" }
- }
- Method {
- name: "burst"
- Parameter { name: "num"; type: "int" }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "setEnabled"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setParticlesPerSecond"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setParticleDuration"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setSystem"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Method {
- name: "setGroup"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setParticleDurationVariation"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setExtruder"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- Method {
- name: "setParticleSize"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setParticleEndSize"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setParticleSizeVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setVelocity"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setAcceleration"
- Parameter { name: "arg"; type: "QQuickDirection"; isPointer: true }
- }
- Method {
- name: "setMaxParticleCount"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setStartTime"
- Parameter { name: "arg"; type: "int" }
- }
- Method { name: "reset" }
- }
- Component {
- name: "QQuickParticleExtruder"
- prototype: "QObject"
- exports: ["QtQuick.Particles/ParticleExtruder 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickParticleGroup"
- defaultProperty: "particleChildren"
- prototype: "QQuickStochasticState"
- exports: ["QtQuick.Particles/ParticleGroup 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
- Property { name: "particleChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "maximumAliveChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "systemChanged"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Method {
- name: "setMaximumAlive"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setSystem"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Method {
- name: "delayRedirect"
- Parameter { name: "obj"; type: "QObject"; isPointer: true }
- }
- }
- Component {
- name: "QQuickParticlePainter"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Particles/ParticlePainter 2.0",
- "QtQuick.Particles/ParticlePainter 2.1",
- "QtQuick.Particles/ParticlePainter 2.11",
- "QtQuick.Particles/ParticlePainter 2.4",
- "QtQuick.Particles/ParticlePainter 2.7"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true }
- Property { name: "groups"; type: "QStringList" }
- Signal { name: "countChanged" }
- Signal {
- name: "systemChanged"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Signal {
- name: "groupsChanged"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Method {
- name: "setSystem"
- Parameter { name: "arg"; type: "QQuickParticleSystem"; isPointer: true }
- }
- Method {
- name: "setGroups"
- Parameter { name: "arg"; type: "QStringList" }
- }
- Method {
- name: "calcSystemOffset"
- Parameter { name: "resetPending"; type: "bool" }
- }
- Method { name: "calcSystemOffset" }
- }
- Component {
- name: "QQuickParticleSystem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Particles/ParticleSystem 2.0",
- "QtQuick.Particles/ParticleSystem 2.1",
- "QtQuick.Particles/ParticleSystem 2.11",
- "QtQuick.Particles/ParticleSystem 2.4",
- "QtQuick.Particles/ParticleSystem 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "running"; type: "bool" }
- Property { name: "paused"; type: "bool" }
- Property { name: "empty"; type: "bool"; isReadonly: true }
- Signal { name: "systemInitialized" }
- Signal {
- name: "runningChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "pausedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "emptyChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method { name: "start" }
- Method { name: "stop" }
- Method { name: "restart" }
- Method { name: "pause" }
- Method { name: "resume" }
- Method { name: "reset" }
- Method {
- name: "setRunning"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setPaused"
- Parameter { name: "arg"; type: "bool" }
- }
- Method { name: "duration"; type: "int" }
- }
- Component {
- name: "QQuickPointDirection"
- prototype: "QQuickDirection"
- exports: ["QtQuick.Particles/PointDirection 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- Property { name: "xVariation"; type: "double" }
- Property { name: "yVariation"; type: "double" }
- Signal {
- name: "xChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "yChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "xVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "yVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setXVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setYVariation"
- Parameter { name: "arg"; type: "double" }
- }
- }
- Component {
- name: "QQuickRectangleExtruder"
- prototype: "QQuickParticleExtruder"
- exports: ["QtQuick.Particles/RectangleShape 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "fill"; type: "bool" }
- Signal {
- name: "fillChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setFill"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickSpriteGoalAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/SpriteGoal 2.0",
- "QtQuick.Particles/SpriteGoal 2.1",
- "QtQuick.Particles/SpriteGoal 2.11",
- "QtQuick.Particles/SpriteGoal 2.4",
- "QtQuick.Particles/SpriteGoal 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "goalState"; type: "string" }
- Property { name: "jump"; type: "bool" }
- Property { name: "systemStates"; type: "bool" }
- Signal {
- name: "goalStateChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Signal {
- name: "jumpChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "systemStatesChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setGoalState"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setJump"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setSystemStates"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- 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"]
- exportMetaObjectRevisions: [0]
- Property { name: "targetX"; type: "double" }
- Property { name: "targetY"; type: "double" }
- Property { name: "targetItem"; type: "QQuickItem"; isPointer: true }
- Property { name: "targetVariation"; type: "double" }
- Property { name: "proportionalMagnitude"; type: "bool" }
- Property { name: "magnitude"; type: "double" }
- Property { name: "magnitudeVariation"; type: "double" }
- Signal {
- name: "targetXChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "targetYChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "targetVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "magnitudeChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "proprotionalMagnitudeChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "magnitudeVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "targetItemChanged"
- Parameter { name: "arg"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "setTargetX"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setTargetY"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setTargetVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setMagnitude"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setProportionalMagnitude"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setMagnitudeVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setTargetItem"
- Parameter { name: "arg"; type: "QQuickItem"; isPointer: true }
- }
- }
- Component {
- name: "QQuickTrailEmitter"
- defaultProperty: "data"
- prototype: "QQuickParticleEmitter"
- exports: [
- "QtQuick.Particles/TrailEmitter 2.0",
- "QtQuick.Particles/TrailEmitter 2.1",
- "QtQuick.Particles/TrailEmitter 2.11",
- "QtQuick.Particles/TrailEmitter 2.4",
- "QtQuick.Particles/TrailEmitter 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "EmitSize"
- values: {
- "ParticleSize": -2
- }
- }
- Property { name: "follow"; type: "string" }
- Property { name: "emitRatePerParticle"; type: "int" }
- Property { name: "emitShape"; type: "QQuickParticleExtruder"; isPointer: true }
- Property { name: "emitHeight"; type: "double" }
- Property { name: "emitWidth"; type: "double" }
- Signal {
- name: "emitFollowParticles"
- Parameter { name: "particles"; type: "QJSValue" }
- Parameter { name: "followed"; type: "QJSValue" }
- }
- Signal {
- name: "particlesPerParticlePerSecondChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "emitterXVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "emitterYVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "followChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Signal {
- name: "emissionShapeChanged"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- Method {
- name: "setParticlesPerParticlePerSecond"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setEmitterXVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setEmitterYVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setFollow"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setEmissionShape"
- Parameter { name: "arg"; type: "QQuickParticleExtruder"; isPointer: true }
- }
- }
- Component {
- name: "QQuickTurbulenceAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Turbulence 2.0",
- "QtQuick.Particles/Turbulence 2.1",
- "QtQuick.Particles/Turbulence 2.11",
- "QtQuick.Particles/Turbulence 2.4",
- "QtQuick.Particles/Turbulence 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "strength"; type: "double" }
- Property { name: "noiseSource"; type: "QUrl" }
- Signal {
- name: "strengthChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "noiseSourceChanged"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Method {
- name: "setStrength"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setNoiseSource"
- Parameter { name: "arg"; type: "QUrl" }
- }
- }
- Component {
- name: "QQuickWanderAffector"
- defaultProperty: "data"
- prototype: "QQuickParticleAffector"
- exports: [
- "QtQuick.Particles/Wander 2.0",
- "QtQuick.Particles/Wander 2.1",
- "QtQuick.Particles/Wander 2.11",
- "QtQuick.Particles/Wander 2.4",
- "QtQuick.Particles/Wander 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "AffectableParameters"
- values: {
- "Position": 0,
- "Velocity": 1,
- "Acceleration": 2
- }
- }
- Property { name: "pace"; type: "double" }
- Property { name: "xVariance"; type: "double" }
- Property { name: "yVariance"; type: "double" }
- Property { name: "affectedParameter"; type: "AffectableParameters" }
- Signal {
- name: "xVarianceChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "yVarianceChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "paceChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "affectedParameterChanged"
- Parameter { name: "arg"; type: "AffectableParameters" }
- }
- Method {
- name: "setXVariance"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setYVariance"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setPace"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setAffectedParameter"
- Parameter { name: "arg"; type: "AffectableParameters" }
- }
- }
-}
diff --git a/src/imports/qtqml/plugin.cpp b/src/imports/qtqml/plugin.cpp
index f63e04c3b9..ec08992355 100644
--- a/src/imports/qtqml/plugin.cpp
+++ b/src/imports/qtqml/plugin.cpp
@@ -61,19 +61,12 @@ QT_BEGIN_NAMESPACE
*/
//![class decl]
-class QtQmlPlugin : public QQmlExtensionPlugin
+class QtQmlPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml"));
- QQmlEnginePrivate::defineModule();
-
- qmlRegisterModule(uri, 2, 15);
- }
+ QtQmlPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {}
};
//![class decl]
diff --git a/src/imports/qtqml/plugins.qmltypes b/src/imports/qtqml/plugins.qmltypes
deleted file mode 100644
index e4ddb3ddd1..0000000000
--- a/src/imports/qtqml/plugins.qmltypes
+++ /dev/null
@@ -1,245 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml 2.14'
-
-Module {
- dependencies: []
- Component {
- name: "QObject"
- exports: ["QtQml/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: "QQmlBind"
- prototype: "QObject"
- exports: [
- "QtQml/Binding 2.0",
- "QtQml/Binding 2.14",
- "QtQml/Binding 2.8"
- ]
- exportMetaObjectRevisions: [0, 14, 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: ["QtQml/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: ["QtQml/Connections 2.0", "QtQml/Connections 2.3"]
- 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: "QQmlInstanceModel"
- prototype: "QObject"
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "modelUpdated"
- Parameter { name: "changeSet"; type: "QQmlChangeSet" }
- Parameter { name: "reset"; type: "bool" }
- }
- Signal {
- name: "createdItem"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Signal {
- name: "initItem"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Signal {
- name: "destroyingItem"
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- }
- Component {
- name: "QQmlInstantiator"
- defaultProperty: "delegate"
- prototype: "QObject"
- exports: ["QtQml/Instantiator 2.1"]
- 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: "QQmlLocale"
- exports: ["QtQml/Locale 2.2"]
- isCreatable: false
- exportMetaObjectRevisions: [2]
- 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: ["QtQml/LoggingCategory 2.12", "QtQml/LoggingCategory 2.8"]
- exportMetaObjectRevisions: [12, 8]
- 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: "QQmlTimer"
- prototype: "QObject"
- exports: ["QtQml/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" }
- }
-}
diff --git a/src/imports/qtqml/qtqml.pro b/src/imports/qtqml/qtqml.pro
index 902f0b1247..0211844b14 100644
--- a/src/imports/qtqml/qtqml.pro
+++ b/src/imports/qtqml/qtqml.pro
@@ -1,7 +1,7 @@
TARGETPATH = QtQml
CXX_MODULE = qml
TARGET = qmlplugin
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index 1b14e9f0e5..98056aa551 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -57,8 +57,6 @@ public:
Q_UNUSED(uri);
moduleDefined = true;
QQmlQtQuick2Module::defineModule();
-
- qmlRegisterModule("QtQuick", 2, 15);
}
~QtQuick2Plugin() override
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
deleted file mode 100644
index a773a8c428..0000000000
--- a/src/imports/qtquick2/plugins.qmltypes
+++ /dev/null
@@ -1,5921 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick 2.14'
-
-Module {
- dependencies: []
- 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: "QDoubleValidator"
- prototype: "QValidator"
- Enum {
- name: "Notation"
- values: {
- "StandardNotation": 0,
- "ScientificNotation": 1
- }
- }
- Property { name: "bottom"; type: "double" }
- Property { name: "top"; type: "double" }
- Property { name: "decimals"; type: "int" }
- Property { name: "notation"; type: "Notation" }
- Signal {
- name: "bottomChanged"
- Parameter { name: "bottom"; type: "double" }
- }
- Signal {
- name: "topChanged"
- Parameter { name: "top"; type: "double" }
- }
- Signal {
- name: "decimalsChanged"
- Parameter { name: "decimals"; type: "int" }
- }
- Signal {
- name: "notationChanged"
- Parameter { name: "notation"; type: "QDoubleValidator::Notation" }
- }
- }
- Component {
- name: "QInputMethod"
- prototype: "QObject"
- exports: ["QtQuick/InputMethod 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Action"
- values: {
- "Click": 0,
- "ContextMenu": 1
- }
- }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "anchorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "keyboardRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "inputItemClipRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "visible"; type: "bool"; isReadonly: true }
- Property { name: "animating"; type: "bool"; isReadonly: true }
- Property { name: "locale"; type: "QLocale"; isReadonly: true }
- Property { name: "inputDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- Signal {
- name: "inputDirectionChanged"
- Parameter { name: "newDirection"; type: "Qt::LayoutDirection" }
- }
- Method { name: "show" }
- Method { name: "hide" }
- Method {
- name: "update"
- Parameter { name: "queries"; type: "Qt::InputMethodQueries" }
- }
- Method { name: "reset" }
- Method { name: "commit" }
- Method {
- name: "invokeAction"
- Parameter { name: "a"; type: "Action" }
- Parameter { name: "cursorPosition"; type: "int" }
- }
- }
- Component {
- name: "QIntValidator"
- prototype: "QValidator"
- Property { name: "bottom"; type: "int" }
- Property { name: "top"; type: "int" }
- Signal {
- name: "bottomChanged"
- Parameter { name: "bottom"; type: "int" }
- }
- Signal {
- name: "topChanged"
- Parameter { name: "top"; type: "int" }
- }
- }
- Component {
- name: "QKeySequence"
- exports: ["QtQuick/StandardKey 2.2"]
- isCreatable: false
- exportMetaObjectRevisions: [2]
- Enum {
- name: "StandardKey"
- values: {
- "UnknownKey": 0,
- "HelpContents": 1,
- "WhatsThis": 2,
- "Open": 3,
- "Close": 4,
- "Save": 5,
- "New": 6,
- "Delete": 7,
- "Cut": 8,
- "Copy": 9,
- "Paste": 10,
- "Undo": 11,
- "Redo": 12,
- "Back": 13,
- "Forward": 14,
- "Refresh": 15,
- "ZoomIn": 16,
- "ZoomOut": 17,
- "Print": 18,
- "AddTab": 19,
- "NextChild": 20,
- "PreviousChild": 21,
- "Find": 22,
- "FindNext": 23,
- "FindPrevious": 24,
- "Replace": 25,
- "SelectAll": 26,
- "Bold": 27,
- "Italic": 28,
- "Underline": 29,
- "MoveToNextChar": 30,
- "MoveToPreviousChar": 31,
- "MoveToNextWord": 32,
- "MoveToPreviousWord": 33,
- "MoveToNextLine": 34,
- "MoveToPreviousLine": 35,
- "MoveToNextPage": 36,
- "MoveToPreviousPage": 37,
- "MoveToStartOfLine": 38,
- "MoveToEndOfLine": 39,
- "MoveToStartOfBlock": 40,
- "MoveToEndOfBlock": 41,
- "MoveToStartOfDocument": 42,
- "MoveToEndOfDocument": 43,
- "SelectNextChar": 44,
- "SelectPreviousChar": 45,
- "SelectNextWord": 46,
- "SelectPreviousWord": 47,
- "SelectNextLine": 48,
- "SelectPreviousLine": 49,
- "SelectNextPage": 50,
- "SelectPreviousPage": 51,
- "SelectStartOfLine": 52,
- "SelectEndOfLine": 53,
- "SelectStartOfBlock": 54,
- "SelectEndOfBlock": 55,
- "SelectStartOfDocument": 56,
- "SelectEndOfDocument": 57,
- "DeleteStartOfWord": 58,
- "DeleteEndOfWord": 59,
- "DeleteEndOfLine": 60,
- "InsertParagraphSeparator": 61,
- "InsertLineSeparator": 62,
- "SaveAs": 63,
- "Preferences": 64,
- "Quit": 65,
- "FullScreen": 66,
- "Deselect": 67,
- "DeleteCompleteLine": 68,
- "Backspace": 69,
- "Cancel": 70
- }
- }
- }
- 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
- exportMetaObjectRevisions: [0]
- Property { name: "numericId"; type: "qlonglong"; isReadonly: true }
- }
- Component {
- name: "QQmlApplication"
- prototype: "QObject"
- Property { name: "arguments"; type: "QStringList"; isReadonly: true }
- Property { name: "name"; type: "string" }
- Property { name: "version"; type: "string" }
- Property { name: "organization"; type: "string" }
- Property { name: "domain"; type: "string" }
- Signal { name: "aboutToQuit" }
- Method {
- name: "setName"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setVersion"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setOrganization"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setDomain"
- Parameter { name: "arg"; type: "string" }
- }
- }
- 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"
- exports: ["QtQuick/VisualDataModel 2.0"]
- exportMetaObjectRevisions: [0]
- attachedType: "QQmlDelegateModelAttached"
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "filterOnGroup"; type: "string" }
- Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
- Property {
- name: "persistedItems"
- type: "QQmlDelegateModelGroup"
- isReadonly: true
- isPointer: true
- }
- Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
- Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "rootIndex"; type: "QVariant" }
- Signal { name: "filterGroupChanged" }
- Signal { name: "defaultGroupsChanged" }
- Method {
- name: "modelIndex"
- type: "QVariant"
- Parameter { name: "idx"; type: "int" }
- }
- Method { name: "parentModelIndex"; type: "QVariant" }
- }
- Component {
- name: "QQmlDelegateModelAttached"
- prototype: "QObject"
- Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
- Property { name: "groups"; type: "QStringList" }
- Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
- Signal { name: "unresolvedChanged" }
- }
- Component {
- name: "QQmlDelegateModelGroup"
- prototype: "QObject"
- exports: ["QtQuick/VisualDataGroup 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "name"; type: "string" }
- Property { name: "includeByDefault"; type: "bool" }
- Signal { name: "defaultIncludeChanged" }
- Signal {
- name: "changed"
- Parameter { name: "removed"; type: "QJSValue" }
- Parameter { name: "inserted"; type: "QJSValue" }
- }
- Method {
- name: "insert"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "create"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "resolve"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "remove"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "addGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "removeGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "setGroups"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "move"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
- Component {
- name: "QQmlEasingValueType"
- exports: ["QtQuick/Easing 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Type"
- values: {
- "Linear": 0,
- "InQuad": 1,
- "OutQuad": 2,
- "InOutQuad": 3,
- "OutInQuad": 4,
- "InCubic": 5,
- "OutCubic": 6,
- "InOutCubic": 7,
- "OutInCubic": 8,
- "InQuart": 9,
- "OutQuart": 10,
- "InOutQuart": 11,
- "OutInQuart": 12,
- "InQuint": 13,
- "OutQuint": 14,
- "InOutQuint": 15,
- "OutInQuint": 16,
- "InSine": 17,
- "OutSine": 18,
- "InOutSine": 19,
- "OutInSine": 20,
- "InExpo": 21,
- "OutExpo": 22,
- "InOutExpo": 23,
- "OutInExpo": 24,
- "InCirc": 25,
- "OutCirc": 26,
- "InOutCirc": 27,
- "OutInCirc": 28,
- "InElastic": 29,
- "OutElastic": 30,
- "InOutElastic": 31,
- "OutInElastic": 32,
- "InBack": 33,
- "OutBack": 34,
- "InOutBack": 35,
- "OutInBack": 36,
- "InBounce": 37,
- "OutBounce": 38,
- "InOutBounce": 39,
- "OutInBounce": 40,
- "InCurve": 41,
- "OutCurve": 42,
- "SineCurve": 43,
- "CosineCurve": 44,
- "Bezier": 45
- }
- }
- Property { name: "type"; type: "Type" }
- Property { name: "amplitude"; type: "double" }
- Property { name: "overshoot"; type: "double" }
- Property { name: "period"; type: "double" }
- 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"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQmlListModel"
- prototype: "QAbstractListModel"
- exports: ["QtQuick/ListModel 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "dynamicRoles"; type: "bool" }
- Property { name: "agent"; revision: 14; type: "QObject"; isReadonly: true; isPointer: true }
- Method { name: "clear" }
- Method {
- name: "remove"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "append"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "insert"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "QJSValue" }
- }
- Method {
- name: "setProperty"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "property"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "move"
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method { name: "sync" }
- }
- Component {
- name: "QQmlListModelWorkerAgent"
- prototype: "QObject"
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "engine"; type: "QV4::ExecutionEngine"; isPointer: true }
- Signal {
- name: "engineChanged"
- Parameter { name: "engine"; type: "QV4::ExecutionEngine"; isPointer: true }
- }
- Method { name: "addref" }
- Method { name: "release" }
- Method { name: "clear" }
- Method {
- name: "remove"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "append"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "insert"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "get"
- type: "QJSValue"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "QJSValue" }
- }
- Method {
- name: "setProperty"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "property"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "move"
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method { name: "sync" }
- }
- Component {
- name: "QQmlLocale"
- exports: ["QtQuick/Locale 2.0"]
- 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"
- exports: ["QtQuick/VisualItemModel 2.0"]
- exportMetaObjectRevisions: [0]
- attachedType: "QQmlObjectModelAttached"
- Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
- Method { name: "clear"; revision: 3 }
- Method {
- name: "get"
- revision: 3
- type: "QObject*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- revision: 3
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "insert"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "move"
- revision: 3
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- Parameter { name: "n"; type: "int" }
- }
- Method {
- name: "move"
- revision: 3
- Parameter { name: "from"; type: "int" }
- Parameter { name: "to"; type: "int" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "n"; type: "int" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QQmlObjectModelAttached"
- prototype: "QObject"
- 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"]
- isCreatable: false
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "Loops"
- values: {
- "Infinite": -2
- }
- }
- Property { name: "running"; type: "bool" }
- Property { name: "paused"; type: "bool" }
- Property { name: "alwaysRunToEnd"; type: "bool" }
- Property { name: "loops"; type: "int" }
- Signal { name: "started" }
- Signal { name: "stopped" }
- Signal {
- name: "runningChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "pausedChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "alwaysRunToEndChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "loopCountChanged"
- Parameter { type: "int" }
- }
- Signal { name: "finished"; revision: 12 }
- Method { name: "restart" }
- Method { name: "start" }
- Method { name: "pause" }
- Method { name: "resume" }
- Method { name: "stop" }
- Method { name: "complete" }
- }
- Component {
- name: "QQuickAccessibleAttached"
- prototype: "QObject"
- exports: ["QtQuick/Accessible 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "role"; type: "QAccessible::Role" }
- Property { name: "name"; type: "string" }
- Property { name: "description"; type: "string" }
- Property { name: "ignored"; type: "bool" }
- Property { name: "checkable"; type: "bool" }
- Property { name: "checked"; type: "bool" }
- Property { name: "editable"; type: "bool" }
- Property { name: "focusable"; type: "bool" }
- Property { name: "focused"; type: "bool" }
- Property { name: "multiLine"; type: "bool" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "selected"; type: "bool" }
- Property { name: "selectable"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "checkStateMixed"; type: "bool" }
- Property { name: "defaultButton"; type: "bool" }
- Property { name: "passwordEdit"; type: "bool" }
- Property { name: "selectableText"; type: "bool" }
- Property { name: "searchEdit"; type: "bool" }
- Signal {
- name: "checkableChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "checkedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "editableChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "focusableChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "focusedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "multiLineChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "selectedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "selectableChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "pressedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "checkStateMixedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "defaultButtonChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "passwordEditChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "selectableTextChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "searchEditChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal { name: "pressAction" }
- Signal { name: "toggleAction" }
- Signal { name: "increaseAction" }
- Signal { name: "decreaseAction" }
- Signal { name: "scrollUpAction" }
- Signal { name: "scrollDownAction" }
- Signal { name: "scrollLeftAction" }
- Signal { name: "scrollRightAction" }
- Signal { name: "previousPageAction" }
- Signal { name: "nextPageAction" }
- Method { name: "valueChanged" }
- Method { name: "cursorPositionChanged" }
- Method {
- name: "setIgnored"
- Parameter { name: "ignored"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAnchorAnimation"
- prototype: "QQuickAbstractAnimation"
- exports: [
- "QtQuick/AnchorAnimation 2.0",
- "QtQuick/AnchorAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "duration"; type: "int" }
- Property { name: "easing"; type: "QEasingCurve" }
- Signal {
- name: "durationChanged"
- Parameter { type: "int" }
- }
- Signal {
- name: "easingChanged"
- Parameter { type: "QEasingCurve" }
- }
- }
- Component {
- name: "QQuickAnchorChanges"
- prototype: "QQuickStateOperation"
- exports: ["QtQuick/AnchorChanges 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true }
- }
- Component {
- name: "QQuickAnchorSet"
- prototype: "QObject"
- Property { name: "left"; type: "QQmlScriptString" }
- Property { name: "right"; type: "QQmlScriptString" }
- Property { name: "horizontalCenter"; type: "QQmlScriptString" }
- Property { name: "top"; type: "QQmlScriptString" }
- Property { name: "bottom"; type: "QQmlScriptString" }
- Property { name: "verticalCenter"; type: "QQmlScriptString" }
- Property { name: "baseline"; type: "QQmlScriptString" }
- }
- Component {
- name: "QQuickAnchors"
- prototype: "QObject"
- Enum {
- name: "Anchors"
- values: {
- "InvalidAnchor": 0,
- "LeftAnchor": 1,
- "RightAnchor": 2,
- "TopAnchor": 4,
- "BottomAnchor": 8,
- "HCenterAnchor": 16,
- "VCenterAnchor": 32,
- "BaselineAnchor": 64,
- "Horizontal_Mask": 19,
- "Vertical_Mask": 108
- }
- }
- Property { name: "left"; type: "QQuickAnchorLine" }
- Property { name: "right"; type: "QQuickAnchorLine" }
- Property { name: "horizontalCenter"; type: "QQuickAnchorLine" }
- Property { name: "top"; type: "QQuickAnchorLine" }
- Property { name: "bottom"; type: "QQuickAnchorLine" }
- Property { name: "verticalCenter"; type: "QQuickAnchorLine" }
- Property { name: "baseline"; type: "QQuickAnchorLine" }
- Property { name: "margins"; type: "double" }
- Property { name: "leftMargin"; type: "double" }
- Property { name: "rightMargin"; type: "double" }
- Property { name: "horizontalCenterOffset"; type: "double" }
- Property { name: "topMargin"; type: "double" }
- Property { name: "bottomMargin"; type: "double" }
- Property { name: "verticalCenterOffset"; type: "double" }
- Property { name: "baselineOffset"; type: "double" }
- Property { name: "fill"; type: "QQuickItem"; isPointer: true }
- Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
- Property { name: "alignWhenCentered"; type: "bool" }
- Signal { name: "centerAlignedChanged" }
- }
- Component {
- name: "QQuickAnimatedImage"
- defaultProperty: "data"
- prototype: "QQuickImage"
- exports: [
- "QtQuick/AnimatedImage 2.0",
- "QtQuick/AnimatedImage 2.1",
- "QtQuick/AnimatedImage 2.11",
- "QtQuick/AnimatedImage 2.3",
- "QtQuick/AnimatedImage 2.4",
- "QtQuick/AnimatedImage 2.5",
- "QtQuick/AnimatedImage 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 3, 4, 5, 7]
- Property { name: "playing"; type: "bool" }
- Property { name: "paused"; type: "bool" }
- Property { name: "currentFrame"; type: "int" }
- Property { name: "frameCount"; type: "int"; isReadonly: true }
- Property { name: "speed"; revision: 11; type: "double" }
- Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
- Signal { name: "frameChanged" }
- Signal { name: "speedChanged"; revision: 11 }
- }
- Component {
- name: "QQuickAnimatedSprite"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/AnimatedSprite 2.0",
- "QtQuick/AnimatedSprite 2.1",
- "QtQuick/AnimatedSprite 2.11",
- "QtQuick/AnimatedSprite 2.12",
- "QtQuick/AnimatedSprite 2.4",
- "QtQuick/AnimatedSprite 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 12, 4, 7]
- Enum {
- name: "LoopParameters"
- values: {
- "Infinite": -1
- }
- }
- Property { name: "running"; type: "bool" }
- Property { name: "interpolate"; type: "bool" }
- Property { name: "source"; type: "QUrl" }
- Property { name: "reverse"; type: "bool" }
- Property { name: "frameSync"; type: "bool" }
- Property { name: "frameCount"; type: "int" }
- Property { name: "frameHeight"; type: "int" }
- Property { name: "frameWidth"; type: "int" }
- Property { name: "frameX"; type: "int" }
- Property { name: "frameY"; type: "int" }
- Property { name: "frameRate"; type: "double" }
- Property { name: "frameDuration"; type: "int" }
- Property { name: "loops"; type: "int" }
- Property { name: "paused"; type: "bool" }
- Property { name: "currentFrame"; type: "int" }
- Signal {
- name: "pausedChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "runningChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "interpolateChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "sourceChanged"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Signal {
- name: "reverseChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "frameSyncChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "frameCountChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameXChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameYChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameRateChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "frameDurationChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "loopsChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "currentFrameChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal { name: "finished"; revision: 12 }
- Method { name: "start" }
- Method { name: "stop" }
- Method { name: "restart" }
- Method {
- name: "advance"
- Parameter { name: "frames"; type: "int" }
- }
- Method { name: "advance" }
- Method { name: "pause" }
- Method { name: "resume" }
- Method {
- name: "setRunning"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setPaused"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setInterpolate"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setSource"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Method {
- name: "setReverse"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setFrameSync"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setFrameCount"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameRate"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setFrameDuration"
- Parameter { name: "arg"; type: "int" }
- }
- Method { name: "resetFrameRate" }
- Method { name: "resetFrameDuration" }
- Method {
- name: "setLoops"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setCurrentFrame"
- Parameter { name: "arg"; type: "int" }
- }
- }
- Component {
- name: "QQuickAnimationController"
- defaultProperty: "animation"
- prototype: "QObject"
- exports: ["QtQuick/AnimationController 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "progress"; type: "double" }
- Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
- Method { name: "reload" }
- Method { name: "completeToBeginning" }
- Method { name: "completeToEnd" }
- }
- Component {
- name: "QQuickAnimationGroup"
- defaultProperty: "animations"
- prototype: "QQuickAbstractAnimation"
- Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickAnimator"
- prototype: "QQuickAbstractAnimation"
- exports: ["QtQuick/Animator 2.12", "QtQuick/Animator 2.2"]
- isCreatable: false
- exportMetaObjectRevisions: [12, 2]
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "easing"; type: "QEasingCurve" }
- Property { name: "duration"; type: "int" }
- Property { name: "to"; type: "double" }
- Property { name: "from"; type: "double" }
- Signal {
- name: "targetItemChanged"
- Parameter { type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "durationChanged"
- Parameter { name: "duration"; type: "int" }
- }
- Signal {
- name: "easingChanged"
- Parameter { name: "curve"; type: "QEasingCurve" }
- }
- Signal {
- name: "toChanged"
- Parameter { name: "to"; type: "double" }
- }
- Signal {
- name: "fromChanged"
- Parameter { name: "from"; type: "double" }
- }
- }
- Component {
- name: "QQuickApplication"
- prototype: "QQmlApplication"
- exports: ["QtQuick/Application 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "active"; type: "bool"; isReadonly: true }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true }
- Property { name: "state"; type: "Qt::ApplicationState"; isReadonly: true }
- Property { name: "font"; type: "QFont"; isReadonly: true }
- Property { name: "displayName"; type: "string" }
- Property { name: "screens"; type: "QQuickScreenInfo"; isList: true; isReadonly: true }
- Signal {
- name: "stateChanged"
- Parameter { name: "state"; type: "Qt::ApplicationState" }
- }
- }
- Component {
- name: "QQuickBasePositioner"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: [
- "QtQuick/Positioner 2.0",
- "QtQuick/Positioner 2.1",
- "QtQuick/Positioner 2.11",
- "QtQuick/Positioner 2.4",
- "QtQuick/Positioner 2.6",
- "QtQuick/Positioner 2.7",
- "QtQuick/Positioner 2.9"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- attachedType: "QQuickPositionerAttached"
- Property { name: "spacing"; type: "double" }
- Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
- Property { name: "move"; type: "QQuickTransition"; isPointer: true }
- Property { name: "add"; type: "QQuickTransition"; isPointer: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Signal { name: "positioningComplete"; revision: 9 }
- Method { name: "forceLayout"; revision: 9 }
- }
- Component {
- name: "QQuickBehavior"
- defaultProperty: "animation"
- prototype: "QObject"
- exports: ["QtQuick/Behavior 2.0", "QtQuick/Behavior 2.13"]
- exportMetaObjectRevisions: [0, 13]
- Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
- Property { name: "enabled"; type: "bool" }
- Property { name: "targetValue"; revision: 13; type: "QVariant"; isReadonly: true }
- }
- Component {
- name: "QQuickBorderImage"
- defaultProperty: "data"
- prototype: "QQuickImageBase"
- exports: [
- "QtQuick/BorderImage 2.0",
- "QtQuick/BorderImage 2.1",
- "QtQuick/BorderImage 2.11",
- "QtQuick/BorderImage 2.4",
- "QtQuick/BorderImage 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "TileMode"
- values: {
- "Stretch": 0,
- "Repeat": 1,
- "Round": 2
- }
- }
- Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true }
- Property { name: "horizontalTileMode"; type: "TileMode" }
- Property { name: "verticalTileMode"; type: "TileMode" }
- Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
- }
- Component {
- name: "QQuickBorderImageMesh"
- prototype: "QQuickShaderEffectMesh"
- exports: ["QtQuick/BorderImageMesh 2.8"]
- exportMetaObjectRevisions: [8]
- Enum {
- name: "TileMode"
- values: {
- "Stretch": 0,
- "Repeat": 1,
- "Round": 2
- }
- }
- Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true }
- Property { name: "size"; type: "QSize" }
- Property { name: "horizontalTileMode"; type: "TileMode" }
- Property { name: "verticalTileMode"; type: "TileMode" }
- }
- Component {
- name: "QQuickCanvasItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/Canvas 2.0",
- "QtQuick/Canvas 2.1",
- "QtQuick/Canvas 2.11",
- "QtQuick/Canvas 2.4",
- "QtQuick/Canvas 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "RenderTarget"
- values: {
- "Image": 0,
- "FramebufferObject": 1
- }
- }
- Enum {
- name: "RenderStrategy"
- values: {
- "Immediate": 0,
- "Threaded": 1,
- "Cooperative": 2
- }
- }
- Property { name: "available"; type: "bool"; isReadonly: true }
- Property { name: "contextType"; type: "string" }
- Property { name: "context"; type: "QJSValue"; isReadonly: true }
- Property { name: "canvasSize"; type: "QSizeF" }
- Property { name: "tileSize"; type: "QSize" }
- Property { name: "canvasWindow"; type: "QRectF" }
- Property { name: "renderTarget"; type: "RenderTarget" }
- Property { name: "renderStrategy"; type: "RenderStrategy" }
- Signal {
- name: "paint"
- Parameter { name: "region"; type: "QRect" }
- }
- Signal { name: "painted" }
- Signal { name: "imageLoaded" }
- Method {
- name: "loadImage"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "unloadImage"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageLoaded"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageLoading"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "isImageError"
- type: "bool"
- Parameter { name: "url"; type: "QUrl" }
- }
- Method {
- name: "getContext"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "requestAnimationFrame"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "cancelRequestAnimationFrame"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method { name: "requestPaint" }
- Method {
- name: "markDirty"
- Parameter { name: "dirtyRect"; type: "QRectF" }
- }
- Method { name: "markDirty" }
- Method {
- name: "save"
- type: "bool"
- Parameter { name: "filename"; type: "string" }
- }
- Method {
- name: "toDataURL"
- type: "string"
- Parameter { name: "type"; type: "string" }
- }
- Method { name: "toDataURL"; type: "string" }
- }
- Component {
- name: "QQuickCloseEvent"
- prototype: "QObject"
- Property { name: "accepted"; type: "bool" }
- }
- Component {
- name: "QQuickColorAnimation"
- prototype: "QQuickPropertyAnimation"
- exports: ["QtQuick/ColorAnimation 2.0", "QtQuick/ColorAnimation 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "from"; type: "QColor" }
- Property { name: "to"; type: "QColor" }
- }
- Component {
- name: "QQuickColumn"
- defaultProperty: "data"
- prototype: "QQuickBasePositioner"
- exports: [
- "QtQuick/Column 2.0",
- "QtQuick/Column 2.1",
- "QtQuick/Column 2.11",
- "QtQuick/Column 2.4",
- "QtQuick/Column 2.6",
- "QtQuick/Column 2.7",
- "QtQuick/Column 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- }
- Component {
- name: "QQuickCurve"
- prototype: "QQuickPathElement"
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- Property { name: "relativeX"; type: "double" }
- Property { name: "relativeY"; type: "double" }
- }
- Component {
- name: "QQuickDoubleValidator"
- prototype: "QDoubleValidator"
- exports: ["QtQuick/DoubleValidator 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "locale"; type: "string" }
- Signal { name: "localeNameChanged" }
- }
- Component {
- name: "QQuickDrag"
- prototype: "QObject"
- exports: ["QtQuick/Drag 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- attachedType: "QQuickDragAttached"
- Enum {
- name: "DragType"
- values: {
- "None": 0,
- "Automatic": 1,
- "Internal": 2
- }
- }
- Enum {
- name: "Axis"
- values: {
- "XAxis": 1,
- "YAxis": 2,
- "XAndYAxis": 3,
- "XandYAxis": 3
- }
- }
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "axis"; type: "Axis" }
- Property { name: "minimumX"; type: "double" }
- Property { name: "maximumX"; type: "double" }
- Property { name: "minimumY"; type: "double" }
- Property { name: "maximumY"; type: "double" }
- Property { name: "active"; type: "bool"; isReadonly: true }
- Property { name: "filterChildren"; type: "bool" }
- Property { name: "smoothed"; type: "bool" }
- Property { name: "threshold"; type: "double" }
- }
- Component {
- name: "QQuickDragAttached"
- prototype: "QObject"
- Property { name: "active"; type: "bool" }
- Property { name: "source"; type: "QObject"; isPointer: true }
- Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "hotSpot"; type: "QPointF" }
- Property { name: "imageSource"; type: "QUrl" }
- Property { name: "keys"; type: "QStringList" }
- Property { name: "mimeData"; type: "QVariantMap" }
- Property { name: "supportedActions"; type: "Qt::DropActions" }
- Property { name: "proposedAction"; type: "Qt::DropAction" }
- Property { name: "dragType"; type: "QQuickDrag::DragType" }
- Signal { name: "dragStarted" }
- Signal {
- name: "dragFinished"
- Parameter { name: "dropAction"; type: "Qt::DropAction" }
- }
- Method {
- name: "start"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "startDrag"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method { name: "cancel" }
- Method { name: "drop"; type: "int" }
- }
- Component {
- name: "QQuickDragAxis"
- prototype: "QObject"
- exports: ["QtQuick/DragAxis 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Property { name: "minimum"; type: "double" }
- Property { name: "maximum"; type: "double" }
- Property { name: "enabled"; type: "bool" }
- }
- Component {
- name: "QQuickDragHandler"
- prototype: "QQuickMultiPointHandler"
- exports: ["QtQuick/DragHandler 2.12", "QtQuick/DragHandler 2.14"]
- exportMetaObjectRevisions: [12, 14]
- Enum {
- name: "SnapMode"
- values: {
- "NoSnap": 0,
- "SnapAuto": 1,
- "SnapIfPressedOutsideTarget": 2,
- "SnapAlways": 3
- }
- }
- 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"; revision: 14; type: "SnapMode" }
- Signal { name: "snapModeChanged"; revision: 14 }
- }
- Component {
- name: "QQuickDropArea"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/DropArea 2.0",
- "QtQuick/DropArea 2.1",
- "QtQuick/DropArea 2.11",
- "QtQuick/DropArea 2.4",
- "QtQuick/DropArea 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "containsDrag"; type: "bool"; isReadonly: true }
- Property { name: "keys"; type: "QStringList" }
- Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true }
- Signal { name: "sourceChanged" }
- Signal {
- name: "entered"
- Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
- }
- Signal { name: "exited" }
- Signal {
- name: "positionChanged"
- Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
- }
- Signal {
- name: "dropped"
- Parameter { name: "drop"; type: "QQuickDropEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickDropAreaDrag"
- prototype: "QObject"
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true }
- Signal { name: "positionChanged" }
- }
- Component {
- name: "QQuickDropEvent"
- prototype: "QObject"
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "keys"; type: "QStringList"; isReadonly: true }
- Property { name: "supportedActions"; type: "Qt::DropActions"; isReadonly: true }
- Property { name: "proposedAction"; type: "Qt::DropActions"; isReadonly: true }
- Property { name: "action"; type: "Qt::DropAction" }
- Property { name: "accepted"; type: "bool" }
- Property { name: "hasColor"; type: "bool"; isReadonly: true }
- Property { name: "hasHtml"; type: "bool"; isReadonly: true }
- Property { name: "hasText"; type: "bool"; isReadonly: true }
- Property { name: "hasUrls"; type: "bool"; isReadonly: true }
- Property { name: "colorData"; type: "QVariant"; isReadonly: true }
- Property { name: "html"; type: "string"; isReadonly: true }
- Property { name: "text"; type: "string"; isReadonly: true }
- Property { name: "urls"; type: "QList<QUrl>"; isReadonly: true }
- Property { name: "formats"; type: "QStringList"; isReadonly: true }
- Method {
- name: "getDataAsString"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "getDataAsArrayBuffer"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "acceptProposedAction"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "accept"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- }
- Component {
- name: "QQuickEnterKeyAttached"
- prototype: "QObject"
- exports: ["QtQuick/EnterKey 2.6"]
- isCreatable: false
- exportMetaObjectRevisions: [6]
- Property { name: "type"; type: "Qt::EnterKeyType" }
- }
- Component {
- name: "QQuickEventPoint"
- prototype: "QObject"
- exports: ["QtQuick/EventPoint 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Enum {
- name: "States"
- values: {
- "Pressed": 1,
- "Updated": 2,
- "Stationary": 4,
- "Released": 8
- }
- }
- Enum {
- name: "GrabTransition"
- values: {
- "GrabPassive": 1,
- "UngrabPassive": 2,
- "CancelGrabPassive": 3,
- "OverrideGrabPassive": 4,
- "GrabExclusive": 16,
- "UngrabExclusive": 32,
- "CancelGrabExclusive": 48
- }
- }
- Property { name: "event"; type: "QQuickPointerEvent"; isReadonly: true; isPointer: true }
- Property { name: "position"; type: "QPointF"; isReadonly: true }
- Property { name: "scenePosition"; type: "QPointF"; isReadonly: true }
- Property { name: "scenePressPosition"; type: "QPointF"; isReadonly: true }
- Property { name: "sceneGrabPosition"; type: "QPointF"; isReadonly: true }
- Property { name: "state"; type: "State"; isReadonly: true }
- Property { name: "pointId"; type: "int"; isReadonly: true }
- Property { name: "timeHeld"; type: "double"; isReadonly: true }
- Property { name: "velocity"; type: "QVector2D"; isReadonly: true }
- Property { name: "accepted"; type: "bool" }
- Property { name: "exclusiveGrabber"; type: "QObject"; isPointer: true }
- }
- Component {
- name: "QQuickEventTouchPoint"
- prototype: "QQuickEventPoint"
- exports: ["QtQuick/EventTouchPoint 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Property { name: "rotation"; type: "double"; isReadonly: true }
- Property { name: "pressure"; type: "double"; isReadonly: true }
- Property { name: "ellipseDiameters"; type: "QSizeF"; isReadonly: true }
- Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true }
- }
- Component {
- name: "QQuickFlickable"
- defaultProperty: "flickableData"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/Flickable 2.0",
- "QtQuick/Flickable 2.1",
- "QtQuick/Flickable 2.10",
- "QtQuick/Flickable 2.11",
- "QtQuick/Flickable 2.12",
- "QtQuick/Flickable 2.4",
- "QtQuick/Flickable 2.7",
- "QtQuick/Flickable 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 10, 11, 12, 4, 7, 9]
- Enum {
- name: "BoundsBehavior"
- values: {
- "StopAtBounds": 0,
- "DragOverBounds": 1,
- "OvershootBounds": 2,
- "DragAndOvershootBounds": 3
- }
- }
- Enum {
- name: "BoundsMovement"
- values: {
- "FollowBoundsBehavior": 1
- }
- }
- Enum {
- name: "FlickableDirection"
- values: {
- "AutoFlickDirection": 0,
- "HorizontalFlick": 1,
- "VerticalFlick": 2,
- "HorizontalAndVerticalFlick": 3,
- "AutoFlickIfNeeded": 12
- }
- }
- Property { name: "contentWidth"; type: "double" }
- Property { name: "contentHeight"; type: "double" }
- Property { name: "contentX"; type: "double" }
- Property { name: "contentY"; type: "double" }
- Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "topMargin"; type: "double" }
- Property { name: "bottomMargin"; type: "double" }
- Property { name: "originY"; type: "double"; isReadonly: true }
- Property { name: "leftMargin"; type: "double" }
- Property { name: "rightMargin"; type: "double" }
- Property { name: "originX"; type: "double"; isReadonly: true }
- Property { name: "horizontalVelocity"; type: "double"; isReadonly: true }
- Property { name: "verticalVelocity"; type: "double"; isReadonly: true }
- Property { name: "boundsBehavior"; type: "BoundsBehavior" }
- Property { name: "boundsMovement"; revision: 10; type: "BoundsMovement" }
- Property { name: "rebound"; type: "QQuickTransition"; isPointer: true }
- Property { name: "maximumFlickVelocity"; type: "double" }
- Property { name: "flickDeceleration"; type: "double" }
- Property { name: "moving"; type: "bool"; isReadonly: true }
- Property { name: "movingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "movingVertically"; type: "bool"; isReadonly: true }
- Property { name: "flicking"; type: "bool"; isReadonly: true }
- Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "flickingVertically"; type: "bool"; isReadonly: true }
- Property { name: "dragging"; type: "bool"; isReadonly: true }
- Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true }
- Property { name: "draggingVertically"; type: "bool"; isReadonly: true }
- Property { name: "flickableDirection"; type: "FlickableDirection" }
- Property { name: "interactive"; type: "bool" }
- Property { name: "pressDelay"; type: "int" }
- Property { name: "atXEnd"; type: "bool"; isReadonly: true }
- Property { name: "atYEnd"; type: "bool"; isReadonly: true }
- Property { name: "atXBeginning"; type: "bool"; isReadonly: true }
- Property { name: "atYBeginning"; type: "bool"; isReadonly: true }
- Property {
- name: "visibleArea"
- type: "QQuickFlickableVisibleArea"
- isReadonly: true
- isPointer: true
- }
- Property { name: "pixelAligned"; type: "bool" }
- Property { name: "synchronousDrag"; revision: 12; type: "bool" }
- Property { name: "horizontalOvershoot"; revision: 9; type: "double"; isReadonly: true }
- Property { name: "verticalOvershoot"; revision: 9; type: "double"; isReadonly: true }
- Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
- Signal { name: "isAtBoundaryChanged" }
- Signal { name: "boundsMovementChanged"; revision: 10 }
- Signal { name: "movementStarted" }
- Signal { name: "movementEnded" }
- Signal { name: "flickStarted" }
- Signal { name: "flickEnded" }
- Signal { name: "dragStarted" }
- Signal { name: "dragEnded" }
- Signal { name: "synchronousDragChanged"; revision: 12 }
- Signal { name: "horizontalOvershootChanged"; revision: 9 }
- Signal { name: "verticalOvershootChanged"; revision: 9 }
- Method {
- name: "resizeContent"
- Parameter { name: "w"; type: "double" }
- Parameter { name: "h"; type: "double" }
- Parameter { name: "center"; type: "QPointF" }
- }
- Method { name: "returnToBounds" }
- Method {
- name: "flick"
- Parameter { name: "xVelocity"; type: "double" }
- Parameter { name: "yVelocity"; type: "double" }
- }
- Method { name: "cancelFlick" }
- }
- Component {
- name: "QQuickFlickableVisibleArea"
- prototype: "QObject"
- Property { name: "xPosition"; type: "double"; isReadonly: true }
- Property { name: "yPosition"; type: "double"; isReadonly: true }
- Property { name: "widthRatio"; type: "double"; isReadonly: true }
- Property { name: "heightRatio"; type: "double"; isReadonly: true }
- Signal {
- name: "xPositionChanged"
- Parameter { name: "xPosition"; type: "double" }
- }
- Signal {
- name: "yPositionChanged"
- Parameter { name: "yPosition"; type: "double" }
- }
- Signal {
- name: "widthRatioChanged"
- Parameter { name: "widthRatio"; type: "double" }
- }
- Signal {
- name: "heightRatioChanged"
- Parameter { name: "heightRatio"; type: "double" }
- }
- }
- Component {
- name: "QQuickFlipable"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/Flipable 2.0",
- "QtQuick/Flipable 2.1",
- "QtQuick/Flipable 2.11",
- "QtQuick/Flipable 2.4",
- "QtQuick/Flipable 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Side"
- values: {
- "Front": 0,
- "Back": 1
- }
- }
- Property { name: "front"; type: "QQuickItem"; isPointer: true }
- Property { name: "back"; type: "QQuickItem"; isPointer: true }
- Property { name: "side"; type: "Side"; isReadonly: true }
- }
- Component {
- name: "QQuickFlow"
- defaultProperty: "data"
- prototype: "QQuickBasePositioner"
- exports: [
- "QtQuick/Flow 2.0",
- "QtQuick/Flow 2.1",
- "QtQuick/Flow 2.11",
- "QtQuick/Flow 2.4",
- "QtQuick/Flow 2.6",
- "QtQuick/Flow 2.7",
- "QtQuick/Flow 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- Enum {
- name: "Flow"
- values: {
- "LeftToRight": 0,
- "TopToBottom": 1
- }
- }
- Property { name: "flow"; type: "Flow" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- }
- Component {
- name: "QQuickFocusScope"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/FocusScope 2.0",
- "QtQuick/FocusScope 2.1",
- "QtQuick/FocusScope 2.11",
- "QtQuick/FocusScope 2.4",
- "QtQuick/FocusScope 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- }
- Component {
- name: "QQuickFontLoader"
- prototype: "QObject"
- exports: ["QtQuick/FontLoader 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2,
- "Error": 3
- }
- }
- Property { name: "source"; type: "QUrl" }
- Property { name: "name"; type: "string" }
- Property { name: "status"; type: "Status"; isReadonly: true }
- }
- Component {
- name: "QQuickFontMetrics"
- prototype: "QObject"
- exports: ["QtQuick/FontMetrics 2.4"]
- exportMetaObjectRevisions: [4]
- Property { name: "font"; type: "QFont" }
- Property { name: "ascent"; type: "double"; isReadonly: true }
- Property { name: "descent"; type: "double"; isReadonly: true }
- Property { name: "height"; type: "double"; isReadonly: true }
- Property { name: "leading"; type: "double"; isReadonly: true }
- Property { name: "lineSpacing"; type: "double"; isReadonly: true }
- Property { name: "minimumLeftBearing"; type: "double"; isReadonly: true }
- Property { name: "minimumRightBearing"; type: "double"; isReadonly: true }
- Property { name: "maximumCharacterWidth"; type: "double"; isReadonly: true }
- Property { name: "xHeight"; type: "double"; isReadonly: true }
- Property { name: "averageCharacterWidth"; type: "double"; isReadonly: true }
- Property { name: "underlinePosition"; type: "double"; isReadonly: true }
- Property { name: "overlinePosition"; type: "double"; isReadonly: true }
- Property { name: "strikeOutPosition"; type: "double"; isReadonly: true }
- Property { name: "lineWidth"; type: "double"; isReadonly: true }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Method {
- name: "advanceWidth"
- type: "double"
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "boundingRect"
- type: "QRectF"
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "tightBoundingRect"
- type: "QRectF"
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "elidedText"
- type: "string"
- Parameter { name: "text"; type: "string" }
- Parameter { name: "mode"; type: "Qt::TextElideMode" }
- Parameter { name: "width"; type: "double" }
- Parameter { name: "flags"; type: "int" }
- }
- Method {
- name: "elidedText"
- type: "string"
- Parameter { name: "text"; type: "string" }
- Parameter { name: "mode"; type: "Qt::TextElideMode" }
- Parameter { name: "width"; type: "double" }
- }
- }
- Component {
- name: "QQuickFontValueType"
- exports: ["QtQuick/Font 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "FontWeight"
- values: {
- "Thin": 0,
- "ExtraLight": 12,
- "Light": 25,
- "Normal": 50,
- "Medium": 57,
- "DemiBold": 63,
- "Bold": 75,
- "ExtraBold": 81,
- "Black": 87
- }
- }
- Enum {
- name: "Capitalization"
- values: {
- "MixedCase": 0,
- "AllUppercase": 1,
- "AllLowercase": 2,
- "SmallCaps": 3,
- "Capitalize": 4
- }
- }
- Enum {
- name: "HintingPreference"
- values: {
- "PreferDefaultHinting": 0,
- "PreferNoHinting": 1,
- "PreferVerticalHinting": 2,
- "PreferFullHinting": 3
- }
- }
- Property { name: "family"; type: "string" }
- Property { name: "styleName"; type: "string" }
- Property { name: "bold"; type: "bool" }
- Property { name: "weight"; type: "FontWeight" }
- Property { name: "italic"; type: "bool" }
- Property { name: "underline"; type: "bool" }
- Property { name: "overline"; type: "bool" }
- Property { name: "strikeout"; type: "bool" }
- Property { name: "pointSize"; type: "double" }
- Property { name: "pixelSize"; type: "int" }
- Property { name: "capitalization"; type: "Capitalization" }
- Property { name: "letterSpacing"; type: "double" }
- Property { name: "wordSpacing"; type: "double" }
- Property { name: "hintingPreference"; type: "HintingPreference" }
- Property { name: "kerning"; type: "bool" }
- Property { name: "preferShaping"; type: "bool" }
- Method { name: "toString"; type: "string" }
- }
- Component {
- name: "QQuickGrabGestureEvent"
- prototype: "QObject"
- exports: ["QtQuick/GestureEvent 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "touchPoints"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "dragThreshold"; type: "double"; isReadonly: true }
- Method { name: "grab" }
- }
- Component {
- name: "QQuickGradient"
- defaultProperty: "stops"
- prototype: "QObject"
- exports: ["QtQuick/Gradient 2.0", "QtQuick/Gradient 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "Orientation"
- values: {
- "Vertical": 2,
- "Horizontal": 1
- }
- }
- Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true }
- Property { name: "orientation"; revision: 12; type: "Orientation" }
- Signal { name: "updated" }
- }
- Component {
- name: "QQuickGradientStop"
- prototype: "QObject"
- exports: ["QtQuick/GradientStop 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "position"; type: "double" }
- Property { name: "color"; type: "QColor" }
- }
- Component {
- name: "QQuickGraphicsInfo"
- prototype: "QObject"
- exports: ["QtQuick/GraphicsInfo 2.8"]
- isCreatable: false
- exportMetaObjectRevisions: [8]
- Enum {
- name: "GraphicsApi"
- values: {
- "Unknown": 0,
- "Software": 1,
- "OpenGL": 2,
- "Direct3D12": 3,
- "OpenVG": 4,
- "OpenGLRhi": 5,
- "Direct3D11Rhi": 6,
- "VulkanRhi": 7,
- "MetalRhi": 8,
- "NullRhi": 9
- }
- }
- Enum {
- name: "ShaderType"
- values: {
- "UnknownShadingLanguage": 0,
- "GLSL": 1,
- "HLSL": 2,
- "RhiShader": 3
- }
- }
- Enum {
- name: "ShaderCompilationType"
- values: {
- "RuntimeCompilation": 1,
- "OfflineCompilation": 2
- }
- }
- Enum {
- name: "ShaderSourceType"
- values: {
- "ShaderSourceString": 1,
- "ShaderSourceFile": 2,
- "ShaderByteCode": 4
- }
- }
- Enum {
- name: "OpenGLContextProfile"
- values: {
- "OpenGLNoProfile": 0,
- "OpenGLCoreProfile": 1,
- "OpenGLCompatibilityProfile": 2
- }
- }
- Enum {
- name: "RenderableType"
- values: {
- "SurfaceFormatUnspecified": 0,
- "SurfaceFormatOpenGL": 1,
- "SurfaceFormatOpenGLES": 2
- }
- }
- Property { name: "api"; type: "GraphicsApi"; isReadonly: true }
- Property { name: "shaderType"; type: "ShaderType"; isReadonly: true }
- Property { name: "shaderCompilationType"; type: "ShaderCompilationType"; isReadonly: true }
- Property { name: "shaderSourceType"; type: "ShaderSourceType"; isReadonly: true }
- Property { name: "majorVersion"; type: "int"; isReadonly: true }
- Property { name: "minorVersion"; type: "int"; isReadonly: true }
- Property { name: "profile"; type: "OpenGLContextProfile"; isReadonly: true }
- Property { name: "renderableType"; type: "RenderableType"; isReadonly: true }
- }
- Component {
- name: "QQuickGrid"
- defaultProperty: "data"
- prototype: "QQuickBasePositioner"
- exports: [
- "QtQuick/Grid 2.0",
- "QtQuick/Grid 2.1",
- "QtQuick/Grid 2.11",
- "QtQuick/Grid 2.4",
- "QtQuick/Grid 2.6",
- "QtQuick/Grid 2.7",
- "QtQuick/Grid 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- Enum {
- name: "Flow"
- values: {
- "LeftToRight": 0,
- "TopToBottom": 1
- }
- }
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Property { name: "rows"; type: "int" }
- Property { name: "columns"; type: "int" }
- Property { name: "rowSpacing"; type: "double" }
- Property { name: "columnSpacing"; type: "double" }
- Property { name: "flow"; type: "Flow" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" }
- Property {
- name: "effectiveHorizontalItemAlignment"
- revision: 1
- type: "HAlignment"
- isReadonly: true
- }
- Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" }
- Signal {
- name: "horizontalAlignmentChanged"
- revision: 1
- Parameter { name: "alignment"; type: "HAlignment" }
- }
- Signal {
- name: "effectiveHorizontalAlignmentChanged"
- revision: 1
- Parameter { name: "alignment"; type: "HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- revision: 1
- Parameter { name: "alignment"; type: "VAlignment" }
- }
- }
- Component {
- name: "QQuickGridMesh"
- prototype: "QQuickShaderEffectMesh"
- exports: ["QtQuick/GridMesh 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "resolution"; type: "QSize" }
- }
- Component {
- name: "QQuickGridView"
- defaultProperty: "data"
- prototype: "QQuickItemView"
- exports: [
- "QtQuick/GridView 2.0",
- "QtQuick/GridView 2.1",
- "QtQuick/GridView 2.10",
- "QtQuick/GridView 2.11",
- "QtQuick/GridView 2.12",
- "QtQuick/GridView 2.13",
- "QtQuick/GridView 2.3",
- "QtQuick/GridView 2.4",
- "QtQuick/GridView 2.7",
- "QtQuick/GridView 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 10, 11, 12, 13, 3, 4, 7, 9]
- attachedType: "QQuickGridViewAttached"
- Enum {
- name: "Flow"
- values: {
- "FlowLeftToRight": 0,
- "FlowTopToBottom": 2
- }
- }
- Enum {
- name: "SnapMode"
- values: {
- "NoSnap": 0,
- "SnapToRow": 1,
- "SnapOneRow": 2
- }
- }
- Property { name: "flow"; type: "Flow" }
- Property { name: "cellWidth"; type: "double" }
- Property { name: "cellHeight"; type: "double" }
- Property { name: "snapMode"; type: "SnapMode" }
- Signal { name: "highlightMoveDurationChanged" }
- Method { name: "moveCurrentIndexUp" }
- Method { name: "moveCurrentIndexDown" }
- Method { name: "moveCurrentIndexLeft" }
- Method { name: "moveCurrentIndexRight" }
- }
- Component { name: "QQuickGridViewAttached"; prototype: "QQuickItemViewAttached" }
- Component {
- name: "QQuickHoverHandler"
- prototype: "QQuickSinglePointHandler"
- exports: ["QtQuick/HoverHandler 2.12"]
- exportMetaObjectRevisions: [12]
- Property { name: "hovered"; type: "bool"; isReadonly: true }
- }
- Component {
- name: "QQuickImage"
- defaultProperty: "data"
- prototype: "QQuickImageBase"
- exports: [
- "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, 14, 3, 4, 5, 7]
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "FillMode"
- values: {
- "Stretch": 0,
- "PreserveAspectFit": 1,
- "PreserveAspectCrop": 2,
- "Tile": 3,
- "TileVertically": 4,
- "TileHorizontally": 5,
- "Pad": 6
- }
- }
- Property { name: "fillMode"; type: "FillMode" }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "mipmap"; revision: 3; type: "bool" }
- Property { name: "autoTransform"; revision: 5; type: "bool" }
- Signal { name: "paintedGeometryChanged" }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "VAlignment" }
- }
- Signal {
- name: "mipmapChanged"
- revision: 3
- Parameter { type: "bool" }
- }
- Signal { name: "autoTransformChanged"; revision: 5 }
- }
- Component {
- name: "QQuickImageBase"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: ["QtQuick/ImageBase 2.14"]
- isCreatable: false
- exportMetaObjectRevisions: [14]
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2,
- "Error": 3
- }
- }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "source"; type: "QUrl" }
- Property { name: "progress"; type: "double"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- 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" }
- }
- Signal {
- name: "statusChanged"
- Parameter { type: "QQuickImageBase::Status" }
- }
- Signal {
- name: "progressChanged"
- Parameter { name: "progress"; type: "double" }
- }
- Signal { name: "currentFrameChanged"; revision: 14 }
- Signal { name: "frameCountChanged"; revision: 14 }
- }
- Component {
- name: "QQuickImplicitSizeItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- Property { name: "implicitWidth"; type: "double"; isReadonly: true }
- Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QQuickIntValidator"
- prototype: "QIntValidator"
- exports: ["QtQuick/IntValidator 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "locale"; type: "string" }
- Signal { name: "localeNameChanged" }
- }
- Component {
- name: "QQuickItem"
- defaultProperty: "data"
- prototype: "QObject"
- exports: [
- "QtQuick/Item 2.0",
- "QtQuick/Item 2.1",
- "QtQuick/Item 2.11",
- "QtQuick/Item 2.4",
- "QtQuick/Item 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Flags"
- values: {
- "ItemClipsChildrenToShape": 1,
- "ItemAcceptsInputMethod": 2,
- "ItemIsFocusScope": 4,
- "ItemHasContents": 8,
- "ItemAcceptsDrops": 16
- }
- }
- Enum {
- name: "TransformOrigin"
- values: {
- "TopLeft": 0,
- "Top": 1,
- "TopRight": 2,
- "Left": 3,
- "Center": 4,
- "Right": 5,
- "BottomLeft": 6,
- "Bottom": 7,
- "BottomRight": 8
- }
- }
- Property { name: "parent"; type: "QQuickItem"; isPointer: true }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- Property { name: "z"; type: "double" }
- Property { name: "width"; type: "double" }
- Property { name: "height"; type: "double" }
- Property { name: "opacity"; type: "double" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "visible"; type: "bool" }
- Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
- Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
- Property { name: "state"; type: "string" }
- Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
- Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
- Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "baselineOffset"; type: "double" }
- Property { name: "clip"; type: "bool" }
- Property { name: "focus"; type: "bool" }
- Property { name: "activeFocus"; type: "bool"; isReadonly: true }
- Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
- Property { name: "rotation"; type: "double" }
- Property { name: "scale"; type: "double" }
- Property { name: "transformOrigin"; type: "TransformOrigin" }
- Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
- Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
- Property { name: "smooth"; type: "bool" }
- Property { name: "antialiasing"; type: "bool" }
- Property { name: "implicitWidth"; type: "double" }
- Property { name: "implicitHeight"; type: "double" }
- Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
- Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
- Signal {
- name: "childrenRectChanged"
- Parameter { type: "QRectF" }
- }
- Signal {
- name: "baselineOffsetChanged"
- Parameter { type: "double" }
- }
- Signal {
- name: "stateChanged"
- Parameter { type: "string" }
- }
- Signal {
- name: "focusChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "activeFocusChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "activeFocusOnTabChanged"
- revision: 1
- Parameter { type: "bool" }
- }
- Signal {
- name: "parentChanged"
- Parameter { type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "transformOriginChanged"
- Parameter { type: "TransformOrigin" }
- }
- Signal {
- name: "smoothChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "antialiasingChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "clipChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "windowChanged"
- revision: 1
- Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
- }
- Signal { name: "containmentMaskChanged"; revision: 11 }
- Method { name: "update" }
- Method {
- name: "grabToImage"
- revision: 4
- type: "bool"
- Parameter { name: "callback"; type: "QJSValue" }
- Parameter { name: "targetSize"; type: "QSize" }
- }
- Method {
- name: "grabToImage"
- revision: 4
- type: "bool"
- Parameter { name: "callback"; type: "QJSValue" }
- }
- Method {
- name: "contains"
- type: "bool"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "mapFromItem"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapToItem"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapFromGlobal"
- revision: 7
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapToGlobal"
- revision: 7
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method { name: "forceActiveFocus" }
- Method {
- name: "forceActiveFocus"
- Parameter { name: "reason"; type: "Qt::FocusReason" }
- }
- Method {
- name: "nextItemInFocusChain"
- revision: 1
- type: "QQuickItem*"
- Parameter { name: "forward"; type: "bool" }
- }
- Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
- Method {
- name: "childAt"
- type: "QQuickItem*"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- }
- Component {
- name: "QQuickItemGrabResult"
- prototype: "QObject"
- Property { name: "image"; type: "QImage"; isReadonly: true }
- Property { name: "url"; type: "QUrl"; isReadonly: true }
- Signal { name: "ready" }
- Method {
- name: "saveToFile"
- type: "bool"
- Parameter { name: "fileName"; type: "string" }
- }
- Method {
- name: "saveToFile"
- type: "bool"
- Parameter { name: "fileName"; type: "string" }
- }
- }
- Component {
- name: "QQuickItemLayer"
- prototype: "QObject"
- Property { name: "enabled"; type: "bool" }
- Property { name: "textureSize"; type: "QSize" }
- Property { name: "sourceRect"; type: "QRectF" }
- Property { name: "mipmap"; type: "bool" }
- Property { name: "smooth"; type: "bool" }
- Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" }
- Property { name: "format"; type: "QQuickShaderEffectSource::Format" }
- Property { name: "samplerName"; type: "QByteArray" }
- Property { name: "effect"; type: "QQmlComponent"; isPointer: true }
- Property { name: "textureMirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
- Property { name: "samples"; type: "int" }
- Signal {
- name: "enabledChanged"
- Parameter { name: "enabled"; type: "bool" }
- }
- Signal {
- name: "sizeChanged"
- Parameter { name: "size"; type: "QSize" }
- }
- Signal {
- name: "mipmapChanged"
- Parameter { name: "mipmap"; type: "bool" }
- }
- Signal {
- name: "wrapModeChanged"
- Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" }
- }
- Signal {
- name: "nameChanged"
- Parameter { name: "name"; type: "QByteArray" }
- }
- Signal {
- name: "effectChanged"
- Parameter { name: "component"; type: "QQmlComponent"; isPointer: true }
- }
- Signal {
- name: "smoothChanged"
- Parameter { name: "smooth"; type: "bool" }
- }
- Signal {
- name: "formatChanged"
- Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" }
- }
- Signal {
- name: "sourceRectChanged"
- Parameter { name: "sourceRect"; type: "QRectF" }
- }
- Signal {
- name: "textureMirroringChanged"
- Parameter { name: "mirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
- }
- Signal {
- name: "samplesChanged"
- Parameter { name: "count"; type: "int" }
- }
- }
- Component {
- name: "QQuickItemView"
- defaultProperty: "flickableData"
- prototype: "QQuickFlickable"
- exports: [
- "QtQuick/ItemView 2.1",
- "QtQuick/ItemView 2.10",
- "QtQuick/ItemView 2.11",
- "QtQuick/ItemView 2.12",
- "QtQuick/ItemView 2.13",
- "QtQuick/ItemView 2.3",
- "QtQuick/ItemView 2.4",
- "QtQuick/ItemView 2.7",
- "QtQuick/ItemView 2.9"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [1, 10, 11, 12, 13, 3, 4, 7, 9]
- Enum {
- name: "LayoutDirection"
- values: {
- "LeftToRight": 0,
- "RightToLeft": 1,
- "VerticalTopToBottom": 2,
- "VerticalBottomToTop": 3
- }
- }
- Enum {
- name: "VerticalLayoutDirection"
- values: {
- "TopToBottom": 2,
- "BottomToTop": 3
- }
- }
- Enum {
- name: "HighlightRangeMode"
- values: {
- "NoHighlightRange": 0,
- "ApplyRange": 1,
- "StrictlyEnforceRange": 2
- }
- }
- Enum {
- name: "PositionMode"
- values: {
- "Beginning": 0,
- "Center": 1,
- "End": 2,
- "Visible": 3,
- "Contain": 4,
- "SnapPosition": 5
- }
- }
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "currentIndex"; type: "int" }
- Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "keyNavigationWraps"; type: "bool" }
- Property { name: "keyNavigationEnabled"; revision: 7; type: "bool" }
- Property { name: "cacheBuffer"; type: "int" }
- Property { name: "displayMarginBeginning"; revision: 3; type: "int" }
- Property { name: "displayMarginEnd"; revision: 3; type: "int" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" }
- Property { name: "header"; type: "QQmlComponent"; isPointer: true }
- Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "footer"; type: "QQmlComponent"; isPointer: true }
- Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
- Property { name: "add"; type: "QQuickTransition"; isPointer: true }
- Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "move"; type: "QQuickTransition"; isPointer: true }
- Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "remove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "displaced"; type: "QQuickTransition"; isPointer: true }
- Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "highlightFollowsCurrentItem"; type: "bool" }
- Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
- Property { name: "preferredHighlightBegin"; type: "double" }
- Property { name: "preferredHighlightEnd"; type: "double" }
- Property { name: "highlightMoveDuration"; type: "int" }
- Signal { name: "keyNavigationEnabledChanged"; revision: 7 }
- Signal { name: "populateTransitionChanged" }
- Signal { name: "addTransitionChanged" }
- Signal { name: "addDisplacedTransitionChanged" }
- Signal { name: "moveTransitionChanged" }
- Signal { name: "moveDisplacedTransitionChanged" }
- Signal { name: "removeTransitionChanged" }
- Signal { name: "removeDisplacedTransitionChanged" }
- Signal { name: "displacedTransitionChanged" }
- Method {
- name: "positionViewAtIndex"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "mode"; type: "int" }
- }
- Method {
- name: "indexAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "itemAt"
- type: "QQuickItem*"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "itemAtIndex"
- revision: 13
- type: "QQuickItem*"
- Parameter { name: "index"; type: "int" }
- }
- Method { name: "positionViewAtBeginning" }
- Method { name: "positionViewAtEnd" }
- Method { name: "forceLayout"; revision: 1 }
- }
- Component {
- name: "QQuickItemViewAttached"
- prototype: "QObject"
- Property { name: "view"; type: "QQuickItemView"; isReadonly: true; isPointer: true }
- Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
- Property { name: "delayRemove"; type: "bool" }
- Property { name: "section"; type: "string"; isReadonly: true }
- Property { name: "previousSection"; type: "string"; isReadonly: true }
- Property { name: "nextSection"; type: "string"; isReadonly: true }
- Signal { name: "currentItemChanged" }
- Signal { name: "add" }
- Signal { name: "remove" }
- Signal { name: "prevSectionChanged" }
- }
- Component {
- name: "QQuickKeyEvent"
- prototype: "QObject"
- Property { name: "key"; type: "int"; isReadonly: true }
- Property { name: "text"; type: "string"; isReadonly: true }
- Property { name: "modifiers"; type: "int"; isReadonly: true }
- Property { name: "isAutoRepeat"; type: "bool"; isReadonly: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "nativeScanCode"; type: "uint"; isReadonly: true }
- Property { name: "accepted"; type: "bool" }
- Method {
- name: "matches"
- revision: 2
- type: "bool"
- Parameter { name: "key"; type: "QKeySequence::StandardKey" }
- }
- }
- Component {
- name: "QQuickKeyNavigationAttached"
- prototype: "QObject"
- exports: ["QtQuick/KeyNavigation 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Priority"
- values: {
- "BeforeItem": 0,
- "AfterItem": 1
- }
- }
- Property { name: "left"; type: "QQuickItem"; isPointer: true }
- Property { name: "right"; type: "QQuickItem"; isPointer: true }
- Property { name: "up"; type: "QQuickItem"; isPointer: true }
- Property { name: "down"; type: "QQuickItem"; isPointer: true }
- Property { name: "tab"; type: "QQuickItem"; isPointer: true }
- Property { name: "backtab"; type: "QQuickItem"; isPointer: true }
- Property { name: "priority"; type: "Priority" }
- }
- Component {
- name: "QQuickKeysAttached"
- prototype: "QObject"
- exports: ["QtQuick/Keys 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Priority"
- values: {
- "BeforeItem": 0,
- "AfterItem": 1
- }
- }
- Property { name: "enabled"; type: "bool" }
- Property { name: "forwardTo"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "priority"; type: "Priority" }
- Signal {
- name: "pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "released"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "shortcutOverride"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit0Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit1Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit2Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit3Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit4Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit5Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit6Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit7Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit8Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "digit9Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "leftPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "rightPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "upPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "downPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "tabPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "backtabPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "asteriskPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "numberSignPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "escapePressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "returnPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "enterPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "deletePressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "spacePressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "backPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "cancelPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "selectPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "yesPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "noPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "context1Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "context2Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "context3Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "context4Pressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "callPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "hangupPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "flipPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "menuPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "volumeUpPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- Signal {
- name: "volumeDownPressed"
- Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickLayoutMirroringAttached"
- prototype: "QObject"
- exports: ["QtQuick/LayoutMirroring 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "enabled"; type: "bool" }
- Property { name: "childrenInherit"; type: "bool" }
- }
- Component {
- name: "QQuickListView"
- defaultProperty: "data"
- prototype: "QQuickItemView"
- exports: [
- "QtQuick/ListView 2.0",
- "QtQuick/ListView 2.1",
- "QtQuick/ListView 2.10",
- "QtQuick/ListView 2.11",
- "QtQuick/ListView 2.12",
- "QtQuick/ListView 2.13",
- "QtQuick/ListView 2.3",
- "QtQuick/ListView 2.4",
- "QtQuick/ListView 2.7",
- "QtQuick/ListView 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 10, 11, 12, 13, 3, 4, 7, 9]
- attachedType: "QQuickListViewAttached"
- Enum {
- name: "Orientation"
- values: {
- "Horizontal": 1,
- "Vertical": 2
- }
- }
- Enum {
- name: "SnapMode"
- values: {
- "NoSnap": 0,
- "SnapToItem": 1,
- "SnapOneItem": 2
- }
- }
- Enum {
- name: "HeaderPositioning"
- values: {
- "InlineHeader": 0,
- "OverlayHeader": 1,
- "PullBackHeader": 2
- }
- }
- Enum {
- name: "FooterPositioning"
- values: {
- "InlineFooter": 0,
- "OverlayFooter": 1,
- "PullBackFooter": 2
- }
- }
- Property { name: "highlightMoveVelocity"; type: "double" }
- Property { name: "highlightResizeVelocity"; type: "double" }
- Property { name: "highlightResizeDuration"; type: "int" }
- Property { name: "spacing"; type: "double" }
- Property { name: "orientation"; type: "Orientation" }
- Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
- Property { name: "currentSection"; type: "string"; isReadonly: true }
- Property { name: "snapMode"; type: "SnapMode" }
- Property { name: "headerPositioning"; revision: 4; type: "HeaderPositioning" }
- Property { name: "footerPositioning"; revision: 4; type: "FooterPositioning" }
- Signal { name: "headerPositioningChanged"; revision: 4 }
- Signal { name: "footerPositioningChanged"; revision: 4 }
- Method { name: "incrementCurrentIndex" }
- Method { name: "decrementCurrentIndex" }
- }
- Component { name: "QQuickListViewAttached"; prototype: "QQuickItemViewAttached" }
- Component {
- name: "QQuickLoader"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: [
- "QtQuick/Loader 2.0",
- "QtQuick/Loader 2.1",
- "QtQuick/Loader 2.11",
- "QtQuick/Loader 2.4",
- "QtQuick/Loader 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2,
- "Error": 3
- }
- }
- Property { name: "active"; type: "bool" }
- Property { name: "source"; type: "QUrl" }
- Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true }
- Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "progress"; type: "double"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- Signal { name: "loaded" }
- Method {
- name: "setSource"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- }
- Component {
- name: "QQuickMatrix4x4"
- prototype: "QQuickTransform"
- exports: ["QtQuick/Matrix4x4 2.3"]
- exportMetaObjectRevisions: [3]
- Property { name: "matrix"; type: "QMatrix4x4" }
- }
- Component {
- name: "QQuickMouseArea"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/MouseArea 2.0",
- "QtQuick/MouseArea 2.1",
- "QtQuick/MouseArea 2.11",
- "QtQuick/MouseArea 2.4",
- "QtQuick/MouseArea 2.5",
- "QtQuick/MouseArea 2.7",
- "QtQuick/MouseArea 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 5, 7, 9]
- Property { name: "mouseX"; type: "double"; isReadonly: true }
- Property { name: "mouseY"; type: "double"; isReadonly: true }
- Property { name: "containsMouse"; type: "bool"; isReadonly: true }
- Property { name: "pressed"; type: "bool"; isReadonly: true }
- Property { name: "enabled"; type: "bool" }
- Property { name: "scrollGestureEnabled"; revision: 5; type: "bool" }
- Property { name: "pressedButtons"; type: "Qt::MouseButtons"; isReadonly: true }
- Property { name: "acceptedButtons"; type: "Qt::MouseButtons" }
- Property { name: "hoverEnabled"; type: "bool" }
- Property { name: "drag"; type: "QQuickDrag"; isReadonly: true; isPointer: true }
- Property { name: "preventStealing"; type: "bool" }
- Property { name: "propagateComposedEvents"; type: "bool" }
- Property { name: "cursorShape"; type: "Qt::CursorShape" }
- Property { name: "containsPress"; revision: 4; type: "bool"; isReadonly: true }
- Property { name: "pressAndHoldInterval"; revision: 9; type: "int" }
- Signal { name: "hoveredChanged" }
- Signal { name: "scrollGestureEnabledChanged"; revision: 5 }
- Signal {
- name: "positionChanged"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "mouseXChanged"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "mouseYChanged"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "pressed"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "pressAndHold"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "released"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "clicked"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "doubleClicked"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- Signal {
- name: "wheel"
- Parameter { name: "wheel"; type: "QQuickWheelEvent"; isPointer: true }
- }
- Signal { name: "entered" }
- Signal { name: "exited" }
- Signal { name: "canceled" }
- Signal { name: "containsPressChanged"; revision: 4 }
- 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" }
- Property { name: "maximumPointCount"; type: "int" }
- Property { name: "centroid"; type: "QQuickHandlerPoint"; isReadonly: true }
- Signal { name: "marginChanged" }
- }
- Component {
- name: "QQuickMultiPointTouchArea"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/MultiPointTouchArea 2.0",
- "QtQuick/MultiPointTouchArea 2.1",
- "QtQuick/MultiPointTouchArea 2.11",
- "QtQuick/MultiPointTouchArea 2.4",
- "QtQuick/MultiPointTouchArea 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true }
- Property { name: "minimumTouchPoints"; type: "int" }
- Property { name: "maximumTouchPoints"; type: "int" }
- Property { name: "mouseEnabled"; type: "bool" }
- Signal {
- name: "pressed"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "updated"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "released"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "canceled"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- Signal {
- name: "gestureStarted"
- Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true }
- }
- Signal {
- name: "touchUpdated"
- Parameter { name: "touchPoints"; type: "QList<QObject*>" }
- }
- }
- Component {
- name: "QQuickNumberAnimation"
- prototype: "QQuickPropertyAnimation"
- exports: [
- "QtQuick/NumberAnimation 2.0",
- "QtQuick/NumberAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "from"; type: "double" }
- Property { name: "to"; type: "double" }
- }
- Component {
- name: "QQuickOpacityAnimator"
- prototype: "QQuickAnimator"
- exports: [
- "QtQuick/OpacityAnimator 2.12",
- "QtQuick/OpacityAnimator 2.2"
- ]
- exportMetaObjectRevisions: [12, 2]
- }
- Component {
- name: "QQuickOpenGLInfo"
- prototype: "QObject"
- exports: ["QtQuick/OpenGLInfo 2.4"]
- isCreatable: false
- exportMetaObjectRevisions: [4]
- Enum {
- name: "ContextProfile"
- values: {
- "NoProfile": 0,
- "CoreProfile": 1,
- "CompatibilityProfile": 2
- }
- }
- Enum {
- name: "RenderableType"
- values: {
- "Unspecified": 0,
- "OpenGL": 1,
- "OpenGLES": 2
- }
- }
- Property { name: "majorVersion"; type: "int"; isReadonly: true }
- Property { name: "minorVersion"; type: "int"; isReadonly: true }
- Property { name: "profile"; type: "ContextProfile"; isReadonly: true }
- Property { name: "renderableType"; type: "RenderableType"; isReadonly: true }
- }
- Component {
- name: "QQuickPackage"
- defaultProperty: "data"
- prototype: "QObject"
- exports: ["QtQuick/Package 2.0"]
- exportMetaObjectRevisions: [0]
- attachedType: "QQuickPackageAttached"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickPackageAttached"
- prototype: "QObject"
- Property { name: "name"; type: "string" }
- }
- Component {
- name: "QQuickPaintedItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/PaintedItem 2.0",
- "QtQuick/PaintedItem 2.1",
- "QtQuick/PaintedItem 2.11",
- "QtQuick/PaintedItem 2.4",
- "QtQuick/PaintedItem 2.7"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "RenderTarget"
- values: {
- "Image": 0,
- "FramebufferObject": 1,
- "InvertedYFramebufferObject": 2
- }
- }
- Enum {
- name: "PerformanceHints"
- values: {
- "FastFBOResizing": 1
- }
- }
- Property { name: "contentsSize"; type: "QSize" }
- Property { name: "fillColor"; type: "QColor" }
- Property { name: "contentsScale"; type: "double" }
- Property { name: "renderTarget"; type: "RenderTarget" }
- Property { name: "textureSize"; type: "QSize" }
- }
- Component {
- name: "QQuickParallelAnimation"
- defaultProperty: "animations"
- prototype: "QQuickAnimationGroup"
- exports: [
- "QtQuick/ParallelAnimation 2.0",
- "QtQuick/ParallelAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- }
- Component {
- name: "QQuickParentAnimation"
- defaultProperty: "animations"
- prototype: "QQuickAnimationGroup"
- exports: [
- "QtQuick/ParentAnimation 2.0",
- "QtQuick/ParentAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "newParent"; type: "QQuickItem"; isPointer: true }
- Property { name: "via"; type: "QQuickItem"; isPointer: true }
- }
- Component {
- name: "QQuickParentChange"
- prototype: "QQuickStateOperation"
- exports: ["QtQuick/ParentChange 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "parent"; type: "QQuickItem"; isPointer: true }
- Property { name: "x"; type: "QQmlScriptString" }
- Property { name: "y"; type: "QQmlScriptString" }
- Property { name: "width"; type: "QQmlScriptString" }
- Property { name: "height"; type: "QQmlScriptString" }
- Property { name: "scale"; type: "QQmlScriptString" }
- Property { name: "rotation"; type: "QQmlScriptString" }
- }
- Component {
- name: "QQuickPath"
- defaultProperty: "pathElements"
- prototype: "QObject"
- exports: ["QtQuick/Path 2.0", "QtQuick/Path 2.14"]
- exportMetaObjectRevisions: [0, 14]
- Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true }
- Property { name: "startX"; type: "double" }
- Property { name: "startY"; type: "double" }
- Property { name: "closed"; type: "bool"; isReadonly: true }
- Property { name: "scale"; revision: 14; type: "QSizeF" }
- Signal { name: "changed" }
- Signal { name: "scaleChanged"; revision: 14 }
- Method {
- name: "pointAtPercent"
- revision: 14
- type: "QPointF"
- Parameter { name: "t"; type: "double" }
- }
- }
- Component {
- name: "QQuickPathAngleArc"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathAngleArc 2.11"]
- exportMetaObjectRevisions: [11]
- Property { name: "centerX"; type: "double" }
- Property { name: "centerY"; type: "double" }
- Property { name: "radiusX"; type: "double" }
- Property { name: "radiusY"; type: "double" }
- Property { name: "startAngle"; type: "double" }
- Property { name: "sweepAngle"; type: "double" }
- Property { name: "moveToStart"; type: "bool" }
- }
- Component {
- name: "QQuickPathAnimation"
- prototype: "QQuickAbstractAnimation"
- exports: ["QtQuick/PathAnimation 2.0", "QtQuick/PathAnimation 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "Orientation"
- values: {
- "Fixed": 0,
- "RightFirst": 1,
- "LeftFirst": 2,
- "BottomFirst": 3,
- "TopFirst": 4
- }
- }
- Property { name: "duration"; type: "int" }
- Property { name: "easing"; type: "QEasingCurve" }
- Property { name: "path"; type: "QQuickPath"; isPointer: true }
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "orientation"; type: "Orientation" }
- Property { name: "anchorPoint"; type: "QPointF" }
- Property { name: "orientationEntryDuration"; type: "int" }
- Property { name: "orientationExitDuration"; type: "int" }
- Property { name: "endRotation"; type: "double" }
- Signal {
- name: "durationChanged"
- Parameter { type: "int" }
- }
- Signal {
- name: "easingChanged"
- Parameter { type: "QEasingCurve" }
- }
- Signal {
- name: "orientationChanged"
- Parameter { type: "Orientation" }
- }
- Signal {
- name: "anchorPointChanged"
- Parameter { type: "QPointF" }
- }
- Signal {
- name: "orientationEntryDurationChanged"
- Parameter { type: "double" }
- }
- Signal {
- name: "orientationExitDurationChanged"
- Parameter { type: "double" }
- }
- Signal {
- name: "endRotationChanged"
- Parameter { type: "double" }
- }
- }
- Component {
- name: "QQuickPathArc"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathArc 2.0", "QtQuick/PathArc 2.9"]
- exportMetaObjectRevisions: [0, 9]
- Enum {
- name: "ArcDirection"
- values: {
- "Clockwise": 0,
- "Counterclockwise": 1
- }
- }
- Property { name: "radiusX"; type: "double" }
- Property { name: "radiusY"; type: "double" }
- Property { name: "useLargeArc"; type: "bool" }
- Property { name: "direction"; type: "ArcDirection" }
- Property { name: "xAxisRotation"; revision: 9; type: "double" }
- Signal { name: "xAxisRotationChanged"; revision: 9 }
- }
- Component {
- name: "QQuickPathAttribute"
- prototype: "QQuickPathElement"
- exports: ["QtQuick/PathAttribute 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "name"; type: "string" }
- Property { name: "value"; type: "double" }
- }
- Component {
- name: "QQuickPathCatmullRomCurve"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathCurve 2.0"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickPathCubic"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathCubic 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "control1X"; type: "double" }
- Property { name: "control1Y"; type: "double" }
- Property { name: "control2X"; type: "double" }
- Property { name: "control2Y"; type: "double" }
- Property { name: "relativeControl1X"; type: "double" }
- Property { name: "relativeControl1Y"; type: "double" }
- Property { name: "relativeControl2X"; type: "double" }
- Property { name: "relativeControl2Y"; type: "double" }
- }
- Component {
- name: "QQuickPathElement"
- prototype: "QObject"
- Signal { name: "changed" }
- }
- Component {
- name: "QQuickPathInterpolator"
- prototype: "QObject"
- exports: ["QtQuick/PathInterpolator 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "path"; type: "QQuickPath"; isPointer: true }
- Property { name: "progress"; type: "double" }
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "angle"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QQuickPathLine"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathLine 2.0"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickPathMove"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathMove 2.9"]
- exportMetaObjectRevisions: [9]
- }
- Component {
- name: "QQuickPathMultiline"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathMultiline 2.14"]
- exportMetaObjectRevisions: [14]
- Property { name: "start"; type: "QPointF"; isReadonly: true }
- Property { name: "paths"; type: "QVariant" }
- }
- Component {
- name: "QQuickPathPercent"
- prototype: "QQuickPathElement"
- exports: ["QtQuick/PathPercent 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "value"; type: "double" }
- }
- Component {
- name: "QQuickPathPolyline"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathPolyline 2.14"]
- exportMetaObjectRevisions: [14]
- Property { name: "start"; type: "QPointF"; isReadonly: true }
- Property { name: "path"; type: "QVariant" }
- }
- Component {
- name: "QQuickPathQuad"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathQuad 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "controlX"; type: "double" }
- Property { name: "controlY"; type: "double" }
- Property { name: "relativeControlX"; type: "double" }
- Property { name: "relativeControlY"; type: "double" }
- }
- Component {
- name: "QQuickPathSvg"
- prototype: "QQuickCurve"
- exports: ["QtQuick/PathSvg 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "path"; type: "string" }
- }
- Component {
- name: "QQuickPathView"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/PathView 2.0",
- "QtQuick/PathView 2.1",
- "QtQuick/PathView 2.11",
- "QtQuick/PathView 2.13",
- "QtQuick/PathView 2.4",
- "QtQuick/PathView 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 13, 4, 7]
- attachedType: "QQuickPathViewAttached"
- Enum {
- name: "HighlightRangeMode"
- values: {
- "NoHighlightRange": 0,
- "ApplyRange": 1,
- "StrictlyEnforceRange": 2
- }
- }
- Enum {
- name: "SnapMode"
- values: {
- "NoSnap": 0,
- "SnapToItem": 1,
- "SnapOneItem": 2
- }
- }
- Enum {
- name: "MovementDirection"
- values: {
- "Shortest": 0,
- "Negative": 1,
- "Positive": 2
- }
- }
- Enum {
- name: "PositionMode"
- values: {
- "Beginning": 0,
- "Center": 1,
- "End": 2,
- "Contain": 4,
- "SnapPosition": 5
- }
- }
- Property { name: "model"; type: "QVariant" }
- Property { name: "path"; type: "QQuickPath"; isPointer: true }
- Property { name: "currentIndex"; type: "int" }
- Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "offset"; type: "double" }
- Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "preferredHighlightBegin"; type: "double" }
- Property { name: "preferredHighlightEnd"; type: "double" }
- Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
- Property { name: "highlightMoveDuration"; type: "int" }
- Property { name: "dragMargin"; type: "double" }
- Property { name: "maximumFlickVelocity"; type: "double" }
- Property { name: "flickDeceleration"; type: "double" }
- Property { name: "interactive"; type: "bool" }
- Property { name: "moving"; type: "bool"; isReadonly: true }
- Property { name: "flicking"; type: "bool"; isReadonly: true }
- Property { name: "dragging"; type: "bool"; isReadonly: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "pathItemCount"; type: "int" }
- Property { name: "snapMode"; type: "SnapMode" }
- Property { name: "movementDirection"; revision: 7; type: "MovementDirection" }
- Property { name: "cacheItemCount"; type: "int" }
- Signal { name: "snapPositionChanged" }
- Signal { name: "movementStarted" }
- Signal { name: "movementEnded" }
- Signal { name: "movementDirectionChanged"; revision: 7 }
- Signal { name: "flickStarted" }
- Signal { name: "flickEnded" }
- Signal { name: "dragStarted" }
- Signal { name: "dragEnded" }
- Method { name: "incrementCurrentIndex" }
- Method { name: "decrementCurrentIndex" }
- Method {
- name: "positionViewAtIndex"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "mode"; type: "int" }
- }
- Method {
- name: "indexAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "itemAt"
- type: "QQuickItem*"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "itemAtIndex"
- revision: 13
- type: "QQuickItem*"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QQuickPathViewAttached"
- prototype: "QObject"
- Property { name: "view"; type: "QQuickPathView"; isReadonly: true; isPointer: true }
- Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
- Property { name: "onPath"; type: "bool"; isReadonly: true }
- Signal { name: "currentItemChanged" }
- Signal { name: "pathChanged" }
- }
- Component {
- name: "QQuickPauseAnimation"
- prototype: "QQuickAbstractAnimation"
- exports: ["QtQuick/PauseAnimation 2.0", "QtQuick/PauseAnimation 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "duration"; type: "int" }
- Signal {
- name: "durationChanged"
- Parameter { type: "int" }
- }
- }
- Component {
- name: "QQuickPen"
- prototype: "QObject"
- Property { name: "width"; type: "double" }
- Property { name: "color"; type: "QColor" }
- Property { name: "pixelAligned"; type: "bool" }
- Signal { name: "penChanged" }
- }
- Component {
- name: "QQuickPinch"
- prototype: "QObject"
- exports: ["QtQuick/Pinch 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Axis"
- values: {
- "NoDrag": 0,
- "XAxis": 1,
- "YAxis": 2,
- "XAndYAxis": 3,
- "XandYAxis": 3
- }
- }
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "minimumScale"; type: "double" }
- Property { name: "maximumScale"; type: "double" }
- Property { name: "minimumRotation"; type: "double" }
- Property { name: "maximumRotation"; type: "double" }
- Property { name: "dragAxis"; type: "Axis" }
- Property { name: "minimumX"; type: "double" }
- Property { name: "maximumX"; type: "double" }
- Property { name: "minimumY"; type: "double" }
- Property { name: "maximumY"; type: "double" }
- Property { name: "active"; type: "bool"; isReadonly: true }
- }
- Component {
- name: "QQuickPinchArea"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/PinchArea 2.0",
- "QtQuick/PinchArea 2.1",
- "QtQuick/PinchArea 2.11",
- "QtQuick/PinchArea 2.4",
- "QtQuick/PinchArea 2.5",
- "QtQuick/PinchArea 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 5, 7]
- Property { name: "enabled"; type: "bool" }
- Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true }
- Signal {
- name: "pinchStarted"
- Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
- }
- Signal {
- name: "pinchUpdated"
- Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
- }
- Signal {
- name: "pinchFinished"
- Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
- }
- Signal {
- name: "smartZoom"
- revision: 5
- Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickPinchEvent"
- prototype: "QObject"
- Property { name: "center"; type: "QPointF"; isReadonly: true }
- Property { name: "startCenter"; type: "QPointF"; isReadonly: true }
- Property { name: "previousCenter"; type: "QPointF"; isReadonly: true }
- Property { name: "scale"; type: "double"; isReadonly: true }
- Property { name: "previousScale"; type: "double"; isReadonly: true }
- Property { name: "angle"; type: "double"; isReadonly: true }
- Property { name: "previousAngle"; type: "double"; isReadonly: true }
- Property { name: "rotation"; type: "double"; isReadonly: true }
- Property { name: "point1"; type: "QPointF"; isReadonly: true }
- Property { name: "startPoint1"; type: "QPointF"; isReadonly: true }
- Property { name: "point2"; type: "QPointF"; isReadonly: true }
- Property { name: "startPoint2"; type: "QPointF"; isReadonly: true }
- Property { name: "pointCount"; type: "int"; isReadonly: true }
- Property { name: "accepted"; type: "bool" }
- }
- Component {
- name: "QQuickPinchHandler"
- prototype: "QQuickMultiPointHandler"
- exports: ["QtQuick/PinchHandler 2.12"]
- exportMetaObjectRevisions: [12]
- Property { name: "minimumScale"; type: "double" }
- Property { name: "maximumScale"; type: "double" }
- Property { name: "minimumRotation"; type: "double" }
- Property { name: "maximumRotation"; type: "double" }
- Property { name: "scale"; type: "double"; isReadonly: true }
- Property { name: "activeScale"; type: "double"; isReadonly: true }
- Property { name: "rotation"; type: "double"; isReadonly: true }
- Property { name: "translation"; type: "QVector2D"; isReadonly: true }
- Property { name: "minimumX"; type: "double" }
- Property { name: "maximumX"; type: "double" }
- Property { name: "minimumY"; type: "double" }
- Property { name: "maximumY"; type: "double" }
- Property { name: "xAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
- Property { name: "yAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
- Signal { name: "updated" }
- }
- Component {
- name: "QQuickPointHandler"
- prototype: "QQuickSinglePointHandler"
- exports: ["QtQuick/PointHandler 2.12"]
- exportMetaObjectRevisions: [12]
- Property { name: "translation"; type: "QVector2D"; isReadonly: true }
- }
- Component {
- name: "QQuickPointerDevice"
- prototype: "QObject"
- exports: ["QtQuick/PointerDevice 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Enum {
- name: "DeviceTypes"
- values: {
- "UnknownDevice": 0,
- "Mouse": 1,
- "TouchScreen": 2,
- "TouchPad": 4,
- "Puck": 8,
- "Stylus": 16,
- "Airbrush": 32,
- "AllDevices": 32767
- }
- }
- Enum {
- name: "PointerTypes"
- values: {
- "GenericPointer": 1,
- "Finger": 2,
- "Pen": 4,
- "Eraser": 8,
- "Cursor": 16,
- "AllPointerTypes": 32767
- }
- }
- Enum {
- name: "Capabilities"
- values: {
- "Position": 1,
- "Area": 2,
- "Pressure": 4,
- "Velocity": 8,
- "MouseEmulation": 64,
- "Scroll": 256,
- "Hover": 512,
- "Rotation": 1024,
- "XTilt": 2048,
- "YTilt": 4096
- }
- }
- Property { name: "type"; type: "DeviceType"; isReadonly: true }
- Property { name: "pointerType"; type: "PointerType"; isReadonly: true }
- Property { name: "capabilities"; type: "Capabilities"; isReadonly: true }
- Property { name: "maximumTouchPoints"; type: "int"; isReadonly: true }
- Property { name: "buttonCount"; type: "int"; isReadonly: true }
- Property { name: "name"; type: "string"; isReadonly: true }
- Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true }
- }
- Component {
- name: "QQuickPointerDeviceHandler"
- prototype: "QQuickPointerHandler"
- Property { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" }
- Property { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" }
- Property { name: "acceptedButtons"; type: "Qt::MouseButtons" }
- Property { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" }
- Method {
- name: "setAcceptedDevices"
- Parameter { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" }
- }
- Method {
- name: "setAcceptedPointerTypes"
- Parameter { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" }
- }
- Method {
- name: "setAcceptedButtons"
- Parameter { name: "buttons"; type: "Qt::MouseButtons" }
- }
- Method {
- name: "setAcceptedModifiers"
- Parameter { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" }
- }
- }
- Component {
- name: "QQuickPointerEvent"
- prototype: "QObject"
- exports: ["QtQuick/PointerEvent 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Property { name: "device"; type: "QQuickPointerDevice"; isReadonly: true; isPointer: true }
- Property { name: "modifiers"; type: "Qt::KeyboardModifiers"; isReadonly: true }
- Property { name: "button"; type: "Qt::MouseButtons"; isReadonly: true }
- Property { name: "buttons"; type: "Qt::MouseButtons"; isReadonly: true }
- }
- Component {
- name: "QQuickPointerHandler"
- prototype: "QObject"
- exports: ["QtQuick/PointerHandler 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- Enum {
- name: "GrabPermissions"
- values: {
- "TakeOverForbidden": 0,
- "CanTakeOverFromHandlersOfSameType": 1,
- "CanTakeOverFromHandlersOfDifferentType": 2,
- "CanTakeOverFromItems": 4,
- "CanTakeOverFromAnything": 15,
- "ApprovesTakeOverByHandlersOfSameType": 16,
- "ApprovesTakeOverByHandlersOfDifferentType": 32,
- "ApprovesTakeOverByItems": 64,
- "ApprovesCancellation": 128,
- "ApprovesTakeOverByAnything": 240
- }
- }
- Property { name: "enabled"; type: "bool" }
- Property { name: "active"; type: "bool"; isReadonly: true }
- Property { name: "target"; type: "QQuickItem"; isPointer: true }
- Property { name: "parent"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "grabPermissions"; type: "GrabPermissions" }
- Property { name: "margin"; type: "double" }
- Signal {
- name: "grabChanged"
- Parameter { name: "transition"; type: "QQuickEventPoint::GrabTransition" }
- Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true }
- }
- Signal { name: "grabPermissionChanged" }
- Signal {
- name: "canceled"
- Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true }
- }
- }
- Component {
- name: "QQuickPointerMouseEvent"
- prototype: "QQuickSinglePointEvent"
- exports: ["QtQuick/PointerMouseEvent 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- }
- Component {
- name: "QQuickPointerTouchEvent"
- prototype: "QQuickPointerEvent"
- exports: ["QtQuick/PointerTouchEvent 2.12"]
- isCreatable: false
- exportMetaObjectRevisions: [12]
- }
- Component {
- name: "QQuickPositionerAttached"
- prototype: "QObject"
- Property { name: "index"; type: "int"; isReadonly: true }
- Property { name: "isFirstItem"; type: "bool"; isReadonly: true }
- Property { name: "isLastItem"; type: "bool"; isReadonly: true }
- }
- Component {
- name: "QQuickPropertyAction"
- prototype: "QQuickAbstractAnimation"
- exports: ["QtQuick/PropertyAction 2.0", "QtQuick/PropertyAction 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "target"; type: "QObject"; isPointer: true }
- Property { name: "property"; type: "string" }
- Property { name: "properties"; type: "string" }
- Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "value"; type: "QVariant" }
- Signal {
- name: "valueChanged"
- Parameter { type: "QVariant" }
- }
- Signal {
- name: "propertiesChanged"
- Parameter { type: "string" }
- }
- }
- Component {
- name: "QQuickPropertyAnimation"
- prototype: "QQuickAbstractAnimation"
- exports: [
- "QtQuick/PropertyAnimation 2.0",
- "QtQuick/PropertyAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "duration"; type: "int" }
- Property { name: "from"; type: "QVariant" }
- Property { name: "to"; type: "QVariant" }
- Property { name: "easing"; type: "QEasingCurve" }
- Property { name: "target"; type: "QObject"; isPointer: true }
- Property { name: "property"; type: "string" }
- Property { name: "properties"; type: "string" }
- Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "durationChanged"
- Parameter { type: "int" }
- }
- Signal {
- name: "easingChanged"
- Parameter { type: "QEasingCurve" }
- }
- Signal {
- name: "propertiesChanged"
- Parameter { type: "string" }
- }
- }
- Component {
- name: "QQuickPropertyChanges"
- prototype: "QQuickStateOperation"
- exports: ["QtQuick/PropertyChanges 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "target"; type: "QObject"; isPointer: true }
- Property { name: "restoreEntryValues"; type: "bool" }
- Property { name: "explicit"; type: "bool" }
- }
- Component {
- name: "QQuickRectangle"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/Rectangle 2.0",
- "QtQuick/Rectangle 2.1",
- "QtQuick/Rectangle 2.11",
- "QtQuick/Rectangle 2.4",
- "QtQuick/Rectangle 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "color"; type: "QColor" }
- Property { name: "gradient"; type: "QJSValue" }
- Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
- Property { name: "radius"; type: "double" }
- }
- Component {
- name: "QQuickRepeater"
- defaultProperty: "delegate"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/Repeater 2.0",
- "QtQuick/Repeater 2.1",
- "QtQuick/Repeater 2.11",
- "QtQuick/Repeater 2.4",
- "QtQuick/Repeater 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "itemAdded"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "itemRemoved"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "itemAt"
- type: "QQuickItem*"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QQuickRotation"
- prototype: "QQuickTransform"
- exports: ["QtQuick/Rotation 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "origin"; type: "QVector3D" }
- Property { name: "angle"; type: "double" }
- Property { name: "axis"; type: "QVector3D" }
- }
- Component {
- name: "QQuickRotationAnimation"
- prototype: "QQuickPropertyAnimation"
- exports: [
- "QtQuick/RotationAnimation 2.0",
- "QtQuick/RotationAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "RotationDirection"
- values: {
- "Numerical": 0,
- "Shortest": 1,
- "Clockwise": 2,
- "Counterclockwise": 3
- }
- }
- Property { name: "from"; type: "double" }
- Property { name: "to"; type: "double" }
- Property { name: "direction"; type: "RotationDirection" }
- }
- Component {
- name: "QQuickRotationAnimator"
- prototype: "QQuickAnimator"
- exports: [
- "QtQuick/RotationAnimator 2.12",
- "QtQuick/RotationAnimator 2.2"
- ]
- exportMetaObjectRevisions: [12, 2]
- Enum {
- name: "RotationDirection"
- values: {
- "Numerical": 0,
- "Shortest": 1,
- "Clockwise": 2,
- "Counterclockwise": 3
- }
- }
- Property { name: "direction"; type: "RotationDirection" }
- Signal {
- name: "directionChanged"
- Parameter { name: "dir"; type: "RotationDirection" }
- }
- }
- Component {
- name: "QQuickRow"
- defaultProperty: "data"
- prototype: "QQuickBasePositioner"
- exports: [
- "QtQuick/Row 2.0",
- "QtQuick/Row 2.1",
- "QtQuick/Row 2.11",
- "QtQuick/Row 2.4",
- "QtQuick/Row 2.6",
- "QtQuick/Row 2.7",
- "QtQuick/Row 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
- }
- Component {
- name: "QQuickScale"
- prototype: "QQuickTransform"
- exports: ["QtQuick/Scale 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "origin"; type: "QVector3D" }
- Property { name: "xScale"; type: "double" }
- Property { name: "yScale"; type: "double" }
- Property { name: "zScale"; type: "double" }
- Signal { name: "scaleChanged" }
- }
- Component {
- name: "QQuickScaleAnimator"
- prototype: "QQuickAnimator"
- exports: ["QtQuick/ScaleAnimator 2.12", "QtQuick/ScaleAnimator 2.2"]
- exportMetaObjectRevisions: [12, 2]
- }
- Component {
- name: "QQuickScaleGrid"
- prototype: "QObject"
- Property { name: "left"; type: "int" }
- Property { name: "top"; type: "int" }
- Property { name: "right"; type: "int" }
- Property { name: "bottom"; type: "int" }
- Signal { name: "borderChanged" }
- Signal { name: "leftBorderChanged" }
- Signal { name: "topBorderChanged" }
- Signal { name: "rightBorderChanged" }
- Signal { name: "bottomBorderChanged" }
- }
- Component {
- name: "QQuickScriptAction"
- prototype: "QQuickAbstractAnimation"
- exports: ["QtQuick/ScriptAction 2.0", "QtQuick/ScriptAction 2.12"]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "script"; type: "QQmlScriptString" }
- Property { name: "scriptName"; type: "string" }
- }
- Component {
- name: "QQuickSequentialAnimation"
- defaultProperty: "animations"
- prototype: "QQuickAnimationGroup"
- exports: [
- "QtQuick/SequentialAnimation 2.0",
- "QtQuick/SequentialAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- }
- Component {
- name: "QQuickShaderEffect"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/ShaderEffect 2.0",
- "QtQuick/ShaderEffect 2.1",
- "QtQuick/ShaderEffect 2.11",
- "QtQuick/ShaderEffect 2.4",
- "QtQuick/ShaderEffect 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "CullMode"
- values: {
- "NoCulling": 0,
- "BackFaceCulling": 1,
- "FrontFaceCulling": 2
- }
- }
- Enum {
- name: "Status"
- values: {
- "Compiled": 0,
- "Uncompiled": 1,
- "Error": 2
- }
- }
- Property { name: "fragmentShader"; type: "QByteArray" }
- Property { name: "vertexShader"; type: "QByteArray" }
- Property { name: "blending"; type: "bool" }
- Property { name: "mesh"; type: "QVariant" }
- Property { name: "cullMode"; type: "CullMode" }
- Property { name: "log"; type: "string"; isReadonly: true }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "supportsAtlasTextures"; revision: 4; type: "bool" }
- }
- Component {
- name: "QQuickShaderEffectMesh"
- prototype: "QObject"
- exports: ["QtQuick/ShaderEffectMesh 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Signal { name: "geometryChanged" }
- }
- Component {
- name: "QQuickShaderEffectSource"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/ShaderEffectSource 2.0",
- "QtQuick/ShaderEffectSource 2.1",
- "QtQuick/ShaderEffectSource 2.11",
- "QtQuick/ShaderEffectSource 2.4",
- "QtQuick/ShaderEffectSource 2.6",
- "QtQuick/ShaderEffectSource 2.7",
- "QtQuick/ShaderEffectSource 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9]
- Enum {
- name: "WrapMode"
- values: {
- "ClampToEdge": 0,
- "RepeatHorizontally": 1,
- "RepeatVertically": 2,
- "Repeat": 3
- }
- }
- Enum {
- name: "Format"
- values: {
- "Alpha": 6406,
- "RGB": 6407,
- "RGBA": 6408
- }
- }
- Enum {
- name: "TextureMirroring"
- values: {
- "NoMirroring": 0,
- "MirrorHorizontally": 1,
- "MirrorVertically": 2
- }
- }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "sourceItem"; type: "QQuickItem"; isPointer: true }
- Property { name: "sourceRect"; type: "QRectF" }
- Property { name: "textureSize"; type: "QSize" }
- Property { name: "format"; type: "Format" }
- Property { name: "live"; type: "bool" }
- Property { name: "hideSource"; type: "bool" }
- Property { name: "mipmap"; type: "bool" }
- Property { name: "recursive"; type: "bool" }
- Property { name: "textureMirroring"; revision: 6; type: "TextureMirroring" }
- Property { name: "samples"; revision: 9; type: "int" }
- Signal { name: "scheduledUpdateCompleted" }
- Method { name: "scheduleUpdate" }
- }
- Component {
- name: "QQuickShortcut"
- prototype: "QObject"
- exports: [
- "QtQuick/Shortcut 2.5",
- "QtQuick/Shortcut 2.6",
- "QtQuick/Shortcut 2.9"
- ]
- exportMetaObjectRevisions: [5, 6, 9]
- Property { name: "sequence"; type: "QVariant" }
- Property { name: "sequences"; revision: 9; type: "QVariantList" }
- Property { name: "nativeText"; revision: 6; type: "string"; isReadonly: true }
- Property { name: "portableText"; revision: 6; type: "string"; isReadonly: true }
- Property { name: "enabled"; type: "bool" }
- Property { name: "autoRepeat"; type: "bool" }
- Property { name: "context"; type: "Qt::ShortcutContext" }
- Signal { name: "sequencesChanged"; revision: 9 }
- Signal { name: "activated" }
- Signal { name: "activatedAmbiguously" }
- }
- Component { name: "QQuickSinglePointEvent"; prototype: "QQuickPointerEvent" }
- Component {
- name: "QQuickSinglePointHandler"
- prototype: "QQuickPointerDeviceHandler"
- Property { name: "point"; type: "QQuickHandlerPoint"; isReadonly: true }
- }
- Component {
- name: "QQuickSmoothedAnimation"
- prototype: "QQuickNumberAnimation"
- exports: [
- "QtQuick/SmoothedAnimation 2.0",
- "QtQuick/SmoothedAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "ReversingMode"
- values: {
- "Eased": 0,
- "Immediate": 1,
- "Sync": 2
- }
- }
- Property { name: "velocity"; type: "double" }
- Property { name: "reversingMode"; type: "ReversingMode" }
- Property { name: "maximumEasingTime"; type: "double" }
- }
- Component {
- name: "QQuickSpringAnimation"
- prototype: "QQuickNumberAnimation"
- exports: [
- "QtQuick/SpringAnimation 2.0",
- "QtQuick/SpringAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "velocity"; type: "double" }
- Property { name: "spring"; type: "double" }
- Property { name: "damping"; type: "double" }
- Property { name: "epsilon"; type: "double" }
- Property { name: "modulus"; type: "double" }
- Property { name: "mass"; type: "double" }
- Signal { name: "syncChanged" }
- }
- Component {
- name: "QQuickSprite"
- prototype: "QQuickStochasticState"
- exports: ["QtQuick/Sprite 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "source"; type: "QUrl" }
- Property { name: "reverse"; type: "bool" }
- Property { name: "frameSync"; type: "bool" }
- Property { name: "frames"; type: "int" }
- Property { name: "frameCount"; type: "int" }
- Property { name: "frameHeight"; type: "int" }
- Property { name: "frameWidth"; type: "int" }
- Property { name: "frameX"; type: "int" }
- Property { name: "frameY"; type: "int" }
- Property { name: "frameRate"; type: "double" }
- Property { name: "frameRateVariation"; type: "double" }
- Property { name: "frameDuration"; type: "int" }
- Property { name: "frameDurationVariation"; type: "int" }
- Signal {
- name: "sourceChanged"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Signal {
- name: "frameHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "reverseChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "frameCountChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameXChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameYChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameRateChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "frameRateVariationChanged"
- Parameter { name: "arg"; type: "double" }
- }
- Signal {
- name: "frameDurationChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameDurationVariationChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "frameSyncChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setSource"
- Parameter { name: "arg"; type: "QUrl" }
- }
- Method {
- name: "setFrameHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setReverse"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setFrames"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameCount"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameRate"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setFrameRateVariation"
- Parameter { name: "arg"; type: "double" }
- }
- Method {
- name: "setFrameDuration"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameDurationVariation"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setFrameSync"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickSpriteSequence"
- defaultProperty: "sprites"
- prototype: "QQuickItem"
- exports: [
- "QtQuick/SpriteSequence 2.0",
- "QtQuick/SpriteSequence 2.1",
- "QtQuick/SpriteSequence 2.11",
- "QtQuick/SpriteSequence 2.4",
- "QtQuick/SpriteSequence 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Property { name: "running"; type: "bool" }
- Property { name: "interpolate"; type: "bool" }
- Property { name: "goalSprite"; type: "string" }
- Property { name: "currentSprite"; type: "string"; isReadonly: true }
- Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true }
- Signal {
- name: "runningChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "interpolateChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "goalSpriteChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Signal {
- name: "currentSpriteChanged"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "jumpTo"
- Parameter { name: "sprite"; type: "string" }
- }
- Method {
- name: "setGoalSprite"
- Parameter { name: "sprite"; type: "string" }
- }
- Method {
- name: "setRunning"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setInterpolate"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickState"
- defaultProperty: "changes"
- prototype: "QObject"
- exports: ["QtQuick/State 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "name"; type: "string" }
- Property { name: "when"; type: "bool" }
- Property { name: "extend"; type: "string" }
- Property { name: "changes"; type: "QQuickStateOperation"; isList: true; isReadonly: true }
- Signal { name: "completed" }
- }
- Component {
- name: "QQuickStateChangeScript"
- prototype: "QQuickStateOperation"
- exports: ["QtQuick/StateChangeScript 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "script"; type: "QQmlScriptString" }
- Property { name: "name"; type: "string" }
- }
- Component {
- name: "QQuickStateGroup"
- prototype: "QObject"
- exports: ["QtQuick/StateGroup 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "state"; type: "string" }
- Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
- Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
- Signal {
- name: "stateChanged"
- Parameter { type: "string" }
- }
- }
- Component { name: "QQuickStateOperation"; prototype: "QObject" }
- 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: "QQuickSystemPalette"
- prototype: "QObject"
- exports: ["QtQuick/SystemPalette 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "ColorGroup"
- values: {
- "Active": 0,
- "Inactive": 2,
- "Disabled": 1
- }
- }
- Property { name: "colorGroup"; type: "QQuickSystemPalette::ColorGroup" }
- Property { name: "window"; type: "QColor"; isReadonly: true }
- Property { name: "windowText"; type: "QColor"; isReadonly: true }
- Property { name: "base"; type: "QColor"; isReadonly: true }
- Property { name: "text"; type: "QColor"; isReadonly: true }
- Property { name: "alternateBase"; type: "QColor"; isReadonly: true }
- Property { name: "button"; type: "QColor"; isReadonly: true }
- Property { name: "buttonText"; type: "QColor"; isReadonly: true }
- Property { name: "light"; type: "QColor"; isReadonly: true }
- Property { name: "midlight"; type: "QColor"; isReadonly: true }
- Property { name: "dark"; type: "QColor"; isReadonly: true }
- Property { name: "mid"; type: "QColor"; isReadonly: true }
- Property { name: "shadow"; type: "QColor"; isReadonly: true }
- Property { name: "highlight"; type: "QColor"; isReadonly: true }
- Property { name: "highlightedText"; type: "QColor"; isReadonly: true }
- Signal { name: "paletteChanged" }
- }
- Component {
- name: "QQuickTableView"
- defaultProperty: "flickableData"
- prototype: "QQuickFlickable"
- exports: ["QtQuick/TableView 2.12", "QtQuick/TableView 2.14"]
- exportMetaObjectRevisions: [12, 14]
- attachedType: "QQuickTableViewAttached"
- Property { name: "rows"; type: "int"; isReadonly: true }
- Property { name: "columns"; type: "int"; isReadonly: true }
- Property { name: "rowSpacing"; type: "double" }
- Property { name: "columnSpacing"; type: "double" }
- Property { name: "rowHeightProvider"; type: "QJSValue" }
- Property { name: "columnWidthProvider"; type: "QJSValue" }
- Property { name: "model"; type: "QVariant" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "reuseItems"; type: "bool" }
- Property { name: "contentWidth"; type: "double" }
- Property { name: "contentHeight"; type: "double" }
- Property { name: "syncView"; revision: 14; type: "QQuickTableView"; isPointer: true }
- Property { name: "syncDirection"; revision: 14; type: "Qt::Orientations" }
- Signal { name: "syncViewChanged"; revision: 14 }
- Signal { name: "syncDirectionChanged"; revision: 14 }
- Method { name: "forceLayout" }
- }
- Component {
- name: "QQuickTableViewAttached"
- prototype: "QObject"
- Property { name: "view"; type: "QQuickTableView"; isReadonly: true; isPointer: true }
- Signal { name: "pooled" }
- Signal { name: "reused" }
- }
- Component {
- name: "QQuickTapHandler"
- prototype: "QQuickSinglePointHandler"
- exports: ["QtQuick/TapHandler 2.12"]
- exportMetaObjectRevisions: [12]
- Enum {
- name: "GesturePolicy"
- values: {
- "DragThreshold": 0,
- "WithinBounds": 1,
- "ReleaseWithinBounds": 2
- }
- }
- Property { name: "pressed"; type: "bool"; isReadonly: true }
- Property { name: "tapCount"; type: "int"; isReadonly: true }
- Property { name: "timeHeld"; type: "double"; isReadonly: true }
- Property { name: "longPressThreshold"; type: "double" }
- Property { name: "gesturePolicy"; type: "GesturePolicy" }
- Signal {
- name: "tapped"
- Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
- }
- Signal {
- name: "singleTapped"
- Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
- }
- Signal {
- name: "doubleTapped"
- Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
- }
- Signal { name: "longPressed" }
- }
- Component {
- name: "QQuickText"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: [
- "QtQuick/Text 2.0",
- "QtQuick/Text 2.1",
- "QtQuick/Text 2.10",
- "QtQuick/Text 2.11",
- "QtQuick/Text 2.2",
- "QtQuick/Text 2.3",
- "QtQuick/Text 2.4",
- "QtQuick/Text 2.6",
- "QtQuick/Text 2.7",
- "QtQuick/Text 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 10, 11, 2, 3, 4, 6, 7, 9]
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextStyle"
- values: {
- "Normal": 0,
- "Outline": 1,
- "Raised": 2,
- "Sunken": 3
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "MarkdownText": 3,
- "AutoText": 2,
- "StyledText": 4
- }
- }
- Enum {
- name: "TextElideMode"
- values: {
- "ElideLeft": 0,
- "ElideRight": 1,
- "ElideMiddle": 2,
- "ElideNone": 3
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Enum {
- name: "LineHeightMode"
- values: {
- "ProportionalHeight": 0,
- "FixedHeight": 1
- }
- }
- Enum {
- name: "FontSizeMode"
- values: {
- "FixedSize": 0,
- "HorizontalFit": 1,
- "VerticalFit": 2,
- "Fit": 3
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "font"; type: "QFont" }
- Property { name: "color"; type: "QColor" }
- Property { name: "linkColor"; type: "QColor" }
- Property { name: "style"; type: "TextStyle" }
- Property { name: "styleColor"; type: "QColor" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "truncated"; type: "bool"; isReadonly: true }
- Property { name: "maximumLineCount"; type: "int" }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "elide"; type: "TextElideMode" }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "lineHeight"; type: "double" }
- Property { name: "lineHeightMode"; type: "LineHeightMode" }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "minimumPixelSize"; type: "int" }
- Property { name: "minimumPointSize"; type: "int" }
- Property { name: "fontSizeMode"; type: "FontSizeMode" }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Property { name: "fontInfo"; revision: 9; type: "QJSValue"; isReadonly: true }
- Property { name: "advance"; revision: 10; type: "QSizeF"; isReadonly: true }
- Signal {
- name: "textChanged"
- Parameter { name: "text"; type: "string" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "styleChanged"
- Parameter { name: "style"; type: "QQuickText::TextStyle" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickText::TextFormat" }
- }
- Signal {
- name: "elideModeChanged"
- Parameter { name: "mode"; type: "QQuickText::TextElideMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal {
- name: "contentWidthChanged"
- Parameter { name: "contentWidth"; type: "double" }
- }
- Signal {
- name: "contentHeightChanged"
- Parameter { name: "contentHeight"; type: "double" }
- }
- Signal {
- name: "lineHeightChanged"
- Parameter { name: "lineHeight"; type: "double" }
- }
- Signal {
- name: "lineHeightModeChanged"
- Parameter { name: "mode"; type: "LineHeightMode" }
- }
- Signal {
- name: "lineLaidOut"
- Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
- }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Signal { name: "fontInfoChanged"; revision: 9 }
- Method { name: "doLayout" }
- Method { name: "forceLayout"; revision: 9 }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- }
- Component { name: "QQuickTextDocument"; prototype: "QObject" }
- Component {
- name: "QQuickTextEdit"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: [
- "QtQuick/TextEdit 2.0",
- "QtQuick/TextEdit 2.1",
- "QtQuick/TextEdit 2.10",
- "QtQuick/TextEdit 2.11",
- "QtQuick/TextEdit 2.2",
- "QtQuick/TextEdit 2.3",
- "QtQuick/TextEdit 2.4",
- "QtQuick/TextEdit 2.6",
- "QtQuick/TextEdit 2.7"
- ]
- exportMetaObjectRevisions: [0, 1, 10, 11, 2, 3, 4, 6, 7]
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "AutoText": 2,
- "MarkdownText": 3
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "overwriteMode"; type: "bool" }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "activeFocusOnPress"; type: "bool" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "textMargin"; type: "double" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
- Property { name: "selectByMouse"; type: "bool" }
- Property { name: "mouseSelectionMode"; type: "SelectionMode" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "renderType"; type: "RenderType" }
- Property {
- name: "textDocument"
- revision: 1
- type: "QQuickTextDocument"
- isReadonly: true
- isPointer: true
- }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
- Property { name: "tabStopDistance"; revision: 10; type: "double" }
- Signal { name: "preeditTextChanged"; revision: 7 }
- Signal { name: "contentSizeChanged" }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectionColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectedTextColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickTextEdit::TextFormat" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "overwriteModeChanged"
- Parameter { name: "overwriteMode"; type: "bool" }
- }
- Signal {
- name: "activeFocusOnPressChanged"
- Parameter { name: "activeFocusOnPressed"; type: "bool" }
- }
- Signal {
- name: "persistentSelectionChanged"
- Parameter { name: "isPersistentSelection"; type: "bool" }
- }
- Signal {
- name: "textMarginChanged"
- Parameter { name: "textMargin"; type: "double" }
- }
- Signal {
- name: "selectByKeyboardChanged"
- revision: 1
- Parameter { name: "selectByKeyboard"; type: "bool" }
- }
- Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
- }
- Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextEdit::SelectionMode" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal { name: "editingFinished"; revision: 6 }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Signal {
- name: "tabStopDistanceChanged"
- revision: 10
- Parameter { name: "distance"; type: "double" }
- }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "append"
- revision: 2
- Parameter { name: "text"; type: "string" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "inputMethodQuery"
- revision: 4
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { type: "int" }
- }
- Method {
- name: "positionAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "getFormattedText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- }
- Component {
- name: "QQuickTextInput"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- exports: [
- "QtQuick/TextInput 2.0",
- "QtQuick/TextInput 2.1",
- "QtQuick/TextInput 2.11",
- "QtQuick/TextInput 2.2",
- "QtQuick/TextInput 2.4",
- "QtQuick/TextInput 2.6",
- "QtQuick/TextInput 2.7",
- "QtQuick/TextInput 2.9"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 2, 4, 6, 7, 9]
- Enum {
- name: "EchoMode"
- values: {
- "Normal": 0,
- "NoEcho": 1,
- "Password": 2,
- "PasswordEchoOnEdit": 3
- }
- }
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "CursorPosition"
- values: {
- "CursorBetweenCharacters": 0,
- "CursorOnCharacter": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "overwriteMode"; type: "bool" }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "maximumLength"; type: "int" }
- Property { name: "validator"; type: "QValidator"; isPointer: true }
- Property { name: "inputMask"; type: "string" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
- Property { name: "echoMode"; type: "EchoMode" }
- Property { name: "activeFocusOnPress"; type: "bool" }
- Property { name: "passwordCharacter"; type: "string" }
- Property { name: "passwordMaskDelay"; revision: 4; type: "int" }
- Property { name: "displayText"; type: "string"; isReadonly: true }
- Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
- Property { name: "autoScroll"; type: "bool" }
- Property { name: "selectByMouse"; type: "bool" }
- Property { name: "mouseSelectionMode"; type: "SelectionMode" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal { name: "accepted" }
- Signal { name: "editingFinished"; revision: 2 }
- Signal { name: "textEdited"; revision: 9 }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "overwriteModeChanged"
- Parameter { name: "overwriteMode"; type: "bool" }
- }
- Signal {
- name: "maximumLengthChanged"
- Parameter { name: "maximumLength"; type: "int" }
- }
- Signal {
- name: "inputMaskChanged"
- Parameter { name: "inputMask"; type: "string" }
- }
- Signal {
- name: "echoModeChanged"
- Parameter { name: "echoMode"; type: "QQuickTextInput::EchoMode" }
- }
- Signal {
- name: "passwordMaskDelayChanged"
- revision: 4
- Parameter { name: "delay"; type: "int" }
- }
- Signal { name: "preeditTextChanged"; revision: 7 }
- Signal {
- name: "activeFocusOnPressChanged"
- Parameter { name: "activeFocusOnPress"; type: "bool" }
- }
- Signal {
- name: "autoScrollChanged"
- Parameter { name: "autoScroll"; type: "bool" }
- }
- Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
- }
- Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "ensureVisible"
- revision: 4
- Parameter { name: "position"; type: "int" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "positionAt"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "inputMethodQuery"
- revision: 4
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- }
- Component {
- name: "QQuickTextLine"
- prototype: "QObject"
- Property { name: "number"; type: "int"; isReadonly: true }
- Property { name: "width"; type: "double" }
- Property { name: "height"; type: "double" }
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- }
- Component {
- name: "QQuickTextMetrics"
- prototype: "QObject"
- exports: ["QtQuick/TextMetrics 2.4"]
- exportMetaObjectRevisions: [4]
- Property { name: "font"; type: "QFont" }
- Property { name: "text"; type: "string" }
- Property { name: "advanceWidth"; type: "double"; isReadonly: true }
- Property { name: "boundingRect"; type: "QRectF"; isReadonly: true }
- Property { name: "width"; type: "double"; isReadonly: true }
- Property { name: "height"; type: "double"; isReadonly: true }
- Property { name: "tightBoundingRect"; type: "QRectF"; isReadonly: true }
- Property { name: "elidedText"; type: "string"; isReadonly: true }
- Property { name: "elide"; type: "Qt::TextElideMode" }
- Property { name: "elideWidth"; type: "double" }
- Signal { name: "metricsChanged" }
- }
- Component {
- name: "QQuickTouchPoint"
- prototype: "QObject"
- exports: ["QtQuick/TouchPoint 2.0", "QtQuick/TouchPoint 2.9"]
- exportMetaObjectRevisions: [0, 9]
- Property { name: "pointId"; type: "int"; isReadonly: true }
- Property { name: "uniqueId"; revision: 9; type: "QPointingDeviceUniqueId"; isReadonly: true }
- Property { name: "pressed"; type: "bool"; isReadonly: true }
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "ellipseDiameters"; revision: 9; type: "QSizeF"; isReadonly: true }
- Property { name: "pressure"; type: "double"; isReadonly: true }
- Property { name: "rotation"; revision: 9; type: "double"; isReadonly: true }
- Property { name: "velocity"; type: "QVector2D"; isReadonly: true }
- Property { name: "area"; type: "QRectF"; isReadonly: true }
- Property { name: "startX"; type: "double"; isReadonly: true }
- Property { name: "startY"; type: "double"; isReadonly: true }
- Property { name: "previousX"; type: "double"; isReadonly: true }
- Property { name: "previousY"; type: "double"; isReadonly: true }
- Property { name: "sceneX"; type: "double"; isReadonly: true }
- Property { name: "sceneY"; type: "double"; isReadonly: true }
- Signal { name: "uniqueIdChanged"; revision: 9 }
- Signal { name: "ellipseDiametersChanged"; revision: 9 }
- Signal { name: "rotationChanged"; revision: 9 }
- }
- Component { name: "QQuickTransform"; prototype: "QObject" }
- Component {
- name: "QQuickTransition"
- defaultProperty: "animations"
- prototype: "QObject"
- exports: ["QtQuick/Transition 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "from"; type: "string" }
- Property { name: "to"; type: "string" }
- Property { name: "reversible"; type: "bool" }
- Property { name: "running"; type: "bool"; isReadonly: true }
- Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
- Property { name: "enabled"; type: "bool" }
- }
- Component {
- name: "QQuickTranslate"
- prototype: "QQuickTransform"
- exports: ["QtQuick/Translate 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- }
- Component {
- name: "QQuickUniformAnimator"
- prototype: "QQuickAnimator"
- exports: [
- "QtQuick/UniformAnimator 2.12",
- "QtQuick/UniformAnimator 2.2"
- ]
- exportMetaObjectRevisions: [12, 2]
- Property { name: "uniform"; type: "string" }
- Signal {
- name: "uniformChanged"
- Parameter { type: "string" }
- }
- }
- Component {
- name: "QQuickVector3dAnimation"
- prototype: "QQuickPropertyAnimation"
- exports: [
- "QtQuick/Vector3dAnimation 2.0",
- "QtQuick/Vector3dAnimation 2.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "from"; type: "QVector3D" }
- Property { name: "to"; type: "QVector3D" }
- }
- Component {
- name: "QQuickViewSection"
- prototype: "QObject"
- exports: ["QtQuick/ViewSection 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "SectionCriteria"
- values: {
- "FullString": 0,
- "FirstCharacter": 1
- }
- }
- Enum {
- name: "LabelPositioning"
- values: {
- "InlineLabels": 1,
- "CurrentLabelAtStart": 2,
- "NextLabelAtEnd": 4
- }
- }
- Property { name: "property"; type: "string" }
- Property { name: "criteria"; type: "SectionCriteria" }
- Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "labelPositioning"; type: "int" }
- Signal { name: "sectionsChanged" }
- }
- Component {
- name: "QQuickViewTransitionAttached"
- prototype: "QObject"
- exports: ["QtQuick/ViewTransition 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "index"; type: "int"; isReadonly: true }
- Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "destination"; type: "QPointF"; isReadonly: true }
- Property { name: "targetIndexes"; type: "QList<int>"; isReadonly: true }
- Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QQuickWheelEvent"
- prototype: "QObject"
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "angleDelta"; type: "QPoint"; isReadonly: true }
- Property { name: "pixelDelta"; type: "QPoint"; isReadonly: true }
- Property { name: "buttons"; type: "int"; isReadonly: true }
- Property { name: "modifiers"; type: "int"; isReadonly: true }
- Property { name: "inverted"; type: "bool"; isReadonly: true }
- Property { name: "accepted"; type: "bool" }
- }
- Component {
- name: "QQuickWheelHandler"
- prototype: "QQuickSinglePointHandler"
- exports: ["QtQuick/WheelHandler 2.14"]
- exportMetaObjectRevisions: [14]
- Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "invertible"; type: "bool" }
- Property { name: "activeTimeout"; type: "double" }
- Property { name: "rotation"; type: "double" }
- Property { name: "rotationScale"; type: "double" }
- Property { name: "property"; type: "string" }
- Property { name: "targetScaleMultiplier"; type: "double" }
- Property { name: "targetTransformAroundCursor"; type: "bool" }
- Signal {
- name: "wheel"
- Parameter { name: "event"; type: "QQuickPointerScrollEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickWorkerScript"
- prototype: "QObject"
- exports: ["QtQuick/WorkerScript 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "source"; type: "QUrl" }
- Signal {
- name: "message"
- Parameter { name: "messageObject"; type: "QJSValue" }
- }
- Method {
- name: "sendMessage"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- }
- Component {
- name: "QQuickXAnimator"
- prototype: "QQuickAnimator"
- exports: ["QtQuick/XAnimator 2.12", "QtQuick/XAnimator 2.2"]
- exportMetaObjectRevisions: [12, 2]
- }
- Component {
- name: "QQuickYAnimator"
- prototype: "QQuickAnimator"
- exports: ["QtQuick/YAnimator 2.12", "QtQuick/YAnimator 2.2"]
- exportMetaObjectRevisions: [12, 2]
- }
- Component {
- name: "QRegExpValidator"
- prototype: "QValidator"
- exports: ["QtQuick/RegExpValidator 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "regExp"; type: "QRegExp" }
- Signal {
- name: "regExpChanged"
- Parameter { name: "regExp"; type: "QRegExp" }
- }
- }
- Component {
- name: "QRegularExpressionValidator"
- prototype: "QValidator"
- exports: ["QtQuick/RegularExpressionValidator 2.14"]
- exportMetaObjectRevisions: [0]
- Property { name: "regularExpression"; type: "QRegularExpression" }
- Signal {
- name: "regularExpressionChanged"
- Parameter { name: "re"; type: "QRegularExpression" }
- }
- Method {
- name: "setRegularExpression"
- Parameter { name: "re"; type: "QRegularExpression" }
- }
- }
- Component {
- name: "QValidator"
- prototype: "QObject"
- Enum {
- name: "State"
- values: {
- "Invalid": 0,
- "Intermediate": 1,
- "Acceptable": 2
- }
- }
- Signal { name: "changed" }
- }
-}
diff --git a/src/imports/qtquick2/qtquick2.pro b/src/imports/qtquick2/qtquick2.pro
index 8543049ead..da1772d415 100644
--- a/src/imports/qtquick2/qtquick2.pro
+++ b/src/imports/qtquick2/qtquick2.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qtquick2plugin
TARGETPATH = QtQuick.2
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp
index db941d9845..24ff43ea6f 100644
--- a/src/imports/settings/plugin.cpp
+++ b/src/imports/settings/plugin.cpp
@@ -44,19 +44,13 @@
QT_BEGIN_NAMESPACE
-class QmlSettingsPlugin : public QQmlExtensionPlugin
+class QmlSettingsPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QmlSettingsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QByteArray(uri) == QByteArray("Qt.labs.settings"));
- qmlRegisterTypesAndRevisions<QQmlSettings>(uri, 1);
- qmlRegisterModule(uri, 1, 1); // QTBUG-73239
- }
+ QmlSettingsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {}
};
QT_END_NAMESPACE
diff --git a/src/imports/settings/plugins.qmltypes b/src/imports/settings/plugins.qmltypes
deleted file mode 100644
index bbc5c1cf8f..0000000000
--- a/src/imports/settings/plugins.qmltypes
+++ /dev/null
@@ -1,36 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.settings 1.1'
-
-Module {
- dependencies: []
- Component {
- name: "QQmlSettings"
- prototype: "QObject"
- exports: ["Qt.labs.settings/Settings 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "category"; type: "string" }
- Property { name: "fileName"; type: "string" }
- Method {
- name: "value"
- type: "QVariant"
- Parameter { name: "key"; type: "string" }
- Parameter { name: "defaultValue"; type: "QVariant" }
- }
- Method {
- name: "value"
- type: "QVariant"
- Parameter { name: "key"; type: "string" }
- }
- Method {
- name: "setValue"
- Parameter { name: "key"; type: "string" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method { name: "sync" }
- }
-}
diff --git a/src/imports/settings/settings.pro b/src/imports/settings/settings.pro
index 816a6a9fef..d8062a2e55 100644
--- a/src/imports/settings/settings.pro
+++ b/src/imports/settings/settings.pro
@@ -12,4 +12,6 @@ SOURCES += \
plugin.cpp \
qqmlsettings.cpp
+CONFIG += qmltypes install_qmltypes
+
load(qml_plugin)
diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp
index 0b6191d5bb..3855a93fc7 100644
--- a/src/imports/shapes/plugin.cpp
+++ b/src/imports/shapes/plugin.cpp
@@ -56,12 +56,8 @@ public:
void registerTypes(const char *uri) override
{
- Q_ASSERT(QByteArray(uri) == QByteArray("QtQuick.Shapes"));
- qmlRegisterTypesAndRevisions<QQuickShape, QQuickShapePath, QQuickShapeGradient,
- QQuickShapeLinearGradient, QQuickShapeRadialGradient,
- QQuickShapeConicalGradient>(uri, 1);
-
- qmlRegisterModule(uri, 1, 15);
+ Q_UNUSED(uri);
+ QQuickShapesModule::defineModule();
}
};
diff --git a/src/imports/shapes/plugins.qmltypes b/src/imports/shapes/plugins.qmltypes
deleted file mode 100644
index fed68b5137..0000000000
--- a/src/imports/shapes/plugins.qmltypes
+++ /dev/null
@@ -1,172 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Shapes 1.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QQuickShape"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtQuick.Shapes/Shape 1.0",
- "QtQuick.Shapes/Shape 1.1",
- "QtQuick.Shapes/Shape 1.11",
- "QtQuick.Shapes/Shape 1.4",
- "QtQuick.Shapes/Shape 1.7"
- ]
- exportMetaObjectRevisions: [0, 1, 11, 4, 7]
- Enum {
- name: "RendererType"
- values: {
- "UnknownRenderer": 0,
- "GeometryRenderer": 1,
- "NvprRenderer": 2,
- "SoftwareRenderer": 3
- }
- }
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Processing": 2
- }
- }
- Enum {
- name: "ContainsMode"
- values: {
- "BoundingRectContains": 0,
- "FillContains": 1
- }
- }
- Property { name: "rendererType"; type: "RendererType"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- Property { name: "vendorExtensionsEnabled"; type: "bool" }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "containsMode"; revision: 11; type: "ContainsMode" }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Signal { name: "rendererChanged" }
- Signal { name: "containsModeChanged"; revision: 11 }
- }
- Component {
- name: "QQuickShapeConicalGradient"
- defaultProperty: "stops"
- prototype: "QQuickShapeGradient"
- exports: [
- "QtQuick.Shapes/ConicalGradient 1.0",
- "QtQuick.Shapes/ConicalGradient 1.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "centerX"; type: "double" }
- Property { name: "centerY"; type: "double" }
- Property { name: "angle"; type: "double" }
- }
- Component {
- name: "QQuickShapeGradient"
- defaultProperty: "stops"
- prototype: "QQuickGradient"
- exports: [
- "QtQuick.Shapes/ShapeGradient 1.0",
- "QtQuick.Shapes/ShapeGradient 1.12"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 12]
- Enum {
- name: "SpreadMode"
- values: {
- "PadSpread": 0,
- "RepeatSpread": 1,
- "ReflectSpread": 2
- }
- }
- Property { name: "spread"; type: "SpreadMode" }
- }
- Component {
- name: "QQuickShapeLinearGradient"
- defaultProperty: "stops"
- prototype: "QQuickShapeGradient"
- exports: [
- "QtQuick.Shapes/LinearGradient 1.0",
- "QtQuick.Shapes/LinearGradient 1.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "x1"; type: "double" }
- Property { name: "y1"; type: "double" }
- Property { name: "x2"; type: "double" }
- Property { name: "y2"; type: "double" }
- }
- Component {
- name: "QQuickShapePath"
- defaultProperty: "pathElements"
- prototype: "QQuickPath"
- exports: [
- "QtQuick.Shapes/ShapePath 1.0",
- "QtQuick.Shapes/ShapePath 1.14"
- ]
- exportMetaObjectRevisions: [0, 14]
- Enum {
- name: "FillRule"
- values: {
- "OddEvenFill": 0,
- "WindingFill": 1
- }
- }
- Enum {
- name: "JoinStyle"
- values: {
- "MiterJoin": 0,
- "BevelJoin": 64,
- "RoundJoin": 128
- }
- }
- Enum {
- name: "CapStyle"
- values: {
- "FlatCap": 0,
- "SquareCap": 16,
- "RoundCap": 32
- }
- }
- Enum {
- name: "StrokeStyle"
- values: {
- "SolidLine": 1,
- "DashLine": 2
- }
- }
- Property { name: "strokeColor"; type: "QColor" }
- Property { name: "strokeWidth"; type: "double" }
- Property { name: "fillColor"; type: "QColor" }
- Property { name: "fillRule"; type: "FillRule" }
- Property { name: "joinStyle"; type: "JoinStyle" }
- Property { name: "miterLimit"; type: "int" }
- Property { name: "capStyle"; type: "CapStyle" }
- Property { name: "strokeStyle"; type: "StrokeStyle" }
- Property { name: "dashOffset"; type: "double" }
- Property { name: "dashPattern"; type: "QVector<qreal>" }
- Property { name: "fillGradient"; type: "QQuickShapeGradient"; isPointer: true }
- Property { name: "scale"; revision: 14; type: "QSizeF" }
- Signal { name: "shapePathChanged" }
- }
- Component {
- name: "QQuickShapeRadialGradient"
- defaultProperty: "stops"
- prototype: "QQuickShapeGradient"
- exports: [
- "QtQuick.Shapes/RadialGradient 1.0",
- "QtQuick.Shapes/RadialGradient 1.12"
- ]
- exportMetaObjectRevisions: [0, 12]
- Property { name: "centerX"; type: "double" }
- Property { name: "centerY"; type: "double" }
- Property { name: "centerRadius"; type: "double" }
- Property { name: "focalX"; type: "double" }
- Property { name: "focalY"; type: "double" }
- Property { name: "focalRadius"; type: "double" }
- }
-}
diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro
index 857fcd7564..bb02dbf08f 100644
--- a/src/imports/shapes/shapes.pro
+++ b/src/imports/shapes/shapes.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmlshapesplugin
TARGETPATH = QtQuick/Shapes
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+IMPORT_VERSION = 1.15
QT = core gui-private qml quick-private quickshapes-private
diff --git a/src/imports/sharedimage/plugin.cpp b/src/imports/sharedimage/plugin.cpp
index b75e38e303..237fa64c61 100644
--- a/src/imports/sharedimage/plugin.cpp
+++ b/src/imports/sharedimage/plugin.cpp
@@ -101,18 +101,12 @@
QT_BEGIN_NAMESPACE
-class QtQuickSharedImagePlugin : public QQmlExtensionPlugin
+class QtQuickSharedImagePlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) {}
-
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(uri == QStringLiteral("Qt.labs.sharedimage"));
- qmlRegisterModule(uri, 1, 0);
- }
+ QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {}
void initializeEngine(QQmlEngine *engine, const char *uri) override
{
diff --git a/src/imports/sharedimage/plugins.qmltypes b/src/imports/sharedimage/plugins.qmltypes
deleted file mode 100644
index 29639e7697..0000000000
--- a/src/imports/sharedimage/plugins.qmltypes
+++ /dev/null
@@ -1,11 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.sharedimage 1.0'
-
-Module {
- dependencies: ["QtQuick 2.0"]
-}
diff --git a/src/imports/sharedimage/sharedimage.pro b/src/imports/sharedimage/sharedimage.pro
index 46a6a56ca5..8ab4f10405 100644
--- a/src/imports/sharedimage/sharedimage.pro
+++ b/src/imports/sharedimage/sharedimage.pro
@@ -14,4 +14,5 @@ HEADERS += \
sharedimageprovider.h \
qsharedimageloader_p.h
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
index 993e91afea..4c991994f3 100644
--- a/src/imports/statemachine/plugin.cpp
+++ b/src/imports/statemachine/plugin.cpp
@@ -50,23 +50,13 @@
QT_BEGIN_NAMESPACE
-class QtQmlStateMachinePlugin : public QQmlExtensionPlugin
+class QtQmlStateMachinePlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- qmlRegisterTypesAndRevisions<
- State, StateMachine, FinalState, TimeoutTransition, SignalTransition,
- QHistoryStateForeign, QStateForeign, QAbstractStateForeign, QSignalTransitionForeign
- >(uri, 1);
- qmlProtectModule(uri, 1);
-
- qmlRegisterModule(uri, 1, 15);
- }
+ QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
};
QT_END_NAMESPACE
diff --git a/src/imports/statemachine/plugins.qmltypes b/src/imports/statemachine/plugins.qmltypes
deleted file mode 100644
index 206159f057..0000000000
--- a/src/imports/statemachine/plugins.qmltypes
+++ /dev/null
@@ -1,179 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml.StateMachine 1.14'
-
-Module {
- dependencies: []
- Component {
- name: "FinalState"
- defaultProperty: "children"
- prototype: "QFinalState"
- exports: ["QtQml.StateMachine/FinalState 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QAbstractState"
- prototype: "QObject"
- exports: ["QtQml.StateMachine/QAbstractState 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "active"; type: "bool"; isReadonly: true }
- Signal { name: "entered" }
- Signal { name: "exited" }
- Signal {
- name: "activeChanged"
- Parameter { name: "active"; type: "bool" }
- }
- }
- Component {
- name: "QAbstractTransition"
- prototype: "QObject"
- Enum {
- name: "TransitionType"
- values: {
- "ExternalTransition": 0,
- "InternalTransition": 1
- }
- }
- Property { name: "sourceState"; type: "QState"; isReadonly: true; isPointer: true }
- Property { name: "targetState"; type: "QAbstractState"; isPointer: true }
- Property { name: "targetStates"; type: "QList<QAbstractState*>" }
- Property { name: "transitionType"; revision: 1; type: "TransitionType" }
- Signal { name: "triggered" }
- }
- Component { name: "QFinalState"; prototype: "QAbstractState" }
- Component {
- name: "QHistoryState"
- prototype: "QAbstractState"
- exports: ["QtQml.StateMachine/HistoryState 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "HistoryType"
- values: {
- "ShallowHistory": 0,
- "DeepHistory": 1
- }
- }
- Property { name: "defaultState"; type: "QAbstractState"; isPointer: true }
- Property { name: "defaultTransition"; type: "QAbstractTransition"; isPointer: true }
- Property { name: "historyType"; type: "HistoryType" }
- }
- Component {
- name: "QSignalTransition"
- prototype: "QAbstractTransition"
- exports: ["QtQml.StateMachine/QSignalTransition 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "senderObject"; type: "QObject"; isPointer: true }
- Property { name: "signal"; type: "QByteArray" }
- }
- Component {
- name: "QState"
- prototype: "QAbstractState"
- exports: ["QtQml.StateMachine/QState 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "ChildMode"
- values: {
- "ExclusiveStates": 0,
- "ParallelStates": 1
- }
- }
- Enum {
- name: "RestorePolicy"
- values: {
- "DontRestoreProperties": 0,
- "RestoreProperties": 1
- }
- }
- Property { name: "initialState"; type: "QAbstractState"; isPointer: true }
- Property { name: "errorState"; type: "QAbstractState"; isPointer: true }
- Property { name: "childMode"; type: "ChildMode" }
- Signal { name: "finished" }
- Signal { name: "propertiesAssigned" }
- }
- Component {
- name: "QStateMachine"
- prototype: "QState"
- Property { name: "errorString"; type: "string"; isReadonly: true }
- Property { name: "globalRestorePolicy"; type: "QState::RestorePolicy" }
- Property { name: "running"; type: "bool" }
- Property { name: "animated"; type: "bool" }
- Signal { name: "started" }
- Signal { name: "stopped" }
- Signal {
- name: "runningChanged"
- Parameter { name: "running"; type: "bool" }
- }
- Method { name: "start" }
- Method { name: "stop" }
- Method {
- name: "setRunning"
- Parameter { name: "running"; type: "bool" }
- }
- }
- Component {
- name: "QTimer"
- prototype: "QObject"
- Property { name: "singleShot"; type: "bool" }
- Property { name: "interval"; type: "int" }
- Property { name: "remainingTime"; type: "int"; isReadonly: true }
- Property { name: "timerType"; type: "Qt::TimerType" }
- Property { name: "active"; type: "bool"; isReadonly: true }
- Signal { name: "timeout" }
- Method {
- name: "start"
- Parameter { name: "msec"; type: "int" }
- }
- Method { name: "start" }
- Method { name: "stop" }
- }
- Component {
- name: "SignalTransition"
- prototype: "QSignalTransition"
- exports: [
- "QtQml.StateMachine/SignalTransition 1.0",
- "QtQml.StateMachine/SignalTransition 1.1"
- ]
- exportMetaObjectRevisions: [0, 1]
- Property { name: "signal"; type: "QJSValue" }
- Property { name: "guard"; type: "QQmlScriptString" }
- Signal { name: "invokeYourself" }
- Signal { name: "qmlSignalChanged" }
- Method { name: "invoke" }
- }
- Component {
- name: "State"
- defaultProperty: "children"
- prototype: "QState"
- exports: ["QtQml.StateMachine/State 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "StateMachine"
- defaultProperty: "children"
- prototype: "QStateMachine"
- exports: ["QtQml.StateMachine/StateMachine 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "running"; type: "bool" }
- Signal { name: "qmlRunningChanged" }
- }
- Component {
- name: "TimeoutTransition"
- prototype: "QSignalTransition"
- exports: [
- "QtQml.StateMachine/TimeoutTransition 1.0",
- "QtQml.StateMachine/TimeoutTransition 1.1"
- ]
- exportMetaObjectRevisions: [0, 1]
- Property { name: "timeout"; type: "int" }
- }
-}
diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro
index 7affc768e2..b17ec6140d 100644
--- a/src/imports/statemachine/statemachine.pro
+++ b/src/imports/statemachine/statemachine.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qtqmlstatemachine
TARGETPATH = QtQml/StateMachine
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+IMPORT_VERSION = 1.15
QT = core-private qml-private
@@ -22,4 +22,6 @@ HEADERS = \
$$PWD/timeouttransition.h \
$$PWD/statemachineforeign.h
+CONFIG += qmltypes install_qmltypes
+
load(qml_plugin)
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 6e075d8792..20c5ce6418 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -1417,19 +1417,23 @@ Item {
// Divide dx and dy to have intermediate mouseMove while dragging
// Fractions of dx/dy need be superior to the dragThreshold
// to make the drag works though
- var ddx = Math.round(dx/3)
- if (ddx < (util.dragThreshold + 1))
- ddx = 0
- var ddy = Math.round(dy/3)
- if (ddy < (util.dragThreshold + 1))
- ddy = 0
+ var intermediateDx = Math.round(dx/3)
+ if (Math.abs(intermediateDx) < (util.dragThreshold + 1))
+ intermediateDx = 0
+ var intermediateDy = Math.round(dy/3)
+ if (Math.abs(intermediateDy) < (util.dragThreshold + 1))
+ intermediateDy = 0
mousePress(item, x, y, button, modifiers, delay)
- //trigger dragging
- mouseMove(item, x + util.dragThreshold + 1, y + util.dragThreshold + 1, moveDelay, button)
- if (ddx > 0 || ddy > 0) {
- mouseMove(item, x + ddx, y + ddy, moveDelay, button)
- mouseMove(item, x + 2*ddx, y + 2*ddy, moveDelay, button)
+
+ // Trigger dragging by dragging past the drag threshold, but making sure to only drag
+ // along a certain axis if a distance greater than zero was given for that axis.
+ var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0
+ var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0
+ mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button)
+ if (intermediateDx !== 0 || intermediateDy !== 0) {
+ mouseMove(item, x + intermediateDx, y + intermediateDy, moveDelay, button)
+ mouseMove(item, x + 2*intermediateDx, y + 2*intermediateDy, moveDelay, button)
}
mouseMove(item, x + dx, y + dy, moveDelay, button)
mouseRelease(item, x + dx, y + dy, button, modifiers, delay)
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 86f0dd6dc7..1914c02dd0 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -37,11 +37,13 @@
**
****************************************************************************/
+#include "quicktestevent_p.h"
+#include "quicktestutil_p.h"
+
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
+#include <QtQuickTest/quicktest.h>
#include <QtQuickTest/private/quicktestresult_p.h>
-#include <QtQuickTest/private/quicktestevent_p.h>
-#include <QtQuickTest/private/quicktestutil_p.h>
#include <QtQuickTest/private/qtestoptions_p.h>
QML_DECLARE_TYPE(QuickTestResult)
@@ -50,21 +52,13 @@ QML_DECLARE_TYPE(QuickTestUtil)
QT_BEGIN_NAMESPACE
-class QTestQmlModule : public QQmlExtensionPlugin
+class QTestQmlModule : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QTestQmlModule(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtTest"));
- qmlRegisterTypesAndRevisions<QuickTestResult, QuickTestEvent,
- QuickTestUtil, QQuickTouchEventSequence>(uri, 1);
-
- qmlRegisterModule(uri, 1, 15);
- }
+ QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
};
QT_END_NAMESPACE
diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes
deleted file mode 100644
index 0491079e86..0000000000
--- a/src/imports/testlib/plugins.qmltypes
+++ /dev/null
@@ -1,368 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtTest 1.14'
-
-Module {
- dependencies: ["QtQuick 2.0", "QtQuick.Window 2.0"]
- Component {
- name: "QQuickTouchEventSequence"
- prototype: "QObject"
- Method {
- name: "press"
- type: "QObject*"
- Parameter { name: "touchId"; type: "int" }
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "move"
- type: "QObject*"
- Parameter { name: "touchId"; type: "int" }
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "release"
- type: "QObject*"
- Parameter { name: "touchId"; type: "int" }
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "stationary"
- type: "QObject*"
- Parameter { name: "touchId"; type: "int" }
- }
- Method { name: "commit"; type: "QObject*" }
- }
- Component {
- name: "QuickTestEvent"
- prototype: "QObject"
- exports: ["QtTest/TestEvent 1.0", "QtTest/TestEvent 1.2"]
- exportMetaObjectRevisions: [0, 2]
- Property { name: "defaultMouseDelay"; type: "int"; isReadonly: true }
- Method {
- name: "keyPress"
- type: "bool"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keyRelease"
- type: "bool"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keyClick"
- type: "bool"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keyPressChar"
- type: "bool"
- Parameter { name: "character"; type: "string" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keyReleaseChar"
- type: "bool"
- Parameter { name: "character"; type: "string" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keyClickChar"
- type: "bool"
- Parameter { name: "character"; type: "string" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "keySequence"
- revision: 2
- type: "bool"
- Parameter { name: "keySequence"; type: "QVariant" }
- }
- Method {
- name: "mousePress"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "button"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "mouseRelease"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "button"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "mouseClick"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "button"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "mouseDoubleClick"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "button"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "mouseDoubleClickSequence"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "button"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "mouseMove"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "delay"; type: "int" }
- Parameter { name: "buttons"; type: "int" }
- }
- Method {
- name: "mouseWheel"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- Parameter { name: "buttons"; type: "int" }
- Parameter { name: "modifiers"; type: "int" }
- Parameter { name: "xDelta"; type: "int" }
- Parameter { name: "yDelta"; type: "int" }
- Parameter { name: "delay"; type: "int" }
- }
- Method {
- name: "touchEvent"
- type: "QQuickTouchEventSequence*"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- }
- Method { name: "touchEvent"; type: "QQuickTouchEventSequence*" }
- }
- Component {
- name: "QuickTestResult"
- prototype: "QObject"
- exports: [
- "QtTest/TestResult 1.0",
- "QtTest/TestResult 1.1",
- "QtTest/TestResult 1.13"
- ]
- exportMetaObjectRevisions: [0, 1, 13]
- Enum {
- name: "RunMode"
- values: {
- "RepeatUntilValidMeasurement": 0,
- "RunOnce": 1
- }
- }
- Property { name: "testCaseName"; type: "string" }
- Property { name: "functionName"; type: "string" }
- Property { name: "dataTag"; type: "string" }
- Property { name: "failed"; type: "bool"; isReadonly: true }
- Property { name: "skipped"; type: "bool" }
- Property { name: "passCount"; type: "int"; isReadonly: true }
- Property { name: "failCount"; type: "int"; isReadonly: true }
- Property { name: "skipCount"; type: "int"; isReadonly: true }
- Property { name: "functionsToRun"; type: "QStringList"; isReadonly: true }
- Property { name: "tagsToRun"; type: "QStringList"; isReadonly: true }
- Signal { name: "programNameChanged" }
- Method { name: "reset" }
- Method { name: "startLogging" }
- Method { name: "stopLogging" }
- Method { name: "initTestTable" }
- Method { name: "clearTestTable" }
- Method { name: "finishTestData" }
- Method { name: "finishTestDataCleanup" }
- Method { name: "finishTestFunction" }
- Method {
- name: "stringify"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "fail"
- Parameter { name: "message"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "verify"
- type: "bool"
- Parameter { name: "success"; type: "bool" }
- Parameter { name: "message"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "compare"
- type: "bool"
- Parameter { name: "success"; type: "bool" }
- Parameter { name: "message"; type: "string" }
- Parameter { name: "val1"; type: "QVariant" }
- Parameter { name: "val2"; type: "QVariant" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "fuzzyCompare"
- type: "bool"
- Parameter { name: "actual"; type: "QVariant" }
- Parameter { name: "expected"; type: "QVariant" }
- Parameter { name: "delta"; type: "double" }
- }
- Method {
- name: "skip"
- Parameter { name: "message"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "expectFail"
- type: "bool"
- Parameter { name: "tag"; type: "string" }
- Parameter { name: "comment"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "expectFailContinue"
- type: "bool"
- Parameter { name: "tag"; type: "string" }
- Parameter { name: "comment"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "warn"
- Parameter { name: "message"; type: "string" }
- Parameter { name: "location"; type: "QUrl" }
- Parameter { name: "line"; type: "int" }
- }
- Method {
- name: "ignoreWarning"
- Parameter { name: "message"; type: "QJSValue" }
- }
- Method {
- name: "wait"
- Parameter { name: "ms"; type: "int" }
- }
- Method {
- name: "sleep"
- Parameter { name: "ms"; type: "int" }
- }
- Method {
- name: "waitForRendering"
- type: "bool"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- Parameter { name: "timeout"; type: "int" }
- }
- Method {
- name: "waitForRendering"
- type: "bool"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method { name: "startMeasurement" }
- Method { name: "beginDataRun" }
- Method { name: "endDataRun" }
- Method { name: "measurementAccepted"; type: "bool" }
- Method { name: "needsMoreMeasurements"; type: "bool" }
- Method {
- name: "startBenchmark"
- Parameter { name: "runMode"; type: "RunMode" }
- Parameter { name: "tag"; type: "string" }
- }
- Method { name: "isBenchmarkDone"; type: "bool" }
- Method { name: "nextBenchmark" }
- Method { name: "stopBenchmark" }
- Method {
- name: "grabImage"
- type: "QObject*"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "findChild"
- revision: 1
- type: "QObject*"
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- Parameter { name: "objectName"; type: "string" }
- }
- Method {
- name: "isPolishScheduled"
- revision: 13
- type: "bool"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- }
- Method {
- name: "waitForItemPolished"
- revision: 13
- type: "bool"
- Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
- Parameter { name: "timeout"; type: "int" }
- }
- }
- Component {
- name: "QuickTestUtil"
- prototype: "QObject"
- exports: ["QtTest/TestUtil 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "printAvailableFunctions"; type: "bool"; isReadonly: true }
- Property { name: "dragThreshold"; type: "int"; isReadonly: true }
- Method {
- name: "typeName"
- type: "QJSValue"
- Parameter { name: "v"; type: "QVariant" }
- }
- Method {
- name: "compare"
- type: "bool"
- Parameter { name: "act"; type: "QVariant" }
- Parameter { name: "exp"; type: "QVariant" }
- }
- Method {
- name: "callerFile"
- type: "QJSValue"
- Parameter { name: "frameIndex"; type: "int" }
- }
- Method { name: "callerFile"; type: "QJSValue" }
- Method {
- name: "callerLine"
- type: "int"
- Parameter { name: "frameIndex"; type: "int" }
- }
- Method { name: "callerLine"; type: "int" }
- }
-}
diff --git a/src/qmltest/quicktestevent.cpp b/src/imports/testlib/quicktestevent.cpp
index 127efa3894..56faff9f7e 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/imports/testlib/quicktestevent.cpp
@@ -197,7 +197,7 @@ namespace QtQuickTest
me.setTimestamp(++lastMouseTimestamp);
break;
case MouseRelease:
- me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, nullptr, stateKey);
+ me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, {}, stateKey);
me.setTimestamp(++lastMouseTimestamp);
lastMouseTimestamp += 500; // avoid double clicks being generated
break;
diff --git a/src/qmltest/quicktestevent_p.h b/src/imports/testlib/quicktestevent_p.h
index a3c2e78e58..f452e4ff82 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/imports/testlib/quicktestevent_p.h
@@ -51,7 +51,6 @@
// We mean it.
//
-#include <QtQuickTest/quicktestglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/QWindow>
#include <QtQml/qqml.h>
@@ -60,7 +59,7 @@
QT_BEGIN_NAMESPACE
class QuickTestEvent;
-class Q_QUICK_TEST_EXPORT QQuickTouchEventSequence : public QObject
+class QQuickTouchEventSequence : public QObject
{
Q_OBJECT
QML_ANONYMOUS
@@ -79,7 +78,7 @@ private:
QuickTestEvent * const m_testEvent;
};
-class Q_QUICK_TEST_EXPORT QuickTestEvent : public QObject
+class QuickTestEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL)
diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule_p.h b/src/imports/testlib/quicktestresultforeign_p.h
index ae52d10c16..92ff8e8a5a 100644
--- a/src/qmlworkerscript/qqmlworkerscriptmodule_p.h
+++ b/src/imports/testlib/quicktestresultforeign_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtQml module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QQMLWORKERSCRIPTMODULE_P_H
-#define QQMLWORKERSCRIPTMODULE_P_H
+#ifndef QUICKTESTRESULTFOREIGN_P_H
+#define QUICKTESTRESULTFOREIGN_P_H
//
// W A R N I N G
@@ -51,16 +51,18 @@
// We mean it.
//
-#include <private/qtqmlworkerscriptglobal_p.h>
+#include <QtQuickTest/private/quicktestresult_p.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
-class Q_QMLWORKERSCRIPT_PRIVATE_EXPORT QQmlWorkerScriptModule
+struct QuickTestResultForeign
{
-public:
- static void defineModule();
+ Q_GADGET
+ QML_FOREIGN(QuickTestResult)
+ QML_NAMED_ELEMENT(TestResult)
};
QT_END_NAMESPACE
-#endif // QQMLWORKERSCRIPTMODULE_P_H
+#endif // QUICKTESTRESULTFOREIGN_P_H
diff --git a/src/qmltest/quicktestutil.cpp b/src/imports/testlib/quicktestutil.cpp
index d9e6a2fba5..d9e6a2fba5 100644
--- a/src/qmltest/quicktestutil.cpp
+++ b/src/imports/testlib/quicktestutil.cpp
diff --git a/src/qmltest/quicktestutil_p.h b/src/imports/testlib/quicktestutil_p.h
index 74d315df7d..2456bf88a7 100644
--- a/src/qmltest/quicktestutil_p.h
+++ b/src/imports/testlib/quicktestutil_p.h
@@ -51,14 +51,13 @@
// We mean it.
//
-#include <QtQuickTest/quicktestglobal.h>
#include <QtCore/qobject.h>
#include <QtQml/qqml.h>
#include <QtQml/qjsvalue.h>
QT_BEGIN_NAMESPACE
-class Q_QUICK_TEST_EXPORT QuickTestUtil : public QObject
+class QuickTestUtil : public QObject
{
Q_OBJECT
Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
diff --git a/src/imports/testlib/testlib.pro b/src/imports/testlib/testlib.pro
index acbe82e5e6..de6453eeab 100644
--- a/src/imports/testlib/testlib.pro
+++ b/src/imports/testlib/testlib.pro
@@ -1,11 +1,19 @@
CXX_MODULE = qml
TARGET = qmltestplugin
TARGETPATH = QtTest
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+IMPORT_VERSION = 1.15
-QT += qml quick qmltest qmltest-private qml-private core-private testlib
+QT += quick qmltest-private qml-private core-private testlib gui-private
-SOURCES += main.cpp
+SOURCES += \
+ main.cpp \
+ quicktestevent.cpp \
+ quicktestutil.cpp
+
+HEADERS += \
+ quicktestevent_p.h \
+ quicktestresultforeign_p.h \
+ quicktestutil_p.h
QML_FILES = \
TestCase.qml \
@@ -15,3 +23,4 @@ QML_FILES = \
load(qml_plugin)
OTHER_FILES += testlib.json
+CONFIG += qmltypes install_qmltypes
diff --git a/src/imports/wavefrontmesh/plugin.cpp b/src/imports/wavefrontmesh/plugin.cpp
index 937d3a8ff0..9bb7a45b2f 100644
--- a/src/imports/wavefrontmesh/plugin.cpp
+++ b/src/imports/wavefrontmesh/plugin.cpp
@@ -44,23 +44,15 @@
QT_BEGIN_NAMESPACE
-class QmlWavefrontMeshPlugin : public QQmlExtensionPlugin
+class QmlWavefrontMeshPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
QmlWavefrontMeshPlugin(QObject *parent = nullptr)
- : QQmlExtensionPlugin(parent)
+ : QQmlEngineExtensionPlugin(parent)
{
}
-
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.wavefrontmesh"));
- qmlRegisterTypesAndRevisions<QWavefrontMesh>(uri, 1);
-
- qmlRegisterModule(uri, 1, 15);
- }
};
QT_END_NAMESPACE
diff --git a/src/imports/wavefrontmesh/plugins.qmltypes b/src/imports/wavefrontmesh/plugins.qmltypes
deleted file mode 100644
index 4e6a1dca73..0000000000
--- a/src/imports/wavefrontmesh/plugins.qmltypes
+++ /dev/null
@@ -1,37 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.wavefrontmesh 1.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QWavefrontMesh"
- prototype: "QQuickShaderEffectMesh"
- exports: ["Qt.labs.wavefrontmesh/WavefrontMesh 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Error"
- values: {
- "NoError": 0,
- "InvalidSourceError": 1,
- "UnsupportedFaceShapeError": 2,
- "UnsupportedIndexSizeError": 3,
- "FileNotFoundError": 4,
- "NoAttributesError": 5,
- "MissingPositionAttributeError": 6,
- "MissingTextureCoordinateAttributeError": 7,
- "MissingPositionAndTextureCoordinateAttributesError": 8,
- "TooManyAttributesError": 9,
- "InvalidPlaneDefinitionError": 10
- }
- }
- Property { name: "source"; type: "QUrl" }
- Property { name: "lastError"; type: "Error"; isReadonly: true }
- Property { name: "projectionPlaneV"; type: "QVector3D" }
- Property { name: "projectionPlaneW"; type: "QVector3D" }
- }
-}
diff --git a/src/imports/wavefrontmesh/wavefrontmesh.pro b/src/imports/wavefrontmesh/wavefrontmesh.pro
index 85bd500089..f6d93b867d 100644
--- a/src/imports/wavefrontmesh/wavefrontmesh.pro
+++ b/src/imports/wavefrontmesh/wavefrontmesh.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmlwavefrontmeshplugin
TARGETPATH = Qt/labs/wavefrontmesh
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+IMPORT_VERSION = 1.15
QT = core-private qml-private quick-private
@@ -12,4 +12,5 @@ SOURCES += \
HEADERS += \
qwavefrontmesh.h
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp
index 2ef4bcb2f1..ec4f2c5d2a 100644
--- a/src/imports/window/plugin.cpp
+++ b/src/imports/window/plugin.cpp
@@ -58,27 +58,13 @@ QT_BEGIN_NAMESPACE
\endqml
*/
-
//![class decl]
-class QtQuick2WindowPlugin : public QQmlExtensionPlugin
+class QtQuick2WindowPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Window"));
-
- qmlRegisterTypesAndRevisions<
- QWindowForeign,
- QQuickWindowForeign,
- QQuickWindowQmlImplForeign,
- QQuickScreenForeign,
- QQuickScreenInfoForeign>(uri, 2);
-
- qmlRegisterModule(uri, 2, 15);
- }
+ QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
};
//![class decl]
diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes
deleted file mode 100644
index 5d6cf33f4f..0000000000
--- a/src/imports/window/plugins.qmltypes
+++ /dev/null
@@ -1,378 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Window 2.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QQuickRootItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- Method {
- name: "setWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "h"; type: "int" }
- }
- }
- Component {
- name: "QQuickScreen"
- prototype: "QObject"
- exports: [
- "QtQuick.Window/Screen 2.0",
- "QtQuick.Window/Screen 2.10",
- "QtQuick.Window/Screen 2.3"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 10, 3]
- attachedType: "QQuickScreenAttached"
- }
- Component {
- name: "QQuickScreenAttached"
- prototype: "QQuickScreenInfo"
- Property { name: "orientationUpdateMask"; type: "Qt::ScreenOrientations" }
- Method {
- name: "angleBetween"
- type: "int"
- Parameter { name: "a"; type: "int" }
- Parameter { name: "b"; type: "int" }
- }
- }
- Component {
- name: "QQuickScreenInfo"
- prototype: "QObject"
- exports: [
- "QtQuick.Window/ScreenInfo 2.10",
- "QtQuick.Window/ScreenInfo 2.3"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [10, 3]
- Property { name: "name"; type: "string"; isReadonly: true }
- Property { name: "manufacturer"; revision: 10; type: "string"; isReadonly: true }
- Property { name: "model"; revision: 10; type: "string"; isReadonly: true }
- Property { name: "serialNumber"; revision: 10; type: "string"; isReadonly: true }
- Property { name: "width"; type: "int"; isReadonly: true }
- Property { name: "height"; type: "int"; isReadonly: true }
- Property { name: "desktopAvailableWidth"; type: "int"; isReadonly: true }
- Property { name: "desktopAvailableHeight"; type: "int"; isReadonly: true }
- Property { name: "logicalPixelDensity"; type: "double"; isReadonly: true }
- Property { name: "pixelDensity"; type: "double"; isReadonly: true }
- Property { name: "devicePixelRatio"; type: "double"; isReadonly: true }
- Property { name: "primaryOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
- Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
- Property { name: "virtualX"; revision: 3; type: "int"; isReadonly: true }
- Property { name: "virtualY"; revision: 3; type: "int"; isReadonly: true }
- Signal { name: "manufacturerChanged"; revision: 10 }
- Signal { name: "modelChanged"; revision: 10 }
- Signal { name: "serialNumberChanged"; revision: 10 }
- Signal { name: "desktopGeometryChanged" }
- Signal { name: "virtualXChanged"; revision: 3 }
- Signal { name: "virtualYChanged"; revision: 3 }
- }
- Component {
- name: "QQuickWindow"
- defaultProperty: "data"
- prototype: "QWindow"
- exports: ["QtQuick.Window/Window 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "CreateTextureOptions"
- values: {
- "TextureHasAlphaChannel": 1,
- "TextureHasMipmaps": 2,
- "TextureOwnsGLTexture": 4,
- "TextureCanUseAtlas": 8,
- "TextureIsOpaque": 16
- }
- }
- Enum {
- name: "SceneGraphError"
- values: {
- "ContextNotAvailable": 1
- }
- }
- Enum {
- name: "TextRenderType"
- values: {
- "QtTextRendering": 0,
- "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 }
- Property {
- name: "activeFocusItem"
- revision: 1
- type: "QQuickItem"
- isReadonly: true
- isPointer: true
- }
- Signal { name: "frameSwapped" }
- Signal {
- name: "openglContextCreated"
- revision: 2
- Parameter { name: "context"; type: "QOpenGLContext"; isPointer: true }
- }
- Signal { name: "sceneGraphInitialized" }
- Signal { name: "sceneGraphInvalidated" }
- Signal { name: "beforeSynchronizing" }
- Signal { name: "afterSynchronizing"; revision: 2 }
- Signal { name: "beforeRendering" }
- Signal { name: "afterRendering" }
- Signal { name: "afterAnimating"; revision: 2 }
- Signal { name: "sceneGraphAboutToStop"; revision: 2 }
- Signal {
- name: "closing"
- revision: 1
- Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
- }
- Signal {
- name: "colorChanged"
- Parameter { type: "QColor" }
- }
- Signal { name: "activeFocusItemChanged"; revision: 1 }
- Signal {
- name: "sceneGraphError"
- revision: 2
- Parameter { name: "error"; type: "QQuickWindow::SceneGraphError" }
- Parameter { name: "message"; type: "string" }
- }
- Signal { name: "beforeRenderPassRecording"; revision: 14 }
- Signal { name: "afterRenderPassRecording"; revision: 14 }
- Method { name: "update" }
- Method { name: "releaseResources" }
- }
- Component {
- name: "QQuickWindowAttached"
- prototype: "QObject"
- Property { name: "visibility"; type: "QWindow::Visibility"; isReadonly: true }
- Property { name: "active"; type: "bool"; isReadonly: true }
- Property { name: "activeFocusItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "width"; type: "int"; isReadonly: true }
- Property { name: "height"; type: "int"; isReadonly: true }
- Property { name: "window"; type: "QQuickWindow"; isReadonly: true; isPointer: true }
- }
- Component {
- name: "QQuickWindowQmlImpl"
- defaultProperty: "data"
- prototype: "QQuickWindow"
- exports: [
- "QtQuick.Window/Window 2.1",
- "QtQuick.Window/Window 2.13",
- "QtQuick.Window/Window 2.14",
- "QtQuick.Window/Window 2.2",
- "QtQuick.Window/Window 2.3"
- ]
- exportMetaObjectRevisions: [1, 13, 14, 2, 3]
- attachedType: "QQuickWindowAttached"
- Property { name: "visible"; type: "bool" }
- Property { name: "visibility"; type: "Visibility" }
- Property { name: "screen"; revision: 3; type: "QObject"; isPointer: true }
- Signal {
- name: "visibleChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "visibilityChanged"
- Parameter { name: "visibility"; type: "QWindow::Visibility" }
- }
- Signal { name: "screenChanged"; revision: 3 }
- }
- Component {
- name: "QWindow"
- prototype: "QObject"
- Enum {
- name: "Visibility"
- values: {
- "Hidden": 0,
- "AutomaticVisibility": 1,
- "Windowed": 2,
- "Minimized": 3,
- "Maximized": 4,
- "FullScreen": 5
- }
- }
- Enum {
- name: "AncestorMode"
- values: {
- "ExcludeTransients": 0,
- "IncludeTransients": 1
- }
- }
- Property { name: "title"; type: "string" }
- Property { name: "modality"; type: "Qt::WindowModality" }
- Property { name: "flags"; type: "Qt::WindowFlags" }
- Property { name: "x"; type: "int" }
- Property { name: "y"; type: "int" }
- Property { name: "width"; type: "int" }
- Property { name: "height"; type: "int" }
- Property { name: "minimumWidth"; type: "int" }
- Property { name: "minimumHeight"; type: "int" }
- Property { name: "maximumWidth"; type: "int" }
- Property { name: "maximumHeight"; type: "int" }
- Property { name: "visible"; type: "bool" }
- Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
- Property { name: "visibility"; revision: 1; type: "Visibility" }
- Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
- Property { name: "opacity"; revision: 1; type: "double" }
- Property { name: "transientParent"; revision: 13; type: "QWindow"; isPointer: true }
- Signal {
- name: "screenChanged"
- Parameter { name: "screen"; type: "QScreen"; isPointer: true }
- }
- Signal {
- name: "modalityChanged"
- Parameter { name: "modality"; type: "Qt::WindowModality" }
- }
- Signal {
- name: "windowStateChanged"
- Parameter { name: "windowState"; type: "Qt::WindowState" }
- }
- Signal {
- name: "windowTitleChanged"
- revision: 2
- Parameter { name: "title"; type: "string" }
- }
- Signal {
- name: "xChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "yChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "widthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "heightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "minimumWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "minimumHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "maximumWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "maximumHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "visibleChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "visibilityChanged"
- revision: 1
- Parameter { name: "visibility"; type: "QWindow::Visibility" }
- }
- Signal { name: "activeChanged"; revision: 1 }
- Signal {
- name: "contentOrientationChanged"
- Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
- }
- Signal {
- name: "focusObjectChanged"
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Signal {
- name: "opacityChanged"
- revision: 1
- Parameter { name: "opacity"; type: "double" }
- }
- Signal {
- name: "transientParentChanged"
- revision: 13
- Parameter { name: "transientParent"; type: "QWindow"; isPointer: true }
- }
- Method { name: "requestActivate"; revision: 1 }
- Method {
- name: "setVisible"
- Parameter { name: "visible"; type: "bool" }
- }
- Method { name: "show" }
- Method { name: "hide" }
- Method { name: "showMinimized" }
- Method { name: "showMaximized" }
- Method { name: "showFullScreen" }
- Method { name: "showNormal" }
- Method { name: "close"; type: "bool" }
- Method { name: "raise" }
- Method { name: "lower" }
- Method {
- name: "setTitle"
- Parameter { type: "string" }
- }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setGeometry"
- Parameter { name: "posx"; type: "int" }
- Parameter { name: "posy"; type: "int" }
- Parameter { name: "w"; type: "int" }
- Parameter { name: "h"; type: "int" }
- }
- Method {
- name: "setGeometry"
- Parameter { name: "rect"; type: "QRect" }
- }
- Method {
- name: "setMinimumWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setMinimumHeight"
- Parameter { name: "h"; type: "int" }
- }
- Method {
- name: "setMaximumWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setMaximumHeight"
- Parameter { name: "h"; type: "int" }
- }
- Method {
- name: "alert"
- revision: 1
- Parameter { name: "msec"; type: "int" }
- }
- Method { name: "requestUpdate"; revision: 3 }
- }
-}
diff --git a/src/imports/window/window.pro b/src/imports/window/window.pro
index a8ce79f275..9c14107267 100644
--- a/src/imports/window/window.pro
+++ b/src/imports/window/window.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = windowplugin
TARGETPATH = QtQuick/Window.2
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
@@ -11,4 +11,5 @@ HEADERS += \
QT += quick-private qml-private
+CONFIG += qmltypes install_qmltypes
load(qml_plugin)
diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp
index 2d8797db7e..0961979c53 100644
--- a/src/imports/workerscript/plugin.cpp
+++ b/src/imports/workerscript/plugin.cpp
@@ -37,12 +37,17 @@
**
****************************************************************************/
-#include <QtQmlWorkerScript/private/qqmlworkerscriptmodule_p.h>
+#include <QtQmlWorkerScript/private/qquickworkerscript_p.h>
+
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
+#include <QtCore/qloggingcategory.h>
+
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(workerScriptPlugin, "qt.workerScriptPlugin")
+
/*!
\qmlmodule QtQml.WorkerScript 2.\QtMinorVersion
\title Qt QML WorkerScript QML Types
@@ -59,19 +64,20 @@ QT_BEGIN_NAMESPACE
\endqml
*/
-class QtQmlWorkerScriptPlugin : public QQmlExtensionPlugin
+class QtQmlWorkerScriptPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
+ QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.WorkerScript"));
-
- QQmlWorkerScriptModule::defineModule();
-
- qmlRegisterModule(uri, 2, 15);
+ if (workerScriptPlugin().isDebugEnabled()) {
+ // Superficial debug message that causes the dependency between QtQmlWorkerScript
+ // and the workerscript plugin to be retained.
+ // As qCDebug() can be a noop, retrieve the className in a separate step.
+ const QString className = QQuickWorkerScript::staticMetaObject.className();
+ qCDebug(workerScriptPlugin) << "Loading WorkerScript plugin:" << className;
+ }
}
};
diff --git a/src/imports/workerscript/plugins.qmltypes b/src/imports/workerscript/plugins.qmltypes
deleted file mode 100644
index b1d6107022..0000000000
--- a/src/imports/workerscript/plugins.qmltypes
+++ /dev/null
@@ -1,26 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml.WorkerScript 2.14'
-
-Module {
- dependencies: []
- Component {
- name: "QQuickWorkerScript"
- prototype: "QObject"
- exports: ["QtQml.WorkerScript/WorkerScript 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "source"; type: "QUrl" }
- Signal {
- name: "message"
- Parameter { name: "messageObject"; type: "QJSValue" }
- }
- Method {
- name: "sendMessage"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- }
-}
diff --git a/src/imports/workerscript/workerscript.pro b/src/imports/workerscript/workerscript.pro
index d48e285bda..aa68d193b4 100644
--- a/src/imports/workerscript/workerscript.pro
+++ b/src/imports/workerscript/workerscript.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = workerscriptplugin
TARGETPATH = QtQml/WorkerScript.2
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+IMPORT_VERSION = 2.15
SOURCES += \
plugin.cpp
diff --git a/src/particles/particles.pro b/src/particles/particles.pro
index 6a3fb1bdc4..f4efb140bd 100644
--- a/src/particles/particles.pro
+++ b/src/particles/particles.pro
@@ -16,4 +16,10 @@ exists("qqml_enable_gcov") {
include(particles.pri)
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick/Particles.2
+QML_IMPORT_NAME = QtQuick.Particles
+IMPORT_VERSION = 2.15
+CONFIG += qmltypes install_qmltypes install_metatypes
+
load(qt_module)
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp
index fc28864746..ce254c212d 100644
--- a/src/particles/qquickitemparticle.cpp
+++ b/src/particles/qquickitemparticle.cpp
@@ -136,6 +136,7 @@ QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) :
QQuickItemParticle::~QQuickItemParticle()
{
delete clock;
+ qDeleteAll(m_managed);
}
void QQuickItemParticle::freeze(QQuickItem* item)
@@ -159,13 +160,21 @@ void QQuickItemParticle::take(QQuickItem *item, bool prioritize)
void QQuickItemParticle::give(QQuickItem *item)
{
- //TODO: This
- Q_UNUSED(item);
+ for (auto groupId : groupIds()) {
+ for (QQuickParticleData* data : qAsConst(m_system->groupData[groupId]->data)) {
+ if (data->delegate == item){
+ m_deletables << item;
+ data->delegate = nullptr;
+ return;
+ }
+ }
+ }
}
void QQuickItemParticle::initialize(int gIdx, int pIdx)
{
- m_loadables << m_system->groupData[gIdx]->data[pIdx];//defer to other thread
+ Q_UNUSED(gIdx);
+ Q_UNUSED(pIdx);
}
void QQuickItemParticle::commit(int, int)
@@ -179,8 +188,11 @@ void QQuickItemParticle::processDeletables()
item->setOpacity(0.);
item->setVisible(false);
QQuickItemParticleAttached* mpa;
- if ((mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(item))))
- mpa->detach();//reparent as well?
+ if ((mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(item)))) {
+ if (mpa->m_parentItem != nullptr)
+ item->setParentItem(mpa->m_parentItem);
+ mpa->detach();
+ }
int idx = -1;
if ((idx = m_managed.indexOf(item)) != -1) {
m_managed.takeAt(idx);
@@ -195,46 +207,43 @@ void QQuickItemParticle::tick(int time)
{
Q_UNUSED(time);//only needed because QTickAnimationProxy expects one
processDeletables();
-
- foreach (QQuickParticleData* d, m_loadables){
- Q_ASSERT(d);
- if (m_stasis.contains(d->delegate))
- qWarning() << "Current model particles prefers overwrite:false";
- //remove old item from the particle that is dying to make room for this one
- if (d->delegate) {
- m_deletables << d->delegate;
- d->delegate = nullptr;
- }
- if (!m_pendingItems.isEmpty()){
- d->delegate = m_pendingItems.front();
- m_pendingItems.pop_front();
- }else if (m_delegate){
- d->delegate = qobject_cast<QQuickItem*>(m_delegate->create(qmlContext(this)));
- if (d->delegate)
- m_managed << d->delegate;
- }
- if (d && d->delegate){//###Data can be zero if creating an item leads to a reset - this screws things up.
- d->delegate->setX(d->curX(m_system) - d->delegate->width() / 2); //TODO: adjust for system?
- d->delegate->setY(d->curY(m_system) - d->delegate->height() / 2);
- QQuickItemParticleAttached* mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(d->delegate));
- if (mpa){
- mpa->m_mp = this;
- mpa->attach();
+ for (auto groupId : groupIds()) {
+ for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
+ if (!d->delegate && d->t != -1 && d->stillAlive(m_system)) {
+ QQuickItem* parentItem = nullptr;
+ if (!m_pendingItems.isEmpty()){
+ QQuickItem *item = m_pendingItems.front();
+ m_pendingItems.pop_front();
+ parentItem = item->parentItem();
+ d->delegate = item;
+ }else if (m_delegate){
+ d->delegate = qobject_cast<QQuickItem*>(m_delegate->create(qmlContext(this)));
+ if (d->delegate)
+ m_managed << d->delegate;
+ }
+ if (d && d->delegate){//###Data can be zero if creating an item leads to a reset - this screws things up.
+ d->delegate->setX(d->curX(m_system) - d->delegate->width() / 2); //TODO: adjust for system?
+ d->delegate->setY(d->curY(m_system) - d->delegate->height() / 2);
+ QQuickItemParticleAttached* mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(d->delegate));
+ if (mpa){
+ mpa->m_parentItem = parentItem;
+ mpa->m_mp = this;
+ mpa->attach();
+ }
+ d->delegate->setParentItem(this);
+ if (m_fade)
+ d->delegate->setOpacity(0.);
+ d->delegate->setVisible(false);//Will be set to true when we prepare the next frame
+ m_activeCount++;
+ }
}
- d->delegate->setParentItem(this);
- if (m_fade)
- d->delegate->setOpacity(0.);
- d->delegate->setVisible(false);//Will be set to true when we prepare the next frame
- m_activeCount++;
}
}
- m_loadables.clear();
}
void QQuickItemParticle::reset()
{
QQuickParticlePainter::reset();
- m_loadables.clear();
// delete all managed items which had their logical particles cleared
// but leave it alone if the logical particle is maintained
@@ -244,7 +253,7 @@ void QQuickItemParticle::reset()
lost.remove(d->delegate);
}
}
- m_deletables.append(lost.values());
+ m_deletables.unite(lost);
//TODO: This doesn't yet handle calling detach on taken particles in the system reset case
processDeletables();
}
@@ -253,18 +262,9 @@ void QQuickItemParticle::reset()
QSGNode* QQuickItemParticle::updatePaintNode(QSGNode* n, UpdatePaintNodeData* d)
{
//Dummy update just to get painting tick
- if (m_pleaseReset){
+ if (m_pleaseReset)
m_pleaseReset = false;
- //Refill loadables, delayed here so as to only happen once per frame max
- //### Constant resetting might lead to m_loadables never being populated when tick() occurs
- for (auto groupId : groupIds()) {
- for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) {
- if (!d->delegate && d->t != -1 && d->stillAlive(m_system)) {
- m_loadables << d;
- }
- }
- }
- }
+
prepareNextFrame();
update();//Get called again
diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h
index 70cfe2a446..32c9881691 100644
--- a/src/particles/qquickitemparticle_p.h
+++ b/src/particles/qquickitemparticle_p.h
@@ -108,9 +108,8 @@ protected:
private:
void processDeletables();
void tick(int time = 0);
- QList<QQuickItem* > m_deletables;
+ QSet<QQuickItem* > m_deletables;
QList<QQuickItem* > m_managed;
- QList< QQuickParticleData* > m_loadables;
bool m_fade;
QList<QQuickItem*> m_pendingItems;
@@ -130,13 +129,14 @@ class QQuickItemParticleAttached : public QObject
Q_PROPERTY(QQuickItemParticle* particle READ particle CONSTANT);
public:
QQuickItemParticleAttached(QObject* parent)
- : QObject(parent), m_mp(0)
+ : QObject(parent), m_mp(0), m_parentItem(nullptr)
{;}
QQuickItemParticle* particle() const { return m_mp; }
void detach(){Q_EMIT detached();}
void attach(){Q_EMIT attached();}
private:
QQuickItemParticle* m_mp;
+ QPointer<QQuickItem> m_parentItem;
friend class QQuickItemParticle;
Q_SIGNALS:
void detached();
diff --git a/src/particles/qquickparticleextruder.cpp b/src/particles/qquickparticleextruder.cpp
index f56e288e09..ea64a79563 100644
--- a/src/particles/qquickparticleextruder.cpp
+++ b/src/particles/qquickparticleextruder.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmltype Shape
+ \qmltype ParticleExtruder
\instantiates QQuickParticleExtruder
\inqmlmodule QtQuick.Particles
\brief For specifying an area for affectors and emitters.
diff --git a/src/particles/qquickparticlesmodule.cpp b/src/particles/qquickparticlesmodule.cpp
index 4f2e1cf29d..801af079e6 100644
--- a/src/particles/qquickparticlesmodule.cpp
+++ b/src/particles/qquickparticlesmodule.cpp
@@ -81,48 +81,6 @@ QT_BEGIN_NAMESPACE
void QQuickParticlesModule::defineModule()
{
initResources();
-
- const char* uri = "QtQuick.Particles";
-
- qmlRegisterTypesAndRevisions<
- QQuickParticleSystem,
- QQuickParticleGroup,
-
- QQuickImageParticle,
-#if QT_CONFIG(quick_shadereffect)
- QQuickCustomParticle,
-#endif
- QQuickItemParticle,
-
- QQuickParticleEmitter,
- QQuickTrailEmitter,
-
- QQuickEllipseExtruder,
- QQuickRectangleExtruder,
- QQuickLineExtruder,
- QQuickMaskExtruder,
-
- QQuickPointDirection,
- QQuickAngleDirection,
- QQuickTargetDirection,
- QQuickCumulativeDirection,
-
- QQuickCustomAffector,
- QQuickWanderAffector,
- QQuickFrictionAffector,
- QQuickAttractorAffector,
- QQuickGravityAffector,
- QQuickAgeAffector,
- QQuickSpriteGoalAffector,
- QQuickGroupGoalAffector,
- QQuickTurbulenceAffector,
-
- // Exposed just for completeness
- QQuickParticleAffector,
- QQuickParticlePainter,
- QQuickParticleExtruder,
- QQuickDirection
- >(uri, 2);
}
QT_END_NAMESPACE
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp
index 14ffc67324..158aede727 100644
--- a/src/particles/qquickparticlesystem.cpp
+++ b/src/particles/qquickparticlesystem.cpp
@@ -389,16 +389,21 @@ QQuickParticleData* QQuickParticleGroupData::newDatum(bool respectsLimits)
bool QQuickParticleGroupData::recycle()
{
+ m_latestAliveParticles.clear();
+
while (dataHeap.top() <= m_system->timeInt) {
foreach (QQuickParticleData* datum, dataHeap.pop()) {
if (!datum->stillAlive(m_system)) {
freeList.free(datum->index);
} else {
- prepareRecycler(datum); //ttl has been altered mid-way, put it back
+ m_latestAliveParticles.push_back(datum);
}
}
}
+ for (auto particle : m_latestAliveParticles)
+ prepareRecycler(particle); //ttl has been altered mid-way, put it back
+
//TODO: If the data is clear, gc (consider shrinking stack size)?
return freeList.count() == 0;
}
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index dd721a7164..7c0a1ffd7d 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -227,6 +227,8 @@ public:
private:
int m_size;
QQuickParticleSystem* m_system;
+ // Only used in recycle() for tracking of alive particles after latest recycling round
+ QVector<QQuickParticleData*> m_latestAliveParticles;
};
struct Color4ub {
diff --git a/src/particles/shaders_ng/imageparticle_colored.frag.qsb b/src/particles/shaders_ng/imageparticle_colored.frag.qsb
index 7ae640d224..aa6ae5c6bc 100644
--- a/src/particles/shaders_ng/imageparticle_colored.frag.qsb
+++ b/src/particles/shaders_ng/imageparticle_colored.frag.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_colored.vert.qsb b/src/particles/shaders_ng/imageparticle_colored.vert.qsb
index 0e2938b72c..a07c8d0e79 100644
--- a/src/particles/shaders_ng/imageparticle_colored.vert.qsb
+++ b/src/particles/shaders_ng/imageparticle_colored.vert.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_deformed.frag.qsb b/src/particles/shaders_ng/imageparticle_deformed.frag.qsb
index fa9d9d35bb..1f4a08fe48 100644
--- a/src/particles/shaders_ng/imageparticle_deformed.frag.qsb
+++ b/src/particles/shaders_ng/imageparticle_deformed.frag.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_deformed.vert.qsb b/src/particles/shaders_ng/imageparticle_deformed.vert.qsb
index 65092d5b26..6a2048c5bf 100644
--- a/src/particles/shaders_ng/imageparticle_deformed.vert.qsb
+++ b/src/particles/shaders_ng/imageparticle_deformed.vert.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_simple.frag.qsb b/src/particles/shaders_ng/imageparticle_simple.frag.qsb
index a5874cba24..f580048e71 100644
--- a/src/particles/shaders_ng/imageparticle_simple.frag.qsb
+++ b/src/particles/shaders_ng/imageparticle_simple.frag.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_simple.vert.qsb b/src/particles/shaders_ng/imageparticle_simple.vert.qsb
index da815d7e19..6735e1ae38 100644
--- a/src/particles/shaders_ng/imageparticle_simple.vert.qsb
+++ b/src/particles/shaders_ng/imageparticle_simple.vert.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_sprite.frag.qsb b/src/particles/shaders_ng/imageparticle_sprite.frag.qsb
index 778550344b..01806a3c54 100644
--- a/src/particles/shaders_ng/imageparticle_sprite.frag.qsb
+++ b/src/particles/shaders_ng/imageparticle_sprite.frag.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_sprite.vert.qsb b/src/particles/shaders_ng/imageparticle_sprite.vert.qsb
index 45b21ace8a..6d8c1852f5 100644
--- a/src/particles/shaders_ng/imageparticle_sprite.vert.qsb
+++ b/src/particles/shaders_ng/imageparticle_sprite.vert.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_tabled.frag.qsb b/src/particles/shaders_ng/imageparticle_tabled.frag.qsb
index c5dcc2c68f..630fb064ac 100644
--- a/src/particles/shaders_ng/imageparticle_tabled.frag.qsb
+++ b/src/particles/shaders_ng/imageparticle_tabled.frag.qsb
Binary files differ
diff --git a/src/particles/shaders_ng/imageparticle_tabled.vert.qsb b/src/particles/shaders_ng/imageparticle_tabled.vert.qsb
index ea42607570..af0f475bb8 100644
--- a/src/particles/shaders_ng/imageparticle_tabled.vert.qsb
+++ b/src/particles/shaders_ng/imageparticle_tabled.vert.qsb
Binary files differ
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp
index 72de52bbe1..5e78539155 100644
--- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp
+++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp
@@ -195,7 +195,7 @@ QAbstractFileEngine::FileFlags QQmlPreviewFileEngine::fileFlags(
if (m_fallback)
return m_fallback->fileFlags(type);
- QAbstractFileEngine::FileFlags ret = 0;
+ QAbstractFileEngine::FileFlags ret;
if (type & PermsMask) {
ret |= QAbstractFileEngine::FileFlags(
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp
index bb43f75c63..acd19a6f73 100644
--- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp
+++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp
@@ -54,7 +54,6 @@ QQmlPreviewFileLoader::QQmlPreviewFileLoader(QQmlPreviewServiceImpl *service) :
m_blacklist.blacklist(":/qt-project.org");
m_blacklist.blacklist(":/QtQuick/Controls/Styles");
m_blacklist.blacklist(":/ExtrasImports/QtQuick/Controls/Styles");
- m_blacklist.blacklist(":/qgradient");
// Target specific configuration should not replaced with files from the host.
m_blacklist.blacklist("/etc");
diff --git a/src/plugins/scenegraph/d3d12/d3d12.json b/src/plugins/scenegraph/d3d12/d3d12.json
deleted file mode 100644
index c450a38556..0000000000
--- a/src/plugins/scenegraph/d3d12/d3d12.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": ["d3d12"]
-}
diff --git a/src/plugins/scenegraph/d3d12/d3d12.pro b/src/plugins/scenegraph/d3d12/d3d12.pro
deleted file mode 100644
index 9cca5458ee..0000000000
--- a/src/plugins/scenegraph/d3d12/d3d12.pro
+++ /dev/null
@@ -1,61 +0,0 @@
-TARGET = qsgd3d12backend
-
-QT += core-private gui-private qml-private quick-private
-
-PLUGIN_TYPE = scenegraph
-PLUGIN_CLASS_NAME = QSGD3D12Adaptation
-load(qt_plugin)
-
-QMAKE_TARGET_PRODUCT = "Qt Quick D3D12 Renderer (Qt $$QT_VERSION)"
-QMAKE_TARGET_DESCRIPTION = "Quick D3D12 Renderer for Qt."
-
-SOURCES += \
- $$PWD/qsgd3d12adaptation.cpp \
- $$PWD/qsgd3d12renderloop.cpp \
- $$PWD/qsgd3d12threadedrenderloop.cpp \
- $$PWD/qsgd3d12renderer.cpp \
- $$PWD/qsgd3d12context.cpp \
- $$PWD/qsgd3d12rendercontext.cpp \
- $$PWD/qsgd3d12internalrectanglenode.cpp \
- $$PWD/qsgd3d12material.cpp \
- $$PWD/qsgd3d12builtinmaterials.cpp \
- $$PWD/qsgd3d12texture.cpp \
- $$PWD/qsgd3d12internalimagenode.cpp \
- $$PWD/qsgd3d12glyphnode.cpp \
- $$PWD/qsgd3d12glyphcache.cpp \
- $$PWD/qsgd3d12layer.cpp \
- $$PWD/qsgd3d12shadereffectnode.cpp \
- $$PWD/qsgd3d12painternode.cpp \
- $$PWD/qsgd3d12publicnodes.cpp \
- $$PWD/qsgd3d12spritenode.cpp
-
-NO_PCH_SOURCES += \
- $$PWD/qsgd3d12engine.cpp
-
-HEADERS += \
- $$PWD/qsgd3d12adaptation_p.h \
- $$PWD/qsgd3d12renderloop_p.h \
- $$PWD/qsgd3d12threadedrenderloop_p.h \
- $$PWD/qsgd3d12renderer_p.h \
- $$PWD/qsgd3d12context_p.h \
- $$PWD/qsgd3d12rendercontext_p.h \
- $$PWD/qsgd3d12engine_p.h \
- $$PWD/qsgd3d12engine_p_p.h \
- $$PWD/qsgd3d12internalrectanglenode_p.h \
- $$PWD/qsgd3d12material_p.h \
- $$PWD/qsgd3d12builtinmaterials_p.h \
- $$PWD/qsgd3d12texture_p.h \
- $$PWD/qsgd3d12internalimagenode_p.h \
- $$PWD/qsgd3d12glyphnode_p.h \
- $$PWD/qsgd3d12glyphcache_p.h \
- $$PWD/qsgd3d12layer_p.h \
- $$PWD/qsgd3d12shadereffectnode_p.h \
- $$PWD/qsgd3d12painternode_p.h \
- $$PWD/qsgd3d12publicnodes_p.h \
- $$PWD/qsgd3d12spritenode_p.h
-
-LIBS += -ldxgi -ld3d12 -ld3dcompiler -ldcomp
-
-include($$PWD/shaders/shaders.pri)
-
-OTHER_FILES += $$PWD/d3d12.json
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp
deleted file mode 100644
index b93da0ae01..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12adaptation_p.h"
-#include "qsgd3d12renderloop_p.h"
-#include "qsgd3d12threadedrenderloop_p.h"
-#include "qsgd3d12context_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QSGD3D12Adaptation::QSGD3D12Adaptation(QObject *parent)
- : QSGContextPlugin(parent)
-{
-}
-
-QStringList QSGD3D12Adaptation::keys() const
-{
- return QStringList() << QLatin1String("d3d12");
-}
-
-QSGContext *QSGD3D12Adaptation::create(const QString &) const
-{
- if (!contextInstance)
- contextInstance = new QSGD3D12Context;
-
- return contextInstance;
-}
-
-QSGContextFactoryInterface::Flags QSGD3D12Adaptation::flags(const QString &) const
-{
- return QSGContextFactoryInterface::SupportsShaderEffectNode;
-}
-
-QSGRenderLoop *QSGD3D12Adaptation::createWindowManager()
-{
- static bool threaded = false;
- static bool envChecked = false;
- if (!envChecked) {
- envChecked = true;
- threaded = qgetenv("QSG_RENDER_LOOP") == QByteArrayLiteral("threaded");
- }
-
- if (threaded)
- return new QSGD3D12ThreadedRenderLoop;
-
- return new QSGD3D12RenderLoop;
-}
-
-QSGD3D12Context *QSGD3D12Adaptation::contextInstance = nullptr;
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h
deleted file mode 100644
index 035c3408ff..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12ADAPTATION_P_H
-#define QSGD3D12ADAPTATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgcontextplugin_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Context;
-class QSGContext;
-class QSGRenderLoop;
-
-class QSGD3D12Adaptation : public QSGContextPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSGContextFactoryInterface" FILE "d3d12.json")
-
-public:
- QSGD3D12Adaptation(QObject *parent = 0);
-
- QStringList keys() const override;
- QSGContext *create(const QString &key) const override;
- QSGContextFactoryInterface::Flags flags(const QString &key) const override;
- QSGRenderLoop *createWindowManager() override;
-
-private:
- static QSGD3D12Context *contextInstance;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12ADAPTATION_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
deleted file mode 100644
index 312e8c19cd..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
+++ /dev/null
@@ -1,737 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12builtinmaterials_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include <QQuickWindow>
-#include <QtCore/qmath.h>
-#include <QtGui/private/qfixed_p.h>
-
-#include "vs_vertexcolor.hlslh"
-#include "ps_vertexcolor.hlslh"
-#include "vs_flatcolor.hlslh"
-#include "ps_flatcolor.hlslh"
-#include "vs_smoothcolor.hlslh"
-#include "ps_smoothcolor.hlslh"
-#include "vs_texture.hlslh"
-#include "ps_texture.hlslh"
-#include "vs_smoothtexture.hlslh"
-#include "ps_smoothtexture.hlslh"
-#include "vs_textmask.hlslh"
-#include "ps_textmask24.hlslh"
-#include "ps_textmask32.hlslh"
-#include "ps_textmask8.hlslh"
-#include "vs_styledtext.hlslh"
-#include "ps_styledtext.hlslh"
-#include "vs_outlinedtext.hlslh"
-#include "ps_outlinedtext.hlslh"
-
-QT_BEGIN_NAMESPACE
-
-// NB! In HLSL constant buffer data is packed into 4-byte boundaries and, more
-// importantly, it is packed so that it does not cross a 16-byte (float4)
-// boundary. Hence the need for padding in some cases.
-
-static inline QVector4D qsg_premultiply(const QVector4D &c, float globalOpacity)
-{
- const float o = c.w() * globalOpacity;
- return QVector4D(c.x() * o, c.y() * o, c.z() * o, o);
-}
-
-static inline QVector4D qsg_premultiply(const QColor &c, float globalOpacity)
-{
- const float o = c.alphaF() * globalOpacity;
- return QVector4D(c.redF() * o, c.greenF() * o, c.blueF() * o, o);
-}
-
-static inline int qsg_colorDiff(const QVector4D &a, const QVector4D &b)
-{
- if (a.x() != b.x())
- return a.x() > b.x() ? 1 : -1;
- if (a.y() != b.y())
- return a.y() > b.y() ? 1 : -1;
- if (a.z() != b.z())
- return a.z() > b.z() ? 1 : -1;
- if (a.w() != b.w())
- return a.w() > b.w() ? 1 : -1;
- return 0;
-}
-
-QSGMaterialType QSGD3D12VertexColorMaterial::mtype;
-
-QSGMaterialType *QSGD3D12VertexColorMaterial::type() const
-{
- return &QSGD3D12VertexColorMaterial::mtype;
-}
-
-int QSGD3D12VertexColorMaterial::compare(const QSGMaterial *other) const
-{
- Q_UNUSED(other);
- Q_ASSERT(other && type() == other->type());
- // As the vertex color material has all its state in the vertex attributes
- // defined by the geometry, all such materials will be equal.
- return 0;
-}
-
-static const int VERTEX_COLOR_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int VERTEX_COLOR_CB_SIZE_1 = sizeof(float); // float
-static const int VERTEX_COLOR_CB_SIZE = VERTEX_COLOR_CB_SIZE_0 + VERTEX_COLOR_CB_SIZE_1;
-
-int QSGD3D12VertexColorMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(VERTEX_COLOR_CB_SIZE);
-}
-
-void QSGD3D12VertexColorMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_VertexColor;
- pipelineState->shaders.vsSize = sizeof(g_VS_VertexColor);
- pipelineState->shaders.ps = g_PS_VertexColor;
- pipelineState->shaders.psSize = sizeof(g_PS_VertexColor);
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12VertexColorMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), VERTEX_COLOR_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += VERTEX_COLOR_CB_SIZE_0;
-
- if (state.isOpacityDirty()) {
- const float opacity = state.opacity();
- memcpy(p, &opacity, VERTEX_COLOR_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
-
- return r;
-}
-
-QSGD3D12FlatColorMaterial::QSGD3D12FlatColorMaterial()
- : m_color(QColor(255, 255, 255))
-{
-}
-
-QSGMaterialType QSGD3D12FlatColorMaterial::mtype;
-
-QSGMaterialType *QSGD3D12FlatColorMaterial::type() const
-{
- return &QSGD3D12FlatColorMaterial::mtype;
-}
-
-int QSGD3D12FlatColorMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QSGD3D12FlatColorMaterial *o = static_cast<const QSGD3D12FlatColorMaterial *>(other);
- return m_color.rgba() - o->color().rgba();
-}
-
-static const int FLAT_COLOR_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int FLAT_COLOR_CB_SIZE_1 = 4 * sizeof(float); // float4
-static const int FLAT_COLOR_CB_SIZE = FLAT_COLOR_CB_SIZE_0 + FLAT_COLOR_CB_SIZE_1;
-
-int QSGD3D12FlatColorMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(FLAT_COLOR_CB_SIZE);
-}
-
-void QSGD3D12FlatColorMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_FlatColor;
- pipelineState->shaders.vsSize = sizeof(g_VS_FlatColor);
- pipelineState->shaders.ps = g_PS_FlatColor;
- pipelineState->shaders.psSize = sizeof(g_PS_FlatColor);
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12FlatColorMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), FLAT_COLOR_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += FLAT_COLOR_CB_SIZE_0;
-
- const QVector4D color = qsg_premultiply(m_color, state.opacity());
- const float f[] = { color.x(), color.y(), color.z(), color.w() };
- if (state.isOpacityDirty() || memcmp(p, f, FLAT_COLOR_CB_SIZE_1)) {
- memcpy(p, f, FLAT_COLOR_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
-
- return r;
-}
-
-void QSGD3D12FlatColorMaterial::setColor(const QColor &color)
-{
- m_color = color;
- setFlag(Blending, m_color.alpha() != 0xFF);
-}
-
-QSGD3D12SmoothColorMaterial::QSGD3D12SmoothColorMaterial()
-{
- setFlag(RequiresFullMatrixExceptTranslate, true);
- setFlag(Blending, true);
-}
-
-QSGMaterialType QSGD3D12SmoothColorMaterial::mtype;
-
-QSGMaterialType *QSGD3D12SmoothColorMaterial::type() const
-{
- return &QSGD3D12SmoothColorMaterial::mtype;
-}
-
-int QSGD3D12SmoothColorMaterial::compare(const QSGMaterial *other) const
-{
- Q_UNUSED(other);
- Q_ASSERT(other && type() == other->type());
- return 0;
-}
-
-static const int SMOOTH_COLOR_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int SMOOTH_COLOR_CB_SIZE_1 = sizeof(float); // float
-static const int SMOOTH_COLOR_CB_SIZE_2 = 2 * sizeof(float); // float2
-static const int SMOOTH_COLOR_CB_SIZE = SMOOTH_COLOR_CB_SIZE_0 + SMOOTH_COLOR_CB_SIZE_1 + SMOOTH_COLOR_CB_SIZE_2;
-
-int QSGD3D12SmoothColorMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(SMOOTH_COLOR_CB_SIZE);
-}
-
-void QSGD3D12SmoothColorMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_SmoothColor;
- pipelineState->shaders.vsSize = sizeof(g_VS_SmoothColor);
- pipelineState->shaders.ps = g_PS_SmoothColor;
- pipelineState->shaders.psSize = sizeof(g_PS_SmoothColor);
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12SmoothColorMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), SMOOTH_COLOR_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += SMOOTH_COLOR_CB_SIZE_0;
-
- if (state.isOpacityDirty()) {
- const float opacity = state.opacity();
- memcpy(p, &opacity, SMOOTH_COLOR_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
- p += SMOOTH_COLOR_CB_SIZE_1;
-
- if (state.isMatrixDirty()) {
- const QRect viewport = state.viewportRect();
- const float v[] = { 2.0f / viewport.width(), 2.0f / viewport.height() };
- memcpy(p, v, SMOOTH_COLOR_CB_SIZE_2);
- r |= UpdatedConstantBuffer;
- }
-
- return r;
-}
-
-QSGMaterialType QSGD3D12TextureMaterial::mtype;
-
-QSGMaterialType *QSGD3D12TextureMaterial::type() const
-{
- return &QSGD3D12TextureMaterial::mtype;
-}
-
-int QSGD3D12TextureMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QSGD3D12TextureMaterial *o = static_cast<const QSGD3D12TextureMaterial *>(other);
- if (int diff = m_texture->textureId() - o->texture()->textureId())
- return diff;
- return int(m_filtering) - int(o->m_filtering);
-}
-
-static const int TEXTURE_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int TEXTURE_CB_SIZE_1 = sizeof(float); // float
-static const int TEXTURE_CB_SIZE = TEXTURE_CB_SIZE_0 + TEXTURE_CB_SIZE_1;
-
-int QSGD3D12TextureMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(TEXTURE_CB_SIZE);
-}
-
-void QSGD3D12TextureMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_Texture;
- pipelineState->shaders.vsSize = sizeof(g_VS_Texture);
- pipelineState->shaders.ps = g_PS_Texture;
- pipelineState->shaders.psSize = sizeof(g_PS_Texture);
-
- pipelineState->shaders.rootSig.textureViewCount = 1;
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12TextureMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), TEXTURE_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += TEXTURE_CB_SIZE_0;
-
- if (state.isOpacityDirty()) {
- const float opacity = state.opacity();
- memcpy(p, &opacity, TEXTURE_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
-
- Q_ASSERT(m_texture);
- m_texture->setFiltering(m_filtering);
- m_texture->setMipmapFiltering(m_mipmap_filtering);
- m_texture->setHorizontalWrapMode(m_horizontal_wrap);
- m_texture->setVerticalWrapMode(m_vertical_wrap);
-
- QSGD3D12TextureView &tv(pipelineState->shaders.rootSig.textureViews[0]);
- if (m_filtering == QSGTexture::Linear)
- tv.filter = m_mipmap_filtering == QSGTexture::Linear
- ? QSGD3D12TextureView::FilterLinear : QSGD3D12TextureView::FilterMinMagLinearMipNearest;
- else
- tv.filter = m_mipmap_filtering == QSGTexture::Linear
- ? QSGD3D12TextureView::FilterMinMagNearestMipLinear : QSGD3D12TextureView::FilterNearest;
- tv.addressModeHoriz = m_horizontal_wrap == QSGTexture::ClampToEdge ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
- tv.addressModeVert = m_vertical_wrap == QSGTexture::ClampToEdge ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
-
- m_texture->bind();
-
- return r;
-}
-
-void QSGD3D12TextureMaterial::setTexture(QSGTexture *texture)
-{
- m_texture = texture;
- setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);
-}
-
-QSGD3D12SmoothTextureMaterial::QSGD3D12SmoothTextureMaterial()
-{
- setFlag(RequiresFullMatrixExceptTranslate, true);
- setFlag(Blending, true);
-}
-
-QSGMaterialType QSGD3D12SmoothTextureMaterial::mtype;
-
-QSGMaterialType *QSGD3D12SmoothTextureMaterial::type() const
-{
- return &QSGD3D12SmoothTextureMaterial::mtype;
-}
-
-int QSGD3D12SmoothTextureMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QSGD3D12SmoothTextureMaterial *o = static_cast<const QSGD3D12SmoothTextureMaterial *>(other);
- if (int diff = m_texture->textureId() - o->texture()->textureId())
- return diff;
- return int(m_filtering) - int(o->m_filtering);
-}
-
-static const int SMOOTH_TEXTURE_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int SMOOTH_TEXTURE_CB_SIZE_1 = sizeof(float); // float
-static const int SMOOTH_TEXTURE_CB_SIZE_2 = 2 * sizeof(float); // float2
-static const int SMOOTH_TEXTURE_CB_SIZE = SMOOTH_TEXTURE_CB_SIZE_0 + SMOOTH_TEXTURE_CB_SIZE_1 + SMOOTH_TEXTURE_CB_SIZE_2;
-
-int QSGD3D12SmoothTextureMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(SMOOTH_TEXTURE_CB_SIZE);
-}
-
-void QSGD3D12SmoothTextureMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_SmoothTexture;
- pipelineState->shaders.vsSize = sizeof(g_VS_SmoothTexture);
- pipelineState->shaders.ps = g_PS_SmoothTexture;
- pipelineState->shaders.psSize = sizeof(g_PS_SmoothTexture);
-
- pipelineState->shaders.rootSig.textureViewCount = 1;
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12SmoothTextureMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), SMOOTH_TEXTURE_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += SMOOTH_TEXTURE_CB_SIZE_0;
-
- if (state.isOpacityDirty()) {
- const float opacity = state.opacity();
- memcpy(p, &opacity, SMOOTH_TEXTURE_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
- p += SMOOTH_TEXTURE_CB_SIZE_1;
-
- if (state.isMatrixDirty()) {
- const QRect viewport = state.viewportRect();
- const float v[] = { 2.0f / viewport.width(), 2.0f / viewport.height() };
- memcpy(p, v, SMOOTH_TEXTURE_CB_SIZE_2);
- r |= UpdatedConstantBuffer;
- }
-
- Q_ASSERT(m_texture);
- m_texture->setFiltering(m_filtering);
- m_texture->setMipmapFiltering(m_mipmap_filtering);
- m_texture->setHorizontalWrapMode(m_horizontal_wrap);
- m_texture->setVerticalWrapMode(m_vertical_wrap);
-
- QSGD3D12TextureView &tv(pipelineState->shaders.rootSig.textureViews[0]);
- if (m_filtering == QSGTexture::Linear)
- tv.filter = m_mipmap_filtering == QSGTexture::Linear
- ? QSGD3D12TextureView::FilterLinear : QSGD3D12TextureView::FilterMinMagLinearMipNearest;
- else
- tv.filter = m_mipmap_filtering == QSGTexture::Linear
- ? QSGD3D12TextureView::FilterMinMagNearestMipLinear : QSGD3D12TextureView::FilterNearest;
- tv.addressModeHoriz = m_horizontal_wrap == QSGTexture::ClampToEdge ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
- tv.addressModeVert = m_vertical_wrap == QSGTexture::ClampToEdge ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
-
- m_texture->bind();
-
- return r;
-}
-
-QSGD3D12TextMaterial::QSGD3D12TextMaterial(StyleType styleType, QSGD3D12RenderContext *rc,
- const QRawFont &font, QFontEngine::GlyphFormat glyphFormat)
- : m_styleType(styleType),
- m_rc(rc),
- m_font(font)
-{
- setFlag(Blending, true);
-
- QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
- if (QFontEngine *fontEngine = fontD->fontEngine) {
- if (glyphFormat == QFontEngine::Format_None)
- glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
- ? fontEngine->glyphFormat : QFontEngine::Format_A32;
-
- QSGD3D12Engine *d3dengine = rc->engine();
- const float devicePixelRatio = d3dengine->windowDevicePixelRatio();
- QTransform glyphCacheTransform = QTransform::fromScale(devicePixelRatio, devicePixelRatio);
- if (!fontEngine->supportsTransformation(glyphCacheTransform))
- glyphCacheTransform = QTransform();
-
- m_glyphCache = fontEngine->glyphCache(d3dengine, glyphFormat, glyphCacheTransform);
- if (!m_glyphCache || int(m_glyphCache->glyphFormat()) != glyphFormat) {
- m_glyphCache = new QSGD3D12GlyphCache(d3dengine, glyphFormat, glyphCacheTransform);
- fontEngine->setGlyphCache(d3dengine, m_glyphCache.data());
- rc->registerFontengineForCleanup(fontEngine);
- }
- }
-}
-
-QSGMaterialType QSGD3D12TextMaterial::mtype[QSGD3D12TextMaterial::NTextMaterialTypes];
-
-QSGMaterialType *QSGD3D12TextMaterial::type() const
-{
- // Format_A32 has special blend settings and therefore two materials with
- // the same style but different formats where one is A32 are treated as
- // different. This way the renderer can manage the pipeline state properly.
- const int matStyle = m_styleType * 2;
- const int matFormat = glyphCache()->glyphFormat() != QFontEngine::Format_A32 ? 0 : 1;
- return &QSGD3D12TextMaterial::mtype[matStyle + matFormat];
-}
-
-int QSGD3D12TextMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QSGD3D12TextMaterial *o = static_cast<const QSGD3D12TextMaterial *>(other);
- if (m_styleType != o->m_styleType)
- return m_styleType - o->m_styleType;
- if (m_glyphCache != o->m_glyphCache)
- return m_glyphCache.data() < o->m_glyphCache.data() ? -1 : 1;
- if (m_styleShift != o->m_styleShift)
- return m_styleShift.y() - o->m_styleShift.y();
- int styleColorDiff = qsg_colorDiff(m_styleColor, o->m_styleColor);
- if (styleColorDiff)
- return styleColorDiff;
- return qsg_colorDiff(m_color, o->m_color);
-}
-
-static const int TEXT_CB_SIZE_0 = 16 * sizeof(float); // float4x4 mvp
-static const int TEXT_CB_SIZE_1 = 2 * sizeof(float); // float2 textureScale
-static const int TEXT_CB_SIZE_2 = sizeof(float); // float dpr
-static const int TEXT_CB_SIZE_3 = sizeof(float); // float color
-static const int TEXT_CB_SIZE_4 = 4 * sizeof(float); // float4 colorVec
-static const int TEXT_CB_SIZE_5 = 2 * sizeof(float); // float2 shift
-static const int TEXT_CB_SIZE_5_PADDING = 2 * sizeof(float); // float2 padding (the next float4 would cross the 16-byte boundary)
-static const int TEXT_CB_SIZE_6 = 4 * sizeof(float); // float4 styleColor
-static const int TEXT_CB_SIZE = TEXT_CB_SIZE_0 + TEXT_CB_SIZE_1 + TEXT_CB_SIZE_2 + TEXT_CB_SIZE_3
- + TEXT_CB_SIZE_4 + TEXT_CB_SIZE_5 + TEXT_CB_SIZE_5_PADDING + TEXT_CB_SIZE_6;
-
-int QSGD3D12TextMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(TEXT_CB_SIZE);
-}
-
-void QSGD3D12TextMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- if (m_styleType == Normal) {
- pipelineState->shaders.vs = g_VS_TextMask;
- pipelineState->shaders.vsSize = sizeof(g_VS_TextMask);
- switch (glyphCache()->glyphFormat()) {
- case QFontEngine::Format_A32:
- pipelineState->shaders.ps = g_PS_TextMask24;
- pipelineState->shaders.psSize = sizeof(g_PS_TextMask24);
- break;
- case QFontEngine::Format_ARGB:
- pipelineState->shaders.ps = g_PS_TextMask32;
- pipelineState->shaders.psSize = sizeof(g_PS_TextMask32);
- break;
- default:
- pipelineState->shaders.ps = g_PS_TextMask8;
- pipelineState->shaders.psSize = sizeof(g_PS_TextMask8);
- break;
- }
- } else if (m_styleType == Outlined) {
- pipelineState->shaders.vs = g_VS_OutlinedText;
- pipelineState->shaders.vsSize = sizeof(g_VS_OutlinedText);
- pipelineState->shaders.ps = g_PS_OutlinedText;
- pipelineState->shaders.psSize = sizeof(g_PS_OutlinedText);
- } else {
- pipelineState->shaders.vs = g_VS_StyledText;
- pipelineState->shaders.vsSize = sizeof(g_VS_StyledText);
- pipelineState->shaders.ps = g_PS_StyledText;
- pipelineState->shaders.psSize = sizeof(g_PS_StyledText);
- }
-
- pipelineState->shaders.rootSig.textureViewCount = 1;
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12TextMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- if (glyphCache()->glyphFormat() == QFontEngine::Format_A32) {
- // can freely change the state due to the way type() works
- pipelineState->blend = QSGD3D12PipelineState::BlendColor;
- extraState->blendFactor = m_color;
- r |= UpdatedBlendFactor; // must be set always as this affects the command list
- }
-
- if (state.isMatrixDirty()) {
- memcpy(p, state.combinedMatrix().constData(), TEXT_CB_SIZE_0);
- r |= UpdatedConstantBuffer;
- }
- p += TEXT_CB_SIZE_0;
-
- const QSize sz = glyphCache()->currentSize();
- const float textureScale[] = { 1.0f / sz.width(), 1.0f / sz.height() };
- if (state.isCachedMaterialDataDirty() || memcmp(p, textureScale, TEXT_CB_SIZE_1)) {
- memcpy(p, textureScale, TEXT_CB_SIZE_1);
- r |= UpdatedConstantBuffer;
- }
- p += TEXT_CB_SIZE_1;
-
- const float dpr = m_rc->engine()->windowDevicePixelRatio();
- if (state.isCachedMaterialDataDirty() || memcmp(p, &dpr, TEXT_CB_SIZE_2)) {
- memcpy(p, &dpr, TEXT_CB_SIZE_2);
- r |= UpdatedConstantBuffer;
- }
- p += TEXT_CB_SIZE_2;
-
- if (glyphCache()->glyphFormat() == QFontEngine::Format_A32) {
- const QVector4D color = qsg_premultiply(m_color, state.opacity());
- const float alpha = color.w();
- if (state.isOpacityDirty() || memcmp(p, &alpha, TEXT_CB_SIZE_3)) {
- memcpy(p, &alpha, TEXT_CB_SIZE_3);
- r |= UpdatedConstantBuffer;
- }
- } else if (glyphCache()->glyphFormat() == QFontEngine::Format_ARGB) {
- const float opacity = m_color.w() * state.opacity();
- if (state.isOpacityDirty() || memcmp(p, &opacity, TEXT_CB_SIZE_3)) {
- memcpy(p, &opacity, TEXT_CB_SIZE_3);
- r |= UpdatedConstantBuffer;
- }
- } else {
- const QVector4D color = qsg_premultiply(m_color, state.opacity());
- const float f[] = { color.x(), color.y(), color.z(), color.w() };
- if (state.isOpacityDirty() || memcmp(p, f, TEXT_CB_SIZE_4)) {
- memcpy(p + TEXT_CB_SIZE_3, f, TEXT_CB_SIZE_4);
- r |= UpdatedConstantBuffer;
- }
- }
- p += TEXT_CB_SIZE_3 + TEXT_CB_SIZE_4;
-
- if (m_styleType == Styled) {
- const float f[] = { m_styleShift.x(), m_styleShift.y() };
- if (state.isCachedMaterialDataDirty() || memcmp(p, f, TEXT_CB_SIZE_5)) {
- memcpy(p, f, TEXT_CB_SIZE_5);
- r |= UpdatedConstantBuffer;
- }
- }
- p += TEXT_CB_SIZE_5 + TEXT_CB_SIZE_5_PADDING;
-
- if (m_styleType == Styled || m_styleType == Outlined) {
- const QVector4D color = qsg_premultiply(m_styleColor, state.opacity());
- const float f[] = { color.x(), color.y(), color.z(), color.w() };
- if (state.isOpacityDirty() || memcmp(p, f, TEXT_CB_SIZE_6)) {
- memcpy(p, f, TEXT_CB_SIZE_6);
- r |= UpdatedConstantBuffer;
- }
- }
-
- QSGD3D12TextureView &tv(pipelineState->shaders.rootSig.textureViews[0]);
- tv.filter = QSGD3D12TextureView::FilterNearest;
- tv.addressModeHoriz = QSGD3D12TextureView::AddressClamp;
- tv.addressModeVert = QSGD3D12TextureView::AddressClamp;
-
- glyphCache()->useTexture();
-
- return r;
-}
-
-void QSGD3D12TextMaterial::populate(const QPointF &p,
- const QVector<quint32> &glyphIndexes,
- const QVector<QPointF> &glyphPositions,
- QSGGeometry *geometry,
- QRectF *boundingRect,
- QPointF *baseLine,
- const QMargins &margins)
-{
- Q_ASSERT(m_font.isValid());
- QVector<QFixedPoint> fixedPointPositions;
- const int glyphPositionsSize = glyphPositions.size();
- fixedPointPositions.reserve(glyphPositionsSize);
- for (int i=0; i < glyphPositionsSize; ++i)
- fixedPointPositions.append(QFixedPoint::fromPointF(glyphPositions.at(i)));
-
- QSGD3D12GlyphCache *cache = glyphCache();
- QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
- cache->populate(fontD->fontEngine, glyphIndexes.size(), glyphIndexes.constData(),
- fixedPointPositions.data());
- cache->fillInPendingGlyphs();
-
- int margin = fontD->fontEngine->glyphMargin(cache->glyphFormat());
-
- float glyphCacheScaleX = cache->transform().m11();
- float glyphCacheScaleY = cache->transform().m22();
- float glyphCacheInverseScaleX = 1.0 / glyphCacheScaleX;
- float glyphCacheInverseScaleY = 1.0 / glyphCacheScaleY;
-
- Q_ASSERT(geometry->indexType() == QSGGeometry::UnsignedShortType);
- geometry->allocate(glyphIndexes.size() * 4, glyphIndexes.size() * 6);
- QVector4D *vp = reinterpret_cast<QVector4D *>(geometry->vertexDataAsTexturedPoint2D());
- Q_ASSERT(geometry->sizeOfVertex() == sizeof(QVector4D));
- ushort *ip = geometry->indexDataAsUShort();
-
- QPointF position(p.x(), p.y() - m_font.ascent());
- bool supportsSubPixelPositions = fontD->fontEngine->supportsSubPixelPositions();
- for (int i = 0; i < glyphIndexes.size(); ++i) {
- QFixed subPixelPosition;
- if (supportsSubPixelPositions)
- subPixelPosition = fontD->fontEngine->subPixelPositionForX(QFixed::fromReal(glyphPositions.at(i).x()));
-
- QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphIndexes.at(i), subPixelPosition);
- const QTextureGlyphCache::Coord &c = cache->coords.value(glyph);
-
- QPointF glyphPosition = glyphPositions.at(i) + position;
- float x = (qFloor(glyphPosition.x() * glyphCacheScaleX) * glyphCacheInverseScaleX)
- + (c.baseLineX * glyphCacheInverseScaleX) - margin;
- float y = (qRound(glyphPosition.y() * glyphCacheScaleY) * glyphCacheInverseScaleY)
- - (c.baseLineY * glyphCacheInverseScaleY) - margin;
-
- float w = c.w * glyphCacheInverseScaleX;
- float h = c.h * glyphCacheInverseScaleY;
-
- *boundingRect |= QRectF(x + margin, y + margin, w, h);
-
- float cx1 = x - margins.left();
- float cx2 = x + w + margins.right();
- float cy1 = y - margins.top();
- float cy2 = y + h + margins.bottom();
-
- float tx1 = c.x - margins.left();
- float tx2 = c.x + c.w + margins.right();
- float ty1 = c.y - margins.top();
- float ty2 = c.y + c.h + margins.bottom();
-
- if (baseLine->isNull())
- *baseLine = glyphPosition;
-
- vp[4 * i + 0] = QVector4D(cx1, cy1, tx1, ty1);
- vp[4 * i + 1] = QVector4D(cx2, cy1, tx2, ty1);
- vp[4 * i + 2] = QVector4D(cx1, cy2, tx1, ty2);
- vp[4 * i + 3] = QVector4D(cx2, cy2, tx2, ty2);
-
- int o = i * 4;
- ip[6 * i + 0] = o + 0;
- ip[6 * i + 1] = o + 2;
- ip[6 * i + 2] = o + 3;
- ip[6 * i + 3] = o + 3;
- ip[6 * i + 4] = o + 1;
- ip[6 * i + 5] = o + 0;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h
deleted file mode 100644
index 8e488f8cd1..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12BUILTINMATERIALS_P_H
-#define QSGD3D12BUILTINMATERIALS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qsgd3d12material_p.h"
-#include "qsgd3d12glyphcache_p.h"
-#include <private/qsgtexture_p.h>
-#include <QRawFont>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12RenderContext;
-
-class QSGD3D12VertexColorMaterial : public QSGD3D12Material
-{
-public:
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
-private:
- static QSGMaterialType mtype;
-};
-
-class QSGD3D12FlatColorMaterial : public QSGD3D12Material
-{
-public:
- QSGD3D12FlatColorMaterial();
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- void setColor(const QColor &color);
- QColor color() const { return m_color; }
-
-private:
- static QSGMaterialType mtype;
- QColor m_color;
-};
-
-class QSGD3D12SmoothColorMaterial : public QSGD3D12Material
-{
-public:
- QSGD3D12SmoothColorMaterial();
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
-private:
- static QSGMaterialType mtype;
-};
-
-class QSGD3D12TextureMaterial : public QSGD3D12Material
-{
-public:
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- void setTexture(QSGTexture *texture);
- QSGTexture *texture() const { return m_texture; }
-
- void setMipmapFiltering(QSGTexture::Filtering filter) { m_mipmap_filtering = filter; }
- QSGTexture::Filtering mipmapFiltering() const { return m_mipmap_filtering; }
-
- void setFiltering(QSGTexture::Filtering filter) { m_filtering = filter; }
- QSGTexture::Filtering filtering() const { return m_filtering; }
-
- void setHorizontalWrapMode(QSGTexture::WrapMode hwrap) { m_horizontal_wrap = hwrap; }
- QSGTexture::WrapMode horizontalWrapMode() const { return m_horizontal_wrap; }
-
- void setVerticalWrapMode(QSGTexture::WrapMode vwrap) { m_vertical_wrap = vwrap; }
- QSGTexture::WrapMode verticalWrapMode() const { return m_vertical_wrap; }
-
-private:
- static QSGMaterialType mtype;
-
- QSGTexture *m_texture = nullptr;
- QSGTexture::Filtering m_filtering = QSGTexture::Nearest;
- QSGTexture::Filtering m_mipmap_filtering = QSGTexture::None;
- QSGTexture::WrapMode m_horizontal_wrap = QSGTexture::ClampToEdge;
- QSGTexture::WrapMode m_vertical_wrap = QSGTexture::ClampToEdge;
-};
-
-class QSGD3D12SmoothTextureMaterial : public QSGD3D12Material
-{
-public:
- QSGD3D12SmoothTextureMaterial();
-
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- void setTexture(QSGTexture *texture) { m_texture = texture; }
- QSGTexture *texture() const { return m_texture; }
-
- void setMipmapFiltering(QSGTexture::Filtering filter) { m_mipmap_filtering = filter; }
- QSGTexture::Filtering mipmapFiltering() const { return m_mipmap_filtering; }
-
- void setFiltering(QSGTexture::Filtering filter) { m_filtering = filter; }
- QSGTexture::Filtering filtering() const { return m_filtering; }
-
- void setHorizontalWrapMode(QSGTexture::WrapMode hwrap) { m_horizontal_wrap = hwrap; }
- QSGTexture::WrapMode horizontalWrapMode() const { return m_horizontal_wrap; }
-
- void setVerticalWrapMode(QSGTexture::WrapMode vwrap) { m_vertical_wrap = vwrap; }
- QSGTexture::WrapMode verticalWrapMode() const { return m_vertical_wrap; }
-
-private:
- static QSGMaterialType mtype;
-
- QSGTexture *m_texture = nullptr;
- QSGTexture::Filtering m_filtering = QSGTexture::Nearest;
- QSGTexture::Filtering m_mipmap_filtering = QSGTexture::None;
- QSGTexture::WrapMode m_horizontal_wrap = QSGTexture::ClampToEdge;
- QSGTexture::WrapMode m_vertical_wrap = QSGTexture::ClampToEdge;
-};
-
-class QSGD3D12TextMaterial : public QSGD3D12Material
-{
-public:
- enum StyleType {
- Normal,
- Styled,
- Outlined,
-
- NStyleTypes
- };
- QSGD3D12TextMaterial(StyleType styleType, QSGD3D12RenderContext *rc, const QRawFont &font,
- QFontEngine::GlyphFormat glyphFormat = QFontEngine::Format_None);
-
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- void setColor(const QColor &c) { m_color = QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF()); }
- void setColor(const QVector4D &color) { m_color = color; }
- const QVector4D &color() const { return m_color; }
-
- void setStyleShift(const QVector2D &shift) { m_styleShift = shift; }
- const QVector2D &styleShift() const { return m_styleShift; }
-
- void setStyleColor(const QColor &c) { m_styleColor = QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF()); }
- void setStyleColor(const QVector4D &color) { m_styleColor = color; }
- const QVector4D &styleColor() const { return m_styleColor; }
-
- void populate(const QPointF &position,
- const QVector<quint32> &glyphIndexes, const QVector<QPointF> &glyphPositions,
- QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine,
- const QMargins &margins = QMargins(0, 0, 0, 0));
-
- QSGD3D12GlyphCache *glyphCache() const { return static_cast<QSGD3D12GlyphCache *>(m_glyphCache.data()); }
-
-private:
- static const int NTextMaterialTypes = NStyleTypes * 2;
- static QSGMaterialType mtype[NTextMaterialTypes];
- StyleType m_styleType;
- QSGD3D12RenderContext *m_rc;
- QVector4D m_color;
- QVector2D m_styleShift;
- QVector4D m_styleColor;
- QRawFont m_font;
- QExplicitlySharedDataPointer<QFontEngineGlyphCache> m_glyphCache;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12BUILTINMATERIALS_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
deleted file mode 100644
index f9bd04aa54..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12context_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12internalrectanglenode_p.h"
-#include "qsgd3d12internalimagenode_p.h"
-#include "qsgd3d12glyphnode_p.h"
-#include "qsgd3d12layer_p.h"
-#include "qsgd3d12shadereffectnode_p.h"
-#include "qsgd3d12painternode_p.h"
-#include "qsgd3d12publicnodes_p.h"
-#include "qsgd3d12spritenode_p.h"
-#include <QtQuick/qquickwindow.h>
-
-QT_BEGIN_NAMESPACE
-
-QSGRenderContext *QSGD3D12Context::createRenderContext()
-{
- return new QSGD3D12RenderContext(this);
-}
-
-QSGInternalRectangleNode *QSGD3D12Context::createInternalRectangleNode()
-{
- return new QSGD3D12InternalRectangleNode;
-}
-
-QSGInternalImageNode *QSGD3D12Context::createInternalImageNode(QSGRenderContext *renderContext)
-{
- Q_UNUSED(renderContext);
- return new QSGD3D12InternalImageNode;
-}
-
-QSGPainterNode *QSGD3D12Context::createPainterNode(QQuickPaintedItem *item)
-{
- return new QSGD3D12PainterNode(item);
-}
-
-QSGGlyphNode *QSGD3D12Context::createGlyphNode(QSGRenderContext *renderContext, bool preferNativeGlyphNode)
-{
- Q_UNUSED(preferNativeGlyphNode);
- // ### distance field text rendering is not supported atm
-
- QSGD3D12RenderContext *rc = static_cast<QSGD3D12RenderContext *>(renderContext);
- return new QSGD3D12GlyphNode(rc);
-}
-
-QSGLayer *QSGD3D12Context::createLayer(QSGRenderContext *renderContext)
-{
- QSGD3D12RenderContext *rc = static_cast<QSGD3D12RenderContext *>(renderContext);
- return new QSGD3D12Layer(rc);
-}
-
-QSGGuiThreadShaderEffectManager *QSGD3D12Context::createGuiThreadShaderEffectManager()
-{
- return new QSGD3D12GuiThreadShaderEffectManager;
-}
-
-QSGShaderEffectNode *QSGD3D12Context::createShaderEffectNode(QSGRenderContext *renderContext,
- QSGGuiThreadShaderEffectManager *mgr)
-{
- QSGD3D12RenderContext *rc = static_cast<QSGD3D12RenderContext *>(renderContext);
- QSGD3D12GuiThreadShaderEffectManager *dmgr = static_cast<QSGD3D12GuiThreadShaderEffectManager *>(mgr);
- return new QSGD3D12ShaderEffectNode(rc, dmgr);
-}
-
-QSize QSGD3D12Context::minimumFBOSize() const
-{
- return QSize(16, 16);
-}
-
-QSurfaceFormat QSGD3D12Context::defaultSurfaceFormat() const
-{
- QSurfaceFormat format = QSurfaceFormat::defaultFormat();
-
- if (QQuickWindow::hasDefaultAlphaBuffer())
- format.setAlphaBufferSize(8);
-
- return format;
-}
-
-QSGRendererInterface *QSGD3D12Context::rendererInterface(QSGRenderContext *renderContext)
-{
- return static_cast<QSGD3D12RenderContext *>(renderContext);
-}
-
-QSGRectangleNode *QSGD3D12Context::createRectangleNode()
-{
- return new QSGD3D12RectangleNode;
-}
-
-QSGImageNode *QSGD3D12Context::createImageNode()
-{
- return new QSGD3D12ImageNode;
-}
-
-QSGNinePatchNode *QSGD3D12Context::createNinePatchNode()
-{
- return new QSGD3D12NinePatchNode;
-}
-
-QSGSpriteNode *QSGD3D12Context::createSpriteNode()
-{
- return new QSGD3D12SpriteNode;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
deleted file mode 100644
index 382183fef6..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12CONTEXT_P_H
-#define QSGD3D12CONTEXT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Context : public QSGContext
-{
-public:
- QSGD3D12Context(QObject *parent = 0) : QSGContext(parent) { }
-
- QSGRenderContext *createRenderContext() override;
- QSGInternalRectangleNode *createInternalRectangleNode() override;
- QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override;
- QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override;
- QSGGlyphNode *createGlyphNode(QSGRenderContext *renderContext, bool preferNativeGlyphNode) override;
- QSGLayer *createLayer(QSGRenderContext *renderContext) override;
- QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager() override;
- QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext,
- QSGGuiThreadShaderEffectManager *mgr) override;
- QSize minimumFBOSize() const override;
- QSurfaceFormat defaultSurfaceFormat() const override;
- QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext) override;
- QSGRectangleNode *createRectangleNode() override;
- QSGImageNode *createImageNode() override;
- QSGNinePatchNode *createNinePatchNode() override;
- QSGSpriteNode *createSpriteNode() override;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12CONTEXT_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
deleted file mode 100644
index 75bde2c66b..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
+++ /dev/null
@@ -1,3280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12engine_p.h"
-#include "qsgd3d12engine_p_p.h"
-#include "cs_mipmapgen.hlslh"
-#include <QString>
-#include <QColor>
-#include <QLoggingCategory>
-#include <qmath.h>
-#include <qalgorithms.h>
-
-// Comment out to disable DeviceLossTester functionality in order to reduce
-// code size and improve startup perf a tiny bit.
-#define DEVLOSS_TEST
-
-#ifdef DEVLOSS_TEST
-#include "cs_tdr.hlslh"
-#endif
-
-#ifdef Q_OS_WINRT
-#include <QtCore/private/qeventdispatcher_winrt_p.h>
-#include <functional>
-#include <windows.ui.xaml.h>
-#include <windows.ui.xaml.media.dxinterop.h>
-#endif
-
-#include <comdef.h>
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(render)
-DECLARE_DEBUG_VAR(descheap)
-DECLARE_DEBUG_VAR(buffer)
-DECLARE_DEBUG_VAR(texture)
-
-// Except for system info on startup.
-Q_LOGGING_CATEGORY(QSG_LOG_INFO_GENERAL, "qt.scenegraph.general")
-
-
-// Any changes to the defaults below must be reflected in adaptations.qdoc as
-// well and proven by qmlbench or similar.
-
-static const int DEFAULT_SWAP_CHAIN_BUFFER_COUNT = 3;
-static const int DEFAULT_FRAME_IN_FLIGHT_COUNT = 2;
-static const int DEFAULT_WAITABLE_SWAP_CHAIN_MAX_LATENCY = 0;
-
-static const int MAX_DRAW_CALLS_PER_LIST = 4096;
-
-static const int MAX_CACHED_ROOTSIG = 16;
-static const int MAX_CACHED_PSO = 64;
-
-static const int GPU_CBVSRVUAV_DESCRIPTORS = 512;
-
-static const DXGI_FORMAT RT_COLOR_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM;
-
-static const int BUCKETS_PER_HEAP = 8; // must match freeMap
-static const int DESCRIPTORS_PER_BUCKET = 32; // the bit map (freeMap) is quint32
-static const int MAX_DESCRIPTORS_PER_HEAP = BUCKETS_PER_HEAP * DESCRIPTORS_PER_BUCKET;
-
-static QString comErrorMessage(HRESULT hr)
-{
-#ifndef Q_OS_WINRT
- const _com_error comError(hr);
-#else
- const _com_error comError(hr, nullptr);
-#endif
- QString result = QLatin1String("Error 0x") + QString::number(ulong(hr), 16);
- if (const wchar_t *msg = comError.ErrorMessage())
- result += QLatin1String(": ") + QString::fromWCharArray(msg);
- return result;
-}
-
-D3D12_CPU_DESCRIPTOR_HANDLE QSGD3D12CPUDescriptorHeapManager::allocate(D3D12_DESCRIPTOR_HEAP_TYPE type)
-{
- D3D12_CPU_DESCRIPTOR_HANDLE h = {};
- for (Heap &heap : m_heaps) {
- if (heap.type == type) {
- for (int bucket = 0; bucket < _countof(heap.freeMap); ++bucket)
- if (heap.freeMap[bucket]) {
- uint freePos = qCountTrailingZeroBits(heap.freeMap[bucket]);
- heap.freeMap[bucket] &= ~(1UL << freePos);
- if (Q_UNLIKELY(debug_descheap()))
- qDebug("descriptor handle heap %p type %x reserve in bucket %d index %d", &heap, type, bucket, freePos);
- freePos += bucket * DESCRIPTORS_PER_BUCKET;
- h = heap.start;
- h.ptr += freePos * heap.handleSize;
- return h;
- }
- }
- }
-
- Heap heap;
- heap.type = type;
- heap.handleSize = m_handleSizes[type];
-
- D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
- heapDesc.NumDescriptors = MAX_DESCRIPTORS_PER_HEAP;
- heapDesc.Type = type;
- // The heaps created here are _never_ shader-visible.
-
- HRESULT hr = m_device->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&heap.heap));
- if (FAILED(hr)) {
- qWarning("Failed to create heap with type 0x%x: %s",
- type, qPrintable(comErrorMessage(hr)));
- return h;
- }
-
- heap.start = heap.heap->GetCPUDescriptorHandleForHeapStart();
-
- if (Q_UNLIKELY(debug_descheap()))
- qDebug("new descriptor heap, type %x, start %llu", type, heap.start.ptr);
-
- heap.freeMap[0] = 0xFFFFFFFE;
- for (int i = 1; i < _countof(heap.freeMap); ++i)
- heap.freeMap[i] = 0xFFFFFFFF;
-
- h = heap.start;
-
- m_heaps.append(heap);
-
- return h;
-}
-
-void QSGD3D12CPUDescriptorHeapManager::release(D3D12_CPU_DESCRIPTOR_HANDLE handle, D3D12_DESCRIPTOR_HEAP_TYPE type)
-{
- for (Heap &heap : m_heaps) {
- if (heap.type == type
- && handle.ptr >= heap.start.ptr
- && handle.ptr < heap.start.ptr + heap.handleSize * MAX_DESCRIPTORS_PER_HEAP) {
- unsigned long pos = (handle.ptr - heap.start.ptr) / heap.handleSize;
- const int bucket = pos / DESCRIPTORS_PER_BUCKET;
- const int indexInBucket = pos - bucket * DESCRIPTORS_PER_BUCKET;
- heap.freeMap[bucket] |= 1UL << indexInBucket;
- if (Q_UNLIKELY(debug_descheap()))
- qDebug("free descriptor handle heap %p type %x bucket %d index %d", &heap, type, bucket, indexInBucket);
- return;
- }
- }
- qWarning("QSGD3D12CPUDescriptorHeapManager: Attempted to release untracked descriptor handle %llu of type %d", handle.ptr, type);
-}
-
-void QSGD3D12CPUDescriptorHeapManager::initialize(ID3D12Device *device)
-{
- m_device = device;
-
- for (int i = 0; i < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; ++i)
- m_handleSizes[i] = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE(i));
-}
-
-void QSGD3D12CPUDescriptorHeapManager::releaseResources()
-{
- for (Heap &heap : m_heaps)
- heap.heap = nullptr;
-
- m_heaps.clear();
-
- m_device = nullptr;
-}
-
-// One device per process, one everything else (engine) per window.
-Q_GLOBAL_STATIC(QSGD3D12DeviceManager, deviceManager)
-
-static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapter)
-{
- const D3D_FEATURE_LEVEL fl = D3D_FEATURE_LEVEL_11_0;
- ComPtr<IDXGIAdapter1> adapter;
- DXGI_ADAPTER_DESC1 desc;
-
- for (int adapterIndex = 0; factory->EnumAdapters1(adapterIndex, &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
- DXGI_ADAPTER_DESC1 desc;
- adapter->GetDesc1(&desc);
- const QString name = QString::fromUtf16((char16_t *) desc.Description);
- qCDebug(QSG_LOG_INFO_GENERAL, "Adapter %d: '%s' (flags 0x%x)", adapterIndex, qPrintable(name), desc.Flags);
- }
-
- if (qEnvironmentVariableIsSet("QT_D3D_ADAPTER_INDEX")) {
- const int adapterIndex = qEnvironmentVariableIntValue("QT_D3D_ADAPTER_INDEX");
- if (SUCCEEDED(factory->EnumAdapters1(adapterIndex, &adapter))) {
- adapter->GetDesc1(&desc);
- const QString name = QString::fromUtf16((char16_t *) desc.Description);
- HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr);
- if (SUCCEEDED(hr)) {
- qCDebug(QSG_LOG_INFO_GENERAL, "Using requested adapter '%s'", qPrintable(name));
- *outAdapter = adapter.Detach();
- return;
- } else {
- qWarning("Failed to create device for requested adapter '%s': %s",
- qPrintable(name), qPrintable(comErrorMessage(hr)));
- }
- }
- }
-
- for (int adapterIndex = 0; factory->EnumAdapters1(adapterIndex, &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
- adapter->GetDesc1(&desc);
- if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
- continue;
-
- if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) {
- const QString name = QString::fromUtf16((char16_t *) desc.Description);
- qCDebug(QSG_LOG_INFO_GENERAL, "Using adapter '%s'", qPrintable(name));
- break;
- }
- }
-
- *outAdapter = adapter.Detach();
-}
-
-ID3D12Device *QSGD3D12DeviceManager::ref()
-{
- ensureCreated();
- m_ref.ref();
- return m_device.Get();
-}
-
-void QSGD3D12DeviceManager::unref()
-{
- if (!m_ref.deref()) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("destroying d3d device");
- m_device = nullptr;
- m_factory = nullptr;
- }
-}
-
-void QSGD3D12DeviceManager::deviceLossDetected()
-{
- for (DeviceLossObserver *observer : qAsConst(m_observers))
- observer->deviceLost();
-
- // Nothing else to do here. All windows are expected to release their
- // resources and call unref() in response immediately.
-}
-
-IDXGIFactory4 *QSGD3D12DeviceManager::dxgi()
-{
- ensureCreated();
- return m_factory.Get();
-}
-
-void QSGD3D12DeviceManager::ensureCreated()
-{
- if (m_device)
- return;
-
- HRESULT hr = CreateDXGIFactory2(0, IID_PPV_ARGS(&m_factory));
- if (FAILED(hr)) {
- qWarning("Failed to create DXGI: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
-
- ComPtr<IDXGIAdapter1> adapter;
- getHardwareAdapter(m_factory.Get(), &adapter);
-
- bool warp = true;
- if (adapter) {
- HRESULT hr = D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device));
- if (SUCCEEDED(hr))
- warp = false;
- else
- qWarning("Failed to create device: %s", qPrintable(comErrorMessage(hr)));
- }
-
- if (warp) {
- qCDebug(QSG_LOG_INFO_GENERAL, "Using WARP");
- m_factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter));
- HRESULT hr = D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device));
- if (FAILED(hr)) {
- qWarning("Failed to create WARP device: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
- }
-
- ComPtr<IDXGIAdapter3> adapter3;
- if (SUCCEEDED(adapter.As(&adapter3))) {
- DXGI_QUERY_VIDEO_MEMORY_INFO vidMemInfo;
- if (SUCCEEDED(adapter3->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vidMemInfo))) {
- qCDebug(QSG_LOG_INFO_GENERAL, "Video memory info: LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB",
- vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024,
- vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024);
- }
- if (SUCCEEDED(adapter3->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vidMemInfo))) {
- qCDebug(QSG_LOG_INFO_GENERAL, "Video memory info: NON-LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB",
- vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024,
- vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024);
- }
- }
-}
-
-void QSGD3D12DeviceManager::registerDeviceLossObserver(DeviceLossObserver *observer)
-{
- if (!m_observers.contains(observer))
- m_observers.append(observer);
-}
-
-QSGD3D12Engine::QSGD3D12Engine()
-{
- d = new QSGD3D12EnginePrivate;
-}
-
-QSGD3D12Engine::~QSGD3D12Engine()
-{
- d->waitGPU();
- d->releaseResources();
- delete d;
-}
-
-bool QSGD3D12Engine::attachToWindow(WId window, const QSize &size, float dpr, int surfaceFormatSamples, bool alpha)
-{
- if (d->isInitialized()) {
- qWarning("QSGD3D12Engine: Cannot attach active engine to window");
- return false;
- }
-
- d->initialize(window, size, dpr, surfaceFormatSamples, alpha);
- return d->isInitialized();
-}
-
-void QSGD3D12Engine::releaseResources()
-{
- d->releaseResources();
-}
-
-bool QSGD3D12Engine::hasResources() const
-{
- // An explicit releaseResources() or a device loss results in initialized == false.
- return d->isInitialized();
-}
-
-void QSGD3D12Engine::setWindowSize(const QSize &size, float dpr)
-{
- d->setWindowSize(size, dpr);
-}
-
-WId QSGD3D12Engine::window() const
-{
- return d->currentWindow();
-}
-
-QSize QSGD3D12Engine::windowSize() const
-{
- return d->currentWindowSize();
-}
-
-float QSGD3D12Engine::windowDevicePixelRatio() const
-{
- return d->currentWindowDpr();
-}
-
-uint QSGD3D12Engine::windowSamples() const
-{
- return d->currentWindowSamples();
-}
-
-void QSGD3D12Engine::beginFrame()
-{
- d->beginFrame();
-}
-
-void QSGD3D12Engine::endFrame()
-{
- d->endFrame();
-}
-
-void QSGD3D12Engine::beginLayer()
-{
- d->beginLayer();
-}
-
-void QSGD3D12Engine::endLayer()
-{
- d->endLayer();
-}
-
-void QSGD3D12Engine::invalidateCachedFrameState()
-{
- d->invalidateCachedFrameState();
-}
-
-void QSGD3D12Engine::restoreFrameState(bool minimal)
-{
- d->restoreFrameState(minimal);
-}
-
-void QSGD3D12Engine::finalizePipeline(const QSGD3D12PipelineState &pipelineState)
-{
- d->finalizePipeline(pipelineState);
-}
-
-uint QSGD3D12Engine::genBuffer()
-{
- return d->genBuffer();
-}
-
-void QSGD3D12Engine::releaseBuffer(uint id)
-{
- d->releaseBuffer(id);
-}
-
-void QSGD3D12Engine::resetBuffer(uint id, const quint8 *data, int size)
-{
- d->resetBuffer(id, data, size);
-}
-
-void QSGD3D12Engine::markBufferDirty(uint id, int offset, int size)
-{
- d->markBufferDirty(id, offset, size);
-}
-
-void QSGD3D12Engine::queueViewport(const QRect &rect)
-{
- d->queueViewport(rect);
-}
-
-void QSGD3D12Engine::queueScissor(const QRect &rect)
-{
- d->queueScissor(rect);
-}
-
-void QSGD3D12Engine::queueSetRenderTarget(uint id)
-{
- d->queueSetRenderTarget(id);
-}
-
-void QSGD3D12Engine::queueClearRenderTarget(const QColor &color)
-{
- d->queueClearRenderTarget(color);
-}
-
-void QSGD3D12Engine::queueClearDepthStencil(float depthValue, quint8 stencilValue, ClearFlags which)
-{
- d->queueClearDepthStencil(depthValue, stencilValue, which);
-}
-
-void QSGD3D12Engine::queueSetBlendFactor(const QVector4D &factor)
-{
- d->queueSetBlendFactor(factor);
-}
-
-void QSGD3D12Engine::queueSetStencilRef(quint32 ref)
-{
- d->queueSetStencilRef(ref);
-}
-
-void QSGD3D12Engine::queueDraw(const DrawParams &params)
-{
- d->queueDraw(params);
-}
-
-void QSGD3D12Engine::present()
-{
- d->present();
-}
-
-void QSGD3D12Engine::waitGPU()
-{
- d->waitGPU();
-}
-
-uint QSGD3D12Engine::genTexture()
-{
- return d->genTexture();
-}
-
-void QSGD3D12Engine::createTexture(uint id, const QSize &size, QImage::Format format, TextureCreateFlags flags)
-{
- d->createTexture(id, size, format, flags);
-}
-
-void QSGD3D12Engine::queueTextureResize(uint id, const QSize &size)
-{
- d->queueTextureResize(id, size);
-}
-
-void QSGD3D12Engine::queueTextureUpload(uint id, const QImage &image, const QPoint &dstPos, TextureUploadFlags flags)
-{
- d->queueTextureUpload(id, QVector<QImage>() << image, QVector<QPoint>() << dstPos, flags);
-}
-
-void QSGD3D12Engine::queueTextureUpload(uint id, const QVector<QImage> &images, const QVector<QPoint> &dstPos,
- TextureUploadFlags flags)
-{
- d->queueTextureUpload(id, images, dstPos, flags);
-}
-
-void QSGD3D12Engine::releaseTexture(uint id)
-{
- d->releaseTexture(id);
-}
-
-void QSGD3D12Engine::useTexture(uint id)
-{
- d->useTexture(id);
-}
-
-uint QSGD3D12Engine::genRenderTarget()
-{
- return d->genRenderTarget();
-}
-
-void QSGD3D12Engine::createRenderTarget(uint id, const QSize &size, const QVector4D &clearColor, uint samples)
-{
- d->createRenderTarget(id, size, clearColor, samples);
-}
-
-void QSGD3D12Engine::releaseRenderTarget(uint id)
-{
- d->releaseRenderTarget(id);
-}
-
-void QSGD3D12Engine::useRenderTargetAsTexture(uint id)
-{
- d->useRenderTargetAsTexture(id);
-}
-
-uint QSGD3D12Engine::activeRenderTarget() const
-{
- return d->activeRenderTarget();
-}
-
-QImage QSGD3D12Engine::executeAndWaitReadbackRenderTarget(uint id)
-{
- return d->executeAndWaitReadbackRenderTarget(id);
-}
-
-void QSGD3D12Engine::simulateDeviceLoss()
-{
- d->simulateDeviceLoss();
-}
-
-void *QSGD3D12Engine::getResource(QQuickWindow *, QSGRendererInterface::Resource resource) const
-{
- return d->getResource(resource);
-}
-
-static inline quint32 alignedSize(quint32 size, quint32 byteAlign)
-{
- return (size + byteAlign - 1) & ~(byteAlign - 1);
-}
-
-quint32 QSGD3D12Engine::alignedConstantBufferSize(quint32 size)
-{
- return alignedSize(size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
-}
-
-QSGD3D12Format QSGD3D12Engine::toDXGIFormat(QSGGeometry::Type sgtype, int tupleSize, int *size)
-{
- QSGD3D12Format format = FmtUnknown;
-
- static const QSGD3D12Format formatMap_ub[] = { FmtUnknown,
- FmtUNormByte,
- FmtUNormByte2,
- FmtUnknown,
- FmtUNormByte4 };
-
- static const QSGD3D12Format formatMap_f[] = { FmtUnknown,
- FmtFloat,
- FmtFloat2,
- FmtFloat3,
- FmtFloat4 };
-
- switch (sgtype) {
- case QSGGeometry::UnsignedByteType:
- format = formatMap_ub[tupleSize];
- if (size)
- *size = tupleSize;
- break;
- case QSGGeometry::FloatType:
- format = formatMap_f[tupleSize];
- if (size)
- *size = sizeof(float) * tupleSize;
- break;
-
- case QSGGeometry::UnsignedShortType:
- format = FmtUnsignedShort;
- if (size)
- *size = sizeof(ushort) * tupleSize;
- break;
- case QSGGeometry::UnsignedIntType:
- format = FmtUnsignedInt;
- if (size)
- *size = sizeof(uint) * tupleSize;
- break;
-
- case QSGGeometry::ByteType:
- case QSGGeometry::IntType:
- case QSGGeometry::ShortType:
- qWarning("no mapping for GL type 0x%x", sgtype);
- break;
-
- default:
- qWarning("unknown GL type 0x%x", sgtype);
- break;
- }
-
- return format;
-}
-
-int QSGD3D12Engine::mipMapLevels(const QSize &size)
-{
- return ceil(log2(qMax(size.width(), size.height()))) + 1;
-}
-
-inline static bool isPowerOfTwo(int x)
-{
- // Assumption: x >= 1
- return x == (x & -x);
-}
-
-QSize QSGD3D12Engine::mipMapAdjustedSourceSize(const QSize &size)
-{
- if (size.isEmpty())
- return size;
-
- QSize adjustedSize = size;
-
- // ### for now only power-of-two sizes are mipmap-capable
- if (!isPowerOfTwo(size.width()))
- adjustedSize.setWidth(qNextPowerOfTwo(size.width()));
- if (!isPowerOfTwo(size.height()))
- adjustedSize.setHeight(qNextPowerOfTwo(size.height()));
-
- return adjustedSize;
-}
-
-void QSGD3D12EnginePrivate::releaseResources()
-{
- if (!initialized)
- return;
-
- mipmapper.releaseResources();
- devLossTest.releaseResources();
-
- frameCommandList = nullptr;
- copyCommandList = nullptr;
-
- copyCommandAllocator = nullptr;
- for (int i = 0; i < frameInFlightCount; ++i) {
- frameCommandAllocator[i] = nullptr;
- pframeData[i].gpuCbvSrvUavHeap = nullptr;
- delete frameFence[i];
- }
-
- defaultDS = nullptr;
- for (int i = 0; i < swapChainBufferCount; ++i) {
- backBufferRT[i] = nullptr;
- defaultRT[i] = nullptr;
- }
-
- psoCache.clear();
- rootSigCache.clear();
- buffers.clear();
- textures.clear();
- renderTargets.clear();
-
- cpuDescHeapManager.releaseResources();
-
- commandQueue = nullptr;
- copyCommandQueue = nullptr;
-
-#ifndef Q_OS_WINRT
- dcompTarget = nullptr;
- dcompVisual = nullptr;
- dcompDevice = nullptr;
-#endif
-
- swapChain = nullptr;
-
- delete presentFence;
- textureUploadFence = nullptr;
-
- deviceManager()->unref();
-
- initialized = false;
-
- // 'window' must be kept, may just be a device loss
-}
-
-void QSGD3D12EnginePrivate::initialize(WId w, const QSize &size, float dpr, int surfaceFormatSamples, bool alpha)
-{
- if (initialized)
- return;
-
- window = w;
- windowSize = size;
- windowDpr = dpr;
- windowSamples = qMax(1, surfaceFormatSamples); // may be -1 or 0, whereas windowSamples is uint and >= 1
- windowAlpha = alpha;
-
- swapChainBufferCount = qMin(qEnvironmentVariableIntValue("QT_D3D_BUFFER_COUNT"), MAX_SWAP_CHAIN_BUFFER_COUNT);
- if (swapChainBufferCount < 2)
- swapChainBufferCount = DEFAULT_SWAP_CHAIN_BUFFER_COUNT;
-
- frameInFlightCount = qMin(qEnvironmentVariableIntValue("QT_D3D_FRAME_COUNT"), MAX_FRAME_IN_FLIGHT_COUNT);
- if (frameInFlightCount < 1)
- frameInFlightCount = DEFAULT_FRAME_IN_FLIGHT_COUNT;
-
- static const char *latReqEnvVar = "QT_D3D_WAITABLE_SWAP_CHAIN_MAX_LATENCY";
- if (!qEnvironmentVariableIsSet(latReqEnvVar))
- waitableSwapChainMaxLatency = DEFAULT_WAITABLE_SWAP_CHAIN_MAX_LATENCY;
- else
- waitableSwapChainMaxLatency = qBound(0, qEnvironmentVariableIntValue(latReqEnvVar), 16);
-
- if (qEnvironmentVariableIsSet("QSG_INFO"))
- const_cast<QLoggingCategory &>(QSG_LOG_INFO_GENERAL()).setEnabled(QtDebugMsg, true);
-
- qCDebug(QSG_LOG_INFO_GENERAL, "d3d12 engine init. swap chain buffer count %d, max frames prepared without blocking %d",
- swapChainBufferCount, frameInFlightCount);
- if (waitableSwapChainMaxLatency)
- qCDebug(QSG_LOG_INFO_GENERAL, "Swap chain frame latency waitable object enabled. Frame latency is %d", waitableSwapChainMaxLatency);
-
- const bool debugLayer = qEnvironmentVariableIntValue("QT_D3D_DEBUG") != 0;
- if (debugLayer) {
- qCDebug(QSG_LOG_INFO_GENERAL, "Enabling debug layer");
-#if !defined(Q_OS_WINRT) || !defined(NDEBUG)
- ComPtr<ID3D12Debug> debugController;
- if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
- debugController->EnableDebugLayer();
-#else
- qCDebug(QSG_LOG_INFO_GENERAL, "Using DebugInterface will not allow certification to pass");
-#endif
- }
-
- QSGD3D12DeviceManager *dev = deviceManager();
- device = dev->ref();
- dev->registerDeviceLossObserver(this);
-
- if (debugLayer) {
- ComPtr<ID3D12InfoQueue> infoQueue;
- if (SUCCEEDED(device->QueryInterface(IID_PPV_ARGS(&infoQueue)))) {
- infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true);
- infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true);
- const bool breakOnWarning = qEnvironmentVariableIntValue("QT_D3D_DEBUG_BREAK_ON_WARNING") != 0;
- infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, breakOnWarning);
- D3D12_INFO_QUEUE_FILTER filter = {};
- D3D12_MESSAGE_ID suppressedMessages[] = {
- // When using a render target other than the default one we
- // have no way to know the custom clear color, if there is one.
- D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE
- };
- filter.DenyList.NumIDs = _countof(suppressedMessages);
- filter.DenyList.pIDList = suppressedMessages;
- // setting the filter would enable Info messages which we don't need
- D3D12_MESSAGE_SEVERITY infoSev = D3D12_MESSAGE_SEVERITY_INFO;
- filter.DenyList.NumSeverities = 1;
- filter.DenyList.pSeverityList = &infoSev;
- infoQueue->PushStorageFilter(&filter);
- }
- }
-
- D3D12_COMMAND_QUEUE_DESC queueDesc = {};
- queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
- if (FAILED(device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&commandQueue)))) {
- qWarning("Failed to create command queue");
- return;
- }
-
- queueDesc.Type = D3D12_COMMAND_LIST_TYPE_COPY;
- if (FAILED(device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&copyCommandQueue)))) {
- qWarning("Failed to create copy command queue");
- return;
- }
-
-#ifndef Q_OS_WINRT
- HWND hwnd = reinterpret_cast<HWND>(w);
-
- if (windowAlpha) {
- // Go through DirectComposition for semi-transparent windows since the
- // traditional approaches won't fly with flip model swapchains.
- HRESULT hr = DCompositionCreateDevice(nullptr, IID_PPV_ARGS(&dcompDevice));
- if (SUCCEEDED(hr)) {
- hr = dcompDevice->CreateTargetForHwnd(hwnd, true, &dcompTarget);
- if (SUCCEEDED(hr)) {
- hr = dcompDevice->CreateVisual(&dcompVisual);
- if (FAILED(hr)) {
- qWarning("Failed to create DirectComposition visual: %s",
- qPrintable(comErrorMessage(hr)));
- windowAlpha = false;
- }
- } else {
- qWarning("Failed to create DirectComposition target: %s",
- qPrintable(comErrorMessage(hr)));
- windowAlpha = false;
- }
- } else {
- qWarning("Failed to create DirectComposition device: %s",
- qPrintable(comErrorMessage(hr)));
- windowAlpha = false;
- }
- }
-
- if (windowAlpha) {
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};
- swapChainDesc.Width = windowSize.width() * windowDpr;
- swapChainDesc.Height = windowSize.height() * windowDpr;
- swapChainDesc.Format = RT_COLOR_FORMAT;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.BufferCount = swapChainBufferCount;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
- swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED;
- if (waitableSwapChainMaxLatency)
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
-
- ComPtr<IDXGISwapChain1> baseSwapChain;
- HRESULT hr = dev->dxgi()->CreateSwapChainForComposition(commandQueue.Get(), &swapChainDesc, nullptr, &baseSwapChain);
- if (SUCCEEDED(hr)) {
- if (SUCCEEDED(baseSwapChain.As(&swapChain))) {
- hr = dcompVisual->SetContent(swapChain.Get());
- if (SUCCEEDED(hr)) {
- hr = dcompTarget->SetRoot(dcompVisual.Get());
- if (FAILED(hr)) {
- qWarning("SetRoot failed for DirectComposition target: %s",
- qPrintable(comErrorMessage(hr)));
- windowAlpha = false;
- }
- } else {
- qWarning("SetContent failed for DirectComposition visual: %s",
- qPrintable(comErrorMessage(hr)));
- windowAlpha = false;
- }
- } else {
- qWarning("Failed to cast swap chain");
- windowAlpha = false;
- }
- } else {
- qWarning("Failed to create swap chain for composition: 0x%x", hr);
- windowAlpha = false;
- }
- }
-
- if (!windowAlpha) {
- DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
- swapChainDesc.BufferCount = swapChainBufferCount;
- swapChainDesc.BufferDesc.Width = windowSize.width() * windowDpr;
- swapChainDesc.BufferDesc.Height = windowSize.height() * windowDpr;
- swapChainDesc.BufferDesc.Format = RT_COLOR_FORMAT;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; // D3D12 requires the flip model
- swapChainDesc.OutputWindow = hwnd;
- swapChainDesc.SampleDesc.Count = 1; // Flip does not support MSAA so no choice here
- swapChainDesc.Windowed = TRUE;
- if (waitableSwapChainMaxLatency)
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
-
- ComPtr<IDXGISwapChain> baseSwapChain;
- HRESULT hr = dev->dxgi()->CreateSwapChain(commandQueue.Get(), &swapChainDesc, &baseSwapChain);
- if (FAILED(hr)) {
- qWarning("Failed to create swap chain: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
- hr = baseSwapChain.As(&swapChain);
- if (FAILED(hr)) {
- qWarning("Failed to cast swap chain: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
- }
-
- dev->dxgi()->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
-#else
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};
- swapChainDesc.Width = windowSize.width() * windowDpr;
- swapChainDesc.Height = windowSize.height() * windowDpr;
- swapChainDesc.Format = RT_COLOR_FORMAT;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.BufferCount = swapChainBufferCount;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
- swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED;
- if (waitableSwapChainMaxLatency)
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
-
- ComPtr<IDXGISwapChain1> baseSwapChain;
- HRESULT hr = dev->dxgi()->CreateSwapChainForComposition(commandQueue.Get(), &swapChainDesc, nullptr, &baseSwapChain);
- if (FAILED(hr)) {
- qWarning("Failed to create swap chain for composition: 0x%x", hr);
- return;
- }
- if (FAILED(baseSwapChain.As(&swapChain))) {
- qWarning("Failed to cast swap chain");
- return;
- }
-
- // The winrt platform plugin returns an ISwapChainPanel* from winId().
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> swapChainPanel
- = reinterpret_cast<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel *>(window);
- ComPtr<ISwapChainPanelNative> swapChainPanelNative;
- if (FAILED(swapChainPanel.As(&swapChainPanelNative))) {
- qWarning("Failed to cast swap chain panel to native");
- return;
- }
- hr = QEventDispatcherWinRT::runOnXamlThread([this, &swapChainPanelNative]() {
- return swapChainPanelNative->SetSwapChain(swapChain.Get());
- });
- if (FAILED(hr)) {
- qWarning("Failed to set swap chain on panel: 0x%x", hr);
- return;
- }
-#endif
-
- if (waitableSwapChainMaxLatency) {
- if (FAILED(swapChain->SetMaximumFrameLatency(waitableSwapChainMaxLatency)))
- qWarning("Failed to set maximum frame latency to %d", waitableSwapChainMaxLatency);
- swapEvent = swapChain->GetFrameLatencyWaitableObject();
- }
-
- for (int i = 0; i < frameInFlightCount; ++i) {
- if (FAILED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&frameCommandAllocator[i])))) {
- qWarning("Failed to create command allocator");
- return;
- }
- }
-
- if (FAILED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_COPY, IID_PPV_ARGS(&copyCommandAllocator)))) {
- qWarning("Failed to create copy command allocator");
- return;
- }
-
- for (int i = 0; i < frameInFlightCount; ++i) {
- if (!createCbvSrvUavHeap(i, GPU_CBVSRVUAV_DESCRIPTORS))
- return;
- }
-
- cpuDescHeapManager.initialize(device);
-
- setupDefaultRenderTargets();
-
- if (FAILED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, frameCommandAllocator[0].Get(),
- nullptr, IID_PPV_ARGS(&frameCommandList)))) {
- qWarning("Failed to create command list");
- return;
- }
- // created in recording state, close it for now
- frameCommandList->Close();
-
- if (FAILED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_COPY, copyCommandAllocator.Get(),
- nullptr, IID_PPV_ARGS(&copyCommandList)))) {
- qWarning("Failed to create copy command list");
- return;
- }
- copyCommandList->Close();
-
- frameIndex = 0;
-
- presentFence = createCPUWaitableFence();
- for (int i = 0; i < frameInFlightCount; ++i)
- frameFence[i] = createCPUWaitableFence();
-
- if (FAILED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&textureUploadFence)))) {
- qWarning("Failed to create fence");
- return;
- }
-
- psoCache.setMaxCost(MAX_CACHED_PSO);
- rootSigCache.setMaxCost(MAX_CACHED_ROOTSIG);
-
- if (!mipmapper.initialize(this))
- return;
-
- if (!devLossTest.initialize(this))
- return;
-
- currentRenderTarget = 0;
-
- initialized = true;
-}
-
-bool QSGD3D12EnginePrivate::createCbvSrvUavHeap(int pframeIndex, int descriptorCount)
-{
- D3D12_DESCRIPTOR_HEAP_DESC gpuDescHeapDesc = {};
- gpuDescHeapDesc.NumDescriptors = descriptorCount;
- gpuDescHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
- gpuDescHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
-
- if (FAILED(device->CreateDescriptorHeap(&gpuDescHeapDesc, IID_PPV_ARGS(&pframeData[pframeIndex].gpuCbvSrvUavHeap)))) {
- qWarning("Failed to create shader-visible CBV-SRV-UAV heap");
- return false;
- }
-
- pframeData[pframeIndex].gpuCbvSrvUavHeapSize = descriptorCount;
-
- return true;
-}
-
-DXGI_SAMPLE_DESC QSGD3D12EnginePrivate::makeSampleDesc(DXGI_FORMAT format, uint samples)
-{
- DXGI_SAMPLE_DESC sampleDesc;
- sampleDesc.Count = 1;
- sampleDesc.Quality = 0;
-
- if (samples > 1) {
- D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msaaInfo = {};
- msaaInfo.Format = format;
- msaaInfo.SampleCount = samples;
- if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &msaaInfo, sizeof(msaaInfo)))) {
- if (msaaInfo.NumQualityLevels > 0) {
- sampleDesc.Count = samples;
- sampleDesc.Quality = msaaInfo.NumQualityLevels - 1;
- } else {
- qWarning("No quality levels for multisampling with sample count %d", samples);
- }
- } else {
- qWarning("Failed to query multisample quality levels for sample count %d", samples);
- }
- }
-
- return sampleDesc;
-}
-
-ID3D12Resource *QSGD3D12EnginePrivate::createColorBuffer(D3D12_CPU_DESCRIPTOR_HANDLE viewHandle, const QSize &size,
- const QVector4D &clearColor, uint samples)
-{
- D3D12_CLEAR_VALUE clearValue = {};
- clearValue.Format = RT_COLOR_FORMAT;
- clearValue.Color[0] = clearColor.x();
- clearValue.Color[1] = clearColor.y();
- clearValue.Color[2] = clearColor.z();
- clearValue.Color[3] = clearColor.w();
-
- D3D12_HEAP_PROPERTIES heapProp = {};
- heapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
-
- D3D12_RESOURCE_DESC rtDesc = {};
- rtDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- rtDesc.Width = size.width();
- rtDesc.Height = size.height();
- rtDesc.DepthOrArraySize = 1;
- rtDesc.MipLevels = 1;
- rtDesc.Format = RT_COLOR_FORMAT;
- rtDesc.SampleDesc = makeSampleDesc(rtDesc.Format, samples);
- rtDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
-
- ID3D12Resource *resource = nullptr;
- const D3D12_RESOURCE_STATES initialState = samples <= 1
- ? D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE
- : D3D12_RESOURCE_STATE_RENDER_TARGET;
- if (FAILED(device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &rtDesc,
- initialState, &clearValue, IID_PPV_ARGS(&resource)))) {
- qWarning("Failed to create offscreen render target of size %dx%d", size.width(), size.height());
- return nullptr;
- }
-
- device->CreateRenderTargetView(resource, nullptr, viewHandle);
-
- return resource;
-}
-
-ID3D12Resource *QSGD3D12EnginePrivate::createDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE viewHandle, const QSize &size, uint samples)
-{
- D3D12_CLEAR_VALUE depthClearValue = {};
- depthClearValue.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
- depthClearValue.DepthStencil.Depth = 1.0f;
- depthClearValue.DepthStencil.Stencil = 0;
-
- D3D12_HEAP_PROPERTIES heapProp = {};
- heapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
-
- D3D12_RESOURCE_DESC bufDesc = {};
- bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- bufDesc.Width = size.width();
- bufDesc.Height = size.height();
- bufDesc.DepthOrArraySize = 1;
- bufDesc.MipLevels = 1;
- bufDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
- bufDesc.SampleDesc = makeSampleDesc(bufDesc.Format, samples);
- bufDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
- bufDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
-
- ID3D12Resource *resource = nullptr;
- if (FAILED(device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc,
- D3D12_RESOURCE_STATE_DEPTH_WRITE, &depthClearValue, IID_PPV_ARGS(&resource)))) {
- qWarning("Failed to create depth-stencil buffer of size %dx%d", size.width(), size.height());
- return nullptr;
- }
-
- D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilDesc = {};
- depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
- depthStencilDesc.ViewDimension = bufDesc.SampleDesc.Count <= 1 ? D3D12_DSV_DIMENSION_TEXTURE2D : D3D12_DSV_DIMENSION_TEXTURE2DMS;
-
- device->CreateDepthStencilView(resource, &depthStencilDesc, viewHandle);
-
- return resource;
-}
-
-void QSGD3D12EnginePrivate::setupDefaultRenderTargets()
-{
- for (int i = 0; i < swapChainBufferCount; ++i) {
- if (FAILED(swapChain->GetBuffer(i, IID_PPV_ARGS(&backBufferRT[i])))) {
- qWarning("Failed to get buffer %d from swap chain", i);
- return;
- }
- defaultRTV[i] = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
- if (windowSamples == 1) {
- defaultRT[i] = backBufferRT[i];
- device->CreateRenderTargetView(defaultRT[i].Get(), nullptr, defaultRTV[i]);
- } else {
- const QSize size(windowSize.width() * windowDpr, windowSize.height() * windowDpr);
- // Not optimal if the user called setClearColor, but there's so
- // much we can do. The debug layer warning is suppressed so we're good to go.
- const QColor cc(Qt::white);
- const QVector4D clearColor(cc.redF(), cc.greenF(), cc.blueF(), cc.alphaF());
- ID3D12Resource *msaaRT = createColorBuffer(defaultRTV[i], size, clearColor, windowSamples);
- if (msaaRT)
- defaultRT[i].Attach(msaaRT);
- }
- }
-
- defaultDSV = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
- const QSize size(windowSize.width() * windowDpr, windowSize.height() * windowDpr);
- ID3D12Resource *ds = createDepthStencil(defaultDSV, size, windowSamples);
- if (ds)
- defaultDS.Attach(ds);
-
- presentFrameIndex = 0;
-}
-
-void QSGD3D12EnginePrivate::setWindowSize(const QSize &size, float dpr)
-{
- if (!initialized || (windowSize == size && windowDpr == dpr))
- return;
-
- waitGPU();
-
- windowSize = size;
- windowDpr = dpr;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug() << "resize" << size << dpr;
-
- // Clear these, otherwise resizing will fail.
- defaultDS = nullptr;
- cpuDescHeapManager.release(defaultDSV, D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
- for (int i = 0; i < swapChainBufferCount; ++i) {
- backBufferRT[i] = nullptr;
- defaultRT[i] = nullptr;
- cpuDescHeapManager.release(defaultRTV[i], D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
- }
-
- const int w = windowSize.width() * windowDpr;
- const int h = windowSize.height() * windowDpr;
- HRESULT hr = swapChain->ResizeBuffers(swapChainBufferCount, w, h, RT_COLOR_FORMAT,
- waitableSwapChainMaxLatency ? DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT : 0);
- if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
- deviceManager()->deviceLossDetected();
- return;
- } else if (FAILED(hr)) {
- qWarning("Failed to resize buffers: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
-
- setupDefaultRenderTargets();
-}
-
-void QSGD3D12EnginePrivate::deviceLost()
-{
- qWarning("D3D device lost, will attempt to reinitialize");
-
- // Release all resources. This is important because otherwise reinitialization may fail.
- releaseResources();
-
- // Now in uninitialized state (but 'window' is still valid). Will recreate
- // all the resources on the next beginFrame().
-}
-
-QSGD3D12CPUWaitableFence *QSGD3D12EnginePrivate::createCPUWaitableFence() const
-{
- QSGD3D12CPUWaitableFence *f = new QSGD3D12CPUWaitableFence;
- HRESULT hr = device->CreateFence(f->value, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&f->fence));
- if (FAILED(hr)) {
- qWarning("Failed to create fence: %s", qPrintable(comErrorMessage(hr)));
- return f;
- }
- f->event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- return f;
-}
-
-void QSGD3D12EnginePrivate::waitForGPU(QSGD3D12CPUWaitableFence *f) const
-{
- const UINT64 newValue = f->value.fetchAndAddAcquire(1) + 1;
- commandQueue->Signal(f->fence.Get(), newValue);
- if (f->fence->GetCompletedValue() < newValue) {
- HRESULT hr = f->fence->SetEventOnCompletion(newValue, f->event);
- if (FAILED(hr)) {
- qWarning("SetEventOnCompletion failed: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
- WaitForSingleObject(f->event, INFINITE);
- }
-}
-
-void QSGD3D12EnginePrivate::transitionResource(ID3D12Resource *resource, ID3D12GraphicsCommandList *commandList,
- D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after) const
-{
- D3D12_RESOURCE_BARRIER barrier;
- barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
- barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
- barrier.Transition.pResource = resource;
- barrier.Transition.StateBefore = before;
- barrier.Transition.StateAfter = after;
- barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
-
- commandList->ResourceBarrier(1, &barrier);
-}
-
-void QSGD3D12EnginePrivate::resolveMultisampledTarget(ID3D12Resource *msaa,
- ID3D12Resource *resolve,
- D3D12_RESOURCE_STATES resolveUsage,
- ID3D12GraphicsCommandList *commandList) const
-{
- D3D12_RESOURCE_BARRIER barriers[2];
- for (int i = 0; i < _countof(barriers); ++i) {
- barriers[i].Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
- barriers[i].Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
- barriers[i].Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
- }
-
- barriers[0].Transition.pResource = msaa;
- barriers[0].Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
- barriers[0].Transition.StateAfter = D3D12_RESOURCE_STATE_RESOLVE_SOURCE;
- barriers[1].Transition.pResource = resolve;
- barriers[1].Transition.StateBefore = resolveUsage;
- barriers[1].Transition.StateAfter = D3D12_RESOURCE_STATE_RESOLVE_DEST;
- commandList->ResourceBarrier(2, barriers);
-
- commandList->ResolveSubresource(resolve, 0, msaa, 0, RT_COLOR_FORMAT);
-
- barriers[0].Transition.pResource = msaa;
- barriers[0].Transition.StateBefore = D3D12_RESOURCE_STATE_RESOLVE_SOURCE;
- barriers[0].Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
- barriers[1].Transition.pResource = resolve;
- barriers[1].Transition.StateBefore = D3D12_RESOURCE_STATE_RESOLVE_DEST;
- barriers[1].Transition.StateAfter = resolveUsage;
- commandList->ResourceBarrier(2, barriers);
-}
-
-void QSGD3D12EnginePrivate::uavBarrier(ID3D12Resource *resource, ID3D12GraphicsCommandList *commandList) const
-{
- D3D12_RESOURCE_BARRIER barrier = {};
- barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
- barrier.UAV.pResource = resource;
-
- commandList->ResourceBarrier(1, &barrier);
-}
-
-ID3D12Resource *QSGD3D12EnginePrivate::createBuffer(int size)
-{
- ID3D12Resource *buf;
-
- D3D12_HEAP_PROPERTIES uploadHeapProp = {};
- uploadHeapProp.Type = D3D12_HEAP_TYPE_UPLOAD;
-
- D3D12_RESOURCE_DESC bufDesc = {};
- bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- bufDesc.Width = size;
- bufDesc.Height = 1;
- bufDesc.DepthOrArraySize = 1;
- bufDesc.MipLevels = 1;
- bufDesc.Format = DXGI_FORMAT_UNKNOWN;
- bufDesc.SampleDesc.Count = 1;
- bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
-
- HRESULT hr = device->CreateCommittedResource(&uploadHeapProp, D3D12_HEAP_FLAG_NONE, &bufDesc,
- D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&buf));
- if (FAILED(hr))
- qWarning("Failed to create buffer resource: %s", qPrintable(comErrorMessage(hr)));
-
- return buf;
-}
-
-void QSGD3D12EnginePrivate::ensureBuffer(Buffer *buf)
-{
- Buffer::InFlightData &bfd(buf->d[currentPFrameIndex]);
- // Only enlarge, never shrink
- const bool newBufferNeeded = bfd.buffer ? (buf->cpuDataRef.size > bfd.resourceSize) : true;
- if (newBufferNeeded) {
- // Round it up and overallocate a little bit so that a subsequent
- // buffer contents rebuild with a slightly larger total size does
- // not lead to creating a new buffer.
- const quint32 sz = alignedSize(buf->cpuDataRef.size, 4096);
- if (Q_UNLIKELY(debug_buffer()))
- qDebug("new buffer[pf=%d] of size %d (actual data size %d)", currentPFrameIndex, sz, buf->cpuDataRef.size);
- bfd.buffer.Attach(createBuffer(sz));
- bfd.resourceSize = sz;
- }
- // Cache the actual data size in the per-in-flight-frame data as well.
- bfd.dataSize = buf->cpuDataRef.size;
-}
-
-void QSGD3D12EnginePrivate::updateBuffer(Buffer *buf)
-{
- if (buf->cpuDataRef.dirty.isEmpty())
- return;
-
- Buffer::InFlightData &bfd(buf->d[currentPFrameIndex]);
- quint8 *p = nullptr;
- const D3D12_RANGE readRange = { 0, 0 };
- if (FAILED(bfd.buffer->Map(0, &readRange, reinterpret_cast<void **>(&p)))) {
- qWarning("Map failed for buffer of size %d", buf->cpuDataRef.size);
- return;
- }
- for (const auto &r : qAsConst(buf->cpuDataRef.dirty)) {
- if (Q_UNLIKELY(debug_buffer()))
- qDebug("%p o %d s %d", buf, r.first, r.second);
- memcpy(p + r.first, buf->cpuDataRef.p + r.first, r.second);
- }
- bfd.buffer->Unmap(0, nullptr);
- buf->cpuDataRef.dirty.clear();
-}
-
-void QSGD3D12EnginePrivate::ensureDevice()
-{
- if (!initialized && window)
- initialize(window, windowSize, windowDpr, windowSamples, windowAlpha);
-}
-
-void QSGD3D12EnginePrivate::beginFrame()
-{
- if (inFrame && !activeLayers)
- qFatal("beginFrame called again without an endFrame, frame index was %d", frameIndex);
-
- if (Q_UNLIKELY(debug_render()))
- qDebug() << "***** begin frame, logical" << frameIndex << "present" << presentFrameIndex << "layer" << activeLayers;
-
- if (inFrame && activeLayers) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("frame %d already in progress", frameIndex);
- if (!currentLayerDepth) {
- // There are layers and the real frame preparation starts now. Prepare for present.
- beginFrameDraw();
- }
- return;
- }
-
- inFrame = true;
-
- // The device may have been lost. This is the point to attempt to start
- // again from scratch. Except when it is not. Operations that can happen
- // out of frame (e.g. textures, render targets) may trigger reinit earlier
- // than beginFrame.
- ensureDevice();
-
- // Wait for a buffer to be available for Present, if the waitable event is in use.
- if (waitableSwapChainMaxLatency)
- WaitForSingleObject(swapEvent, INFINITE);
-
- // Block if needed. With 2 frames in flight frame N waits for frame N - 2, but not N - 1, to finish.
- currentPFrameIndex = frameIndex % frameInFlightCount;
- if (frameIndex >= frameInFlightCount) {
- ID3D12Fence *fence = frameFence[currentPFrameIndex]->fence.Get();
- HANDLE event = frameFence[currentPFrameIndex]->event;
- // Frame fence values start from 1, hence the +1.
- const quint64 inFlightFenceValue = frameIndex - frameInFlightCount + 1;
- if (fence->GetCompletedValue() < inFlightFenceValue) {
- fence->SetEventOnCompletion(inFlightFenceValue, event);
- WaitForSingleObject(event, INFINITE);
- }
- frameCommandAllocator[currentPFrameIndex]->Reset();
- }
-
- PersistentFrameData &pfd(pframeData[currentPFrameIndex]);
- pfd.cbvSrvUavNextFreeDescriptorIndex = 0;
-
- for (Buffer &b : buffers) {
- if (b.entryInUse())
- b.d[currentPFrameIndex].dirty.clear();
- }
-
- if (frameIndex >= frameInFlightCount - 1) {
- // Now sync the buffer changes from the previous, potentially still in
- // flight, frames. This is done by taking the ranges dirtied in those
- // frames and adding them to the global CPU-side buffer's dirty list,
- // as if this frame changed those ranges. (however, dirty ranges
- // inherited this way are not added to this frame's persistent
- // per-frame dirty list because the next frame after this one should
- // inherit this frame's genuine changes only, the rest will come from
- // the earlier ones)
- for (int delta = frameInFlightCount - 1; delta >= 1; --delta) {
- const int prevPFrameIndex = (frameIndex - delta) % frameInFlightCount;
- PersistentFrameData &prevFrameData(pframeData[prevPFrameIndex]);
- for (uint id : qAsConst(prevFrameData.buffersUsedInFrame)) {
- Buffer &b(buffers[id - 1]);
- if (b.d[currentPFrameIndex].buffer && b.d[currentPFrameIndex].dataSize == b.cpuDataRef.size) {
- if (Q_UNLIKELY(debug_buffer()))
- qDebug() << "frame" << frameIndex << "takes dirty" << b.d[prevPFrameIndex].dirty
- << "from frame" << frameIndex - delta << "for buffer" << id;
- for (const auto &range : qAsConst(b.d[prevPFrameIndex].dirty))
- addDirtyRange(&b.cpuDataRef.dirty, range.first, range.second, b.cpuDataRef.size);
- } else {
- if (Q_UNLIKELY(debug_buffer()))
- qDebug() << "frame" << frameIndex << "makes all dirty from frame" << frameIndex - delta
- << "for buffer" << id;
- addDirtyRange(&b.cpuDataRef.dirty, 0, b.cpuDataRef.size, b.cpuDataRef.size);
- }
- }
- }
- }
-
- if (frameIndex >= frameInFlightCount) {
- // Do some texture upload bookkeeping.
- const quint64 finishedFrameIndex = frameIndex - frameInFlightCount; // we know since we just blocked for this
- // pfd conveniently refers to the same slot that was used by that frame
- if (!pfd.pendingTextureUploads.isEmpty()) {
- if (Q_UNLIKELY(debug_texture()))
- qDebug("Removing texture upload data for frame %d", finishedFrameIndex);
- for (uint id : qAsConst(pfd.pendingTextureUploads)) {
- const int idx = id - 1;
- Texture &t(textures[idx]);
- // fenceValue is 0 when the previous frame cleared it, skip in
- // this case. Skip also when fenceValue > the value it was when
- // adding the last GPU wait - this is the case when more
- // uploads were queued for the same texture in the meantime.
- if (t.fenceValue && t.fenceValue == t.lastWaitFenceValue) {
- t.fenceValue = 0;
- t.lastWaitFenceValue = 0;
- t.stagingBuffers.clear();
- t.stagingHeaps.clear();
- if (Q_UNLIKELY(debug_texture()))
- qDebug("Cleaned staging data for texture %u", id);
- }
- }
- pfd.pendingTextureUploads.clear();
- if (!pfd.pendingTextureMipMap.isEmpty()) {
- if (Q_UNLIKELY(debug_texture()))
- qDebug() << "cleaning mipmap generation data for " << pfd.pendingTextureMipMap;
- // no special cleanup is needed as mipmap generation uses the frame's resources
- pfd.pendingTextureMipMap.clear();
- }
- bool hasPending = false;
- for (int delta = 1; delta < frameInFlightCount; ++delta) {
- const PersistentFrameData &prevFrameData(pframeData[(frameIndex - delta) % frameInFlightCount]);
- if (!prevFrameData.pendingTextureUploads.isEmpty()) {
- hasPending = true;
- break;
- }
- }
- if (!hasPending) {
- if (Q_UNLIKELY(debug_texture()))
- qDebug("no more pending textures");
- copyCommandAllocator->Reset();
- }
- }
-
- // Do the deferred deletes.
- if (!pfd.deleteQueue.isEmpty()) {
- for (PersistentFrameData::DeleteQueueEntry &e : pfd.deleteQueue) {
- e.res = nullptr;
- e.descHeap = nullptr;
- if (e.cpuDescriptorPtr) {
- D3D12_CPU_DESCRIPTOR_HANDLE h = { e.cpuDescriptorPtr };
- cpuDescHeapManager.release(h, e.descHeapType);
- }
- }
- pfd.deleteQueue.clear();
- }
- // Deferred deletes issued outside a begin-endFrame go to the next
- // frame's out-of-frame delete queue as these cannot be executed in the
- // next beginFrame, only in next + frameInFlightCount. Move to the
- // normal queue if this is the next beginFrame.
- if (!pfd.outOfFrameDeleteQueue.isEmpty()) {
- pfd.deleteQueue = pfd.outOfFrameDeleteQueue;
- pfd.outOfFrameDeleteQueue.clear();
- }
-
- // Mark released texture, buffer, etc. slots free.
- if (!pfd.pendingReleases.isEmpty()) {
- for (const auto &pr : qAsConst(pfd.pendingReleases)) {
- Q_ASSERT(pr.id);
- if (pr.type == PersistentFrameData::PendingRelease::TypeTexture) {
- Texture &t(textures[pr.id - 1]);
- Q_ASSERT(t.entryInUse());
- t.flags &= ~RenderTarget::EntryInUse; // createTexture() can now reuse this entry
- t.texture = nullptr;
- } else if (pr.type == PersistentFrameData::PendingRelease::TypeBuffer) {
- Buffer &b(buffers[pr.id - 1]);
- Q_ASSERT(b.entryInUse());
- b.flags &= ~Buffer::EntryInUse;
- for (int i = 0; i < frameInFlightCount; ++i)
- b.d[i].buffer = nullptr;
- } else {
- qFatal("Corrupt pending release list, type %d", pr.type);
- }
- }
- pfd.pendingReleases.clear();
- }
- if (!pfd.outOfFramePendingReleases.isEmpty()) {
- pfd.pendingReleases = pfd.outOfFramePendingReleases;
- pfd.outOfFramePendingReleases.clear();
- }
- }
-
- pfd.buffersUsedInFrame.clear();
-
- beginDrawCalls();
-
- // Prepare for present if this is a frame without layers.
- if (!activeLayers)
- beginFrameDraw();
-}
-
-void QSGD3D12EnginePrivate::beginDrawCalls()
-{
- frameCommandList->Reset(frameCommandAllocator[frameIndex % frameInFlightCount].Get(), nullptr);
- commandList = frameCommandList.Get();
- invalidateCachedFrameState();
-}
-
-void QSGD3D12EnginePrivate::invalidateCachedFrameState()
-{
- tframeData.drawingMode = QSGGeometry::DrawingMode(-1);
- tframeData.currentIndexBuffer = 0;
- tframeData.activeTextureCount = 0;
- tframeData.drawCount = 0;
- tframeData.lastPso = nullptr;
- tframeData.lastRootSig = nullptr;
- tframeData.descHeapSet = false;
-}
-
-void QSGD3D12EnginePrivate::restoreFrameState(bool minimal)
-{
- queueSetRenderTarget(currentRenderTarget);
- if (!minimal) {
- queueViewport(tframeData.viewport);
- queueScissor(tframeData.scissor);
- queueSetBlendFactor(tframeData.blendFactor);
- queueSetStencilRef(tframeData.stencilRef);
- }
- finalizePipeline(tframeData.pipelineState);
-}
-
-void QSGD3D12EnginePrivate::beginFrameDraw()
-{
- if (windowSamples == 1)
- transitionResource(defaultRT[presentFrameIndex % swapChainBufferCount].Get(), commandList,
- D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
-}
-
-void QSGD3D12EnginePrivate::endFrame()
-{
- if (!inFrame)
- qFatal("endFrame called without beginFrame, frame index %d", frameIndex);
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("***** end frame");
-
- endDrawCalls(true);
-
- commandQueue->Signal(frameFence[frameIndex % frameInFlightCount]->fence.Get(), frameIndex + 1);
- ++frameIndex;
-
- inFrame = false;
-}
-
-void QSGD3D12EnginePrivate::endDrawCalls(bool lastInFrame)
-{
- PersistentFrameData &pfd(pframeData[currentPFrameIndex]);
-
- // Now is the time to sync all the changed areas in the buffers.
- if (Q_UNLIKELY(debug_buffer()))
- qDebug() << "buffers used in drawcall set" << pfd.buffersUsedInDrawCallSet;
- for (uint id : qAsConst(pfd.buffersUsedInDrawCallSet))
- updateBuffer(&buffers[id - 1]);
-
- pfd.buffersUsedInFrame += pfd.buffersUsedInDrawCallSet;
- pfd.buffersUsedInDrawCallSet.clear();
-
- // Add a wait on the 3D queue for the relevant texture uploads on the copy queue.
- if (!pfd.pendingTextureUploads.isEmpty()) {
- quint64 topFenceValue = 0;
- for (uint id : qAsConst(pfd.pendingTextureUploads)) {
- const int idx = id - 1;
- Texture &t(textures[idx]);
- Q_ASSERT(t.fenceValue);
- // skip if already added a Wait in the previous frame
- if (t.lastWaitFenceValue == t.fenceValue)
- continue;
- t.lastWaitFenceValue = t.fenceValue;
- if (t.fenceValue > topFenceValue)
- topFenceValue = t.fenceValue;
- if (t.mipmap())
- pfd.pendingTextureMipMap.insert(id);
- }
- if (topFenceValue) {
- if (Q_UNLIKELY(debug_texture()))
- qDebug("added wait for texture fence %llu", topFenceValue);
- commandQueue->Wait(textureUploadFence.Get(), topFenceValue);
- // Generate mipmaps after the wait, when necessary.
- if (!pfd.pendingTextureMipMap.isEmpty()) {
- if (Q_UNLIKELY(debug_texture()))
- qDebug() << "starting mipmap generation for" << pfd.pendingTextureMipMap;
- for (uint id : qAsConst(pfd.pendingTextureMipMap))
- mipmapper.queueGenerate(textures[id - 1]);
- }
- }
- }
-
- if (lastInFrame) {
- // Resolve and transition the backbuffer for present, if needed.
- const int idx = presentFrameIndex % swapChainBufferCount;
- if (windowSamples == 1) {
- transitionResource(defaultRT[idx].Get(), commandList,
- D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
- } else {
- if (Q_UNLIKELY(debug_render())) {
- const D3D12_RESOURCE_DESC desc = defaultRT[idx]->GetDesc();
- qDebug("added resolve for multisampled render target (count %d, quality %d)",
- desc.SampleDesc.Count, desc.SampleDesc.Quality);
- }
- resolveMultisampledTarget(defaultRT[idx].Get(), backBufferRT[idx].Get(),
- D3D12_RESOURCE_STATE_PRESENT, commandList);
- }
-
- if (activeLayers) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("this frame had %d layers", activeLayers);
- activeLayers = 0;
- }
- }
-
- // Go!
- HRESULT hr = frameCommandList->Close();
- if (FAILED(hr)) {
- qWarning("Failed to close command list: %s", qPrintable(comErrorMessage(hr)));
- if (hr == E_INVALIDARG)
- qWarning("Invalid arguments. Some of the commands in the list is invalid in some way.");
- }
-
- ID3D12CommandList *commandLists[] = { frameCommandList.Get() };
- commandQueue->ExecuteCommandLists(_countof(commandLists), commandLists);
-
- commandList = nullptr;
-}
-
-void QSGD3D12EnginePrivate::beginLayer()
-{
- if (inFrame && !activeLayers)
- qFatal("Layer rendering cannot be started while a frame is active");
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("===== beginLayer active %d depth %d (inFrame=%d)", activeLayers, currentLayerDepth, inFrame);
-
- ++activeLayers;
- ++currentLayerDepth;
-
- // Do an early beginFrame. With multiple layers this results in
- // beginLayer - beginFrame - endLayer - beginLayer - beginFrame - endLayer - ... - (*) beginFrame - endFrame
- // where (*) denotes the start of the preparation of the actual, non-layer frame.
-
- if (activeLayers == 1)
- beginFrame();
-}
-
-void QSGD3D12EnginePrivate::endLayer()
-{
- if (!inFrame || !activeLayers || !currentLayerDepth)
- qFatal("Mismatched endLayer");
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("===== endLayer active %d depth %d", activeLayers, currentLayerDepth);
-
- --currentLayerDepth;
-
- // Do not touch activeLayers. It remains valid until endFrame.
-}
-
-// Root signature:
-// [0] CBV - always present
-// [1] table with one SRV per texture (must be a table since root descriptor SRVs cannot be textures) - optional
-// one static sampler per texture - optional
-//
-// SRVs can be created freely via QSGD3D12CPUDescriptorHeapManager and stored
-// in QSGD3D12TextureView. The engine will copy them onto a dedicated,
-// shader-visible CBV-SRV-UAV heap in the correct order.
-
-void QSGD3D12EnginePrivate::finalizePipeline(const QSGD3D12PipelineState &pipelineState)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- tframeData.pipelineState = pipelineState;
-
- RootSigCacheEntry *cachedRootSig = rootSigCache[pipelineState.shaders.rootSig];
- if (!cachedRootSig) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("NEW ROOTSIG");
-
- cachedRootSig = new RootSigCacheEntry;
-
- D3D12_ROOT_PARAMETER rootParams[4];
- int rootParamCount = 0;
-
- rootParams[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- rootParams[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- rootParams[0].Descriptor.ShaderRegister = 0; // b0
- rootParams[0].Descriptor.RegisterSpace = 0;
- ++rootParamCount;
-
- D3D12_DESCRIPTOR_RANGE tvDescRange;
- if (pipelineState.shaders.rootSig.textureViewCount > 0) {
- rootParams[rootParamCount].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- rootParams[rootParamCount].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
- rootParams[rootParamCount].DescriptorTable.NumDescriptorRanges = 1;
- tvDescRange.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
- tvDescRange.NumDescriptors = pipelineState.shaders.rootSig.textureViewCount;
- tvDescRange.BaseShaderRegister = 0; // t0, t1, ...
- tvDescRange.RegisterSpace = 0;
- tvDescRange.OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
- rootParams[rootParamCount].DescriptorTable.pDescriptorRanges = &tvDescRange;
- ++rootParamCount;
- }
-
- Q_ASSERT(rootParamCount <= _countof(rootParams));
- D3D12_ROOT_SIGNATURE_DESC desc;
- desc.NumParameters = rootParamCount;
- desc.pParameters = rootParams;
- // Mixing up samplers and resource views in QSGD3D12TextureView means
- // that the number of static samplers has to match the number of
- // textures. This is not really ideal in general but works for Quick's use cases.
- // The shaders can still choose to declare and use fewer samplers, if they want to.
- desc.NumStaticSamplers = pipelineState.shaders.rootSig.textureViewCount;
- D3D12_STATIC_SAMPLER_DESC staticSamplers[8];
- int sdIdx = 0;
- Q_ASSERT(pipelineState.shaders.rootSig.textureViewCount <= _countof(staticSamplers));
- for (int i = 0; i < pipelineState.shaders.rootSig.textureViewCount; ++i) {
- const QSGD3D12TextureView &tv(pipelineState.shaders.rootSig.textureViews[i]);
- D3D12_STATIC_SAMPLER_DESC sd = {};
- sd.Filter = D3D12_FILTER(tv.filter);
- sd.AddressU = D3D12_TEXTURE_ADDRESS_MODE(tv.addressModeHoriz);
- sd.AddressV = D3D12_TEXTURE_ADDRESS_MODE(tv.addressModeVert);
- sd.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
- sd.MinLOD = 0.0f;
- sd.MaxLOD = D3D12_FLOAT32_MAX;
- sd.ShaderRegister = sdIdx; // t0, t1, ...
- sd.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
- staticSamplers[sdIdx++] = sd;
- }
- desc.pStaticSamplers = staticSamplers;
- desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
-
- ComPtr<ID3DBlob> signature;
- ComPtr<ID3DBlob> error;
- if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error))) {
- QByteArray msg(static_cast<const char *>(error->GetBufferPointer()), error->GetBufferSize());
- qWarning("Failed to serialize root signature: %s", qPrintable(msg));
- return;
- }
- if (FAILED(device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(),
- IID_PPV_ARGS(&cachedRootSig->rootSig)))) {
- qWarning("Failed to create root signature");
- return;
- }
-
- rootSigCache.insert(pipelineState.shaders.rootSig, cachedRootSig);
- }
-
- PSOCacheEntry *cachedPso = psoCache[pipelineState];
- if (!cachedPso) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("NEW PSO");
-
- cachedPso = new PSOCacheEntry;
-
- D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
-
- D3D12_INPUT_ELEMENT_DESC inputElements[QSGD3D12_MAX_INPUT_ELEMENTS];
- int ieIdx = 0;
- for (int i = 0; i < pipelineState.inputElementCount; ++i) {
- const QSGD3D12InputElement &ie(pipelineState.inputElements[i]);
- D3D12_INPUT_ELEMENT_DESC ieDesc = {};
- ieDesc.SemanticName = ie.semanticName;
- ieDesc.SemanticIndex = ie.semanticIndex;
- ieDesc.Format = DXGI_FORMAT(ie.format);
- ieDesc.InputSlot = ie.slot;
- ieDesc.AlignedByteOffset = ie.offset;
- ieDesc.InputSlotClass = D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
- if (Q_UNLIKELY(debug_render()))
- qDebug("input [%d]: %s %d 0x%x %d", ieIdx, ie.semanticName, ie.offset, ie.format, ie.slot);
- inputElements[ieIdx++] = ieDesc;
- }
-
- psoDesc.InputLayout = { inputElements, UINT(ieIdx) };
-
- psoDesc.pRootSignature = cachedRootSig->rootSig.Get();
-
- D3D12_SHADER_BYTECODE vshader;
- vshader.pShaderBytecode = pipelineState.shaders.vs;
- vshader.BytecodeLength = pipelineState.shaders.vsSize;
- D3D12_SHADER_BYTECODE pshader;
- pshader.pShaderBytecode = pipelineState.shaders.ps;
- pshader.BytecodeLength = pipelineState.shaders.psSize;
-
- psoDesc.VS = vshader;
- psoDesc.PS = pshader;
-
- D3D12_RASTERIZER_DESC rastDesc = {};
- rastDesc.FillMode = D3D12_FILL_MODE_SOLID;
- rastDesc.CullMode = D3D12_CULL_MODE(pipelineState.cullMode);
- rastDesc.FrontCounterClockwise = pipelineState.frontCCW;
- rastDesc.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
- rastDesc.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
- rastDesc.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
- rastDesc.DepthClipEnable = TRUE;
-
- psoDesc.RasterizerState = rastDesc;
-
- D3D12_BLEND_DESC blendDesc = {};
- if (pipelineState.blend == QSGD3D12PipelineState::BlendNone) {
- D3D12_RENDER_TARGET_BLEND_DESC noBlendDesc = {};
- noBlendDesc.RenderTargetWriteMask = pipelineState.colorWrite ? D3D12_COLOR_WRITE_ENABLE_ALL : 0;
- blendDesc.RenderTarget[0] = noBlendDesc;
- } else if (pipelineState.blend == QSGD3D12PipelineState::BlendPremul) {
- const D3D12_RENDER_TARGET_BLEND_DESC premulBlendDesc = {
- TRUE, FALSE,
- D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD,
- D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD,
- D3D12_LOGIC_OP_NOOP,
- UINT8(pipelineState.colorWrite ? D3D12_COLOR_WRITE_ENABLE_ALL : 0)
- };
- blendDesc.RenderTarget[0] = premulBlendDesc;
- } else if (pipelineState.blend == QSGD3D12PipelineState::BlendColor) {
- const D3D12_RENDER_TARGET_BLEND_DESC colorBlendDesc = {
- TRUE, FALSE,
- D3D12_BLEND_BLEND_FACTOR, D3D12_BLEND_INV_SRC_COLOR, D3D12_BLEND_OP_ADD,
- D3D12_BLEND_BLEND_FACTOR, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD,
- D3D12_LOGIC_OP_NOOP,
- UINT8(pipelineState.colorWrite ? D3D12_COLOR_WRITE_ENABLE_ALL : 0)
- };
- blendDesc.RenderTarget[0] = colorBlendDesc;
- }
- psoDesc.BlendState = blendDesc;
-
- psoDesc.DepthStencilState.DepthEnable = pipelineState.depthEnable;
- psoDesc.DepthStencilState.DepthWriteMask = pipelineState.depthWrite ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
- psoDesc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC(pipelineState.depthFunc);
-
- psoDesc.DepthStencilState.StencilEnable = pipelineState.stencilEnable;
- psoDesc.DepthStencilState.StencilReadMask = psoDesc.DepthStencilState.StencilWriteMask = 0xFF;
- D3D12_DEPTH_STENCILOP_DESC stencilOpDesc = {
- D3D12_STENCIL_OP(pipelineState.stencilFailOp),
- D3D12_STENCIL_OP(pipelineState.stencilDepthFailOp),
- D3D12_STENCIL_OP(pipelineState.stencilPassOp),
- D3D12_COMPARISON_FUNC(pipelineState.stencilFunc)
- };
- psoDesc.DepthStencilState.FrontFace = psoDesc.DepthStencilState.BackFace = stencilOpDesc;
-
- psoDesc.SampleMask = UINT_MAX;
- psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE(pipelineState.topologyType);
- psoDesc.NumRenderTargets = 1;
- psoDesc.RTVFormats[0] = RT_COLOR_FORMAT;
- psoDesc.DSVFormat = DXGI_FORMAT_D24_UNORM_S8_UINT;
- psoDesc.SampleDesc = defaultRT[0]->GetDesc().SampleDesc;
-
- HRESULT hr = device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&cachedPso->pso));
- if (FAILED(hr)) {
- qWarning("Failed to create graphics pipeline state: %s",
- qPrintable(comErrorMessage(hr)));
- return;
- }
-
- psoCache.insert(pipelineState, cachedPso);
- }
-
- if (cachedPso->pso.Get() != tframeData.lastPso) {
- tframeData.lastPso = cachedPso->pso.Get();
- commandList->SetPipelineState(tframeData.lastPso);
- }
-
- if (cachedRootSig->rootSig.Get() != tframeData.lastRootSig) {
- tframeData.lastRootSig = cachedRootSig->rootSig.Get();
- commandList->SetGraphicsRootSignature(tframeData.lastRootSig);
- }
-
- if (pipelineState.shaders.rootSig.textureViewCount > 0)
- setDescriptorHeaps();
-}
-
-void QSGD3D12EnginePrivate::setDescriptorHeaps(bool force)
-{
- if (force || !tframeData.descHeapSet) {
- tframeData.descHeapSet = true;
- ID3D12DescriptorHeap *heaps[] = { pframeData[currentPFrameIndex].gpuCbvSrvUavHeap.Get() };
- commandList->SetDescriptorHeaps(_countof(heaps), heaps);
- }
-}
-
-void QSGD3D12EnginePrivate::queueViewport(const QRect &rect)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- tframeData.viewport = rect;
- const D3D12_VIEWPORT viewport = { float(rect.x()), float(rect.y()), float(rect.width()), float(rect.height()), 0, 1 };
- commandList->RSSetViewports(1, &viewport);
-}
-
-void QSGD3D12EnginePrivate::queueScissor(const QRect &rect)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- tframeData.scissor = rect;
- const D3D12_RECT scissorRect = { rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height() };
- commandList->RSSetScissorRects(1, &scissorRect);
-}
-
-void QSGD3D12EnginePrivate::queueSetRenderTarget(uint id)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle;
- D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle;
-
- if (!id) {
- rtvHandle = defaultRTV[presentFrameIndex % swapChainBufferCount];
- dsvHandle = defaultDSV;
- } else {
- const int idx = id - 1;
- Q_ASSERT(idx < renderTargets.count() && renderTargets[idx].entryInUse());
- RenderTarget &rt(renderTargets[idx]);
- rtvHandle = rt.rtv;
- dsvHandle = rt.dsv;
- if (!(rt.flags & RenderTarget::NeedsReadBarrier)) {
- rt.flags |= RenderTarget::NeedsReadBarrier;
- if (!(rt.flags & RenderTarget::Multisample))
- transitionResource(rt.color.Get(), commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
- D3D12_RESOURCE_STATE_RENDER_TARGET);
- }
- }
-
- commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, &dsvHandle);
-
- currentRenderTarget = id;
-}
-
-void QSGD3D12EnginePrivate::queueClearRenderTarget(const QColor &color)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- const float clearColor[] = { float(color.redF()), float(color.blueF()), float(color.greenF()), float(color.alphaF()) };
- D3D12_CPU_DESCRIPTOR_HANDLE rtv = !currentRenderTarget
- ? defaultRTV[presentFrameIndex % swapChainBufferCount]
- : renderTargets[currentRenderTarget - 1].rtv;
- commandList->ClearRenderTargetView(rtv, clearColor, 0, nullptr);
-}
-
-void QSGD3D12EnginePrivate::queueClearDepthStencil(float depthValue, quint8 stencilValue, QSGD3D12Engine::ClearFlags which)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- D3D12_CPU_DESCRIPTOR_HANDLE dsv = !currentRenderTarget
- ? defaultDSV
- : renderTargets[currentRenderTarget - 1].dsv;
- commandList->ClearDepthStencilView(dsv, D3D12_CLEAR_FLAGS(int(which)), depthValue, stencilValue, 0, nullptr);
-}
-
-void QSGD3D12EnginePrivate::queueSetBlendFactor(const QVector4D &factor)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- tframeData.blendFactor = factor;
- const float f[4] = { factor.x(), factor.y(), factor.z(), factor.w() };
- commandList->OMSetBlendFactor(f);
-}
-
-void QSGD3D12EnginePrivate::queueSetStencilRef(quint32 ref)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- tframeData.stencilRef = ref;
- commandList->OMSetStencilRef(ref);
-}
-
-void QSGD3D12EnginePrivate::queueDraw(const QSGD3D12Engine::DrawParams &params)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- const bool skip = tframeData.scissor.isEmpty();
-
- PersistentFrameData &pfd(pframeData[currentPFrameIndex]);
-
- pfd.buffersUsedInDrawCallSet.insert(params.vertexBuf);
- const int vertexBufIdx = params.vertexBuf - 1;
- Q_ASSERT(params.vertexBuf && vertexBufIdx < buffers.count() && buffers[vertexBufIdx].entryInUse());
- pfd.buffersUsedInDrawCallSet.insert(params.constantBuf);
- const int constantBufIdx = params.constantBuf - 1;
- Q_ASSERT(params.constantBuf && constantBufIdx < buffers.count() && buffers[constantBufIdx].entryInUse());
- int indexBufIdx = -1;
- if (params.indexBuf) {
- pfd.buffersUsedInDrawCallSet.insert(params.indexBuf);
- indexBufIdx = params.indexBuf - 1;
- Q_ASSERT(indexBufIdx < buffers.count() && buffers[indexBufIdx].entryInUse());
- }
-
- // Ensure buffers are created but do not copy the data here, leave that to endDrawCalls().
- ensureBuffer(&buffers[vertexBufIdx]);
- ensureBuffer(&buffers[constantBufIdx]);
- if (indexBufIdx >= 0)
- ensureBuffer(&buffers[indexBufIdx]);
-
- // Set the CBV.
- if (!skip && params.cboOffset >= 0) {
- ID3D12Resource *cbuf = buffers[constantBufIdx].d[currentPFrameIndex].buffer.Get();
- if (cbuf)
- commandList->SetGraphicsRootConstantBufferView(0, cbuf->GetGPUVirtualAddress() + params.cboOffset);
- }
-
- // Set up vertex and index buffers.
- ID3D12Resource *vbuf = buffers[vertexBufIdx].d[currentPFrameIndex].buffer.Get();
- ID3D12Resource *ibuf = indexBufIdx >= 0 && params.startIndexIndex >= 0
- ? buffers[indexBufIdx].d[currentPFrameIndex].buffer.Get() : nullptr;
-
- if (!skip && params.mode != tframeData.drawingMode) {
- D3D_PRIMITIVE_TOPOLOGY topology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
- switch (params.mode) {
- case QSGGeometry::DrawPoints:
- topology = D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
- break;
- case QSGGeometry::DrawLines:
- topology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
- break;
- case QSGGeometry::DrawLineStrip:
- topology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- break;
- case QSGGeometry::DrawTriangles:
- topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- break;
- case QSGGeometry::DrawTriangleStrip:
- topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
- break;
- default:
- qFatal("Unsupported drawing mode 0x%x", params.mode);
- break;
- }
- commandList->IASetPrimitiveTopology(topology);
- tframeData.drawingMode = params.mode;
- }
-
- if (!skip) {
- D3D12_VERTEX_BUFFER_VIEW vbv;
- vbv.BufferLocation = vbuf->GetGPUVirtualAddress() + params.vboOffset;
- vbv.SizeInBytes = params.vboSize;
- vbv.StrideInBytes = params.vboStride;
-
- // must be set after the topology
- commandList->IASetVertexBuffers(0, 1, &vbv);
- }
-
- if (!skip && params.startIndexIndex >= 0 && ibuf && tframeData.currentIndexBuffer != params.indexBuf) {
- tframeData.currentIndexBuffer = params.indexBuf;
- D3D12_INDEX_BUFFER_VIEW ibv;
- ibv.BufferLocation = ibuf->GetGPUVirtualAddress();
- ibv.SizeInBytes = buffers[indexBufIdx].cpuDataRef.size;
- ibv.Format = DXGI_FORMAT(params.indexFormat);
- commandList->IASetIndexBuffer(&ibv);
- }
-
- // Copy the SRVs to a drawcall-dedicated area of the shader-visible descriptor heap.
- Q_ASSERT(tframeData.activeTextureCount == tframeData.pipelineState.shaders.rootSig.textureViewCount);
- if (tframeData.activeTextureCount > 0) {
- if (!skip) {
- ensureGPUDescriptorHeap(tframeData.activeTextureCount);
- const uint stride = cpuDescHeapManager.handleSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- D3D12_CPU_DESCRIPTOR_HANDLE dst = pfd.gpuCbvSrvUavHeap->GetCPUDescriptorHandleForHeapStart();
- dst.ptr += pfd.cbvSrvUavNextFreeDescriptorIndex * stride;
- for (int i = 0; i < tframeData.activeTextureCount; ++i) {
- const TransientFrameData::ActiveTexture &t(tframeData.activeTextures[i]);
- Q_ASSERT(t.id);
- const int idx = t.id - 1;
- const bool isTex = t.type == TransientFrameData::ActiveTexture::TypeTexture;
- device->CopyDescriptorsSimple(1, dst, isTex ? textures[idx].srv : renderTargets[idx].srv,
- D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- dst.ptr += stride;
- }
-
- D3D12_GPU_DESCRIPTOR_HANDLE gpuAddr = pfd.gpuCbvSrvUavHeap->GetGPUDescriptorHandleForHeapStart();
- gpuAddr.ptr += pfd.cbvSrvUavNextFreeDescriptorIndex * stride;
- commandList->SetGraphicsRootDescriptorTable(1, gpuAddr);
-
- pfd.cbvSrvUavNextFreeDescriptorIndex += tframeData.activeTextureCount;
- }
- tframeData.activeTextureCount = 0;
- }
-
- // Add the draw call.
- if (!skip) {
- ++tframeData.drawCount;
- if (params.startIndexIndex >= 0)
- commandList->DrawIndexedInstanced(params.count, 1, params.startIndexIndex, 0, 0);
- else
- commandList->DrawInstanced(params.count, 1, 0, 0);
- }
-
- if (tframeData.drawCount == MAX_DRAW_CALLS_PER_LIST) {
- if (Q_UNLIKELY(debug_render()))
- qDebug("Limit of %d draw calls reached, executing command list", MAX_DRAW_CALLS_PER_LIST);
- // submit the command list
- endDrawCalls();
- // start a new one
- beginDrawCalls();
- // prepare for the upcoming drawcalls
- restoreFrameState();
- }
-}
-
-void QSGD3D12EnginePrivate::ensureGPUDescriptorHeap(int cbvSrvUavDescriptorCount)
-{
- PersistentFrameData &pfd(pframeData[currentPFrameIndex]);
- int newSize = pfd.gpuCbvSrvUavHeapSize;
- while (pfd.cbvSrvUavNextFreeDescriptorIndex + cbvSrvUavDescriptorCount > newSize)
- newSize *= 2;
- if (newSize != pfd.gpuCbvSrvUavHeapSize) {
- if (Q_UNLIKELY(debug_descheap()))
- qDebug("Out of space for SRVs, creating new CBV-SRV-UAV descriptor heap with descriptor count %d", newSize);
- deferredDelete(pfd.gpuCbvSrvUavHeap);
- createCbvSrvUavHeap(currentPFrameIndex, newSize);
- setDescriptorHeaps(true);
- pfd.cbvSrvUavNextFreeDescriptorIndex = 0;
- }
-}
-
-void QSGD3D12EnginePrivate::present()
-{
- if (!initialized)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("--- present with vsync ---");
-
- // This call will not block the CPU unless at least 3 buffers are queued,
- // unless the waitable frame latency event is enabled. Then the latency of
- // 3 is changed to whatever value desired, and blocking happens in
- // beginFrame. If none of these hold, the fence-based wait in beginFrame
- // throttles. Vsync (interval 1) is always enabled.
- HRESULT hr = swapChain->Present(1, 0);
- if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
- deviceManager()->deviceLossDetected();
- return;
- } else if (FAILED(hr)) {
- qWarning("Present failed: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
-
-#ifndef Q_OS_WINRT
- if (dcompDevice)
- dcompDevice->Commit();
-#endif
-
- ++presentFrameIndex;
-}
-
-void QSGD3D12EnginePrivate::waitGPU()
-{
- if (!initialized)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("--- blocking wait for GPU ---");
-
- waitForGPU(presentFence);
-}
-
-template<class T> uint newId(T *tbl)
-{
- uint id = 0;
- for (int i = 0; i < tbl->count(); ++i) {
- if (!(*tbl)[i].entryInUse()) {
- id = i + 1;
- break;
- }
- }
-
- if (!id) {
- tbl->resize(tbl->size() + 1);
- id = tbl->count();
- }
-
- (*tbl)[id - 1].flags = 0x01; // reset flags and set EntryInUse
-
- return id;
-}
-
-template<class T> void syncEntryFlags(T *e, int flag, bool b)
-{
- if (b)
- e->flags |= flag;
- else
- e->flags &= ~flag;
-}
-
-uint QSGD3D12EnginePrivate::genBuffer()
-{
- return newId(&buffers);
-}
-
-void QSGD3D12EnginePrivate::releaseBuffer(uint id)
-{
- if (!id || !initialized)
- return;
-
- const int idx = id - 1;
- Q_ASSERT(idx < buffers.count());
-
- if (Q_UNLIKELY(debug_buffer()))
- qDebug("releasing buffer %u", id);
-
- Buffer &b(buffers[idx]);
- if (!b.entryInUse())
- return;
-
- // Do not null out and do not mark the entry reusable yet.
- // Do that only when the frames potentially in flight have finished for sure.
-
- for (int i = 0; i < frameInFlightCount; ++i) {
- if (b.d[i].buffer)
- deferredDelete(b.d[i].buffer);
- }
-
- QSet<PersistentFrameData::PendingRelease> *pendingReleasesSet = inFrame
- ? &pframeData[currentPFrameIndex].pendingReleases
- : &pframeData[(currentPFrameIndex + 1) % frameInFlightCount].outOfFramePendingReleases;
-
- pendingReleasesSet->insert(PersistentFrameData::PendingRelease(PersistentFrameData::PendingRelease::TypeBuffer, id));
-}
-
-void QSGD3D12EnginePrivate::resetBuffer(uint id, const quint8 *data, int size)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < buffers.count() && buffers[idx].entryInUse());
- Buffer &b(buffers[idx]);
-
- if (Q_UNLIKELY(debug_buffer()))
- qDebug("reset buffer %u, size %d", id, size);
-
- b.cpuDataRef.p = data;
- b.cpuDataRef.size = size;
-
- b.cpuDataRef.dirty.clear();
- b.d[currentPFrameIndex].dirty.clear();
-
- if (size > 0) {
- const QPair<int, int> range = qMakePair(0, size);
- b.cpuDataRef.dirty.append(range);
- b.d[currentPFrameIndex].dirty.append(range);
- }
-}
-
-void QSGD3D12EnginePrivate::addDirtyRange(DirtyList *dirty, int offset, int size, int bufferSize)
-{
- // Bail out when the dirty list already spans the entire buffer.
- if (!dirty->isEmpty()) {
- if (dirty->at(0).first == 0 && dirty->at(0).second == bufferSize)
- return;
- }
-
- const QPair<int, int> range = qMakePair(offset, size);
- if (!dirty->contains(range))
- dirty->append(range);
-}
-
-void QSGD3D12EnginePrivate::markBufferDirty(uint id, int offset, int size)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < buffers.count() && buffers[idx].entryInUse());
- Buffer &b(buffers[idx]);
-
- addDirtyRange(&b.cpuDataRef.dirty, offset, size, b.cpuDataRef.size);
- addDirtyRange(&b.d[currentPFrameIndex].dirty, offset, size, b.cpuDataRef.size);
-}
-
-uint QSGD3D12EnginePrivate::genTexture()
-{
- const uint id = newId(&textures);
- textures[id - 1].fenceValue = 0;
- return id;
-}
-
-static inline DXGI_FORMAT textureFormat(QImage::Format format, bool wantsAlpha, bool mipmap, bool force32bit,
- QImage::Format *imageFormat, int *bytesPerPixel)
-{
- DXGI_FORMAT f = DXGI_FORMAT_R8G8B8A8_UNORM;
- QImage::Format convFormat = format;
- int bpp = 4;
-
- if (!mipmap) {
- switch (format) {
- case QImage::Format_Grayscale8:
- case QImage::Format_Indexed8:
- case QImage::Format_Alpha8:
- if (!force32bit) {
- f = DXGI_FORMAT_R8_UNORM;
- bpp = 1;
- } else {
- convFormat = QImage::Format_RGBA8888;
- }
- break;
- case QImage::Format_RGB32:
- f = DXGI_FORMAT_B8G8R8A8_UNORM;
- break;
- case QImage::Format_ARGB32:
- f = DXGI_FORMAT_B8G8R8A8_UNORM;
- convFormat = wantsAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- break;
- case QImage::Format_ARGB32_Premultiplied:
- f = DXGI_FORMAT_B8G8R8A8_UNORM;
- convFormat = wantsAlpha ? format : QImage::Format_RGB32;
- break;
- default:
- convFormat = wantsAlpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888;
- break;
- }
- } else {
- // Mipmap generation needs unordered access and BGRA is not an option for that. Stick to RGBA.
- convFormat = wantsAlpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888;
- }
-
- if (imageFormat)
- *imageFormat = convFormat;
-
- if (bytesPerPixel)
- *bytesPerPixel = bpp;
-
- return f;
-}
-
-static inline QImage::Format imageFormatForTexture(DXGI_FORMAT format)
-{
- QImage::Format f = QImage::Format_Invalid;
-
- switch (format) {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- f = QImage::Format_RGBA8888_Premultiplied;
- break;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- f = QImage::Format_ARGB32_Premultiplied;
- break;
- case DXGI_FORMAT_R8_UNORM:
- f = QImage::Format_Grayscale8;
- break;
- default:
- break;
- }
-
- return f;
-}
-
-void QSGD3D12EnginePrivate::createTexture(uint id, const QSize &size, QImage::Format format,
- QSGD3D12Engine::TextureCreateFlags createFlags)
-{
- ensureDevice();
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < textures.count() && textures[idx].entryInUse());
- Texture &t(textures[idx]);
-
- syncEntryFlags(&t, Texture::Alpha, createFlags & QSGD3D12Engine::TextureWithAlpha);
- syncEntryFlags(&t, Texture::MipMap, createFlags & QSGD3D12Engine::TextureWithMipMaps);
-
- const QSize adjustedSize = !t.mipmap() ? size : QSGD3D12Engine::mipMapAdjustedSourceSize(size);
-
- D3D12_HEAP_PROPERTIES defaultHeapProp = {};
- defaultHeapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
-
- D3D12_RESOURCE_DESC textureDesc = {};
- textureDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- textureDesc.Width = adjustedSize.width();
- textureDesc.Height = adjustedSize.height();
- textureDesc.DepthOrArraySize = 1;
- textureDesc.MipLevels = !t.mipmap() ? 1 : QSGD3D12Engine::mipMapLevels(adjustedSize);
- textureDesc.Format = textureFormat(format, t.alpha(), t.mipmap(),
- createFlags.testFlag(QSGD3D12Engine::TextureAlways32Bit),
- nullptr, nullptr);
- textureDesc.SampleDesc.Count = 1;
- textureDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
- if (t.mipmap())
- textureDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
-
- HRESULT hr = device->CreateCommittedResource(&defaultHeapProp, D3D12_HEAP_FLAG_NONE, &textureDesc,
- D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&t.texture));
- if (FAILED(hr)) {
- qWarning("Failed to create texture resource: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
-
- t.srv = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
-
- D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
- srvDesc.Format = textureDesc.Format;
- srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = textureDesc.MipLevels;
-
- device->CreateShaderResourceView(t.texture.Get(), &srvDesc, t.srv);
-
- if (t.mipmap()) {
- // Mipmap generation will need an UAV for each level that needs to be generated.
- t.mipUAVs.clear();
- for (int level = 1; level < textureDesc.MipLevels; ++level) {
- D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
- uavDesc.Format = textureDesc.Format;
- uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
- uavDesc.Texture2D.MipSlice = level;
- D3D12_CPU_DESCRIPTOR_HANDLE h = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- device->CreateUnorderedAccessView(t.texture.Get(), nullptr, &uavDesc, h);
- t.mipUAVs.append(h);
- }
- }
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("created texture %u, size %dx%d, miplevels %d", id, adjustedSize.width(), adjustedSize.height(), textureDesc.MipLevels);
-}
-
-void QSGD3D12EnginePrivate::queueTextureResize(uint id, const QSize &size)
-{
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < textures.count() && textures[idx].entryInUse());
- Texture &t(textures[idx]);
-
- if (!t.texture) {
- qWarning("Cannot resize non-created texture %u", id);
- return;
- }
-
- if (t.mipmap()) {
- qWarning("Cannot resize mipmapped texture %u", id);
- return;
- }
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("resizing texture %u, size %dx%d", id, size.width(), size.height());
-
- D3D12_RESOURCE_DESC textureDesc = t.texture->GetDesc();
- textureDesc.Width = size.width();
- textureDesc.Height = size.height();
-
- D3D12_HEAP_PROPERTIES defaultHeapProp = {};
- defaultHeapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
-
- ComPtr<ID3D12Resource> oldTexture = t.texture;
- deferredDelete(t.texture);
-
- HRESULT hr = device->CreateCommittedResource(&defaultHeapProp, D3D12_HEAP_FLAG_NONE, &textureDesc,
- D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&t.texture));
- if (FAILED(hr)) {
- qWarning("Failed to create resized texture resource: %s",
- qPrintable(comErrorMessage(hr)));
- return;
- }
-
- deferredDelete(t.srv, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- t.srv = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
-
- D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
- srvDesc.Format = textureDesc.Format;
- srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = textureDesc.MipLevels;
-
- device->CreateShaderResourceView(t.texture.Get(), &srvDesc, t.srv);
-
- D3D12_TEXTURE_COPY_LOCATION dstLoc;
- dstLoc.pResource = t.texture.Get();
- dstLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- dstLoc.SubresourceIndex = 0;
-
- D3D12_TEXTURE_COPY_LOCATION srcLoc;
- srcLoc.pResource = oldTexture.Get();
- srcLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- srcLoc.SubresourceIndex = 0;
-
- copyCommandList->Reset(copyCommandAllocator.Get(), nullptr);
-
- copyCommandList->CopyTextureRegion(&dstLoc, 0, 0, 0, &srcLoc, nullptr);
-
- copyCommandList->Close();
- ID3D12CommandList *commandLists[] = { copyCommandList.Get() };
- copyCommandQueue->ExecuteCommandLists(_countof(commandLists), commandLists);
-
- t.fenceValue = nextTextureUploadFenceValue.fetchAndAddAcquire(1) + 1;
- copyCommandQueue->Signal(textureUploadFence.Get(), t.fenceValue);
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("submitted old content copy for texture %u on the copy queue, fence %llu", id, t.fenceValue);
-}
-
-void QSGD3D12EnginePrivate::queueTextureUpload(uint id, const QVector<QImage> &images, const QVector<QPoint> &dstPos,
- QSGD3D12Engine::TextureUploadFlags flags)
-{
- Q_ASSERT(id);
- Q_ASSERT(images.count() == dstPos.count());
- if (images.isEmpty())
- return;
-
- const int idx = id - 1;
- Q_ASSERT(idx < textures.count() && textures[idx].entryInUse());
- Texture &t(textures[idx]);
- Q_ASSERT(t.texture);
-
- // When mipmapping is not in use, image can be smaller than the size passed
- // to createTexture() and dstPos can specify a non-zero destination position.
-
- if (t.mipmap() && (images.count() != 1 || dstPos.count() != 1 || !dstPos[0].isNull())) {
- qWarning("Mipmapped textures (%u) do not support partial uploads", id);
- return;
- }
-
- // Make life simpler by disallowing queuing a new mipmapped upload before the previous one finishes.
- if (t.mipmap() && t.fenceValue) {
- qWarning("Attempted to queue mipmapped texture upload (%u) while a previous upload is still in progress", id);
- return;
- }
-
- t.fenceValue = nextTextureUploadFenceValue.fetchAndAddAcquire(1) + 1;
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("adding upload for texture %u on the copy queue, fence %llu", id, t.fenceValue);
-
- D3D12_RESOURCE_DESC textureDesc = t.texture->GetDesc();
- const QSize adjustedTextureSize(textureDesc.Width, textureDesc.Height);
-
- int totalSize = 0;
- for (const QImage &image : images) {
- int bytesPerPixel;
- textureFormat(image.format(), t.alpha(), t.mipmap(),
- flags.testFlag(QSGD3D12Engine::TextureUploadAlways32Bit),
- nullptr, &bytesPerPixel);
- const int w = !t.mipmap() ? image.width() : adjustedTextureSize.width();
- const int h = !t.mipmap() ? image.height() : adjustedTextureSize.height();
- const int stride = alignedSize(w * bytesPerPixel, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
- totalSize += alignedSize(h * stride, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
- }
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("%d sub-uploads, heap size %d bytes", images.count(), totalSize);
-
- // Instead of individual committed resources for each upload buffer,
- // allocate only once and use placed resources.
- D3D12_HEAP_PROPERTIES uploadHeapProp = {};
- uploadHeapProp.Type = D3D12_HEAP_TYPE_UPLOAD;
- D3D12_HEAP_DESC uploadHeapDesc = {};
- uploadHeapDesc.SizeInBytes = totalSize;
- uploadHeapDesc.Properties = uploadHeapProp;
- uploadHeapDesc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
-
- Texture::StagingHeap sheap;
- if (FAILED(device->CreateHeap(&uploadHeapDesc, IID_PPV_ARGS(&sheap.heap)))) {
- qWarning("Failed to create texture upload heap of size %d", totalSize);
- return;
- }
- t.stagingHeaps.append(sheap);
-
- copyCommandList->Reset(copyCommandAllocator.Get(), nullptr);
-
- int placedOffset = 0;
- for (int i = 0; i < images.count(); ++i) {
- QImage::Format convFormat;
- int bytesPerPixel;
- textureFormat(images[i].format(), t.alpha(), t.mipmap(),
- flags.testFlag(QSGD3D12Engine::TextureUploadAlways32Bit),
- &convFormat, &bytesPerPixel);
- if (Q_UNLIKELY(debug_texture() && i == 0))
- qDebug("source image format %d, target format %d, bpp %d", images[i].format(), convFormat, bytesPerPixel);
-
- QImage convImage = images[i].format() == convFormat ? images[i] : images[i].convertToFormat(convFormat);
-
- if (t.mipmap() && adjustedTextureSize != convImage.size())
- convImage = convImage.scaled(adjustedTextureSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
- const int stride = alignedSize(convImage.width() * bytesPerPixel, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
-
- D3D12_RESOURCE_DESC bufDesc = {};
- bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- bufDesc.Width = stride * convImage.height();
- bufDesc.Height = 1;
- bufDesc.DepthOrArraySize = 1;
- bufDesc.MipLevels = 1;
- bufDesc.Format = DXGI_FORMAT_UNKNOWN;
- bufDesc.SampleDesc.Count = 1;
- bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
-
- Texture::StagingBuffer sbuf;
- if (FAILED(device->CreatePlacedResource(sheap.heap.Get(), placedOffset,
- &bufDesc, D3D12_RESOURCE_STATE_GENERIC_READ,
- nullptr, IID_PPV_ARGS(&sbuf.buffer)))) {
- qWarning("Failed to create texture upload buffer");
- return;
- }
-
- quint8 *p = nullptr;
- const D3D12_RANGE readRange = { 0, 0 };
- if (FAILED(sbuf.buffer->Map(0, &readRange, reinterpret_cast<void **>(&p)))) {
- qWarning("Map failed (texture upload buffer)");
- return;
- }
- for (int y = 0, ye = convImage.height(); y < ye; ++y) {
- memcpy(p, convImage.constScanLine(y), convImage.width() * bytesPerPixel);
- p += stride;
- }
- sbuf.buffer->Unmap(0, nullptr);
-
- D3D12_TEXTURE_COPY_LOCATION dstLoc;
- dstLoc.pResource = t.texture.Get();
- dstLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- dstLoc.SubresourceIndex = 0;
-
- D3D12_TEXTURE_COPY_LOCATION srcLoc;
- srcLoc.pResource = sbuf.buffer.Get();
- srcLoc.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
- srcLoc.PlacedFootprint.Offset = 0;
- srcLoc.PlacedFootprint.Footprint.Format = textureDesc.Format;
- srcLoc.PlacedFootprint.Footprint.Width = convImage.width();
- srcLoc.PlacedFootprint.Footprint.Height = convImage.height();
- srcLoc.PlacedFootprint.Footprint.Depth = 1;
- srcLoc.PlacedFootprint.Footprint.RowPitch = stride;
-
- copyCommandList->CopyTextureRegion(&dstLoc, dstPos[i].x(), dstPos[i].y(), 0, &srcLoc, nullptr);
-
- t.stagingBuffers.append(sbuf);
- placedOffset += alignedSize(bufDesc.Width, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
- }
-
- copyCommandList->Close();
- ID3D12CommandList *commandLists[] = { copyCommandList.Get() };
- copyCommandQueue->ExecuteCommandLists(_countof(commandLists), commandLists);
- copyCommandQueue->Signal(textureUploadFence.Get(), t.fenceValue);
-}
-
-void QSGD3D12EnginePrivate::releaseTexture(uint id)
-{
- if (!id || !initialized)
- return;
-
- const int idx = id - 1;
- Q_ASSERT(idx < textures.count());
-
- if (Q_UNLIKELY(debug_texture()))
- qDebug("releasing texture %d", id);
-
- Texture &t(textures[idx]);
- if (!t.entryInUse())
- return;
-
- if (t.texture) {
- deferredDelete(t.texture);
- deferredDelete(t.srv, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- for (D3D12_CPU_DESCRIPTOR_HANDLE h : t.mipUAVs)
- deferredDelete(h, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- }
-
- QSet<PersistentFrameData::PendingRelease> *pendingReleasesSet = inFrame
- ? &pframeData[currentPFrameIndex].pendingReleases
- : &pframeData[(currentPFrameIndex + 1) % frameInFlightCount].outOfFramePendingReleases;
-
- pendingReleasesSet->insert(PersistentFrameData::PendingRelease(PersistentFrameData::PendingRelease::TypeTexture, id));
-}
-
-void QSGD3D12EnginePrivate::useTexture(uint id)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < textures.count() && textures[idx].entryInUse());
-
- // Within one frame the order of calling this function determines the
- // texture register (0, 1, ...) so fill up activeTextures accordingly.
- tframeData.activeTextures[tframeData.activeTextureCount++]
- = TransientFrameData::ActiveTexture(TransientFrameData::ActiveTexture::TypeTexture, id);
-
- if (textures[idx].fenceValue)
- pframeData[currentPFrameIndex].pendingTextureUploads.insert(id);
-}
-
-bool QSGD3D12EnginePrivate::MipMapGen::initialize(QSGD3D12EnginePrivate *enginePriv)
-{
- engine = enginePriv;
-
- D3D12_STATIC_SAMPLER_DESC sampler = {};
- sampler.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
- sampler.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
- sampler.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
- sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
- sampler.MinLOD = 0.0f;
- sampler.MaxLOD = D3D12_FLOAT32_MAX;
-
- D3D12_DESCRIPTOR_RANGE descRange[2];
- descRange[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
- descRange[0].NumDescriptors = 1;
- descRange[0].BaseShaderRegister = 0; // t0
- descRange[0].RegisterSpace = 0;
- descRange[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
- descRange[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
- descRange[1].NumDescriptors = 4;
- descRange[1].BaseShaderRegister = 0; // u0..u3
- descRange[1].RegisterSpace = 0;
- descRange[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
-
- // Split into two to allow switching between the first and second set of UAVs later.
- D3D12_ROOT_PARAMETER rootParameters[3];
- rootParameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- rootParameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- rootParameters[0].DescriptorTable.NumDescriptorRanges = 1;
- rootParameters[0].DescriptorTable.pDescriptorRanges = &descRange[0];
-
- rootParameters[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- rootParameters[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- rootParameters[1].DescriptorTable.NumDescriptorRanges = 1;
- rootParameters[1].DescriptorTable.pDescriptorRanges = &descRange[1];
-
- rootParameters[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
- rootParameters[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- rootParameters[2].Constants.Num32BitValues = 4; // uint2 mip1Size, uint sampleLevel, uint totalMips
- rootParameters[2].Constants.ShaderRegister = 0; // b0
- rootParameters[2].Constants.RegisterSpace = 0;
-
- D3D12_ROOT_SIGNATURE_DESC desc = {};
- desc.NumParameters = 3;
- desc.pParameters = rootParameters;
- desc.NumStaticSamplers = 1;
- desc.pStaticSamplers = &sampler;
-
- ComPtr<ID3DBlob> signature;
- ComPtr<ID3DBlob> error;
- if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error))) {
- QByteArray msg(static_cast<const char *>(error->GetBufferPointer()), error->GetBufferSize());
- qWarning("Failed to serialize compute root signature: %s", qPrintable(msg));
- return false;
- }
- if (FAILED(engine->device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(),
- IID_PPV_ARGS(&rootSig)))) {
- qWarning("Failed to create compute root signature");
- return false;
- }
-
- D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};
- psoDesc.pRootSignature = rootSig.Get();
- psoDesc.CS.pShaderBytecode = g_CS_Generate4MipMaps;
- psoDesc.CS.BytecodeLength = sizeof(g_CS_Generate4MipMaps);
-
- if (FAILED(engine->device->CreateComputePipelineState(&psoDesc, IID_PPV_ARGS(&pipelineState)))) {
- qWarning("Failed to create compute pipeline state");
- return false;
- }
-
- return true;
-}
-
-void QSGD3D12EnginePrivate::MipMapGen::releaseResources()
-{
- pipelineState = nullptr;
- rootSig = nullptr;
-}
-
-// The mipmap generator is used to insert commands on the main 3D queue. It is
-// guaranteed that the queue has a wait for the base texture level upload
-// before invoking queueGenerate(). There can be any number of invocations
-// without waiting for earlier ones to finish. finished() is invoked when it is
-// known for sure that frame containing the upload and mipmap generation has
-// finished on the GPU.
-
-void QSGD3D12EnginePrivate::MipMapGen::queueGenerate(const Texture &t)
-{
- D3D12_RESOURCE_DESC textureDesc = t.texture->GetDesc();
-
- engine->commandList->SetPipelineState(pipelineState.Get());
- engine->commandList->SetComputeRootSignature(rootSig.Get());
-
- // 1 SRV + (miplevels - 1) UAVs
- const int descriptorCount = 1 + (textureDesc.MipLevels - 1);
-
- engine->ensureGPUDescriptorHeap(descriptorCount);
-
- // The descriptor heap is set on the command list either because the
- // ensure() call above resized, or, typically, due to a texture-dependent
- // draw call earlier.
-
- engine->transitionResource(t.texture.Get(), engine->commandList,
- D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
-
- QSGD3D12EnginePrivate::PersistentFrameData &pfd(engine->pframeData[engine->currentPFrameIndex]);
-
- const uint stride = engine->cpuDescHeapManager.handleSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- D3D12_CPU_DESCRIPTOR_HANDLE h = pfd.gpuCbvSrvUavHeap->GetCPUDescriptorHandleForHeapStart();
- h.ptr += pfd.cbvSrvUavNextFreeDescriptorIndex * stride;
-
- engine->device->CopyDescriptorsSimple(1, h, t.srv, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- h.ptr += stride;
-
- for (int level = 1; level < textureDesc.MipLevels; ++level, h.ptr += stride)
- engine->device->CopyDescriptorsSimple(1, h, t.mipUAVs[level - 1], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
-
- D3D12_GPU_DESCRIPTOR_HANDLE gpuAddr = pfd.gpuCbvSrvUavHeap->GetGPUDescriptorHandleForHeapStart();
- gpuAddr.ptr += pfd.cbvSrvUavNextFreeDescriptorIndex * stride;
-
- engine->commandList->SetComputeRootDescriptorTable(0, gpuAddr);
- gpuAddr.ptr += stride; // now points to the first UAV
-
- for (int level = 1; level < textureDesc.MipLevels; level += 4, gpuAddr.ptr += stride * 4) {
- engine->commandList->SetComputeRootDescriptorTable(1, gpuAddr);
-
- QSize sz(textureDesc.Width, textureDesc.Height);
- sz.setWidth(qMax(1, sz.width() >> level));
- sz.setHeight(qMax(1, sz.height() >> level));
-
- const quint32 constants[4] = { quint32(sz.width()), quint32(sz.height()),
- quint32(level - 1),
- quint32(textureDesc.MipLevels - 1) };
-
- engine->commandList->SetComputeRoot32BitConstants(2, 4, constants, 0);
- engine->commandList->Dispatch(sz.width(), sz.height(), 1);
- engine->uavBarrier(t.texture.Get(), engine->commandList);
- }
-
- engine->transitionResource(t.texture.Get(), engine->commandList,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
-
- pfd.cbvSrvUavNextFreeDescriptorIndex += descriptorCount;
-}
-
-void QSGD3D12EnginePrivate::deferredDelete(ComPtr<ID3D12Resource> res)
-{
- PersistentFrameData::DeleteQueueEntry e;
- e.res = res;
- QVector<PersistentFrameData::DeleteQueueEntry> *dq = inFrame
- ? &pframeData[currentPFrameIndex].deleteQueue
- : &pframeData[(currentPFrameIndex + 1) % frameInFlightCount].outOfFrameDeleteQueue;
- (*dq) << e;
-}
-
-void QSGD3D12EnginePrivate::deferredDelete(ComPtr<ID3D12DescriptorHeap> dh)
-{
- PersistentFrameData::DeleteQueueEntry e;
- e.descHeap = dh;
- QVector<PersistentFrameData::DeleteQueueEntry> *dq = inFrame
- ? &pframeData[currentPFrameIndex].deleteQueue
- : &pframeData[(currentPFrameIndex + 1) % frameInFlightCount].outOfFrameDeleteQueue;
- (*dq) << e;
-}
-
-void QSGD3D12EnginePrivate::deferredDelete(D3D12_CPU_DESCRIPTOR_HANDLE h, D3D12_DESCRIPTOR_HEAP_TYPE type)
-{
- PersistentFrameData::DeleteQueueEntry e;
- e.cpuDescriptorPtr = h.ptr;
- e.descHeapType = type;
- QVector<PersistentFrameData::DeleteQueueEntry> *dq = inFrame
- ? &pframeData[currentPFrameIndex].deleteQueue
- : &pframeData[(currentPFrameIndex + 1) % frameInFlightCount].outOfFrameDeleteQueue;
- (*dq) << e;
-}
-
-uint QSGD3D12EnginePrivate::genRenderTarget()
-{
- return newId(&renderTargets);
-}
-
-void QSGD3D12EnginePrivate::createRenderTarget(uint id, const QSize &size, const QVector4D &clearColor, uint samples)
-{
- ensureDevice();
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < renderTargets.count() && renderTargets[idx].entryInUse());
- RenderTarget &rt(renderTargets[idx]);
-
- rt.rtv = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
- rt.dsv = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
- rt.srv = cpuDescHeapManager.allocate(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
-
- ID3D12Resource *res = createColorBuffer(rt.rtv, size, clearColor, samples);
- if (res)
- rt.color.Attach(res);
-
- ID3D12Resource *dsres = createDepthStencil(rt.dsv, size, samples);
- if (dsres)
- rt.ds.Attach(dsres);
-
- const bool multisample = rt.color->GetDesc().SampleDesc.Count > 1;
- syncEntryFlags(&rt, RenderTarget::Multisample, multisample);
-
- if (!multisample) {
- device->CreateShaderResourceView(rt.color.Get(), nullptr, rt.srv);
- } else {
- D3D12_HEAP_PROPERTIES defaultHeapProp = {};
- defaultHeapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
-
- D3D12_RESOURCE_DESC textureDesc = {};
- textureDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- textureDesc.Width = size.width();
- textureDesc.Height = size.height();
- textureDesc.DepthOrArraySize = 1;
- textureDesc.MipLevels = 1;
- textureDesc.Format = RT_COLOR_FORMAT;
- textureDesc.SampleDesc.Count = 1;
- textureDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
-
- HRESULT hr = device->CreateCommittedResource(&defaultHeapProp, D3D12_HEAP_FLAG_NONE, &textureDesc,
- D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&rt.colorResolve));
- if (FAILED(hr)) {
- qWarning("Failed to create resolve buffer: %s",
- qPrintable(comErrorMessage(hr)));
- return;
- }
-
- device->CreateShaderResourceView(rt.colorResolve.Get(), nullptr, rt.srv);
- }
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("created new render target %u, size %dx%d, samples %d", id, size.width(), size.height(), samples);
-}
-
-void QSGD3D12EnginePrivate::releaseRenderTarget(uint id)
-{
- if (!id || !initialized)
- return;
-
- const int idx = id - 1;
- Q_ASSERT(idx < renderTargets.count());
- RenderTarget &rt(renderTargets[idx]);
- if (!rt.entryInUse())
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("releasing render target %u", id);
-
- if (rt.colorResolve) {
- deferredDelete(rt.colorResolve);
- rt.colorResolve = nullptr;
- }
- if (rt.color) {
- deferredDelete(rt.color);
- rt.color = nullptr;
- deferredDelete(rt.rtv, D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
- deferredDelete(rt.srv, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- }
- if (rt.ds) {
- deferredDelete(rt.ds);
- rt.ds = nullptr;
- deferredDelete(rt.dsv, D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
- }
-
- rt.flags &= ~RenderTarget::EntryInUse;
-}
-
-void QSGD3D12EnginePrivate::useRenderTargetAsTexture(uint id)
-{
- if (!inFrame) {
- qWarning("%s: Cannot be called outside begin/endFrame", __FUNCTION__);
- return;
- }
-
- Q_ASSERT(id);
- const int idx = id - 1;
- Q_ASSERT(idx < renderTargets.count());
- RenderTarget &rt(renderTargets[idx]);
- Q_ASSERT(rt.entryInUse() && rt.color);
-
- if (rt.flags & RenderTarget::NeedsReadBarrier) {
- rt.flags &= ~RenderTarget::NeedsReadBarrier;
- if (rt.flags & RenderTarget::Multisample)
- resolveMultisampledTarget(rt.color.Get(), rt.colorResolve.Get(), D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, commandList);
- else
- transitionResource(rt.color.Get(), commandList, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
- }
-
- tframeData.activeTextures[tframeData.activeTextureCount++] =
- TransientFrameData::ActiveTexture(TransientFrameData::ActiveTexture::TypeRenderTarget, id);
-}
-
-QImage QSGD3D12EnginePrivate::executeAndWaitReadbackRenderTarget(uint id)
-{
- // Readback due to QQuickWindow::grabWindow() happens outside
- // begin-endFrame, but QQuickItemGrabResult leads to rendering a layer
- // without a real frame afterwards and triggering readback. This has to be
- // supported as well.
- if (inFrame && (!activeLayers || currentLayerDepth)) {
- qWarning("%s: Cannot be called while frame preparation is active", __FUNCTION__);
- return QImage();
- }
-
- // Due to the above we insert a fake "real" frame when a layer was just rendered into.
- if (inFrame) {
- beginFrame();
- endFrame();
- }
-
- frameCommandList->Reset(frameCommandAllocator[frameIndex % frameInFlightCount].Get(), nullptr);
-
- D3D12_RESOURCE_STATES bstate;
- bool needsBarrier = false;
- ID3D12Resource *rtRes;
- if (id == 0) {
- const int idx = presentFrameIndex % swapChainBufferCount;
- if (windowSamples > 1) {
- resolveMultisampledTarget(defaultRT[idx].Get(), backBufferRT[idx].Get(),
- D3D12_RESOURCE_STATE_COPY_SOURCE, frameCommandList.Get());
- } else {
- bstate = D3D12_RESOURCE_STATE_PRESENT;
- needsBarrier = true;
- }
- rtRes = backBufferRT[idx].Get();
- } else {
- const int idx = id - 1;
- Q_ASSERT(idx < renderTargets.count());
- RenderTarget &rt(renderTargets[idx]);
- Q_ASSERT(rt.entryInUse() && rt.color);
-
- if (rt.flags & RenderTarget::Multisample) {
- resolveMultisampledTarget(rt.color.Get(), rt.colorResolve.Get(),
- D3D12_RESOURCE_STATE_COPY_SOURCE, frameCommandList.Get());
- rtRes = rt.colorResolve.Get();
- } else {
- rtRes = rt.color.Get();
- bstate = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
- needsBarrier = true;
- }
- }
-
- ComPtr<ID3D12Resource> readbackBuf;
-
- D3D12_RESOURCE_DESC rtDesc = rtRes->GetDesc();
- UINT64 textureByteSize = 0;
- D3D12_PLACED_SUBRESOURCE_FOOTPRINT textureLayout = {};
- device->GetCopyableFootprints(&rtDesc, 0, 1, 0, &textureLayout, nullptr, nullptr, &textureByteSize);
-
- D3D12_HEAP_PROPERTIES heapProp = {};
- heapProp.Type = D3D12_HEAP_TYPE_READBACK;
-
- D3D12_RESOURCE_DESC bufDesc = {};
- bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- bufDesc.Width = textureByteSize;
- bufDesc.Height = 1;
- bufDesc.DepthOrArraySize = 1;
- bufDesc.MipLevels = 1;
- bufDesc.Format = DXGI_FORMAT_UNKNOWN;
- bufDesc.SampleDesc.Count = 1;
- bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
-
- if (FAILED(device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc,
- D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&readbackBuf)))) {
- qWarning("Failed to create committed resource (readback buffer)");
- return QImage();
- }
-
- D3D12_TEXTURE_COPY_LOCATION dstLoc;
- dstLoc.pResource = readbackBuf.Get();
- dstLoc.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
- dstLoc.PlacedFootprint = textureLayout;
- D3D12_TEXTURE_COPY_LOCATION srcLoc;
- srcLoc.pResource = rtRes;
- srcLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- srcLoc.SubresourceIndex = 0;
-
- ID3D12GraphicsCommandList *cl = frameCommandList.Get();
- if (needsBarrier)
- transitionResource(rtRes, cl, bstate, D3D12_RESOURCE_STATE_COPY_SOURCE);
- cl->CopyTextureRegion(&dstLoc, 0, 0, 0, &srcLoc, nullptr);
- if (needsBarrier)
- transitionResource(rtRes, cl, D3D12_RESOURCE_STATE_COPY_SOURCE, bstate);
-
- cl->Close();
- ID3D12CommandList *commandLists[] = { cl };
- commandQueue->ExecuteCommandLists(_countof(commandLists), commandLists);
-
- QScopedPointer<QSGD3D12CPUWaitableFence> f(createCPUWaitableFence());
- waitForGPU(f.data()); // uh oh
-
- QImage::Format fmt = imageFormatForTexture(rtDesc.Format);
- if (fmt == QImage::Format_Invalid) {
- qWarning("Could not map render target format %d to a QImage format", rtDesc.Format);
- return QImage();
- }
- QImage img(rtDesc.Width, rtDesc.Height, fmt);
- quint8 *p = nullptr;
- const D3D12_RANGE readRange = { 0, 0 };
- if (FAILED(readbackBuf->Map(0, &readRange, reinterpret_cast<void **>(&p)))) {
- qWarning("Mapping the readback buffer failed");
- return QImage();
- }
- const int bpp = 4; // ###
- if (id == 0) {
- for (UINT y = 0; y < rtDesc.Height; ++y) {
- quint8 *dst = img.scanLine(y);
- memcpy(dst, p, rtDesc.Width * bpp);
- p += textureLayout.Footprint.RowPitch;
- }
- } else {
- for (int y = rtDesc.Height - 1; y >= 0; --y) {
- quint8 *dst = img.scanLine(y);
- memcpy(dst, p, rtDesc.Width * bpp);
- p += textureLayout.Footprint.RowPitch;
- }
- }
- readbackBuf->Unmap(0, nullptr);
-
- return img;
-}
-
-void QSGD3D12EnginePrivate::simulateDeviceLoss()
-{
- qWarning("QSGD3D12Engine: Triggering device loss via TDR");
- devLossTest.killDevice();
-}
-
-bool QSGD3D12EnginePrivate::DeviceLossTester::initialize(QSGD3D12EnginePrivate *enginePriv)
-{
- engine = enginePriv;
-
-#ifdef DEVLOSS_TEST
- D3D12_DESCRIPTOR_RANGE descRange[2];
- descRange[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV;
- descRange[0].NumDescriptors = 1;
- descRange[0].BaseShaderRegister = 0;
- descRange[0].RegisterSpace = 0;
- descRange[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
- descRange[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
- descRange[1].NumDescriptors = 1;
- descRange[1].BaseShaderRegister = 0;
- descRange[1].RegisterSpace = 0;
- descRange[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
-
- D3D12_ROOT_PARAMETER param;
- param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- param.DescriptorTable.NumDescriptorRanges = 2;
- param.DescriptorTable.pDescriptorRanges = descRange;
-
- D3D12_ROOT_SIGNATURE_DESC desc = {};
- desc.NumParameters = 1;
- desc.pParameters = &param;
-
- ComPtr<ID3DBlob> signature;
- ComPtr<ID3DBlob> error;
- if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error))) {
- QByteArray msg(static_cast<const char *>(error->GetBufferPointer()), error->GetBufferSize());
- qWarning("Failed to serialize compute root signature: %s", qPrintable(msg));
- return false;
- }
- if (FAILED(engine->device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(),
- IID_PPV_ARGS(&computeRootSignature)))) {
- qWarning("Failed to create compute root signature");
- return false;
- }
-
- D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};
- psoDesc.pRootSignature = computeRootSignature.Get();
- psoDesc.CS.pShaderBytecode = g_timeout;
- psoDesc.CS.BytecodeLength = sizeof(g_timeout);
-
- if (FAILED(engine->device->CreateComputePipelineState(&psoDesc, IID_PPV_ARGS(&computeState)))) {
- qWarning("Failed to create compute pipeline state");
- return false;
- }
-#endif
-
- return true;
-}
-
-void QSGD3D12EnginePrivate::DeviceLossTester::releaseResources()
-{
- computeState = nullptr;
- computeRootSignature = nullptr;
-}
-
-void QSGD3D12EnginePrivate::DeviceLossTester::killDevice()
-{
-#ifdef DEVLOSS_TEST
- ID3D12CommandAllocator *ca = engine->frameCommandAllocator[engine->frameIndex % engine->frameInFlightCount].Get();
- ID3D12GraphicsCommandList *cl = engine->frameCommandList.Get();
- cl->Reset(ca, computeState.Get());
-
- cl->SetComputeRootSignature(computeRootSignature.Get());
- cl->Dispatch(256, 1, 1);
-
- cl->Close();
- ID3D12CommandList *commandLists[] = { cl };
- engine->commandQueue->ExecuteCommandLists(_countof(commandLists), commandLists);
-
- engine->waitGPU();
-#endif
-}
-
-void *QSGD3D12EnginePrivate::getResource(QSGRendererInterface::Resource resource) const
-{
- switch (resource) {
- case QSGRendererInterface::DeviceResource:
- return device;
- case QSGRendererInterface::CommandQueueResource:
- return commandQueue.Get();
- case QSGRendererInterface::CommandListResource:
- return commandList;
- default:
- break;
- }
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h
deleted file mode 100644
index b30994fe0d..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12ENGINE_P_H
-#define QSGD3D12ENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QWindow>
-#include <QImage>
-#include <QVector4D>
-#include <qsggeometry.h>
-#include <qsgrendererinterface.h>
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-// No D3D or COM headers must be pulled in here. All that has to be isolated
-// to engine_p_p.h and engine.cpp.
-
-class QSGD3D12EnginePrivate;
-
-// Shader bytecode and other strings are expected to be static so that a
-// different pointer means a different shader.
-
-enum QSGD3D12Format {
- FmtUnknown = 0,
-
- FmtFloat4 = 2, // DXGI_FORMAT_R32G32B32A32_FLOAT
- FmtFloat3 = 6, // DXGI_FORMAT_R32G32B32_FLOAT
- FmtFloat2 = 16, // DXGI_FORMAT_R32G32_FLOAT
- FmtFloat = 41, // DXGI_FORMAT_R32_FLOAT
-
- // glVertexAttribPointer with GL_UNSIGNED_BYTE and normalized == true maps to the UNORM formats below
- FmtUNormByte4 = 28, // DXGI_FORMAT_R8G8B8A8_UNORM
- FmtUNormByte2 = 49, // DXGI_FORMAT_R8G8_UNORM
- FmtUNormByte = 61, // DXGI_FORMAT_R8_UNORM
-
- // Index data types
- FmtUnsignedShort = 57, // DXGI_FORMAT_R16_UINT
- FmtUnsignedInt = 42 // DXGI_FORMAT_R32_UINT
-};
-
-struct QSGD3D12InputElement
-{
- const char *semanticName = nullptr;
- int semanticIndex = 0;
- QSGD3D12Format format = FmtFloat4;
- quint32 slot = 0;
- quint32 offset = 0;
-
- bool operator==(const QSGD3D12InputElement &other) const {
- return semanticName == other.semanticName && semanticIndex == other.semanticIndex
- && format == other.format && slot == other.slot && offset == other.offset;
- }
-};
-
-inline uint qHash(const QSGD3D12InputElement &key, uint seed = 0)
-{
- return qHash(key.semanticName, seed) + key.semanticIndex + key.format + key.offset;
-}
-
-struct QSGD3D12TextureView
-{
- enum Filter {
- FilterNearest = 0,
- FilterLinear = 0x15,
- FilterMinMagNearestMipLinear = 0x1,
- FilterMinMagLinearMipNearest = 0x14
- };
-
- enum AddressMode {
- AddressWrap = 1,
- AddressClamp = 3
- };
-
- Filter filter = FilterLinear;
- AddressMode addressModeHoriz = AddressClamp;
- AddressMode addressModeVert = AddressClamp;
-
- bool operator==(const QSGD3D12TextureView &other) const {
- return filter == other.filter
- && addressModeHoriz == other.addressModeHoriz
- && addressModeVert == other.addressModeVert;
- }
-};
-
-inline uint qHash(const QSGD3D12TextureView &key, uint seed = 0)
-{
- Q_UNUSED(seed);
- return key.filter + key.addressModeHoriz + key.addressModeVert;
-}
-
-const int QSGD3D12_MAX_TEXTURE_VIEWS = 8;
-
-struct QSGD3D12RootSignature
-{
- int textureViewCount = 0;
- QSGD3D12TextureView textureViews[QSGD3D12_MAX_TEXTURE_VIEWS];
-
- bool operator==(const QSGD3D12RootSignature &other) const {
- if (textureViewCount != other.textureViewCount)
- return false;
- for (int i = 0; i < textureViewCount; ++i)
- if (!(textureViews[i] == other.textureViews[i]))
- return false;
- return true;
- }
-};
-
-inline uint qHash(const QSGD3D12RootSignature &key, uint seed = 0)
-{
- return key.textureViewCount + (key.textureViewCount > 0 ? qHash(key.textureViews[0], seed) : 0);
-}
-
-// Shader bytecode blobs and root signature-related data.
-struct QSGD3D12ShaderState
-{
- const quint8 *vs = nullptr;
- quint32 vsSize = 0;
- const quint8 *ps = nullptr;
- quint32 psSize = 0;
-
- QSGD3D12RootSignature rootSig;
-
- bool operator==(const QSGD3D12ShaderState &other) const {
- return vs == other.vs && vsSize == other.vsSize
- && ps == other.ps && psSize == other.psSize
- && rootSig == other.rootSig;
- }
-};
-
-inline uint qHash(const QSGD3D12ShaderState &key, uint seed = 0)
-{
- return qHash(key.vs, seed) + key.vsSize + qHash(key.ps, seed) + key.psSize + qHash(key.rootSig, seed);
-}
-
-const int QSGD3D12_MAX_INPUT_ELEMENTS = 8;
-
-struct QSGD3D12PipelineState
-{
- enum CullMode {
- CullNone = 1,
- CullFront,
- CullBack
- };
-
- enum CompareFunc {
- CompareNever = 1,
- CompareLess,
- CompareEqual,
- CompareLessEqual,
- CompareGreater,
- CompareNotEqual,
- CompareGreaterEqual,
- CompareAlways
- };
-
- enum StencilOp {
- StencilKeep = 1,
- StencilZero,
- StencilReplace,
- StencilIncrSat,
- StencilDecrSat,
- StencilInvert,
- StencilIncr,
- StencilDescr
- };
-
- enum TopologyType {
- TopologyTypePoint = 1,
- TopologyTypeLine,
- TopologyTypeTriangle
- };
-
- enum BlendType {
- BlendNone,
- BlendPremul, // == GL_ONE, GL_ONE_MINUS_SRC_ALPHA
- BlendColor // == GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR
- };
-
- QSGD3D12ShaderState shaders;
-
- int inputElementCount = 0;
- QSGD3D12InputElement inputElements[QSGD3D12_MAX_INPUT_ELEMENTS];
-
- CullMode cullMode = CullNone;
- bool frontCCW = true;
- bool colorWrite = true;
- BlendType blend = BlendNone;
- bool depthEnable = true;
- CompareFunc depthFunc = CompareLess;
- bool depthWrite = true;
- bool stencilEnable = false;
- CompareFunc stencilFunc = CompareEqual;
- StencilOp stencilFailOp = StencilKeep;
- StencilOp stencilDepthFailOp = StencilKeep;
- StencilOp stencilPassOp = StencilKeep;
- TopologyType topologyType = TopologyTypeTriangle;
-
- bool operator==(const QSGD3D12PipelineState &other) const {
- bool eq = shaders == other.shaders
- && inputElementCount == other.inputElementCount
- && cullMode == other.cullMode
- && frontCCW == other.frontCCW
- && colorWrite == other.colorWrite
- && blend == other.blend
- && depthEnable == other.depthEnable
- && (!depthEnable || depthFunc == other.depthFunc)
- && depthWrite == other.depthWrite
- && stencilEnable == other.stencilEnable
- && (!stencilEnable || stencilFunc == other.stencilFunc)
- && (!stencilEnable || stencilFailOp == other.stencilFailOp)
- && (!stencilEnable || stencilDepthFailOp == other.stencilDepthFailOp)
- && (!stencilEnable || stencilPassOp == other.stencilPassOp)
- && topologyType == other.topologyType;
- if (eq) {
- for (int i = 0; i < inputElementCount; ++i) {
- if (!(inputElements[i] == other.inputElements[i])) {
- eq = false;
- break;
- }
- }
- }
- return eq;
- }
-};
-
-inline uint qHash(const QSGD3D12PipelineState &key, uint seed = 0)
-{
- return qHash(key.shaders, seed) + key.inputElementCount
- + key.cullMode + key.frontCCW
- + key.colorWrite + key.blend
- + key.depthEnable + key.depthWrite
- + key.stencilEnable
- + key.topologyType;
-}
-
-class QSGD3D12Engine
-{
-public:
- QSGD3D12Engine();
- ~QSGD3D12Engine();
-
- bool attachToWindow(WId window, const QSize &size, float dpr, int surfaceFormatSamples, bool alpha);
- void releaseResources();
- bool hasResources() const;
- void setWindowSize(const QSize &size, float dpr);
- WId window() const;
- QSize windowSize() const;
- float windowDevicePixelRatio() const;
- uint windowSamples() const;
-
- void beginFrame();
- void endFrame();
- void beginLayer();
- void endLayer();
- void invalidateCachedFrameState();
- void restoreFrameState(bool minimal = false);
-
- uint genBuffer();
- void releaseBuffer(uint id);
- void resetBuffer(uint id, const quint8 *data, int size);
- void markBufferDirty(uint id, int offset, int size);
-
- enum ClearFlag {
- ClearDepth = 0x1,
- ClearStencil = 0x2
- };
- Q_DECLARE_FLAGS(ClearFlags, ClearFlag)
-
- void queueViewport(const QRect &rect);
- void queueScissor(const QRect &rect);
- void queueSetRenderTarget(uint id = 0);
- void queueClearRenderTarget(const QColor &color);
- void queueClearDepthStencil(float depthValue, quint8 stencilValue, ClearFlags which);
- void queueSetBlendFactor(const QVector4D &factor);
- void queueSetStencilRef(quint32 ref);
-
- void finalizePipeline(const QSGD3D12PipelineState &pipelineState);
-
- struct DrawParams {
- QSGGeometry::DrawingMode mode = QSGGeometry::DrawTriangles;
- int count = 0;
- uint vertexBuf = 0;
- uint indexBuf = 0;
- uint constantBuf = 0;
- int vboOffset = 0;
- int vboSize = 0;
- int vboStride = 0;
- int cboOffset = 0;
- int startIndexIndex = -1;
- QSGD3D12Format indexFormat = FmtUnsignedShort;
- };
-
- void queueDraw(const DrawParams &params);
-
- void present();
- void waitGPU();
-
- static quint32 alignedConstantBufferSize(quint32 size);
- static QSGD3D12Format toDXGIFormat(QSGGeometry::Type sgtype, int tupleSize = 1, int *size = nullptr);
- static int mipMapLevels(const QSize &size);
- static QSize mipMapAdjustedSourceSize(const QSize &size);
-
- enum TextureCreateFlag {
- TextureWithAlpha = 0x01,
- TextureWithMipMaps = 0x02,
- TextureAlways32Bit = 0x04
- };
- Q_DECLARE_FLAGS(TextureCreateFlags, TextureCreateFlag)
-
- enum TextureUploadFlag {
- TextureUploadAlways32Bit = 0x01
- };
- Q_DECLARE_FLAGS(TextureUploadFlags, TextureUploadFlag)
-
- uint genTexture();
- void createTexture(uint id, const QSize &size, QImage::Format format, TextureCreateFlags flags);
- void queueTextureResize(uint id, const QSize &size);
- void queueTextureUpload(uint id, const QImage &image, const QPoint &dstPos = QPoint(), TextureUploadFlags flags = 0);
- void queueTextureUpload(uint id, const QVector<QImage> &images, const QVector<QPoint> &dstPos, TextureUploadFlags flags = 0);
- void releaseTexture(uint id);
- void useTexture(uint id);
-
- uint genRenderTarget();
- void createRenderTarget(uint id, const QSize &size, const QVector4D &clearColor, uint samples);
- void releaseRenderTarget(uint id);
- void useRenderTargetAsTexture(uint id);
- uint activeRenderTarget() const;
-
- QImage executeAndWaitReadbackRenderTarget(uint id = 0);
-
- void simulateDeviceLoss();
-
- void *getResource(QQuickWindow *window, QSGRendererInterface::Resource resource) const;
-
-private:
- QSGD3D12EnginePrivate *d;
- Q_DISABLE_COPY(QSGD3D12Engine)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSGD3D12Engine::ClearFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSGD3D12Engine::TextureCreateFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSGD3D12Engine::TextureUploadFlags)
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12ENGINE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
deleted file mode 100644
index a95cbb1cbb..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
+++ /dev/null
@@ -1,455 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12ENGINE_P_P_H
-#define QSGD3D12ENGINE_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qsgd3d12engine_p.h"
-#include <QCache>
-
-#include <d3d12.h>
-#include <dxgi1_4.h>
-#include <dcomp.h>
-#include <wrl/client.h>
-
-using namespace Microsoft::WRL;
-
-// No moc-related features (Q_OBJECT, signals, etc.) can be used here to due
-// moc-generated code failing to compile when combined with COM stuff.
-
-// Recommended reading before moving further: https://github.com/Microsoft/DirectXTK/wiki/ComPtr
-// Note esp. operator= vs. Attach and operator& vs. GetAddressOf
-
-// ID3D12* is never passed to Qt containers directly. Always use ComPtr and put it into a struct.
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12CPUDescriptorHeapManager
-{
-public:
- void initialize(ID3D12Device *device);
-
- void releaseResources();
-
- D3D12_CPU_DESCRIPTOR_HANDLE allocate(D3D12_DESCRIPTOR_HEAP_TYPE type);
- void release(D3D12_CPU_DESCRIPTOR_HANDLE handle, D3D12_DESCRIPTOR_HEAP_TYPE type);
- quint32 handleSize(D3D12_DESCRIPTOR_HEAP_TYPE type) const { return m_handleSizes[type]; }
-
-private:
- ID3D12Device *m_device = nullptr;
- struct Heap {
- D3D12_DESCRIPTOR_HEAP_TYPE type;
- ComPtr<ID3D12DescriptorHeap> heap;
- D3D12_CPU_DESCRIPTOR_HANDLE start;
- quint32 handleSize;
- quint32 freeMap[8];
- };
- QVector<Heap> m_heaps;
- quint32 m_handleSizes[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
-};
-
-class QSGD3D12DeviceManager
-{
-public:
- ID3D12Device *ref();
- void unref();
- void deviceLossDetected();
- IDXGIFactory4 *dxgi();
-
- struct DeviceLossObserver {
- virtual void deviceLost() = 0;
- virtual ~DeviceLossObserver() = default;
- };
- void registerDeviceLossObserver(DeviceLossObserver *observer);
-
-private:
- void ensureCreated();
-
- ComPtr<ID3D12Device> m_device;
- ComPtr<IDXGIFactory4> m_factory;
- QAtomicInt m_ref;
- QVector<DeviceLossObserver *> m_observers;
-};
-
-struct QSGD3D12CPUWaitableFence
-{
- ~QSGD3D12CPUWaitableFence() {
- if (event)
- CloseHandle(event);
- }
- ComPtr<ID3D12Fence> fence;
- HANDLE event = nullptr;
- QAtomicInt value;
-};
-
-class QSGD3D12EnginePrivate : public QSGD3D12DeviceManager::DeviceLossObserver
-{
-public:
- void initialize(WId w, const QSize &size, float dpr, int surfaceFormatSamples, bool alpha);
- bool isInitialized() const { return initialized; }
- void releaseResources();
- void setWindowSize(const QSize &size, float dpr);
- WId currentWindow() const { return window; }
- QSize currentWindowSize() const { return windowSize; }
- float currentWindowDpr() const { return windowDpr; }
- uint currentWindowSamples() const { return windowSamples; }
-
- void beginFrame();
- void endFrame();
- void beginLayer();
- void endLayer();
- void invalidateCachedFrameState();
- void restoreFrameState(bool minimal = false);
-
- uint genBuffer();
- void releaseBuffer(uint id);
- void resetBuffer(uint id, const quint8 *data, int size);
- void markBufferDirty(uint id, int offset, int size);
-
- void queueViewport(const QRect &rect);
- void queueScissor(const QRect &rect);
- void queueSetRenderTarget(uint id);
- void queueClearRenderTarget(const QColor &color);
- void queueClearDepthStencil(float depthValue, quint8 stencilValue, QSGD3D12Engine::ClearFlags which);
- void queueSetBlendFactor(const QVector4D &factor);
- void queueSetStencilRef(quint32 ref);
-
- void finalizePipeline(const QSGD3D12PipelineState &pipelineState);
-
- void queueDraw(const QSGD3D12Engine::DrawParams &params);
-
- void present();
- void waitGPU();
-
- uint genTexture();
- void createTexture(uint id, const QSize &size, QImage::Format format, QSGD3D12Engine::TextureCreateFlags flags);
- void queueTextureResize(uint id, const QSize &size);
- void queueTextureUpload(uint id, const QVector<QImage> &images, const QVector<QPoint> &dstPos,
- QSGD3D12Engine::TextureUploadFlags flags);
- void releaseTexture(uint id);
- void useTexture(uint id);
-
- uint genRenderTarget();
- void createRenderTarget(uint id, const QSize &size, const QVector4D &clearColor, uint samples);
- void releaseRenderTarget(uint id);
- void useRenderTargetAsTexture(uint id);
- uint activeRenderTarget() const { return currentRenderTarget; }
-
- QImage executeAndWaitReadbackRenderTarget(uint id);
-
- void simulateDeviceLoss();
-
- void *getResource(QSGRendererInterface::Resource resource) const;
-
- // the device is intentionally hidden here. all resources have to go
- // through the engine and, unlike with GL, cannot just be created in random
- // places due to the need for proper tracking, managing and releasing.
-private:
- void ensureDevice();
- void setupDefaultRenderTargets();
- void deviceLost() override;
-
- bool createCbvSrvUavHeap(int pframeIndex, int descriptorCount);
- void setDescriptorHeaps(bool force = false);
- void ensureGPUDescriptorHeap(int cbvSrvUavDescriptorCount);
-
- DXGI_SAMPLE_DESC makeSampleDesc(DXGI_FORMAT format, uint samples);
- ID3D12Resource *createColorBuffer(D3D12_CPU_DESCRIPTOR_HANDLE viewHandle, const QSize &size,
- const QVector4D &clearColor, uint samples);
- ID3D12Resource *createDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE viewHandle, const QSize &size, uint samples);
-
- QSGD3D12CPUWaitableFence *createCPUWaitableFence() const;
- void waitForGPU(QSGD3D12CPUWaitableFence *f) const;
-
- void transitionResource(ID3D12Resource *resource, ID3D12GraphicsCommandList *commandList,
- D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after) const;
- void resolveMultisampledTarget(ID3D12Resource *msaa, ID3D12Resource *resolve, D3D12_RESOURCE_STATES resolveUsage,
- ID3D12GraphicsCommandList *commandList) const;
- void uavBarrier(ID3D12Resource *resource, ID3D12GraphicsCommandList *commandList) const;
-
- ID3D12Resource *createBuffer(int size);
-
- typedef QVector<QPair<int, int> > DirtyList;
- void addDirtyRange(DirtyList *dirty, int offset, int size, int bufferSize);
-
- struct PersistentFrameData {
- ComPtr<ID3D12DescriptorHeap> gpuCbvSrvUavHeap;
- int gpuCbvSrvUavHeapSize;
- int cbvSrvUavNextFreeDescriptorIndex;
- QSet<uint> pendingTextureUploads;
- QSet<uint> pendingTextureMipMap;
- struct DeleteQueueEntry {
- ComPtr<ID3D12Resource> res;
- ComPtr<ID3D12DescriptorHeap> descHeap;
- SIZE_T cpuDescriptorPtr = 0;
- D3D12_DESCRIPTOR_HEAP_TYPE descHeapType = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
- };
- QVector<DeleteQueueEntry> deleteQueue;
- QVector<DeleteQueueEntry> outOfFrameDeleteQueue;
- QSet<uint> buffersUsedInDrawCallSet;
- QSet<uint> buffersUsedInFrame;
- struct PendingRelease {
- enum Type {
- TypeTexture,
- TypeBuffer
- };
- Type type = TypeTexture;
- uint id = 0;
- PendingRelease(Type type, uint id) : type(type), id(id) { }
- PendingRelease() { }
- bool operator==(const PendingRelease &other) const { return type == other.type && id == other.id; }
- };
- QSet<PendingRelease> pendingReleases;
- QSet<PendingRelease> outOfFramePendingReleases;
- };
- friend uint qHash(const PersistentFrameData::PendingRelease &pr, uint seed);
-
- void deferredDelete(ComPtr<ID3D12Resource> res);
- void deferredDelete(ComPtr<ID3D12DescriptorHeap> dh);
- void deferredDelete(D3D12_CPU_DESCRIPTOR_HANDLE h, D3D12_DESCRIPTOR_HEAP_TYPE type);
-
- struct Buffer;
- void ensureBuffer(Buffer *buf);
- void updateBuffer(Buffer *buf);
-
- void beginDrawCalls();
- void beginFrameDraw();
- void endDrawCalls(bool lastInFrame = false);
-
- static const int MAX_SWAP_CHAIN_BUFFER_COUNT = 4;
- static const int MAX_FRAME_IN_FLIGHT_COUNT = 4;
-
- bool initialized = false;
- bool inFrame = false;
- WId window = 0;
- QSize windowSize;
- float windowDpr;
- uint windowSamples;
- bool windowAlpha;
- int swapChainBufferCount;
- int frameInFlightCount;
- int waitableSwapChainMaxLatency;
- ID3D12Device *device;
- ComPtr<ID3D12CommandQueue> commandQueue;
- ComPtr<ID3D12CommandQueue> copyCommandQueue;
- ComPtr<IDXGISwapChain3> swapChain;
- HANDLE swapEvent;
- ComPtr<ID3D12Resource> backBufferRT[MAX_SWAP_CHAIN_BUFFER_COUNT];
- ComPtr<ID3D12Resource> defaultRT[MAX_SWAP_CHAIN_BUFFER_COUNT];
- D3D12_CPU_DESCRIPTOR_HANDLE defaultRTV[MAX_SWAP_CHAIN_BUFFER_COUNT];
- ComPtr<ID3D12Resource> defaultDS;
- D3D12_CPU_DESCRIPTOR_HANDLE defaultDSV;
- ComPtr<ID3D12CommandAllocator> frameCommandAllocator[MAX_FRAME_IN_FLIGHT_COUNT];
- ComPtr<ID3D12CommandAllocator> copyCommandAllocator;
- ComPtr<ID3D12GraphicsCommandList> frameCommandList;
- ComPtr<ID3D12GraphicsCommandList> copyCommandList;
- QSGD3D12CPUDescriptorHeapManager cpuDescHeapManager;
- quint64 presentFrameIndex;
- quint64 frameIndex;
- QSGD3D12CPUWaitableFence *presentFence = nullptr;
- QSGD3D12CPUWaitableFence *frameFence[MAX_FRAME_IN_FLIGHT_COUNT];
-
- PersistentFrameData pframeData[MAX_FRAME_IN_FLIGHT_COUNT];
- int currentPFrameIndex;
- ID3D12GraphicsCommandList *commandList = nullptr;
- int activeLayers = 0;
- int currentLayerDepth = 0;
-
- struct PSOCacheEntry {
- ComPtr<ID3D12PipelineState> pso;
- };
- QCache<QSGD3D12PipelineState, PSOCacheEntry> psoCache;
- struct RootSigCacheEntry {
- ComPtr<ID3D12RootSignature> rootSig;
- };
- QCache<QSGD3D12RootSignature, RootSigCacheEntry> rootSigCache;
-
- struct Texture {
- enum Flag {
- EntryInUse = 0x01,
- Alpha = 0x02,
- MipMap = 0x04
- };
- int flags = 0;
- bool entryInUse() const { return flags & EntryInUse; }
- bool alpha() const { return flags & Alpha; }
- bool mipmap() const { return flags & MipMap; }
- ComPtr<ID3D12Resource> texture;
- D3D12_CPU_DESCRIPTOR_HANDLE srv;
- quint64 fenceValue = 0;
- quint64 lastWaitFenceValue = 0;
- struct StagingHeap {
- ComPtr<ID3D12Heap> heap;
- };
- QVector<StagingHeap> stagingHeaps;
- struct StagingBuffer {
- ComPtr<ID3D12Resource> buffer;
- };
- QVector<StagingBuffer> stagingBuffers;
- QVector<D3D12_CPU_DESCRIPTOR_HANDLE> mipUAVs;
- };
-
- QVector<Texture> textures;
- ComPtr<ID3D12Fence> textureUploadFence;
- QAtomicInt nextTextureUploadFenceValue;
-
- struct TransientFrameData {
- QSGGeometry::DrawingMode drawingMode;
- uint currentIndexBuffer;
- struct ActiveTexture {
- enum Type {
- TypeTexture,
- TypeRenderTarget
- };
- Type type = TypeTexture;
- uint id = 0;
- ActiveTexture(Type type, uint id) : type(type), id(id) { }
- ActiveTexture() { }
- };
- int activeTextureCount;
- ActiveTexture activeTextures[QSGD3D12_MAX_TEXTURE_VIEWS];
- int drawCount;
- ID3D12PipelineState *lastPso;
- ID3D12RootSignature *lastRootSig;
- bool descHeapSet;
-
- QRect viewport;
- QRect scissor;
- QVector4D blendFactor = QVector4D(1, 1, 1, 1);
- quint32 stencilRef = 1;
- QSGD3D12PipelineState pipelineState;
- };
- TransientFrameData tframeData;
-
- struct MipMapGen {
- bool initialize(QSGD3D12EnginePrivate *enginePriv);
- void releaseResources();
- void queueGenerate(const Texture &t);
-
- QSGD3D12EnginePrivate *engine;
- ComPtr<ID3D12RootSignature> rootSig;
- ComPtr<ID3D12PipelineState> pipelineState;
- };
-
- MipMapGen mipmapper;
-
- struct RenderTarget {
- enum Flag {
- EntryInUse = 0x01,
- NeedsReadBarrier = 0x02,
- Multisample = 0x04
- };
- int flags = 0;
- bool entryInUse() const { return flags & EntryInUse; }
- ComPtr<ID3D12Resource> color;
- ComPtr<ID3D12Resource> colorResolve;
- D3D12_CPU_DESCRIPTOR_HANDLE rtv;
- ComPtr<ID3D12Resource> ds;
- D3D12_CPU_DESCRIPTOR_HANDLE dsv;
- D3D12_CPU_DESCRIPTOR_HANDLE srv;
- };
-
- QVector<RenderTarget> renderTargets;
- uint currentRenderTarget;
-
- struct CPUBufferRef {
- const quint8 *p = nullptr;
- quint32 size = 0;
- DirtyList dirty;
- CPUBufferRef() { dirty.reserve(16); }
- };
-
- struct Buffer {
- enum Flag {
- EntryInUse = 0x01
- };
- int flags = 0;
- bool entryInUse() const { return flags & EntryInUse; }
- struct InFlightData {
- ComPtr<ID3D12Resource> buffer;
- DirtyList dirty;
- quint32 dataSize = 0;
- quint32 resourceSize = 0;
- InFlightData() { dirty.reserve(16); }
- };
- InFlightData d[MAX_FRAME_IN_FLIGHT_COUNT];
- CPUBufferRef cpuDataRef;
- };
-
- QVector<Buffer> buffers;
-
- struct DeviceLossTester {
- bool initialize(QSGD3D12EnginePrivate *enginePriv);
- void releaseResources();
- void killDevice();
-
- QSGD3D12EnginePrivate *engine;
- ComPtr<ID3D12PipelineState> computeState;
- ComPtr<ID3D12RootSignature> computeRootSignature;
- };
-
- DeviceLossTester devLossTest;
-
-#ifndef Q_OS_WINRT
- ComPtr<IDCompositionDevice> dcompDevice;
- ComPtr<IDCompositionTarget> dcompTarget;
- ComPtr<IDCompositionVisual> dcompVisual;
-#endif
-};
-
-inline uint qHash(const QSGD3D12EnginePrivate::PersistentFrameData::PendingRelease &pr, uint seed = 0)
-{
- Q_UNUSED(seed);
- return pr.id + pr.type;
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp
deleted file mode 100644
index 915917c3d5..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12glyphcache_p.h"
-#include "qsgd3d12engine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-// Convert A8 glyphs to 32-bit in the engine. This is here to work around
-// QTBUG-55330 for AMD cards.
-// If removing, textmask.hlsl must be adjusted! (.a -> .r)
-#define ALWAYS_32BIT
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(render)
-
-QSGD3D12GlyphCache::QSGD3D12GlyphCache(QSGD3D12Engine *engine, QFontEngine::GlyphFormat format, const QTransform &matrix)
- : QTextureGlyphCache(format, matrix),
- m_engine(engine)
-{
-}
-
-QSGD3D12GlyphCache::~QSGD3D12GlyphCache()
-{
- if (m_id)
- m_engine->releaseTexture(m_id);
-}
-
-void QSGD3D12GlyphCache::createTextureData(int width, int height)
-{
- width = qMax(128, width);
- height = qMax(32, height);
-
- m_id = m_engine->genTexture();
- Q_ASSERT(m_id);
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("new glyph cache texture %u of size %dx%d, fontengine format %d", m_id, width, height, m_format);
-
- m_size = QSize(width, height);
-
- const QImage::Format imageFormat =
- m_format == QFontEngine::Format_A8 ? QImage::Format_Alpha8 : QImage::Format_ARGB32_Premultiplied;
- m_engine->createTexture(m_id, m_size, imageFormat, QSGD3D12Engine::TextureWithAlpha
-#ifdef ALWAYS_32BIT
- | QSGD3D12Engine::TextureAlways32Bit
-#endif
- );
-}
-
-void QSGD3D12GlyphCache::resizeTextureData(int width, int height)
-{
- width = qMax(128, width);
- height = qMax(32, height);
-
- if (m_size.width() >= width && m_size.height() >= height)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("glyph cache texture %u resize to %dx%d", m_id, width, height);
-
- m_size = QSize(width, height);
-
- m_engine->queueTextureResize(m_id, m_size);
-}
-
-void QSGD3D12GlyphCache::beginFillTexture()
-{
- Q_ASSERT(m_glyphImages.isEmpty() && m_glyphPos.isEmpty());
-}
-
-void QSGD3D12GlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
-{
- QImage mask = textureMapForGlyph(glyph, subPixelPosition);
- const int maskWidth = mask.width();
- const int maskHeight = mask.height();
-
- if (mask.format() == QImage::Format_Mono) {
- mask = mask.convertToFormat(QImage::Format_Indexed8);
- for (int y = 0; y < maskHeight; ++y) {
- uchar *src = mask.scanLine(y);
- for (int x = 0; x < maskWidth; ++x)
- src[x] = -src[x]; // convert 0 and 1 into 0 and 255
- }
- } else if (mask.depth() == 32) {
- if (mask.format() == QImage::Format_RGB32) {
- // We need to make the alpha component equal to the average of the RGB values.
- // This is needed when drawing sub-pixel antialiased text on translucent targets.
- for (int y = 0; y < maskHeight; ++y) {
- QRgb *src = reinterpret_cast<QRgb *>(mask.scanLine(y));
- for (int x = 0; x < maskWidth; ++x) {
- const int r = qRed(src[x]);
- const int g = qGreen(src[x]);
- const int b = qBlue(src[x]);
- int avg;
- if (mask.format() == QImage::Format_RGB32)
- avg = (r + g + b + 1) / 3; // "+1" for rounding.
- else // Format_ARGB32_Premultiplied
- avg = qAlpha(src[x]);
- src[x] = qRgba(r, g, b, avg);
- }
- }
- }
- }
-
- m_glyphImages.append(mask);
- m_glyphPos.append(QPoint(c.x, c.y));
-}
-
-void QSGD3D12GlyphCache::endFillTexture()
-{
- if (m_glyphImages.isEmpty())
- return;
-
- Q_ASSERT(m_id);
-
- m_engine->queueTextureUpload(m_id, m_glyphImages, m_glyphPos
-#ifdef ALWAYS_32BIT
- , QSGD3D12Engine::TextureUploadAlways32Bit
-#endif
- );
-
- // Nothing else left to do, it is up to the text material to call
- // useTexture() which will then add the texture dependency to the frame.
-
- m_glyphImages.clear();
- m_glyphPos.clear();
-}
-
-int QSGD3D12GlyphCache::glyphPadding() const
-{
- return 1;
-}
-
-int QSGD3D12GlyphCache::maxTextureWidth() const
-{
- return 16384;
-}
-
-int QSGD3D12GlyphCache::maxTextureHeight() const
-{
- return 16384;
-}
-
-void QSGD3D12GlyphCache::useTexture()
-{
- if (m_id)
- m_engine->useTexture(m_id);
-}
-
-QSize QSGD3D12GlyphCache::currentSize() const
-{
- return m_size;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h
deleted file mode 100644
index 88d3d36f33..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12GLYPHCACHE_P_H
-#define QSGD3D12GLYPHCACHE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtextureglyphcache_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-
-class QSGD3D12GlyphCache : public QTextureGlyphCache
-{
-public:
- QSGD3D12GlyphCache(QSGD3D12Engine *engine, QFontEngine::GlyphFormat format, const QTransform &matrix);
- ~QSGD3D12GlyphCache();
-
- void createTextureData(int width, int height) override;
- void resizeTextureData(int width, int height) override;
- void beginFillTexture() override;
- void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
- void endFillTexture() override;
- int glyphPadding() const override;
- int maxTextureWidth() const override;
- int maxTextureHeight() const override;
-
- void useTexture();
- QSize currentSize() const;
-
-private:
- QSGD3D12Engine *m_engine;
- uint m_id = 0;
- QVector<QImage> m_glyphImages;
- QVector<QPoint> m_glyphPos;
- QSize m_size;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12GLYPHCACHE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp
deleted file mode 100644
index e559739018..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12glyphnode_p.h"
-#include "qsgd3d12builtinmaterials_p.h"
-
-QT_BEGIN_NAMESPACE
-
-void QSGD3D12GlyphNode::setMaterialColor(const QColor &color)
-{
- static_cast<QSGD3D12TextMaterial *>(m_material)->setColor(color);
-}
-
-void QSGD3D12GlyphNode::update()
-{
- QRawFont font = m_glyphs.rawFont();
- QMargins margins(0, 0, 0, 0);
-
- if (m_style == QQuickText::Normal) {
- // QSGBasicGlyphNode dtor will delete
- m_material = new QSGD3D12TextMaterial(QSGD3D12TextMaterial::Normal, m_rc, font);
- } else if (m_style == QQuickText::Outline) {
- QSGD3D12TextMaterial *material = new QSGD3D12TextMaterial(QSGD3D12TextMaterial::Outlined,
- m_rc, font, QFontEngine::Format_A8);
- material->setStyleColor(m_styleColor);
- m_material = material;
- margins = QMargins(1, 1, 1, 1);
- } else {
- QSGD3D12TextMaterial *material = new QSGD3D12TextMaterial(QSGD3D12TextMaterial::Styled,
- m_rc, font, QFontEngine::Format_A8);
- if (m_style == QQuickText::Sunken) {
- material->setStyleShift(QVector2D(0, -1));
- margins.setTop(1);
- } else if (m_style == QQuickText::Raised) {
- material->setStyleShift(QVector2D(0, 1));
- margins.setBottom(1);
- }
- material->setStyleColor(m_styleColor);
- m_material = material;
- }
-
- QSGD3D12TextMaterial *textMaterial = static_cast<QSGD3D12TextMaterial *>(m_material);
- textMaterial->setColor(m_color);
-
- QRectF boundingRect;
- textMaterial->populate(m_position, m_glyphs.glyphIndexes(), m_glyphs.positions(), geometry(),
- &boundingRect, &m_baseLine, margins);
- setBoundingRect(boundingRect);
-
- setMaterial(m_material);
- markDirty(DirtyGeometry);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h
deleted file mode 100644
index d04a8e8777..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12GLYPHNODE_P_H
-#define QSGD3D12GLYPHNODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgbasicglyphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12RenderContext;
-
-class QSGD3D12GlyphNode : public QSGBasicGlyphNode
-{
-public:
- QSGD3D12GlyphNode(QSGD3D12RenderContext *rc) : m_rc(rc) { }
-
- void setMaterialColor(const QColor &color) override;
- void update() override;
-
-private:
- QSGD3D12RenderContext *m_rc;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12GLYPHNODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp
deleted file mode 100644
index aa163cacbf..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12internalimagenode_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QSGD3D12InternalImageNode::QSGD3D12InternalImageNode()
-{
- setMaterial(&m_material);
-}
-
-void QSGD3D12InternalImageNode::setFiltering(QSGTexture::Filtering filtering)
-{
- if (m_material.filtering() == filtering)
- return;
-
- m_material.setFiltering(filtering);
- m_smoothMaterial.setFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12InternalImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)
-{
- if (m_material.mipmapFiltering() == filtering)
- return;
-
- m_material.setMipmapFiltering(filtering);
- m_smoothMaterial.setMipmapFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12InternalImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode)
-{
- if (m_material.verticalWrapMode() == wrapMode)
- return;
-
- m_material.setVerticalWrapMode(wrapMode);
- m_smoothMaterial.setVerticalWrapMode(wrapMode);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12InternalImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode)
-{
- if (m_material.horizontalWrapMode() == wrapMode)
- return;
-
- m_material.setHorizontalWrapMode(wrapMode);
- m_smoothMaterial.setHorizontalWrapMode(wrapMode);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12InternalImageNode::updateMaterialAntialiasing()
-{
- if (m_antialiasing)
- setMaterial(&m_smoothMaterial);
- else
- setMaterial(&m_material);
-}
-
-void QSGD3D12InternalImageNode::setMaterialTexture(QSGTexture *texture)
-{
- m_material.setTexture(texture);
- m_smoothMaterial.setTexture(texture);
-}
-
-QSGTexture *QSGD3D12InternalImageNode::materialTexture() const
-{
- return m_material.texture();
-}
-
-bool QSGD3D12InternalImageNode::updateMaterialBlending()
-{
- const bool alpha = m_material.flags() & QSGMaterial::Blending;
- if (materialTexture() && alpha != materialTexture()->hasAlphaChannel()) {
- m_material.setFlag(QSGMaterial::Blending, !alpha);
- return true;
- }
- return false;
-}
-
-bool QSGD3D12InternalImageNode::supportsWrap(const QSize &) const
-{
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h
deleted file mode 100644
index 26284740ee..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12INTERNALIMAGENODE_P_H
-#define QSGD3D12INTERNALIMAGENODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgbasicinternalimagenode_p.h>
-#include "qsgd3d12builtinmaterials_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12InternalImageNode : public QSGBasicInternalImageNode
-{
-public:
- QSGD3D12InternalImageNode();
-
- void setMipmapFiltering(QSGTexture::Filtering filtering) override;
- void setFiltering(QSGTexture::Filtering filtering) override;
- void setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) override;
- void setVerticalWrapMode(QSGTexture::WrapMode wrapMode) override;
-
- void updateMaterialAntialiasing() override;
- void setMaterialTexture(QSGTexture *texture) override;
- QSGTexture *materialTexture() const override;
- bool updateMaterialBlending() override;
- bool supportsWrap(const QSize &size) const override;
-
-private:
- QSGD3D12TextureMaterial m_material;
- QSGD3D12SmoothTextureMaterial m_smoothMaterial;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12INTERNALIMAGENODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp
deleted file mode 100644
index 2d9c5b55d1..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12internalrectanglenode_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QSGD3D12InternalRectangleNode::QSGD3D12InternalRectangleNode()
-{
- setMaterial(&m_material);
-}
-
-void QSGD3D12InternalRectangleNode::updateMaterialAntialiasing()
-{
- if (m_antialiasing)
- setMaterial(&m_smoothMaterial);
- else
- setMaterial(&m_material);
-}
-
-void QSGD3D12InternalRectangleNode::updateMaterialBlending(QSGNode::DirtyState *state)
-{
- // smoothed material is always blended, so no change in material state
- if (material() == &m_material) {
- bool wasBlending = (m_material.flags() & QSGMaterial::Blending);
- bool isBlending = (m_gradient_stops.size() > 0 && !m_gradient_is_opaque)
- || (m_color.alpha() < 255 && m_color.alpha() != 0)
- || (m_pen_width > 0 && m_border_color.alpha() < 255);
- if (wasBlending != isBlending) {
- m_material.setFlag(QSGMaterial::Blending, isBlending);
- *state |= QSGNode::DirtyMaterial;
- }
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h
deleted file mode 100644
index 2fc3c69285..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12INTERNALRECTANGLENODE_P_H
-#define QSGD3D12INTERNALRECTANGLENODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgbasicinternalrectanglenode_p.h>
-#include "qsgd3d12builtinmaterials_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12InternalRectangleNode : public QSGBasicInternalRectangleNode
-{
-public:
- QSGD3D12InternalRectangleNode();
-
-private:
- void updateMaterialAntialiasing() override;
- void updateMaterialBlending(QSGNode::DirtyState *state) override;
-
- QSGD3D12VertexColorMaterial m_material;
- QSGD3D12SmoothColorMaterial m_smoothMaterial;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12INTERNALRECTANGLENODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp
deleted file mode 100644
index b9d3a180cf..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12layer_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12engine_p.h"
-#include "qsgd3d12renderer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(render)
-
-QSGD3D12Layer::QSGD3D12Layer(QSGD3D12RenderContext *rc)
- : QSGLayer(*(new QSGD3D12LayerPrivate)),
- m_rc(rc)
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("new layer %p", this);
-}
-
-QSGD3D12Layer::~QSGD3D12Layer()
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("destroying layer %p", this);
-
- cleanup();
-}
-
-// QSGTexture
-
-int QSGD3D12Layer::textureId() const
-{
- return m_rt; // not a texture id per se but will do
-}
-
-int QSGD3D12LayerPrivate::comparisonKey() const
-{
- Q_Q(const QSGD3D12Layer);
- return q->m_rt;
-}
-
-QSize QSGD3D12Layer::textureSize() const
-{
- return m_size;
-}
-
-bool QSGD3D12Layer::hasAlphaChannel() const
-{
- return true;
-}
-
-bool QSGD3D12Layer::hasMipmaps() const
-{
- // mipmapped layers are not supported for now
- return false;
-}
-
-QRectF QSGD3D12Layer::normalizedTextureSubRect() const
-{
- return QRectF(m_mirrorHorizontal ? 1 : 0,
- m_mirrorVertical ? 0 : 1,
- m_mirrorHorizontal ? -1 : 1,
- m_mirrorVertical ? 1 : -1);
-}
-
-void QSGD3D12Layer::bind()
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p bind rt=%u", this, m_rt);
-
- QSGD3D12Engine *engine = m_rc->engine();
- Q_ASSERT(m_rt);
-
-#ifndef QT_NO_DEBUG
- // Should not use the color buffer as a texture while it is the current render target.
- if (!m_recursive && engine->activeRenderTarget() == m_rt && engine->windowSamples() == 1)
- qWarning("ShaderEffectSource: \'recursive\' must be set to true when rendering recursively.");
-#endif
-
- engine->useRenderTargetAsTexture(m_rt);
-}
-
-// QSGDynamicTexture
-
-bool QSGD3D12Layer::updateTexture()
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p updateTexture", this);
-
- const bool doUpdate = (m_live || m_updateContentPending) && m_dirtyTexture;
-
- if (doUpdate)
- updateContent();
-
- if (m_updateContentPending) {
- m_updateContentPending = false;
- emit scheduledUpdateCompleted();
- }
-
- return doUpdate;
-}
-
-// QSGLayer
-
-void QSGD3D12Layer::setItem(QSGNode *item)
-{
- if (m_item == item)
- return;
-
- if (m_live && !item)
- resetRenderTarget();
-
- m_item = item;
- markDirtyTexture();
-}
-
-void QSGD3D12Layer::setRect(const QRectF &rect)
-{
- if (m_rect == rect)
- return;
-
- m_rect = rect;
- markDirtyTexture();
-}
-
-void QSGD3D12Layer::setSize(const QSize &size)
-{
- if (m_size == size)
- return;
-
- if (m_live && size.isNull())
- resetRenderTarget();
-
- m_size = size;
- markDirtyTexture();
-}
-
-void QSGD3D12Layer::scheduleUpdate()
-{
- if (m_updateContentPending)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p scheduleUpdate", this);
-
- m_updateContentPending = true;
-
- if (m_dirtyTexture)
- emit updateRequested();
-}
-
-QImage QSGD3D12Layer::toImage() const
-{
- return m_rc->engine()->executeAndWaitReadbackRenderTarget(m_rt);
-}
-
-void QSGD3D12Layer::setLive(bool live)
-{
- if (m_live == live)
- return;
-
- if (live && (!m_item || m_size.isNull()))
- resetRenderTarget();
-
- m_live = live;
- markDirtyTexture();
-}
-
-void QSGD3D12Layer::setRecursive(bool recursive)
-{
- m_recursive = recursive;
-}
-
-void QSGD3D12Layer::setFormat(uint format)
-{
- Q_UNUSED(format);
-}
-
-void QSGD3D12Layer::setHasMipmaps(bool mipmap)
-{
- // mipmapped layers are not supported for now
- Q_UNUSED(mipmap);
-}
-
-void QSGD3D12Layer::setDevicePixelRatio(qreal ratio)
-{
- m_dpr = ratio;
-}
-
-void QSGD3D12Layer::setMirrorHorizontal(bool mirror)
-{
- m_mirrorHorizontal = mirror;
-}
-
-void QSGD3D12Layer::setMirrorVertical(bool mirror)
-{
- m_mirrorVertical = mirror;
-}
-
-void QSGD3D12Layer::markDirtyTexture()
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p markDirtyTexture", this);
-
- m_dirtyTexture = true;
-
- if (m_live || m_updateContentPending)
- emit updateRequested();
-}
-
-void QSGD3D12Layer::invalidated()
-{
- cleanup();
-}
-
-void QSGD3D12Layer::cleanup()
-{
- if (!m_renderer && !m_rt)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p cleanup renderer=%p rt=%u", this, m_renderer, m_rt);
-
- delete m_renderer;
- m_renderer = nullptr;
-
- resetRenderTarget();
-}
-
-void QSGD3D12Layer::resetRenderTarget()
-{
- if (!m_rt)
- return;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p resetRenderTarget rt=%u", this, m_rt);
-
- m_rc->engine()->releaseRenderTarget(m_rt);
- m_rt = 0;
-
- if (m_secondaryRT) {
- m_rc->engine()->releaseRenderTarget(m_secondaryRT);
- m_secondaryRT = 0;
- }
-}
-
-void QSGD3D12Layer::updateContent()
-{
- if (Q_UNLIKELY(debug_render()))
- qDebug("layer %p updateContent", this);
-
- if (!m_item || m_size.isNull()) {
- resetRenderTarget();
- m_dirtyTexture = false;
- return;
- }
-
- QSGNode *root = m_item;
- while (root->firstChild() && root->type() != QSGNode::RootNodeType)
- root = root->firstChild();
-
- if (root->type() != QSGNode::RootNodeType)
- return;
-
- if (!m_renderer) {
- m_renderer = m_rc->createRenderer();
- static_cast<QSGD3D12Renderer *>(m_renderer)->turnToLayerRenderer();
- connect(m_renderer, &QSGRenderer::sceneGraphChanged, this, &QSGD3D12Layer::markDirtyTexture);
- }
-
- m_renderer->setDevicePixelRatio(m_dpr);
- m_renderer->setRootNode(static_cast<QSGRootNode *>(root));
-
- QSGD3D12Engine *engine = m_rc->engine();
- const uint sampleCount = engine->windowSamples();
- const QVector4D clearColor;
-
- if (!m_rt || m_rtSize != m_size) {
- if (m_rt)
- resetRenderTarget();
-
- m_rt = engine->genRenderTarget();
- m_rtSize = m_size;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("new render target for layer %p, size=%dx%d, samples=%d",
- this, m_size.width(), m_size.height(), sampleCount);
-
- engine->createRenderTarget(m_rt, m_rtSize, clearColor, sampleCount);
-
- // For multisampling the resolving via an extra non-ms color buffer is
- // handled internally in the engine, no need to worry about it here.
- }
-
- if (m_recursive && !m_secondaryRT && sampleCount == 1) {
- m_secondaryRT = engine->genRenderTarget();
- engine->createRenderTarget(m_secondaryRT, m_rtSize, clearColor, sampleCount);
- }
-
- m_dirtyTexture = false;
-
- m_renderer->setDeviceRect(m_size);
- m_renderer->setViewportRect(m_size);
-
- // Note that the handling of vertical mirroring differs from OpenGL here
- // due to y running top-bottom with D3D as opposed to bottom-top with GL.
- // The common parts of Quick follow OpenGL so vertical mirroring is
- // typically enabled.
- QRectF mirrored(m_mirrorHorizontal ? m_rect.right() : m_rect.left(),
- m_mirrorVertical ? m_rect.top() : m_rect.bottom(),
- m_mirrorHorizontal ? -m_rect.width() : m_rect.width(),
- m_mirrorVertical ? m_rect.height() : -m_rect.height());
-
- m_renderer->setProjectionMatrixToRect(mirrored);
- m_renderer->setClearColor(Qt::transparent);
-
- if (!m_recursive || sampleCount > 1) {
- m_renderer->renderScene(m_rt);
- } else {
- m_renderer->renderScene(m_secondaryRT);
- qSwap(m_rt, m_secondaryRT);
- }
-
- if (m_recursive)
- markDirtyTexture(); // Continuously update if 'live' and 'recursive'.
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h
deleted file mode 100644
index 42a56877cf..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12LAYER_P_H
-#define QSGD3D12LAYER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgadaptationlayer_p.h>
-#include <private/qsgtexture_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12RenderContext;
-class QSGD3D12LayerPrivate;
-
-class QSGD3D12Layer : public QSGLayer
-{
- Q_DECLARE_PRIVATE(QSGD3D12Layer)
- Q_OBJECT
-
-public:
- QSGD3D12Layer(QSGD3D12RenderContext *rc);
- ~QSGD3D12Layer();
-
- int textureId() const override;
- QSize textureSize() const override;
- bool hasAlphaChannel() const override;
- bool hasMipmaps() const override;
- QRectF normalizedTextureSubRect() const override;
- void bind() override;
-
- bool updateTexture() override;
-
- void setItem(QSGNode *item) override;
- void setRect(const QRectF &rect) override;
- void setSize(const QSize &size) override;
- void scheduleUpdate() override;
- QImage toImage() const override;
- void setLive(bool live) override;
- void setRecursive(bool recursive) override;
- void setFormat(uint format) override;
- void setHasMipmaps(bool mipmap) override;
- void setDevicePixelRatio(qreal ratio) override;
- void setMirrorHorizontal(bool mirror) override;
- void setMirrorVertical(bool mirror) override;
- void setSamples(int) override { }
-
-public Q_SLOTS:
- void markDirtyTexture() override;
- void invalidated() override;
-
-private:
- void cleanup();
- void resetRenderTarget();
- void updateContent();
-
- QSGD3D12RenderContext *m_rc;
- uint m_rt = 0;
- uint m_secondaryRT = 0;
- QSize m_rtSize;
- QSize m_size;
- QRectF m_rect;
- QSGNode *m_item = nullptr;
- QSGRenderer *m_renderer = nullptr;
- float m_dpr = 1;
- bool m_mirrorHorizontal = false;
- bool m_mirrorVertical = true;
- bool m_live = true;
- bool m_recursive = false;
- bool m_dirtyTexture = true;
- bool m_updateContentPending = false;
-};
-
-class QSGD3D12LayerPrivate : public QSGTexturePrivate
-{
- Q_DECLARE_PUBLIC(QSGD3D12Layer)
-public:
- int comparisonKey() const override;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12LAYER_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12material.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12material.cpp
deleted file mode 100644
index 1b638106ee..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12material.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12material_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QSGMaterialShader *QSGD3D12Material::createShader() const
-{
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12material_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12material_p.h
deleted file mode 100644
index 65d53600c3..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12material_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12MATERIAL_P_H
-#define QSGD3D12MATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/qsgmaterial.h>
-#include "qsgd3d12engine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGRenderer;
-
-// The D3D renderer works with QSGD3D12Material as the "base" class since
-// QSGMaterial and its GL program related bits are not suitable. Also, there is
-// no split like with QSGMaterialShader.
-
-typedef QSGMaterialShader::RenderState QSGD3D12MaterialRenderState;
-
-class QSGD3D12Material : public QSGMaterial
-{
-public:
- struct ExtraState {
- QVector4D blendFactor;
- };
-
- enum UpdateResult {
- UpdatedShaders = 0x0001,
- UpdatedConstantBuffer = 0x0002,
- UpdatedBlendFactor = 0x0004
- };
- Q_DECLARE_FLAGS(UpdateResults, UpdateResult)
-
- virtual int constantBufferSize() const = 0;
- virtual void preparePipeline(QSGD3D12PipelineState *pipelineState) = 0;
- virtual UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) = 0;
-
-private:
- QSGMaterialShader *createShader() const override; // dummy, QSGMaterialShader is too GL dependent
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSGD3D12Material::UpdateResults)
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12MATERIAL_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp
deleted file mode 100644
index b22c42f2e5..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12painternode_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12engine_p.h"
-#include <private/qquickitem_p.h>
-#include <qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-QSGD3D12PainterTexture::QSGD3D12PainterTexture(QSGD3D12Engine *engine)
- : QSGD3D12Texture(engine)
-{
-}
-
-void QSGD3D12PainterTexture::bind()
-{
- if (m_image.isNull()) {
- if (!m_id) {
- m_id = m_engine->genTexture();
- m_engine->createTexture(m_id, QSize(16, 16), QImage::Format_RGB32, 0);
- }
- } else if (m_image.size() != lastSize) {
- lastSize = m_image.size();
- if (m_id)
- m_engine->releaseTexture(m_id);
- m_id = m_engine->genTexture();
- m_engine->createTexture(m_id, m_image.size(), m_image.format(), QSGD3D12Engine::TextureWithAlpha);
- m_engine->queueTextureUpload(m_id, m_image);
- } else if (!dirty.isEmpty()) {
- const int bpl = m_image.bytesPerLine();
- const uchar *p = m_image.constBits() + dirty.y() * bpl + dirty.x() * 4;
- QImage subImg(p, dirty.width(), dirty.height(), bpl, QImage::Format_ARGB32_Premultiplied);
- m_engine->queueTextureUpload(m_id, subImg, dirty.topLeft());
- }
-
- dirty = QRect();
-
- m_engine->useTexture(m_id);
-}
-
-QSGD3D12PainterNode::QSGD3D12PainterNode(QQuickPaintedItem *item)
- : m_item(item),
- m_engine(static_cast<QSGD3D12RenderContext *>(QQuickItemPrivate::get(item)->sceneGraphRenderContext())->engine()),
- m_texture(new QSGD3D12PainterTexture(m_engine)),
- m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4),
- m_dirtyGeometry(false),
- m_dirtyContents(false)
-{
- setGeometry(&m_geometry);
- m_material.setTexture(m_texture);
- setMaterial(&m_material);
-}
-
-QSGD3D12PainterNode::~QSGD3D12PainterNode()
-{
- delete m_texture;
-}
-
-void QSGD3D12PainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget)
-{
- // always QImage-based
-}
-
-void QSGD3D12PainterNode::setSize(const QSize &size)
-{
- if (m_size == size)
- return;
-
- m_size = size;
- m_dirtyGeometry = true;
-}
-
-void QSGD3D12PainterNode::setDirty(const QRect &dirtyRect)
-{
- m_dirtyRect = dirtyRect;
- m_dirtyContents = true;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12PainterNode::setOpaquePainting(bool)
-{
- // ignored
-}
-
-void QSGD3D12PainterNode::setLinearFiltering(bool linearFiltering)
-{
- m_material.setFiltering(linearFiltering ? QSGTexture::Linear : QSGTexture::Nearest);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12PainterNode::setMipmapping(bool)
-{
- // ### not yet
-}
-
-void QSGD3D12PainterNode::setSmoothPainting(bool s)
-{
- if (m_smoothPainting == s)
- return;
-
- m_smoothPainting = s;
- m_dirtyContents = true;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12PainterNode::setFillColor(const QColor &c)
-{
- if (m_fillColor == c)
- return;
-
- m_fillColor = c;
- m_dirtyContents = true;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12PainterNode::setContentsScale(qreal s)
-{
- if (m_contentsScale == s)
- return;
-
- m_contentsScale = s;
- m_dirtyContents = true;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12PainterNode::setFastFBOResizing(bool)
-{
- // nope
-}
-
-void QSGD3D12PainterNode::setTextureSize(const QSize &size)
-{
- if (m_textureSize == size)
- return;
-
- m_textureSize = size;
- m_dirtyGeometry = true;
-}
-
-QImage QSGD3D12PainterNode::toImage() const
-{
- return *m_texture->image();
-}
-
-void QSGD3D12PainterNode::update()
-{
- if (m_dirtyGeometry) {
- m_dirtyGeometry = false;
- QRectF src(0, 0, 1, 1);
- QRectF dst(QPointF(0, 0), m_size);
- QSGGeometry::updateTexturedRectGeometry(&m_geometry, dst, src);
- markDirty(DirtyGeometry);
- }
-
- QImage *img = m_texture->image();
- if (img->size() != m_textureSize) {
- *img = QImage(m_textureSize, QImage::Format_ARGB32_Premultiplied);
- img->fill(Qt::transparent);
- m_dirtyContents = true;
- }
-
- if (m_dirtyContents) {
- m_dirtyContents = false;
- if (!img->isNull()) {
- QRect dirtyRect = m_dirtyRect.isNull() ? QRect(QPoint(0, 0), m_size) : m_dirtyRect;
- QPainter painter;
- painter.begin(img);
- if (m_smoothPainting)
- painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
-
- QRect clipRect;
- QRect dirtyTextureRect;
-
- if (m_contentsScale == 1) {
- float scaleX = m_textureSize.width() / (float) m_size.width();
- float scaleY = m_textureSize.height() / (float) m_size.height();
- painter.scale(scaleX, scaleY);
- clipRect = dirtyRect;
- dirtyTextureRect = QRectF(dirtyRect.x() * scaleX,
- dirtyRect.y() * scaleY,
- dirtyRect.width() * scaleX,
- dirtyRect.height() * scaleY).toAlignedRect();
- } else {
- painter.scale(m_contentsScale, m_contentsScale);
- QRect sclip(qFloor(dirtyRect.x() / m_contentsScale),
- qFloor(dirtyRect.y() / m_contentsScale),
- qCeil(dirtyRect.width() / m_contentsScale + dirtyRect.x() / m_contentsScale
- - qFloor(dirtyRect.x() / m_contentsScale)),
- qCeil(dirtyRect.height() / m_contentsScale + dirtyRect.y() / m_contentsScale
- - qFloor(dirtyRect.y() / m_contentsScale)));
- clipRect = sclip;
- dirtyTextureRect = dirtyRect;
- }
-
- // only clip if we were originally updating only a subrect
- if (!m_dirtyRect.isNull())
- painter.setClipRect(clipRect);
-
- painter.setCompositionMode(QPainter::CompositionMode_Source);
- painter.fillRect(clipRect, m_fillColor);
- painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
-
- m_item->paint(&painter);
- painter.end();
-
- m_texture->dirty = dirtyTextureRect;
- }
- m_dirtyRect = QRect();
- }
-}
-
-QSGTexture *QSGD3D12PainterNode::texture() const
-{
- return m_texture;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h
deleted file mode 100644
index 7f4842b3a6..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12PAINTERNODE_P_H
-#define QSGD3D12PAINTERNODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgadaptationlayer_p.h>
-#include "qsgd3d12texture_p.h"
-#include "qsgd3d12builtinmaterials_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-
-class QSGD3D12PainterTexture : public QSGD3D12Texture
-{
-public:
- QSGD3D12PainterTexture(QSGD3D12Engine *engine);
-
- void bind() override;
- bool hasAlphaChannel() const override { return true; }
-
- QImage *image() { return &m_image; }
-
- QRect dirty;
-
-private:
- QSize lastSize;
-};
-
-class QSGD3D12PainterNode : public QSGPainterNode
-{
-public:
- QSGD3D12PainterNode(QQuickPaintedItem *item);
- ~QSGD3D12PainterNode();
-
- void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override;
- void setSize(const QSize &size) override;
- void setDirty(const QRect &dirtyRect = QRect()) override;
- void setOpaquePainting(bool opaque) override;
- void setLinearFiltering(bool linearFiltering) override;
- void setMipmapping(bool mipmapping) override;
- void setSmoothPainting(bool s) override;
- void setFillColor(const QColor &c) override;
- void setContentsScale(qreal s) override;
- void setFastFBOResizing(bool dynamic) override;
- void setTextureSize(const QSize &size) override;
-
- QImage toImage() const override;
- void update() override;
- QSGTexture *texture() const override;
-
-private:
- QQuickPaintedItem *m_item;
- QSGD3D12Engine *m_engine;
- QSGD3D12PainterTexture *m_texture;
- QSize m_size;
- QSize m_textureSize;
- float m_contentsScale = 1;
- bool m_smoothPainting = false;
- QColor m_fillColor = Qt::transparent;
- QRect m_dirtyRect;
-
- QSGGeometry m_geometry;
- QSGD3D12TextureMaterial m_material;
-
- uint m_dirtyGeometry : 1;
- uint m_dirtyContents : 1;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12PAINTERNODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp
deleted file mode 100644
index 1f01c440e5..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12publicnodes_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QSGD3D12RectangleNode::QSGD3D12RectangleNode()
- : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
-{
- QSGGeometry::updateRectGeometry(&m_geometry, QRectF());
- setMaterial(&m_material);
- setGeometry(&m_geometry);
-#ifdef QSG_RUNTIME_DESCRIPTION
- qsgnode_set_description(this, QLatin1String("rectangle"));
-#endif
-}
-
-void QSGD3D12RectangleNode::setRect(const QRectF &rect)
-{
- QSGGeometry::updateRectGeometry(&m_geometry, rect);
- markDirty(QSGNode::DirtyGeometry);
-}
-
-QRectF QSGD3D12RectangleNode::rect() const
-{
- const QSGGeometry::Point2D *pts = m_geometry.vertexDataAsPoint2D();
- return QRectF(pts[0].x,
- pts[0].y,
- pts[3].x - pts[0].x,
- pts[3].y - pts[0].y);
-}
-
-void QSGD3D12RectangleNode::setColor(const QColor &color)
-{
- if (color != m_material.color()) {
- m_material.setColor(color);
- markDirty(QSGNode::DirtyMaterial);
- }
-}
-
-QColor QSGD3D12RectangleNode::color() const
-{
- return m_material.color();
-}
-
-QSGD3D12ImageNode::QSGD3D12ImageNode()
- : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4),
- m_texCoordMode(QSGD3D12ImageNode::NoTransform),
- m_isAtlasTexture(false),
- m_ownsTexture(false)
-{
- setGeometry(&m_geometry);
- setMaterial(&m_material);
- m_material.setMipmapFiltering(QSGTexture::None);
-#ifdef QSG_RUNTIME_DESCRIPTION
- qsgnode_set_description(this, QLatin1String("image"));
-#endif
-}
-
-QSGD3D12ImageNode::~QSGD3D12ImageNode()
-{
- if (m_ownsTexture)
- delete m_material.texture();
-}
-
-void QSGD3D12ImageNode::setFiltering(QSGTexture::Filtering filtering)
-{
- if (m_material.filtering() == filtering)
- return;
-
- m_material.setFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-QSGTexture::Filtering QSGD3D12ImageNode::filtering() const
-{
- return m_material.filtering();
-}
-
-void QSGD3D12ImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)
-{
- if (m_material.mipmapFiltering() == filtering)
- return;
-
- m_material.setMipmapFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-QSGTexture::Filtering QSGD3D12ImageNode::mipmapFiltering() const
-{
- return m_material.mipmapFiltering();
-}
-
-void QSGD3D12ImageNode::setRect(const QRectF &r)
-{
- if (m_rect == r)
- return;
-
- m_rect = r;
- QSGImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
- markDirty(DirtyGeometry);
-}
-
-QRectF QSGD3D12ImageNode::rect() const
-{
- return m_rect;
-}
-
-void QSGD3D12ImageNode::setSourceRect(const QRectF &r)
-{
- if (m_sourceRect == r)
- return;
-
- m_sourceRect = r;
- QSGImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
- markDirty(DirtyGeometry);
-}
-
-QRectF QSGD3D12ImageNode::sourceRect() const
-{
- return m_sourceRect;
-}
-
-void QSGD3D12ImageNode::setTexture(QSGTexture *texture)
-{
- Q_ASSERT(texture);
-
- if (m_ownsTexture)
- delete m_material.texture();
-
- m_material.setTexture(texture);
- QSGImageNode::rebuildGeometry(&m_geometry, texture, m_rect, m_sourceRect, m_texCoordMode);
-
- DirtyState dirty = DirtyMaterial;
- const bool wasAtlas = m_isAtlasTexture;
- m_isAtlasTexture = texture->isAtlasTexture();
- if (wasAtlas || m_isAtlasTexture)
- dirty |= DirtyGeometry;
-
- markDirty(dirty);
-}
-
-QSGTexture *QSGD3D12ImageNode::texture() const
-{
- return m_material.texture();
-}
-
-void QSGD3D12ImageNode::setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)
-{
- if (m_texCoordMode == mode)
- return;
-
- m_texCoordMode = mode;
- QSGImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
- markDirty(DirtyMaterial);
-}
-
-QSGD3D12ImageNode::TextureCoordinatesTransformMode QSGD3D12ImageNode::textureCoordinatesTransform() const
-{
- return m_texCoordMode;
-}
-
-void QSGD3D12ImageNode::setOwnsTexture(bool owns)
-{
- m_ownsTexture = owns;
-}
-
-bool QSGD3D12ImageNode::ownsTexture() const
-{
- return m_ownsTexture;
-}
-
-QSGD3D12NinePatchNode::QSGD3D12NinePatchNode()
- : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
-{
- m_geometry.setDrawingMode(QSGGeometry::DrawTriangleStrip);
- setGeometry(&m_geometry);
- setMaterial(&m_material);
-}
-
-QSGD3D12NinePatchNode::~QSGD3D12NinePatchNode()
-{
- delete m_material.texture();
-}
-
-void QSGD3D12NinePatchNode::setTexture(QSGTexture *texture)
-{
- delete m_material.texture();
- m_material.setTexture(texture);
-}
-
-void QSGD3D12NinePatchNode::setBounds(const QRectF &bounds)
-{
- m_bounds = bounds;
-}
-
-void QSGD3D12NinePatchNode::setDevicePixelRatio(qreal ratio)
-{
- m_devicePixelRatio = ratio;
-}
-
-void QSGD3D12NinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom)
-{
- m_padding = QVector4D(left, top, right, bottom);
-}
-
-void QSGD3D12NinePatchNode::update()
-{
- QSGNinePatchNode::rebuildGeometry(m_material.texture(), &m_geometry, m_padding, m_bounds, m_devicePixelRatio);
- markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h
deleted file mode 100644
index 6150083aaf..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12PUBLICNODES_P_H
-#define QSGD3D12PUBLICNODES_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/qsgrectanglenode.h>
-#include <QtQuick/qsgimagenode.h>
-#include <QtQuick/qsgninepatchnode.h>
-#include "qsgd3d12builtinmaterials_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12RectangleNode : public QSGRectangleNode
-{
-public:
- QSGD3D12RectangleNode();
-
- void setRect(const QRectF &rect) override;
- QRectF rect() const override;
-
- void setColor(const QColor &color) override;
- QColor color() const override;
-
-private:
- QSGGeometry m_geometry;
- QSGD3D12FlatColorMaterial m_material;
-};
-
-class QSGD3D12ImageNode : public QSGImageNode
-{
-public:
- QSGD3D12ImageNode();
- ~QSGD3D12ImageNode();
-
- void setRect(const QRectF &rect) override;
- QRectF rect() const override;
-
- void setSourceRect(const QRectF &r) override;
- QRectF sourceRect() const override;
-
- void setTexture(QSGTexture *texture) override;
- QSGTexture *texture() const override;
-
- void setFiltering(QSGTexture::Filtering filtering) override;
- QSGTexture::Filtering filtering() const override;
-
- void setMipmapFiltering(QSGTexture::Filtering filtering) override;
- QSGTexture::Filtering mipmapFiltering() const override;
-
- void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode) override;
- TextureCoordinatesTransformMode textureCoordinatesTransform() const override;
-
- void setOwnsTexture(bool owns) override;
- bool ownsTexture() const override;
-
-private:
- QSGGeometry m_geometry;
- QSGD3D12TextureMaterial m_material;
- QRectF m_rect;
- QRectF m_sourceRect;
- TextureCoordinatesTransformMode m_texCoordMode;
- uint m_isAtlasTexture : 1;
- uint m_ownsTexture : 1;
-};
-
-class QSGD3D12NinePatchNode : public QSGNinePatchNode
-{
-public:
- QSGD3D12NinePatchNode();
- ~QSGD3D12NinePatchNode();
-
- void setTexture(QSGTexture *texture) override;
- void setBounds(const QRectF &bounds) override;
- void setDevicePixelRatio(qreal ratio) override;
- void setPadding(qreal left, qreal top, qreal right, qreal bottom) override;
- void update() override;
-
-private:
- QSGGeometry m_geometry;
- QSGD3D12TextureMaterial m_material;
- QRectF m_bounds;
- qreal m_devicePixelRatio;
- QVector4D m_padding;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp
deleted file mode 100644
index 48693207c6..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12renderer_p.h"
-#include "qsgd3d12texture_p.h"
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(render)
-
-QSGD3D12RenderContext::QSGD3D12RenderContext(QSGContext *ctx)
- : QSGRenderContext(ctx)
-{
-}
-
-bool QSGD3D12RenderContext::isValid() const
-{
- // The render thread sets an engine when it starts up and resets when it
- // quits. The rc is initialized and functional between those two points,
- // regardless of any calls to invalidate(). See setEngine().
- return m_engine != nullptr;
-}
-
-void QSGD3D12RenderContext::initialize(const InitParams *)
-{
- if (m_initialized)
- return;
-
- m_initialized = true;
- emit initialized();
-}
-
-void QSGD3D12RenderContext::invalidate()
-{
- if (!m_initialized)
- return;
-
- m_initialized = false;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug("rendercontext invalidate engine %p, %d/%d/%d", m_engine,
- m_texturesToDelete.count(), m_textures.count(), m_fontEnginesToClean.count());
-
- qDeleteAll(m_texturesToDelete);
- m_texturesToDelete.clear();
-
- qDeleteAll(m_textures);
- m_textures.clear();
-
- for (QSet<QFontEngine *>::const_iterator it = m_fontEnginesToClean.constBegin(),
- end = m_fontEnginesToClean.constEnd(); it != end; ++it) {
- (*it)->clearGlyphCache(m_engine);
- if (!(*it)->ref.deref())
- delete *it;
- }
- m_fontEnginesToClean.clear();
-
- m_sg->renderContextInvalidated(this);
- emit invalidated();
-}
-
-QSGTexture *QSGD3D12RenderContext::createTexture(const QImage &image, uint flags) const
-{
- Q_ASSERT(m_engine);
- QSGD3D12Texture *t = new QSGD3D12Texture(m_engine);
- t->create(image, flags);
- return t;
-}
-
-QSGRenderer *QSGD3D12RenderContext::createRenderer()
-{
- return new QSGD3D12Renderer(this);
-}
-
-int QSGD3D12RenderContext::maxTextureSize() const
-{
- return 16384; // D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION
-}
-
-void QSGD3D12RenderContext::renderNextFrame(QSGRenderer *renderer, uint fbo)
-{
- static_cast<QSGD3D12Renderer *>(renderer)->renderScene(fbo);
-}
-
-void QSGD3D12RenderContext::setEngine(QSGD3D12Engine *engine)
-{
- if (m_engine == engine)
- return;
-
- m_engine = engine;
-
- if (m_engine)
- initialize(nullptr);
-}
-
-QSGRendererInterface::GraphicsApi QSGD3D12RenderContext::graphicsApi() const
-{
- return Direct3D12;
-}
-
-void *QSGD3D12RenderContext::getResource(QQuickWindow *window, Resource resource) const
-{
- if (!m_engine) {
- qWarning("getResource: No D3D12 engine available yet (window not exposed?)");
- return nullptr;
- }
- // window can be ignored since the rendercontext and engine are both per window
- return m_engine->getResource(window, resource);
-}
-
-QSGRendererInterface::ShaderType QSGD3D12RenderContext::shaderType() const
-{
- return HLSL;
-}
-
-QSGRendererInterface::ShaderCompilationTypes QSGD3D12RenderContext::shaderCompilationType() const
-{
- return RuntimeCompilation | OfflineCompilation;
-}
-
-QSGRendererInterface::ShaderSourceTypes QSGD3D12RenderContext::shaderSourceType() const
-{
- return ShaderSourceString | ShaderSourceFile | ShaderByteCode;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h
deleted file mode 100644
index c555c0808e..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12RENDERCONTEXT_P_H
-#define QSGD3D12RENDERCONTEXT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgcontext_p.h>
-#include <qsgrendererinterface.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-
-class QSGD3D12RenderContext : public QSGRenderContext, public QSGRendererInterface
-{
-public:
- QSGD3D12RenderContext(QSGContext *ctx);
- bool isValid() const override;
- void initialize(const InitParams *params) override;
- void invalidate() override;
- void renderNextFrame(QSGRenderer *renderer, uint fbo) override;
- QSGTexture *createTexture(const QImage &image, uint flags) const override;
- QSGRenderer *createRenderer() override;
- int maxTextureSize() const override;
-
- void setEngine(QSGD3D12Engine *engine);
- QSGD3D12Engine *engine() { return m_engine; }
-
- // QSGRendererInterface
- GraphicsApi graphicsApi() const override;
- void *getResource(QQuickWindow *window, Resource resource) const override;
- ShaderType shaderType() const override;
- ShaderCompilationTypes shaderCompilationType() const override;
- ShaderSourceTypes shaderSourceType() const override;
-
-private:
- QSGD3D12Engine *m_engine = nullptr;
- bool m_initialized = false;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12RENDERCONTEXT_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp
deleted file mode 100644
index c38c616ae6..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp
+++ /dev/null
@@ -1,785 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12renderer_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include <private/qsgnodeupdater_p.h>
-#include <private/qsgrendernode_p.h>
-
-#include "vs_stencilclip.hlslh"
-#include "ps_stencilclip.hlslh"
-
-//#define I_LIKE_STENCIL
-
-QT_BEGIN_NAMESPACE
-
-#define QSGNODE_TRAVERSE(NODE) for (QSGNode *child = NODE->firstChild(); child; child = child->nextSibling())
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(build)
-DECLARE_DEBUG_VAR(change)
-DECLARE_DEBUG_VAR(render)
-
-class DummyUpdater : public QSGNodeUpdater
-{
-public:
- void updateState(QSGNode *) { };
-};
-
-QSGD3D12Renderer::QSGD3D12Renderer(QSGRenderContext *context)
- : QSGRenderer(context),
- m_vboData(1024),
- m_iboData(256),
- m_cboData(4096),
- m_renderList(16)
-{
- setNodeUpdater(new DummyUpdater);
-}
-
-QSGD3D12Renderer::~QSGD3D12Renderer()
-{
- if (m_engine) {
- m_engine->releaseBuffer(m_vertexBuf);
- m_engine->releaseBuffer(m_indexBuf);
- m_engine->releaseBuffer(m_constantBuf);
- }
-}
-
-void QSGD3D12Renderer::renderScene(GLuint fboId)
-{
- m_renderTarget = fboId;
-
- struct DummyBindable : public QSGBindable {
- void bind() const { }
- } bindable;
-
- QSGRenderer::renderScene(bindable); // calls back render()
-}
-
-// Search through the node set and remove nodes that are descendants of other
-// nodes in the same set.
-static QSet<QSGNode *> qsg_removeDescendants(const QSet<QSGNode *> &nodes, QSGRootNode *root)
-{
- QSet<QSGNode *> result = nodes;
- for (QSGNode *node : nodes) {
- QSGNode *n = node;
- while (n != root) {
- if (n != node && result.contains(n)) {
- result.remove(node);
- break;
- }
- n = n->parent();
- }
- }
- return result;
-}
-
-void QSGD3D12Renderer::updateMatrices(QSGNode *node, QSGTransformNode *xform)
-{
- if (node->isSubtreeBlocked())
- return;
-
- if (node->type() == QSGNode::TransformNodeType) {
- QSGTransformNode *tn = static_cast<QSGTransformNode *>(node);
- if (xform)
- tn->setCombinedMatrix(xform->combinedMatrix() * tn->matrix());
- else
- tn->setCombinedMatrix(tn->matrix());
- QSGNODE_TRAVERSE(node)
- updateMatrices(child, tn);
- } else {
- if (node->type() == QSGNode::GeometryNodeType || node->type() == QSGNode::ClipNodeType) {
- m_nodeDirtyMap[node] |= QSGD3D12MaterialRenderState::DirtyMatrix;
- QSGBasicGeometryNode *gnode = static_cast<QSGBasicGeometryNode *>(node);
- const QMatrix4x4 *newMatrix = xform ? &xform->combinedMatrix() : nullptr;
- // NB the newMatrix ptr is usually the same as before as it just
- // references the transform node's own matrix.
- gnode->setRendererMatrix(newMatrix);
- }
- QSGNODE_TRAVERSE(node)
- updateMatrices(child, xform);
- }
-}
-
-void QSGD3D12Renderer::updateOpacities(QSGNode *node, float inheritedOpacity)
-{
- if (node->isSubtreeBlocked())
- return;
-
- if (node->type() == QSGNode::OpacityNodeType) {
- QSGOpacityNode *on = static_cast<QSGOpacityNode *>(node);
- float combined = inheritedOpacity * on->opacity();
- on->setCombinedOpacity(combined);
- QSGNODE_TRAVERSE(node)
- updateOpacities(child, combined);
- } else {
- if (node->type() == QSGNode::GeometryNodeType) {
- m_nodeDirtyMap[node] |= QSGD3D12MaterialRenderState::DirtyOpacity;
- QSGGeometryNode *gn = static_cast<QSGGeometryNode *>(node);
- gn->setInheritedOpacity(inheritedOpacity);
- }
- QSGNODE_TRAVERSE(node)
- updateOpacities(child, inheritedOpacity);
- }
-}
-
-void QSGD3D12Renderer::buildRenderList(QSGNode *node, QSGClipNode *clip)
-{
- if (node->isSubtreeBlocked())
- return;
-
- if (node->type() == QSGNode::GeometryNodeType || node->type() == QSGNode::ClipNodeType) {
- QSGBasicGeometryNode *gn = static_cast<QSGBasicGeometryNode *>(node);
- QSGGeometry *g = gn->geometry();
-
- Element e;
- e.node = gn;
-
- if (g->vertexCount() > 0) {
- e.vboOffset = m_vboData.size();
- const int vertexSize = g->sizeOfVertex() * g->vertexCount();
- m_vboData.resize(m_vboData.size() + vertexSize);
- memcpy(m_vboData.data() + e.vboOffset, g->vertexData(), vertexSize);
- }
-
- if (g->indexCount() > 0) {
- e.iboOffset = m_iboData.size();
- e.iboStride = g->sizeOfIndex();
- const int indexSize = e.iboStride * g->indexCount();
- m_iboData.resize(m_iboData.size() + indexSize);
- memcpy(m_iboData.data() + e.iboOffset, g->indexData(), indexSize);
- }
-
- e.cboOffset = m_cboData.size();
- if (node->type() == QSGNode::GeometryNodeType) {
- QSGD3D12Material *m = static_cast<QSGD3D12Material *>(static_cast<QSGGeometryNode *>(node)->activeMaterial());
- e.cboSize = m->constantBufferSize();
- } else {
- // Stencil-based clipping needs a 4x4 matrix.
- e.cboSize = QSGD3D12Engine::alignedConstantBufferSize(16 * sizeof(float));
- }
- m_cboData.resize(m_cboData.size() + e.cboSize);
-
- m_renderList.add(e);
-
- gn->setRendererClipList(clip);
- if (node->type() == QSGNode::ClipNodeType)
- clip = static_cast<QSGClipNode *>(node);
- } else if (node->type() == QSGNode::RenderNodeType) {
- QSGRenderNode *rn = static_cast<QSGRenderNode *>(node);
- Element e;
- e.node = rn;
- m_renderList.add(e);
- }
-
- QSGNODE_TRAVERSE(node)
- buildRenderList(child, clip);
-}
-
-void QSGD3D12Renderer::render()
-{
- QSGD3D12RenderContext *rc = static_cast<QSGD3D12RenderContext *>(context());
- m_engine = rc->engine();
- if (!m_layerRenderer)
- m_engine->beginFrame();
- else
- m_engine->beginLayer();
-
- m_activeScissorRect = QRect();
-
- if (m_rebuild) {
- m_rebuild = false;
-
- m_dirtyTransformNodes.clear();
- m_dirtyTransformNodes.insert(rootNode());
- m_dirtyOpacityNodes.clear();
- m_dirtyOpacityNodes.insert(rootNode());
-
- m_renderList.reset();
- m_vboData.reset();
- m_iboData.reset();
- m_cboData.reset();
-
- buildRenderList(rootNode(), nullptr);
-
- if (!m_vertexBuf)
- m_vertexBuf = m_engine->genBuffer();
- m_engine->resetBuffer(m_vertexBuf, m_vboData.data(), m_vboData.size());
-
- if (!m_constantBuf)
- m_constantBuf = m_engine->genBuffer();
- m_engine->resetBuffer(m_constantBuf, m_cboData.data(), m_cboData.size());
-
- if (m_iboData.size()) {
- if (!m_indexBuf)
- m_indexBuf = m_engine->genBuffer();
- m_engine->resetBuffer(m_indexBuf, m_iboData.data(), m_iboData.size());
- } else if (m_indexBuf) {
- m_engine->releaseBuffer(m_indexBuf);
- m_indexBuf = 0;
- }
-
- if (Q_UNLIKELY(debug_build())) {
- qDebug("renderList: %d elements in total", m_renderList.size());
- for (int i = 0; i < m_renderList.size(); ++i) {
- const Element &e = m_renderList.at(i);
- qDebug() << " - " << e.vboOffset << e.iboOffset << e.cboOffset << e.cboSize << e.node;
- }
- }
- }
-
- const QRect devRect = deviceRect();
- m_projectionChangedDueToDeviceSize = devRect != m_lastDeviceRect;
- if (m_projectionChangedDueToDeviceSize)
- m_lastDeviceRect = devRect;
-
- if (m_dirtyTransformNodes.size()) {
- const QSet<QSGNode *> subTreeRoots = qsg_removeDescendants(m_dirtyTransformNodes, rootNode());
- for (QSGNode *node : subTreeRoots) {
- // First find the parent transform so we have the accumulated
- // matrix up until this point.
- QSGTransformNode *xform = 0;
- QSGNode *n = node;
- if (n->type() == QSGNode::TransformNodeType)
- n = node->parent();
- while (n != rootNode() && n->type() != QSGNode::TransformNodeType)
- n = n->parent();
- if (n != rootNode())
- xform = static_cast<QSGTransformNode *>(n);
-
- // Then update in the subtree
- updateMatrices(node, xform);
- }
- }
-
- if (m_dirtyOpacityNodes.size()) {
- const QSet<QSGNode *> subTreeRoots = qsg_removeDescendants(m_dirtyOpacityNodes, rootNode());
- for (QSGNode *node : subTreeRoots) {
- float opacity = 1.0f;
- QSGNode *n = node;
- if (n->type() == QSGNode::OpacityNodeType)
- n = node->parent();
- while (n != rootNode() && n->type() != QSGNode::OpacityNodeType)
- n = n->parent();
- if (n != rootNode())
- opacity = static_cast<QSGOpacityNode *>(n)->combinedOpacity();
-
- updateOpacities(node, opacity);
- }
- m_dirtyOpaqueElements = true;
- }
-
- if (m_dirtyOpaqueElements) {
- m_dirtyOpaqueElements = false;
- m_opaqueElements.clear();
- m_opaqueElements.resize(m_renderList.size());
- for (int i = 0; i < m_renderList.size(); ++i) {
- const Element &e = m_renderList.at(i);
- if (e.node->type() == QSGNode::GeometryNodeType) {
- const QSGGeometryNode *gn = static_cast<QSGGeometryNode *>(e.node);
- if (gn->inheritedOpacity() > 0.999f && ((gn->activeMaterial()->flags() & QSGMaterial::Blending) == 0))
- m_opaqueElements.setBit(i);
- }
- // QSGRenderNodes are always treated as non-opaque
- }
- }
-
- // Build pipeline state and draw calls.
- renderElements();
-
- m_dirtyTransformNodes.clear();
- m_dirtyOpacityNodes.clear();
- m_dirtyOpaqueElements = false;
- m_nodeDirtyMap.clear();
-
- // Finalize buffers and execute commands.
- if (!m_layerRenderer)
- m_engine->endFrame();
- else
- m_engine->endLayer();
-}
-
-void QSGD3D12Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state)
-{
- // note that with DirtyNodeRemoved the window and all the graphics engine may already be gone
-
- if (Q_UNLIKELY(debug_change())) {
- QDebug debug = qDebug();
- debug << "dirty:";
- if (state & QSGNode::DirtyGeometry)
- debug << "Geometry";
- if (state & QSGNode::DirtyMaterial)
- debug << "Material";
- if (state & QSGNode::DirtyMatrix)
- debug << "Matrix";
- if (state & QSGNode::DirtyNodeAdded)
- debug << "Added";
- if (state & QSGNode::DirtyNodeRemoved)
- debug << "Removed";
- if (state & QSGNode::DirtyOpacity)
- debug << "Opacity";
- if (state & QSGNode::DirtySubtreeBlocked)
- debug << "SubtreeBlocked";
- if (state & QSGNode::DirtyForceUpdate)
- debug << "ForceUpdate";
-
- // when removed, some parts of the node could already have been destroyed
- // so don't debug it out.
- if (state & QSGNode::DirtyNodeRemoved)
- debug << (void *) node << node->type();
- else
- debug << node;
- }
-
- if (state & (QSGNode::DirtyNodeAdded
- | QSGNode::DirtyNodeRemoved
- | QSGNode::DirtySubtreeBlocked
- | QSGNode::DirtyGeometry
- | QSGNode::DirtyForceUpdate))
- m_rebuild = true;
-
- if (state & QSGNode::DirtyMatrix)
- m_dirtyTransformNodes << node;
-
- if (state & QSGNode::DirtyOpacity)
- m_dirtyOpacityNodes << node;
-
- if (state & QSGNode::DirtyMaterial)
- m_dirtyOpaqueElements = true;
-
- QSGRenderer::nodeChanged(node, state);
-}
-
-void QSGD3D12Renderer::renderElements()
-{
- m_engine->queueSetRenderTarget(m_renderTarget);
- m_engine->queueViewport(viewportRect());
- m_engine->queueClearRenderTarget(clearColor());
- m_engine->queueClearDepthStencil(1, 0, QSGD3D12Engine::ClearDepth | QSGD3D12Engine::ClearStencil);
-
- m_pipelineState.blend = m_freshPipelineState.blend = QSGD3D12PipelineState::BlendNone;
- m_pipelineState.depthEnable = m_freshPipelineState.depthEnable = true;
- m_pipelineState.depthWrite = m_freshPipelineState.depthWrite = true;
-
- // First do opaque...
- // The algorithm is quite simple. We traverse the list back-to-front, and
- // for every item we start a second traversal and draw all elements which
- // have identical material. Then we clear the bit for this in the rendered
- // list so we don't draw it again when we come to that index.
- QBitArray rendered = m_opaqueElements;
- for (int i = m_renderList.size() - 1; i >= 0; --i) {
- if (rendered.testBit(i)) {
- renderElement(i);
- for (int j = i - 1; j >= 0; --j) {
- if (rendered.testBit(j)) {
- const QSGGeometryNode *gni = static_cast<QSGGeometryNode *>(m_renderList.at(i).node);
- const QSGGeometryNode *gnj = static_cast<QSGGeometryNode *>(m_renderList.at(j).node);
- if (gni->clipList() == gnj->clipList()
- && gni->inheritedOpacity() == gnj->inheritedOpacity()
- && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode()
- && gni->geometry()->attributes() == gnj->geometry()->attributes()) {
- const QSGMaterial *ami = gni->activeMaterial();
- const QSGMaterial *amj = gnj->activeMaterial();
- if (ami->type() == amj->type()
- && ami->flags() == amj->flags()
- && ami->compare(amj) == 0) {
- renderElement(j);
- rendered.clearBit(j);
- }
- }
- }
- }
- }
- }
-
- m_pipelineState.blend = m_freshPipelineState.blend = QSGD3D12PipelineState::BlendPremul;
- m_pipelineState.depthWrite = m_freshPipelineState.depthWrite = false;
-
- // ...then the alpha ones
- for (int i = 0; i < m_renderList.size(); ++i) {
- if ((m_renderList.at(i).node->type() == QSGNode::GeometryNodeType && !m_opaqueElements.testBit(i))
- || m_renderList.at(i).node->type() == QSGNode::RenderNodeType)
- renderElement(i);
- }
-}
-
-struct RenderNodeState : public QSGRenderNode::RenderState
-{
- const QMatrix4x4 *projectionMatrix() const override { return m_projectionMatrix; }
- QRect scissorRect() const override { return m_scissorRect; }
- bool scissorEnabled() const override { return m_scissorEnabled; }
- int stencilValue() const override { return m_stencilValue; }
- bool stencilEnabled() const override { return m_stencilEnabled; }
- const QRegion *clipRegion() const override { return nullptr; }
-
- const QMatrix4x4 *m_projectionMatrix;
- QRect m_scissorRect;
- bool m_scissorEnabled;
- int m_stencilValue;
- bool m_stencilEnabled;
-};
-
-void QSGD3D12Renderer::renderElement(int elementIndex)
-{
- Element &e = m_renderList.at(elementIndex);
- Q_ASSERT(e.node->type() == QSGNode::GeometryNodeType || e.node->type() == QSGNode::RenderNodeType);
-
- if (e.node->type() == QSGNode::RenderNodeType) {
- renderRenderNode(static_cast<QSGRenderNode *>(e.node), elementIndex);
- return;
- }
-
- if (e.vboOffset < 0)
- return;
-
- Q_ASSERT(e.cboOffset >= 0);
-
- const QSGGeometryNode *gn = static_cast<QSGGeometryNode *>(e.node);
- if (Q_UNLIKELY(debug_render()))
- qDebug() << "renderElement:" << elementIndex << gn << e.vboOffset << e.iboOffset << gn->inheritedOpacity() << gn->clipList();
-
- if (gn->inheritedOpacity() < 0.001f) // pretty much invisible, don't draw it
- return;
-
- // Update the QSGRenderer members which the materials will access.
- m_current_projection_matrix = projectionMatrix();
- const float scale = 1.0 / m_renderList.size();
- m_current_projection_matrix(2, 2) = scale;
- m_current_projection_matrix(2, 3) = 1.0f - (elementIndex + 1) * scale;
- m_current_model_view_matrix = gn->matrix() ? *gn->matrix() : QMatrix4x4();
- m_current_determinant = m_current_model_view_matrix.determinant();
- m_current_opacity = gn->inheritedOpacity();
-
- const QSGGeometry *g = gn->geometry();
- QSGD3D12Material *m = static_cast<QSGD3D12Material *>(gn->activeMaterial());
-
- if (m->type() != m_lastMaterialType) {
- m_pipelineState = m_freshPipelineState;
- m->preparePipeline(&m_pipelineState);
- }
-
- QSGD3D12MaterialRenderState::DirtyStates dirtyState = m_nodeDirtyMap.value(e.node);
-
- // After a rebuild everything in the cbuffer has to be updated.
- if (!e.cboPrepared) {
- e.cboPrepared = true;
- dirtyState = QSGD3D12MaterialRenderState::DirtyAll;
- }
-
- // DirtyMatrix does not include projection matrix changes that can arise
- // due to changing the render target's size (and there is no rebuild).
- // Accommodate for this.
- if (m_projectionChangedDueToDeviceSize)
- dirtyState |= QSGD3D12MaterialRenderState::DirtyMatrix;
-
- quint8 *cboPtr = nullptr;
- if (e.cboSize > 0)
- cboPtr = m_cboData.data() + e.cboOffset;
-
- if (Q_UNLIKELY(debug_render()))
- qDebug() << "dirty state for" << e.node << "is" << dirtyState;
-
- QSGD3D12Material::ExtraState extraState;
- QSGD3D12Material::UpdateResults updRes = m->updatePipeline(state(dirtyState),
- &m_pipelineState,
- &extraState,
- cboPtr);
-
- if (updRes.testFlag(QSGD3D12Material::UpdatedConstantBuffer))
- m_engine->markBufferDirty(m_constantBuf, e.cboOffset, e.cboSize);
-
- if (updRes.testFlag(QSGD3D12Material::UpdatedBlendFactor))
- m_engine->queueSetBlendFactor(extraState.blendFactor);
-
- setInputLayout(g, &m_pipelineState);
-
- m_lastMaterialType = m->type();
-
- setupClipping(gn->clipList(), elementIndex);
-
- // ### Lines and points with sizes other than 1 have to be implemented in some other way. Just ignore for now.
- if (g->drawingMode() == QSGGeometry::DrawLineStrip || g->drawingMode() == QSGGeometry::DrawLines) {
- if (g->lineWidth() != 1.0f)
- qWarning("QSGD3D12Renderer: Line widths other than 1 are not supported by this renderer");
- } else if (g->drawingMode() == QSGGeometry::DrawPoints) {
- if (g->lineWidth() != 1.0f)
- qWarning("QSGD3D12Renderer: Point sprites are not supported by this renderer");
- }
-
- m_engine->finalizePipeline(m_pipelineState);
-
- queueDrawCall(g, e);
-}
-
-void QSGD3D12Renderer::setInputLayout(const QSGGeometry *g, QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->inputElementCount = g->attributeCount();
- const QSGGeometry::Attribute *attrs = g->attributes();
- quint32 offset = 0;
- for (int i = 0; i < g->attributeCount(); ++i) {
- QSGD3D12InputElement &ie(pipelineState->inputElements[i]);
- static const char *semanticNames[] = { "UNKNOWN", "POSITION", "COLOR", "TEXCOORD", "TEXCOORD", "TEXCOORD" };
- static const int semanticIndices[] = { 0, 0, 0, 0, 1, 2 };
- const int semantic = attrs[i].attributeType;
- Q_ASSERT(semantic >= 1 && semantic < _countof(semanticNames));
- const int tupleSize = attrs[i].tupleSize;
- ie.semanticName = semanticNames[semantic];
- ie.semanticIndex = semanticIndices[semantic];
- ie.offset = offset;
- int bytesPerTuple = 0;
- ie.format = QSGD3D12Engine::toDXGIFormat(QSGGeometry::Type(attrs[i].type), tupleSize, &bytesPerTuple);
- if (ie.format == FmtUnknown)
- qFatal("QSGD3D12Renderer: unsupported tuple size for attribute type 0x%x", attrs[i].type);
- offset += bytesPerTuple;
- // There is one buffer with interleaved data so the slot is always 0.
- ie.slot = 0;
- }
-}
-
-void QSGD3D12Renderer::queueDrawCall(const QSGGeometry *g, const QSGD3D12Renderer::Element &e)
-{
- QSGD3D12Engine::DrawParams dp;
- dp.mode = QSGGeometry::DrawingMode(g->drawingMode());
- dp.vertexBuf = m_vertexBuf;
- dp.constantBuf = m_constantBuf;
- dp.vboOffset = e.vboOffset;
- dp.vboSize = g->vertexCount() * g->sizeOfVertex();
- dp.vboStride = g->sizeOfVertex();
- dp.cboOffset = e.cboOffset;
-
- if (e.iboOffset >= 0) {
- const QSGGeometry::Type indexType = QSGGeometry::Type(g->indexType());
- const QSGD3D12Format indexFormat = QSGD3D12Engine::toDXGIFormat(indexType);
- if (indexFormat == FmtUnknown)
- qFatal("QSGD3D12Renderer: unsupported index type 0x%x", indexType);
- dp.count = g->indexCount();
- dp.indexBuf = m_indexBuf;
- dp.startIndexIndex = e.iboOffset / e.iboStride;
- dp.indexFormat = indexFormat;
- } else {
- dp.count = g->vertexCount();
- }
-
- m_engine->queueDraw(dp);
-}
-
-void QSGD3D12Renderer::setupClipping(const QSGClipNode *clip, int elementIndex)
-{
- const QRect devRect = deviceRect();
- QRect scissorRect;
- int clipTypes = 0;
- quint32 stencilValue = 0;
-
- while (clip) {
- QMatrix4x4 m = projectionMatrix();
- if (clip->matrix())
- m *= *clip->matrix();
-
-#ifndef I_LIKE_STENCIL
- const bool isRectangleWithNoPerspective = clip->isRectangular()
- && qFuzzyIsNull(m(3, 0)) && qFuzzyIsNull(m(3, 1));
- const bool noRotate = qFuzzyIsNull(m(0, 1)) && qFuzzyIsNull(m(1, 0));
- const bool isRotate90 = qFuzzyIsNull(m(0, 0)) && qFuzzyIsNull(m(1, 1));
-
- if (isRectangleWithNoPerspective && (noRotate || isRotate90)) {
- QRectF bbox = clip->clipRect();
- float invW = 1.0f / m(3, 3);
- float fx1, fy1, fx2, fy2;
- if (noRotate) {
- fx1 = (bbox.left() * m(0, 0) + m(0, 3)) * invW;
- fy1 = (bbox.bottom() * m(1, 1) + m(1, 3)) * invW;
- fx2 = (bbox.right() * m(0, 0) + m(0, 3)) * invW;
- fy2 = (bbox.top() * m(1, 1) + m(1, 3)) * invW;
- } else {
- Q_ASSERT(isRotate90);
- fx1 = (bbox.bottom() * m(0, 1) + m(0, 3)) * invW;
- fy1 = (bbox.left() * m(1, 0) + m(1, 3)) * invW;
- fx2 = (bbox.top() * m(0, 1) + m(0, 3)) * invW;
- fy2 = (bbox.right() * m(1, 0) + m(1, 3)) * invW;
- }
-
- if (fx1 > fx2)
- qSwap(fx1, fx2);
- if (fy1 > fy2)
- qSwap(fy1, fy2);
-
- int ix1 = qRound((fx1 + 1) * devRect.width() * 0.5f);
- int iy1 = qRound((fy1 + 1) * devRect.height() * 0.5f);
- int ix2 = qRound((fx2 + 1) * devRect.width() * 0.5f);
- int iy2 = qRound((fy2 + 1) * devRect.height() * 0.5f);
-
- if (!(clipTypes & ClipScissor)) {
- scissorRect = QRect(ix1, devRect.height() - iy2, ix2 - ix1, iy2 - iy1);
- clipTypes |= ClipScissor;
- } else {
- scissorRect &= QRect(ix1, devRect.height() - iy2, ix2 - ix1, iy2 - iy1);
- }
- } else
-#endif
- {
- clipTypes |= ClipStencil;
- renderStencilClip(clip, elementIndex, m, stencilValue);
- }
-
- clip = clip->clipList();
- }
-
- setScissor((clipTypes & ClipScissor) ? scissorRect : viewportRect());
-
- if (clipTypes & ClipStencil) {
- m_pipelineState.stencilEnable = true;
- m_engine->queueSetStencilRef(stencilValue);
- m_currentStencilValue = stencilValue;
- } else {
- m_pipelineState.stencilEnable = false;
- m_currentStencilValue = 0;
- }
-
- m_currentClipTypes = clipTypes;
-}
-
-void QSGD3D12Renderer::setScissor(const QRect &r)
-{
- if (m_activeScissorRect == r)
- return;
-
- m_activeScissorRect = r;
- m_engine->queueScissor(r);
-}
-
-void QSGD3D12Renderer::renderStencilClip(const QSGClipNode *clip, int elementIndex,
- const QMatrix4x4 &m, quint32 &stencilValue)
-{
- QSGD3D12PipelineState sps;
- sps.shaders.vs = g_VS_StencilClip;
- sps.shaders.vsSize = sizeof(g_VS_StencilClip);
- sps.shaders.ps = g_PS_StencilClip;
- sps.shaders.psSize = sizeof(g_PS_StencilClip);
-
- m_engine->queueClearDepthStencil(1, 0, QSGD3D12Engine::ClearStencil);
- sps.stencilEnable = true;
- sps.colorWrite = false;
- sps.depthWrite = false;
-
- sps.stencilFunc = QSGD3D12PipelineState::CompareEqual;
- sps.stencilFailOp = QSGD3D12PipelineState::StencilKeep;
- sps.stencilDepthFailOp = QSGD3D12PipelineState::StencilKeep;
- sps.stencilPassOp = QSGD3D12PipelineState::StencilIncr;
-
- m_engine->queueSetStencilRef(stencilValue);
-
- int clipIndex = elementIndex;
- while (m_renderList.at(--clipIndex).node != clip) {
- Q_ASSERT(clipIndex >= 0);
- }
- const Element &ce = m_renderList.at(clipIndex);
- Q_ASSERT(ce.node == clip);
-
- const QSGGeometry *g = clip->geometry();
- Q_ASSERT(g->attributeCount() == 1);
- Q_ASSERT(g->attributes()[0].tupleSize == 2);
- Q_ASSERT(g->attributes()[0].type == QSGGeometry::FloatType);
-
- setInputLayout(g, &sps);
- m_engine->finalizePipeline(sps);
-
- Q_ASSERT(ce.cboSize > 0);
- quint8 *p = m_cboData.data() + ce.cboOffset;
- memcpy(p, m.constData(), 16 * sizeof(float));
- m_engine->markBufferDirty(m_constantBuf, ce.cboOffset, ce.cboSize);
-
- queueDrawCall(g, ce);
-
- ++stencilValue;
-}
-
-void QSGD3D12Renderer::renderRenderNode(QSGRenderNode *node, int elementIndex)
-{
- QSGRenderNodePrivate *rd = QSGRenderNodePrivate::get(node);
- RenderNodeState state;
-
- setupClipping(rd->m_clip_list, elementIndex);
-
- QMatrix4x4 pm = projectionMatrix();
- state.m_projectionMatrix = &pm;
- state.m_scissorEnabled = m_currentClipTypes & ClipScissor;
- state.m_stencilEnabled = m_currentClipTypes & ClipStencil;
- state.m_scissorRect = m_activeScissorRect;
- state.m_stencilValue = m_currentStencilValue;
-
- // ### rendernodes do not have the QSGBasicGeometryNode infrastructure
- // for storing combined matrices, opacity and such, but perhaps they should.
- QSGNode *xform = node->parent();
- QSGNode *root = rootNode();
- QMatrix4x4 modelview;
- while (xform != root) {
- if (xform->type() == QSGNode::TransformNodeType) {
- modelview *= static_cast<QSGTransformNode *>(xform)->combinedMatrix();
- break;
- }
- xform = xform->parent();
- }
- rd->m_matrix = &modelview;
-
- QSGNode *opacity = node->parent();
- rd->m_opacity = 1.0;
- while (opacity != rootNode()) {
- if (opacity->type() == QSGNode::OpacityNodeType) {
- rd->m_opacity = static_cast<QSGOpacityNode *>(opacity)->combinedOpacity();
- break;
- }
- opacity = opacity->parent();
- }
-
- node->render(&state);
-
- m_engine->invalidateCachedFrameState();
- // For simplicity, reset viewport, scissor, blend factor, stencil ref when
- // any of them got changed. This will likely be rare so skip these otherwise.
- // Render target, pipeline state, draw call related stuff will be reset always.
- const bool restoreMinimal = node->changedStates() == 0;
- m_engine->restoreFrameState(restoreMinimal);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h
deleted file mode 100644
index df30a49f0d..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12RENDERER_P_H
-#define QSGD3D12RENDERER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgrenderer_p.h>
-#include <QtGui/private/qdatabuffer_p.h>
-#include <QtCore/qbitarray.h>
-#include "qsgd3d12engine_p.h"
-#include "qsgd3d12material_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGRenderNode;
-
-class QSGD3D12Renderer : public QSGRenderer
-{
-public:
- QSGD3D12Renderer(QSGRenderContext *context);
- ~QSGD3D12Renderer();
-
- void renderScene(GLuint fboId) override;
- void render() override;
- void nodeChanged(QSGNode *node, QSGNode::DirtyState state) override;
-
- void turnToLayerRenderer() { m_layerRenderer = true; }
-
-private:
- void updateMatrices(QSGNode *node, QSGTransformNode *xform);
- void updateOpacities(QSGNode *node, float inheritedOpacity);
- void buildRenderList(QSGNode *node, QSGClipNode *clip);
- void renderElements();
- void renderElement(int elementIndex);
- void setInputLayout(const QSGGeometry *g, QSGD3D12PipelineState *pipelineState);
- void setupClipping(const QSGClipNode *clip, int elementIndex);
- void setScissor(const QRect &r);
- void renderStencilClip(const QSGClipNode *clip, int elementIndex, const QMatrix4x4 &m, quint32 &stencilValue);
- void renderRenderNode(QSGRenderNode *node, int elementIndex);
-
- struct Element {
- QSGNode *node = nullptr;
- qint32 vboOffset = -1;
- qint32 iboOffset = -1;
- quint32 iboStride = 0;
- qint32 cboOffset = -1;
- quint32 cboSize = 0;
- bool cboPrepared = false;
- };
-
- void queueDrawCall(const QSGGeometry *g, const Element &e);
-
- bool m_layerRenderer = false;
- QSet<QSGNode *> m_dirtyTransformNodes;
- QSet<QSGNode *> m_dirtyOpacityNodes;
- QBitArray m_opaqueElements;
- bool m_rebuild = true;
- bool m_dirtyOpaqueElements = true;
- QDataBuffer<quint8> m_vboData;
- QDataBuffer<quint8> m_iboData;
- QDataBuffer<quint8> m_cboData;
- QDataBuffer<Element> m_renderList;
- uint m_vertexBuf = 0;
- uint m_indexBuf = 0;
- uint m_constantBuf = 0;
- QSGD3D12Engine *m_engine = nullptr;
-
- QSGMaterialType *m_lastMaterialType = nullptr;
- QSGD3D12PipelineState m_pipelineState;
- QSGD3D12PipelineState m_freshPipelineState;
-
- typedef QHash<QSGNode *, QSGD3D12MaterialRenderState::DirtyStates> NodeDirtyMap;
- NodeDirtyMap m_nodeDirtyMap;
-
- QRect m_activeScissorRect;
- QRect m_lastDeviceRect;
- bool m_projectionChangedDueToDeviceSize;
-
- uint m_renderTarget = 0;
- quint32 m_currentStencilValue;
- enum ClipType {
- ClipScissor = 0x1,
- ClipStencil = 0x2
- };
- int m_currentClipTypes;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12RENDERER_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
deleted file mode 100644
index 4a6894e69e..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12renderloop_p.h"
-#include "qsgd3d12engine_p.h"
-#include "qsgd3d12context_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12shadereffectnode_p.h"
-#include <private/qquickwindow_p.h>
-#include <private/qquickprofiler_p.h>
-#include <private/qquickanimatorcontroller_p.h>
-#include <QElapsedTimer>
-#include <QGuiApplication>
-#include <QScreen>
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(loop)
-DECLARE_DEBUG_VAR(time)
-
-
-// This render loop operates on the gui (main) thread.
-// Conceptually it matches the OpenGL 'windows' render loop.
-
-static inline int qsgrl_animation_interval()
-{
- const qreal refreshRate = QGuiApplication::primaryScreen() ? QGuiApplication::primaryScreen()->refreshRate() : 0;
- return refreshRate < 1 ? 16 : int(1000 / refreshRate);
-}
-
-QSGD3D12RenderLoop::QSGD3D12RenderLoop()
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug("new d3d12 render loop");
-
- sg = new QSGD3D12Context;
-
- m_anims = sg->createAnimationDriver(this);
- connect(m_anims, &QAnimationDriver::started, this, &QSGD3D12RenderLoop::onAnimationStarted);
- connect(m_anims, &QAnimationDriver::stopped, this, &QSGD3D12RenderLoop::onAnimationStopped);
- m_anims->install();
-
- m_vsyncDelta = qsgrl_animation_interval();
-}
-
-QSGD3D12RenderLoop::~QSGD3D12RenderLoop()
-{
- delete sg;
-}
-
-void QSGD3D12RenderLoop::show(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "show" << window;
-}
-
-void QSGD3D12RenderLoop::hide(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "hide" << window;
-}
-
-void QSGD3D12RenderLoop::resize(QQuickWindow *window)
-{
- if (!m_windows.contains(window) || window->size().isEmpty())
- return;
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "resize" << window;
-
- const WindowData &data(m_windows[window]);
-
- if (!data.exposed)
- return;
-
- if (data.engine)
- data.engine->setWindowSize(window->size(), window->effectiveDevicePixelRatio());
-}
-
-void QSGD3D12RenderLoop::windowDestroyed(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "window destroyed" << window;
-
- if (!m_windows.contains(window))
- return;
-
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
- wd->fireAboutToStop();
-
- WindowData &data(m_windows[window]);
- QSGD3D12Engine *engine = data.engine;
- QSGD3D12RenderContext *rc = data.rc;
- m_windows.remove(window);
-
- // QSGNode destruction may release graphics resources in use so wait first.
- engine->waitGPU();
-
- // Bye bye nodes...
- wd->cleanupNodesOnShutdown();
-
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
-
- rc->invalidate();
-
- delete rc;
- delete engine;
-
- wd->animationController.reset();
-}
-
-void QSGD3D12RenderLoop::exposeWindow(QQuickWindow *window)
-{
- WindowData data;
- data.exposed = true;
- data.engine = new QSGD3D12Engine;
- data.rc = static_cast<QSGD3D12RenderContext *>(QQuickWindowPrivate::get(window)->context);
- data.rc->setEngine(data.engine);
- m_windows[window] = data;
-
- const int samples = window->format().samples();
- const bool alpha = window->format().alphaBufferSize() > 0;
- const qreal dpr = window->effectiveDevicePixelRatio();
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "initializing D3D12 engine" << window << window->size() << dpr << samples << alpha;
-
- data.engine->attachToWindow(window->winId(), window->size(), dpr, samples, alpha);
-}
-
-void QSGD3D12RenderLoop::obscureWindow(QQuickWindow *window)
-{
- m_windows[window].exposed = false;
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
- wd->fireAboutToStop();
-}
-
-void QSGD3D12RenderLoop::exposureChanged(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "exposure changed" << window << window->isExposed();
-
- if (window->isExposed()) {
- if (!m_windows.contains(window))
- exposeWindow(window);
-
- // Stop non-visual animation timer as we now have a window rendering.
- if (m_animationTimer && somethingVisible()) {
- killTimer(m_animationTimer);
- m_animationTimer = 0;
- }
- // If we have a pending timer and we get an expose, we need to stop it.
- // Otherwise we get two frames and two animation ticks in the same time interval.
- if (m_updateTimer) {
- killTimer(m_updateTimer);
- m_updateTimer = 0;
- }
-
- WindowData &data(m_windows[window]);
- data.exposed = true;
- data.updatePending = true;
-
- render();
-
- } else if (m_windows.contains(window)) {
- obscureWindow(window);
-
- // Potentially start the non-visual animation timer if nobody is rendering.
- if (m_anims->isRunning() && !somethingVisible() && !m_animationTimer)
- m_animationTimer = startTimer(m_vsyncDelta);
- }
-}
-
-QImage QSGD3D12RenderLoop::grab(QQuickWindow *window)
-{
- const bool tempExpose = !m_windows.contains(window);
- if (tempExpose)
- exposeWindow(window);
-
- m_windows[window].grabOnly = true;
-
- renderWindow(window);
-
- QImage grabbed = m_grabContent;
- m_grabContent = QImage();
-
- if (tempExpose)
- obscureWindow(window);
-
- return grabbed;
-}
-
-bool QSGD3D12RenderLoop::somethingVisible() const
-{
- for (auto it = m_windows.constBegin(), itEnd = m_windows.constEnd(); it != itEnd; ++it) {
- if (it.key()->isVisible() && it.key()->isExposed())
- return true;
- }
- return false;
-}
-
-void QSGD3D12RenderLoop::maybePostUpdateTimer()
-{
- if (!m_updateTimer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("starting update timer");
- m_updateTimer = startTimer(m_vsyncDelta / 3);
- }
-}
-
-void QSGD3D12RenderLoop::update(QQuickWindow *window)
-{
- maybeUpdate(window);
-}
-
-void QSGD3D12RenderLoop::maybeUpdate(QQuickWindow *window)
-{
- if (!m_windows.contains(window) || !somethingVisible())
- return;
-
- m_windows[window].updatePending = true;
- maybePostUpdateTimer();
-}
-
-QAnimationDriver *QSGD3D12RenderLoop::animationDriver() const
-{
- return m_anims;
-}
-
-QSGContext *QSGD3D12RenderLoop::sceneGraphContext() const
-{
- return sg;
-}
-
-QSGRenderContext *QSGD3D12RenderLoop::createRenderContext(QSGContext *) const
-{
- // The rendercontext and engine are per-window, like with the threaded
- // loop, but unlike the non-threaded OpenGL variants.
- return sg->createRenderContext();
-}
-
-void QSGD3D12RenderLoop::releaseResources(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "releaseResources" << window;
-}
-
-void QSGD3D12RenderLoop::postJob(QQuickWindow *window, QRunnable *job)
-{
- Q_UNUSED(window);
- Q_ASSERT(job);
- Q_ASSERT(window);
- job->run();
- delete job;
-}
-
-QSurface::SurfaceType QSGD3D12RenderLoop::windowSurfaceType() const
-{
- return QSurface::OpenGLSurface;
-}
-
-bool QSGD3D12RenderLoop::interleaveIncubation() const
-{
- return m_anims->isRunning() && somethingVisible();
-}
-
-void QSGD3D12RenderLoop::onAnimationStarted()
-{
- if (!somethingVisible()) {
- if (!m_animationTimer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("starting non-visual animation timer");
- m_animationTimer = startTimer(m_vsyncDelta);
- }
- } else {
- maybePostUpdateTimer();
- }
-}
-
-void QSGD3D12RenderLoop::onAnimationStopped()
-{
- if (m_animationTimer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("stopping non-visual animation timer");
- killTimer(m_animationTimer);
- m_animationTimer = 0;
- }
-}
-
-bool QSGD3D12RenderLoop::event(QEvent *event)
-{
- switch (event->type()) {
- case QEvent::Timer:
- {
- QTimerEvent *te = static_cast<QTimerEvent *>(event);
- if (te->timerId() == m_animationTimer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("animation tick while no windows exposed");
- m_anims->advance();
- } else if (te->timerId() == m_updateTimer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("update timeout - rendering");
- killTimer(m_updateTimer);
- m_updateTimer = 0;
- render();
- }
- return true;
- }
- default:
- break;
- }
-
- return QObject::event(event);
-}
-
-void QSGD3D12RenderLoop::render()
-{
- bool rendered = false;
- for (auto it = m_windows.begin(), itEnd = m_windows.end(); it != itEnd; ++it) {
- if (it->updatePending) {
- it->updatePending = false;
- renderWindow(it.key());
- rendered = true;
- }
- }
-
- if (!rendered) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("render - no changes, sleep");
- QThread::msleep(m_vsyncDelta);
- }
-
- if (m_anims->isRunning()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("render - advancing animations");
-
- m_anims->advance();
-
- // It is not given that animations triggered another maybeUpdate()
- // and thus another render pass, so to keep things running,
- // make sure there is another frame pending.
- maybePostUpdateTimer();
-
- emit timeToIncubate();
- }
-}
-
-void QSGD3D12RenderLoop::renderWindow(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "renderWindow" << window;
-
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
- if (!m_windows.contains(window) || !window->geometry().isValid())
- return;
-
- WindowData &data(m_windows[window]);
- if (!data.exposed) { // not the same as window->isExposed(), when grabbing invisible windows for instance
- if (Q_UNLIKELY(debug_loop()))
- qDebug("renderWindow - not exposed, abort");
- return;
- }
-
- if (!data.grabOnly)
- wd->flushFrameSynchronousEvents();
-
- QElapsedTimer renderTimer;
- qint64 renderTime = 0, syncTime = 0, polishTime = 0;
- const bool profileFrames = debug_time();
- if (profileFrames)
- renderTimer.start();
- Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
-
- wd->polishItems();
-
- if (profileFrames)
- polishTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphPolishPolish);
-
- emit window->afterAnimating();
-
- // The native window may change in some (quite artificial) cases, e.g. due
- // to a hide - destroy - show on the QWindow.
- bool needsWindow = !data.engine->window();
- if (data.engine->window() && data.engine->window() != window->winId()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("sync - native window handle changes for active engine");
- data.engine->waitGPU();
- wd->cleanupNodesOnShutdown();
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
- data.rc->invalidate();
- data.engine->releaseResources();
- needsWindow = true;
- }
- if (needsWindow) {
- // Must only ever get here when there is no window or releaseResources() has been called.
- const int samples = window->format().samples();
- const bool alpha = window->format().alphaBufferSize() > 0;
- const qreal dpr = window->effectiveDevicePixelRatio();
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "sync - reinitializing D3D12 engine" << window << window->size() << dpr << samples << alpha;
- data.engine->attachToWindow(window->winId(), window->size(), dpr, samples, alpha);
- }
-
- // Recover from device loss.
- if (!data.engine->hasResources()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("sync - device was lost, resetting scenegraph");
- wd->cleanupNodesOnShutdown();
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
- data.rc->invalidate();
- }
-
- data.rc->initialize(nullptr);
-
- wd->syncSceneGraph();
- data.rc->endSync();
-
- if (profileFrames)
- syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopSync);
-
- wd->renderSceneGraph(window->size());
-
- if (profileFrames)
- renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopRender);
-
- if (!data.grabOnly) {
- // The engine is able to have multiple frames in flight. This in effect is
- // similar to BufferQueueingOpenGL. Provide an env var to force the
- // traditional blocking swap behavior, just in case.
- static bool blockOnEachFrame = qEnvironmentVariableIntValue("QT_D3D_BLOCKING_PRESENT") != 0;
-
- if (window->isVisible()) {
- data.engine->present();
- if (blockOnEachFrame)
- data.engine->waitGPU();
- // The concept of "frame swaps" is quite misleading by default, when
- // blockOnEachFrame is not used, but emit it for compatibility.
- wd->fireFrameSwapped();
- } else {
- if (blockOnEachFrame)
- data.engine->waitGPU();
- }
- } else {
- m_grabContent = data.engine->executeAndWaitReadbackRenderTarget();
- data.grabOnly = false;
- }
-
- qint64 swapTime = 0;
- if (profileFrames)
- swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopSwap);
-
- if (Q_UNLIKELY(debug_time())) {
- static QTime lastFrameTime = QTime::currentTime();
- qDebug("Frame rendered with 'd3d12' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d",
- int(swapTime / 1000000),
- int(polishTime / 1000000),
- int((syncTime - polishTime) / 1000000),
- int((renderTime - syncTime) / 1000000),
- int((swapTime - renderTime) / 10000000),
- int(lastFrameTime.msecsTo(QTime::currentTime())));
- lastFrameTime = QTime::currentTime();
- }
-
- // Simulate device loss if requested.
- static int devLossTest = qEnvironmentVariableIntValue("QT_D3D_TEST_DEVICE_LOSS");
- if (devLossTest > 0) {
- static QElapsedTimer kt;
- static bool timerRunning = false;
- if (!timerRunning) {
- kt.start();
- timerRunning = true;
- } else if (kt.elapsed() > 5000) {
- --devLossTest;
- kt.restart();
- data.engine->simulateDeviceLoss();
- }
- }
-}
-
-int QSGD3D12RenderLoop::flags() const
-{
- return SupportsGrabWithoutExpose;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h
deleted file mode 100644
index c0333ffad0..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12RENDERLOOP_P_H
-#define QSGD3D12RENDERLOOP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgrenderloop_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-class QSGD3D12Context;
-class QSGD3D12RenderContext;
-
-class QSGD3D12RenderLoop : public QSGRenderLoop
-{
- Q_OBJECT
-
-public:
- QSGD3D12RenderLoop();
- ~QSGD3D12RenderLoop();
-
- void show(QQuickWindow *window) override;
- void hide(QQuickWindow *window) override;
- void resize(QQuickWindow *window) override;
-
- void windowDestroyed(QQuickWindow *window) override;
-
- void exposureChanged(QQuickWindow *window) override;
-
- QImage grab(QQuickWindow *window) override;
-
- void update(QQuickWindow *window) override;
- void maybeUpdate(QQuickWindow *window) override;
-
- QAnimationDriver *animationDriver() const override;
-
- QSGContext *sceneGraphContext() const override;
- QSGRenderContext *createRenderContext(QSGContext *) const override;
-
- void releaseResources(QQuickWindow *window) override;
- void postJob(QQuickWindow *window, QRunnable *job) override;
-
- QSurface::SurfaceType windowSurfaceType() const override;
- bool interleaveIncubation() const override;
- int flags() const override;
-
- bool event(QEvent *event) override;
-
-public Q_SLOTS:
- void onAnimationStarted();
- void onAnimationStopped();
-
-private:
- void exposeWindow(QQuickWindow *window);
- void obscureWindow(QQuickWindow *window);
- void renderWindow(QQuickWindow *window);
- void render();
- void maybePostUpdateTimer();
- bool somethingVisible() const;
-
- QSGD3D12Context *sg;
- QAnimationDriver *m_anims;
- int m_vsyncDelta;
- int m_updateTimer = 0;
- int m_animationTimer = 0;
-
- struct WindowData {
- QSGD3D12RenderContext *rc = nullptr;
- QSGD3D12Engine *engine = nullptr;
- bool updatePending = false;
- bool grabOnly = false;
- bool exposed = false;
- };
-
- QHash<QQuickWindow *, WindowData> m_windows;
-
- QImage m_grabContent;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12RENDERLOOP_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp
deleted file mode 100644
index 1f574a9802..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp
+++ /dev/null
@@ -1,995 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12shadereffectnode_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12texture_p.h"
-#include "qsgd3d12engine_p.h"
-#include <QtCore/qthreadpool.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qfileselector.h>
-#include <QtQml/qqmlfile.h>
-#include <qsgtextureprovider.h>
-
-#include <d3d12shader.h>
-#include <d3dcompiler.h>
-
-#include "vs_shadereffectdefault.hlslh"
-#include "ps_shadereffectdefault.hlslh"
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(shader)
-
-void QSGD3D12ShaderLinker::reset(const QByteArray &vertBlob, const QByteArray &fragBlob)
-{
- Q_ASSERT(!vertBlob.isEmpty() && !fragBlob.isEmpty());
- vs = vertBlob;
- fs = fragBlob;
-
- error = false;
-
- constantBufferSize = 0;
- constants.clear();
- samplers.clear();
- textures.clear();
- textureNameMap.clear();
-}
-
-void QSGD3D12ShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices)
-{
- Q_ASSERT(shader.shaderInfo.variables.count() == shader.varData.count());
- if (!dirtyIndices) {
- constantBufferSize = qMax(constantBufferSize, shader.shaderInfo.constantDataSize);
- for (int i = 0; i < shader.shaderInfo.variables.count(); ++i) {
- const auto &var(shader.shaderInfo.variables.at(i));
- if (var.type == QSGGuiThreadShaderEffectManager::ShaderInfo::Constant) {
- const auto &vd(shader.varData.at(i));
- Constant c;
- c.size = var.size;
- c.specialType = vd.specialType;
- if (c.specialType != QSGShaderEffectNode::VariableData::SubRect) {
- c.value = vd.value;
- } else {
- Q_ASSERT(var.name.startsWith(QByteArrayLiteral("qt_SubRect_")));
- c.value = var.name.mid(11);
- }
- constants[var.offset] = c;
- }
- }
- } else {
- for (int idx : *dirtyIndices)
- constants[shader.shaderInfo.variables.at(idx).offset].value = shader.varData.at(idx).value;
- }
-}
-
-void QSGD3D12ShaderLinker::feedSamplers(const QSGShaderEffectNode::ShaderData &shader)
-{
- for (int i = 0; i < shader.shaderInfo.variables.count(); ++i) {
- const auto &var(shader.shaderInfo.variables.at(i));
- if (var.type == QSGGuiThreadShaderEffectManager::ShaderInfo::Sampler) {
- Q_ASSERT(shader.varData.at(i).specialType == QSGShaderEffectNode::VariableData::Unused);
- samplers.insert(var.bindPoint);
- }
- }
-}
-
-void QSGD3D12ShaderLinker::feedTextures(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices)
-{
- if (!dirtyIndices) {
- for (int i = 0; i < shader.shaderInfo.variables.count(); ++i) {
- const auto &var(shader.shaderInfo.variables.at(i));
- const auto &vd(shader.varData.at(i));
- if (var.type == QSGGuiThreadShaderEffectManager::ShaderInfo::Texture) {
- Q_ASSERT(vd.specialType == QSGShaderEffectNode::VariableData::Source);
- textures.insert(var.bindPoint, vd.value);
- textureNameMap.insert(var.name, var.bindPoint);
- }
- }
- } else {
- for (int idx : *dirtyIndices) {
- const auto &var(shader.shaderInfo.variables.at(idx));
- const auto &vd(shader.varData.at(idx));
- textures.insert(var.bindPoint, vd.value);
- textureNameMap.insert(var.name, var.bindPoint);
- }
- }
-}
-
-void QSGD3D12ShaderLinker::linkTextureSubRects()
-{
- // feedConstants stores <name> in Constant::value for subrect entries. Now
- // that both constants and textures are known, replace the name with the
- // texture bind point.
- for (Constant &c : constants) {
- if (c.specialType == QSGShaderEffectNode::VariableData::SubRect) {
- if (c.value.type() == QVariant::ByteArray) {
- const QByteArray name = c.value.toByteArray();
- if (!textureNameMap.contains(name))
- qWarning("ShaderEffect: qt_SubRect_%s refers to unknown source texture", qPrintable(name));
- c.value = textureNameMap[name];
- }
- }
- }
-}
-
-void QSGD3D12ShaderLinker::dump()
-{
- if (error) {
- qDebug() << "Failed to generate program data";
- return;
- }
- qDebug() << "Combined shader data" << vs.size() << fs.size() << "cbuffer size" << constantBufferSize;
- qDebug() << " - constants" << constants;
- qDebug() << " - samplers" << samplers;
- qDebug() << " - textures" << textures;
-}
-
-QDebug operator<<(QDebug debug, const QSGD3D12ShaderLinker::Constant &c)
-{
- QDebugStateSaver saver(debug);
- debug.space();
- debug << "size" << c.size;
- if (c.specialType != QSGShaderEffectNode::VariableData::None)
- debug << "special" << c.specialType;
- else
- debug << "value" << c.value;
- return debug;
-}
-
-QSGD3D12ShaderEffectMaterial::QSGD3D12ShaderEffectMaterial(QSGD3D12ShaderEffectNode *node)
- : node(node)
-{
- setFlag(Blending | RequiresFullMatrix, true); // may be changed in sync()
-}
-
-QSGD3D12ShaderEffectMaterial::~QSGD3D12ShaderEffectMaterial()
-{
- delete dummy;
-}
-
-struct QSGD3D12ShaderMaterialTypeCache
-{
- QSGMaterialType *get(const QByteArray &vs, const QByteArray &fs);
- void reset() { qDeleteAll(m_types); m_types.clear(); }
-
- struct Key {
- QByteArray blob[2];
- Key() { }
- Key(const QByteArray &vs, const QByteArray &fs) { blob[0] = vs; blob[1] = fs; }
- bool operator==(const Key &other) const {
- return blob[0] == other.blob[0] && blob[1] == other.blob[1];
- }
- };
- QHash<Key, QSGMaterialType *> m_types;
-};
-
-uint qHash(const QSGD3D12ShaderMaterialTypeCache::Key &key, uint seed = 0)
-{
- uint hash = seed;
- for (int i = 0; i < 2; ++i)
- hash = hash * 31337 + qHash(key.blob[i]);
- return hash;
-}
-
-QSGMaterialType *QSGD3D12ShaderMaterialTypeCache::get(const QByteArray &vs, const QByteArray &fs)
-{
- const Key k(vs, fs);
- if (m_types.contains(k))
- return m_types.value(k);
-
- QSGMaterialType *t = new QSGMaterialType;
- m_types.insert(k, t);
- return t;
-}
-
-Q_GLOBAL_STATIC(QSGD3D12ShaderMaterialTypeCache, shaderMaterialTypeCache)
-
-void QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache()
-{
- shaderMaterialTypeCache()->reset();
-}
-
-QSGMaterialType *QSGD3D12ShaderEffectMaterial::type() const
-{
- return mtype;
-}
-
-static bool hasAtlasTexture(const QVector<QSGTextureProvider *> &textureProviders)
-{
- for (int i = 0; i < textureProviders.count(); ++i) {
- QSGTextureProvider *t = textureProviders.at(i);
- if (t && t->texture() && t->texture()->isAtlasTexture())
- return true;
- }
- return false;
-}
-
-int QSGD3D12ShaderEffectMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QSGD3D12ShaderEffectMaterial *o = static_cast<const QSGD3D12ShaderEffectMaterial *>(other);
-
- if (int diff = cullMode - o->cullMode)
- return diff;
-
- if (int diff = textureProviders.count() - o->textureProviders.count())
- return diff;
-
- if (linker.constants != o->linker.constants)
- return 1;
-
- if ((hasAtlasTexture(textureProviders) && !geometryUsesTextureSubRect)
- || (hasAtlasTexture(o->textureProviders) && !o->geometryUsesTextureSubRect))
- return 1;
-
- for (int i = 0; i < textureProviders.count(); ++i) {
- QSGTextureProvider *tp1 = textureProviders.at(i);
- QSGTextureProvider *tp2 = o->textureProviders.at(i);
- if (!tp1 || !tp2)
- return tp1 == tp2 ? 0 : 1;
- QSGTexture *t1 = tp1->texture();
- QSGTexture *t2 = tp2->texture();
- if (!t1 || !t2)
- return t1 == t2 ? 0 : 1;
- if (int diff = t1->textureId() - t2->textureId())
- return diff;
- }
-
- return 0;
-}
-
-int QSGD3D12ShaderEffectMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(linker.constantBufferSize);
-}
-
-void QSGD3D12ShaderEffectMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = reinterpret_cast<const quint8 *>(linker.vs.constData());
- pipelineState->shaders.vsSize = linker.vs.size();
- pipelineState->shaders.ps = reinterpret_cast<const quint8 *>(linker.fs.constData());
- pipelineState->shaders.psSize = linker.fs.size();
-
- pipelineState->shaders.rootSig.textureViewCount = textureProviders.count();
-}
-
-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());
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12ShaderEffectMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = 0;
- quint8 *p = constantBuffer;
-
- for (auto it = linker.constants.constBegin(), itEnd = linker.constants.constEnd(); it != itEnd; ++it) {
- quint8 *dst = p + it.key();
- const QSGD3D12ShaderLinker::Constant &c(it.value());
- if (c.specialType == QSGShaderEffectNode::VariableData::Opacity) {
- if (state.isOpacityDirty()) {
- const float f = state.opacity();
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, &f, sizeof(f));
- r |= UpdatedConstantBuffer;
- }
- } else if (c.specialType == QSGShaderEffectNode::VariableData::Matrix) {
- if (state.isMatrixDirty()) {
- const int sz = 16 * sizeof(float);
- Q_ASSERT(sz == c.size);
- memcpy(dst, state.combinedMatrix().constData(), sz);
- r |= UpdatedConstantBuffer;
- }
- } else if (c.specialType == QSGShaderEffectNode::VariableData::SubRect) {
- // float4
- QRectF subRect(0, 0, 1, 1);
- int srcBindPoint = c.value.toInt(); // filled in by linkTextureSubRects
- if (QSGTexture *t = textureProviders.at(srcBindPoint)->texture())
- subRect = t->normalizedTextureSubRect();
- const float f[4] = { float(subRect.x()), float(subRect.y()),
- float(subRect.width()), float(subRect.height()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- } else if (c.specialType == QSGShaderEffectNode::VariableData::None) {
- r |= UpdatedConstantBuffer;
- switch (c.value.type()) {
- case QMetaType::QColor: {
- const QColor v = qsg_premultiply_color(qvariant_cast<QColor>(c.value));
- const float f[4] = { float(v.redF()), float(v.greenF()), float(v.blueF()), float(v.alphaF()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::Float: {
- const float f = qvariant_cast<float>(c.value);
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, &f, sizeof(f));
- break;
- }
- case QMetaType::Double: {
- const float f = float(qvariant_cast<double>(c.value));
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, &f, sizeof(f));
- break;
- }
- case QMetaType::Int: {
- const int i = c.value.toInt();
- Q_ASSERT(sizeof(i) == c.size);
- memcpy(dst, &i, sizeof(i));
- break;
- }
- case QMetaType::Bool: {
- const bool b = c.value.toBool();
- Q_ASSERT(sizeof(b) == c.size);
- memcpy(dst, &b, sizeof(b));
- break;
- }
- case QMetaType::QTransform: { // float3x3
- const QTransform v = qvariant_cast<QTransform>(c.value);
- const float m[3][3] = {
- { float(v.m11()), float(v.m12()), float(v.m13()) },
- { float(v.m21()), float(v.m22()), float(v.m23()) },
- { float(v.m31()), float(v.m32()), float(v.m33()) }
- };
- Q_ASSERT(sizeof(m) == c.size);
- memcpy(dst, m[0], sizeof(m));
- break;
- }
- case QMetaType::QSize:
- case QMetaType::QSizeF: { // float2
- const QSizeF v = c.value.toSizeF();
- const float f[2] = { float(v.width()), float(v.height()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QPoint:
- case QMetaType::QPointF: { // float2
- const QPointF v = c.value.toPointF();
- const float f[2] = { float(v.x()), float(v.y()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QRect:
- case QMetaType::QRectF: { // float4
- const QRectF v = c.value.toRectF();
- const float f[4] = { float(v.x()), float(v.y()), float(v.width()), float(v.height()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QVector2D: { // float2
- const QVector2D v = qvariant_cast<QVector2D>(c.value);
- const float f[2] = { float(v.x()), float(v.y()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QVector3D: { // float3
- const QVector3D v = qvariant_cast<QVector3D>(c.value);
- const float f[3] = { float(v.x()), float(v.y()), float(v.z()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QVector4D: { // float4
- const QVector4D v = qvariant_cast<QVector4D>(c.value);
- const float f[4] = { float(v.x()), float(v.y()), float(v.z()), float(v.w()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QQuaternion: { // float4
- const QQuaternion v = qvariant_cast<QQuaternion>(c.value);
- const float f[4] = { float(v.x()), float(v.y()), float(v.z()), float(v.scalar()) };
- Q_ASSERT(sizeof(f) == c.size);
- memcpy(dst, f, sizeof(f));
- break;
- }
- case QMetaType::QMatrix4x4: { // float4x4
- const QMatrix4x4 v = qvariant_cast<QMatrix4x4>(c.value);
- const int sz = 16 * sizeof(float);
- Q_ASSERT(sz == c.size);
- memcpy(dst, v.constData(), sz);
- break;
- }
- default:
- break;
- }
- }
- }
-
- for (int i = 0; i < textureProviders.count(); ++i) {
- QSGTextureProvider *tp = textureProviders[i];
- QSGD3D12TextureView &tv(pipelineState->shaders.rootSig.textureViews[i]);
- if (tp) {
- if (QSGTexture *t = tp->texture()) {
- if (t->isAtlasTexture() && !geometryUsesTextureSubRect) {
- QSGTexture *newTexture = t->removedFromAtlas();
- if (newTexture)
- t = newTexture;
- }
- tv.filter = t->filtering() == QSGTexture::Linear
- ? QSGD3D12TextureView::FilterLinear : QSGD3D12TextureView::FilterNearest;
- tv.addressModeHoriz = t->horizontalWrapMode() == QSGTexture::ClampToEdge
- ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
- tv.addressModeVert = t->verticalWrapMode() == QSGTexture::ClampToEdge
- ? QSGD3D12TextureView::AddressClamp : QSGD3D12TextureView::AddressWrap;
- t->bind();
- continue;
- }
- }
- if (!dummy) {
- dummy = new QSGD3D12Texture(node->renderContext()->engine());
- QImage img(128, 128, QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- dummy->create(img, QSGRenderContext::CreateTexture_Alpha);
- }
- tv.filter = QSGD3D12TextureView::FilterNearest;
- tv.addressModeHoriz = QSGD3D12TextureView::AddressWrap;
- tv.addressModeVert = QSGD3D12TextureView::AddressWrap;
- dummy->bind();
- }
-
- switch (cullMode) {
- case QSGShaderEffectNode::FrontFaceCulling:
- pipelineState->cullMode = QSGD3D12PipelineState::CullFront;
- break;
- case QSGShaderEffectNode::BackFaceCulling:
- pipelineState->cullMode = QSGD3D12PipelineState::CullBack;
- break;
- default:
- pipelineState->cullMode = QSGD3D12PipelineState::CullNone;
- break;
- }
-
- return r;
-}
-
-void QSGD3D12ShaderEffectMaterial::updateTextureProviders(bool layoutChange)
-{
- if (layoutChange) {
- for (QSGTextureProvider *tp : textureProviders) {
- if (tp) {
- QObject::disconnect(tp, SIGNAL(textureChanged()), node,
- SLOT(handleTextureChange()));
- QObject::disconnect(tp, SIGNAL(destroyed(QObject*)), node,
- SLOT(handleTextureProviderDestroyed(QObject*)));
- }
- }
-
- textureProviders.fill(nullptr, linker.textures.count());
- }
-
- for (auto it = linker.textures.constBegin(), itEnd = linker.textures.constEnd(); it != itEnd; ++it) {
- const int bindPoint = it.key();
- // Now that the linker has merged the textures, we can switch over to a
- // simple vector indexed by the binding point for textureProviders.
- Q_ASSERT(bindPoint >= 0 && bindPoint < textureProviders.count());
- QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(it.value()));
- QSGTextureProvider *newProvider = source && source->isTextureProvider() ? source->textureProvider() : nullptr;
- QSGTextureProvider *&activeProvider(textureProviders[bindPoint]);
- if (newProvider != activeProvider) {
- if (activeProvider) {
- QObject::disconnect(activeProvider, SIGNAL(textureChanged()), node,
- SLOT(handleTextureChange()));
- QObject::disconnect(activeProvider, SIGNAL(destroyed(QObject*)), node,
- SLOT(handleTextureProviderDestroyed(QObject*)));
- }
- if (newProvider) {
- Q_ASSERT_X(newProvider->thread() == QThread::currentThread(),
- "QSGD3D12ShaderEffectMaterial::updateTextureProviders",
- "Texture provider must belong to the rendering thread");
- QObject::connect(newProvider, SIGNAL(textureChanged()), node, SLOT(handleTextureChange()));
- QObject::connect(newProvider, SIGNAL(destroyed(QObject*)), node,
- SLOT(handleTextureProviderDestroyed(QObject*)));
- } else {
- const char *typeName = source ? source->metaObject()->className() : it.value().typeName();
- qWarning("ShaderEffect: Texture t%d is not assigned a valid texture provider (%s).",
- bindPoint, typeName);
- }
- activeProvider = newProvider;
- }
- }
-}
-
-QSGD3D12ShaderEffectNode::QSGD3D12ShaderEffectNode(QSGD3D12RenderContext *rc, QSGD3D12GuiThreadShaderEffectManager *mgr)
- : QSGShaderEffectNode(mgr),
- m_rc(rc),
- m_mgr(mgr),
- m_material(this)
-{
- setFlag(UsePreprocess, true);
- setMaterial(&m_material);
-}
-
-QRectF QSGD3D12ShaderEffectNode::updateNormalizedTextureSubRect(bool supportsAtlasTextures)
-{
- QRectF srcRect(0, 0, 1, 1);
- bool geometryUsesTextureSubRect = false;
- if (supportsAtlasTextures && m_material.textureProviders.count() == 1) {
- QSGTextureProvider *provider = m_material.textureProviders.at(0);
- if (provider->texture()) {
- srcRect = provider->texture()->normalizedTextureSubRect();
- geometryUsesTextureSubRect = true;
- }
- }
-
- if (m_material.geometryUsesTextureSubRect != geometryUsesTextureSubRect) {
- m_material.geometryUsesTextureSubRect = geometryUsesTextureSubRect;
- markDirty(QSGNode::DirtyMaterial);
- }
-
- return srcRect;
-}
-
-void QSGD3D12ShaderEffectNode::syncMaterial(SyncData *syncData)
-{
- if (Q_UNLIKELY(debug_shader()))
- qDebug() << "shadereffect node sync" << syncData->dirty;
-
- if (bool(m_material.flags() & QSGMaterial::Blending) != syncData->blending) {
- m_material.setFlag(QSGMaterial::Blending, syncData->blending);
- markDirty(QSGNode::DirtyMaterial);
- }
-
- if (m_material.cullMode != syncData->cullMode) {
- m_material.cullMode = syncData->cullMode;
- markDirty(QSGNode::DirtyMaterial);
- }
-
- if (syncData->dirty & QSGShaderEffectNode::DirtyShaders) {
- QByteArray vertBlob, fragBlob;
-
- m_material.hasCustomVertexShader = syncData->vertex.shader->hasShaderCode;
- if (m_material.hasCustomVertexShader) {
- vertBlob = syncData->vertex.shader->shaderInfo.blob;
- } else {
- vertBlob = QByteArray::fromRawData(reinterpret_cast<const char *>(g_VS_DefaultShaderEffect),
- sizeof(g_VS_DefaultShaderEffect));
- }
-
- m_material.hasCustomFragmentShader = syncData->fragment.shader->hasShaderCode;
- if (m_material.hasCustomFragmentShader) {
- fragBlob = syncData->fragment.shader->shaderInfo.blob;
- } else {
- fragBlob = QByteArray::fromRawData(reinterpret_cast<const char *>(g_PS_DefaultShaderEffect),
- sizeof(g_PS_DefaultShaderEffect));
- }
-
- m_material.mtype = shaderMaterialTypeCache()->get(vertBlob, fragBlob);
- m_material.linker.reset(vertBlob, fragBlob);
-
- if (m_material.hasCustomVertexShader) {
- m_material.linker.feedConstants(*syncData->vertex.shader);
- } else {
- QSGShaderEffectNode::ShaderData defaultSD;
- defaultSD.shaderInfo.blob = vertBlob;
- defaultSD.shaderInfo.type = QSGGuiThreadShaderEffectManager::ShaderInfo::TypeVertex;
-
- // { float4x4 qt_Matrix; float qt_Opacity; } where only the matrix is used
- QSGGuiThreadShaderEffectManager::ShaderInfo::Variable v;
- v.name = QByteArrayLiteral("qt_Matrix");
- v.offset = 0;
- v.size = 16 * sizeof(float);
- defaultSD.shaderInfo.variables.append(v);
- QSGShaderEffectNode::VariableData vd;
- vd.specialType = QSGShaderEffectNode::VariableData::Matrix;
- defaultSD.varData.append(vd);
- defaultSD.shaderInfo.constantDataSize = (16 + 1) * sizeof(float);
- m_material.linker.feedConstants(defaultSD);
- }
-
- m_material.linker.feedSamplers(*syncData->vertex.shader);
- m_material.linker.feedTextures(*syncData->vertex.shader);
-
- if (m_material.hasCustomFragmentShader) {
- m_material.linker.feedConstants(*syncData->fragment.shader);
- } else {
- QSGShaderEffectNode::ShaderData defaultSD;
- defaultSD.shaderInfo.blob = fragBlob;
- defaultSD.shaderInfo.type = QSGGuiThreadShaderEffectManager::ShaderInfo::TypeFragment;
-
- // { float4x4 qt_Matrix; float qt_Opacity; } where only the opacity is used
- QSGGuiThreadShaderEffectManager::ShaderInfo::Variable v;
- v.name = QByteArrayLiteral("qt_Opacity");
- v.offset = 16 * sizeof(float);
- v.size = sizeof(float);
- defaultSD.shaderInfo.variables.append(v);
- QSGShaderEffectNode::VariableData vd;
- vd.specialType = QSGShaderEffectNode::VariableData::Opacity;
- defaultSD.varData.append(vd);
-
- v.name = QByteArrayLiteral("source");
- v.bindPoint = 0;
- v.type = QSGGuiThreadShaderEffectManager::ShaderInfo::Texture;
- defaultSD.shaderInfo.variables.append(v);
- vd.specialType = QSGShaderEffectNode::VariableData::Source;
- defaultSD.varData.append(vd);
-
- v.name = QByteArrayLiteral("sourceSampler");
- v.bindPoint = 0;
- v.type = QSGGuiThreadShaderEffectManager::ShaderInfo::Sampler;
- defaultSD.shaderInfo.variables.append(v);
- vd.specialType = QSGShaderEffectNode::VariableData::Unused;
- defaultSD.varData.append(vd);
-
- defaultSD.shaderInfo.constantDataSize = (16 + 1) * sizeof(float);
-
- m_material.linker.feedConstants(defaultSD);
- m_material.linker.feedSamplers(defaultSD);
- m_material.linker.feedTextures(defaultSD);
- }
-
- // While this may seem unnecessary for the built-in shaders, the value
- // of 'source' is still in there and we have to process it.
- m_material.linker.feedSamplers(*syncData->fragment.shader);
- m_material.linker.feedTextures(*syncData->fragment.shader);
-
- m_material.linker.linkTextureSubRects();
-
- m_material.updateTextureProviders(true);
-
- markDirty(QSGNode::DirtyMaterial);
-
- if (Q_UNLIKELY(debug_shader()))
- m_material.linker.dump();
- } else {
- if (syncData->dirty & QSGShaderEffectNode::DirtyShaderConstant) {
- if (!syncData->vertex.dirtyConstants->isEmpty())
- m_material.linker.feedConstants(*syncData->vertex.shader, syncData->vertex.dirtyConstants);
- if (!syncData->fragment.dirtyConstants->isEmpty())
- m_material.linker.feedConstants(*syncData->fragment.shader, syncData->fragment.dirtyConstants);
- markDirty(QSGNode::DirtyMaterial);
- if (Q_UNLIKELY(debug_shader()))
- m_material.linker.dump();
- }
-
- if (syncData->dirty & QSGShaderEffectNode::DirtyShaderTexture) {
- if (!syncData->vertex.dirtyTextures->isEmpty())
- m_material.linker.feedTextures(*syncData->vertex.shader, syncData->vertex.dirtyTextures);
- if (!syncData->fragment.dirtyTextures->isEmpty())
- m_material.linker.feedTextures(*syncData->fragment.shader, syncData->fragment.dirtyTextures);
- m_material.linker.linkTextureSubRects();
- m_material.updateTextureProviders(false);
- markDirty(QSGNode::DirtyMaterial);
- if (Q_UNLIKELY(debug_shader()))
- m_material.linker.dump();
- }
- }
-
- if (bool(m_material.flags() & QSGMaterial::RequiresFullMatrix) != m_material.hasCustomVertexShader) {
- m_material.setFlag(QSGMaterial::RequiresFullMatrix, m_material.hasCustomVertexShader);
- markDirty(QSGNode::DirtyMaterial);
- }
-}
-
-void QSGD3D12ShaderEffectNode::handleTextureChange()
-{
- markDirty(QSGNode::DirtyMaterial);
- emit m_mgr->textureChanged();
-}
-
-void QSGD3D12ShaderEffectNode::handleTextureProviderDestroyed(QObject *object)
-{
- for (QSGTextureProvider *&tp : m_material.textureProviders) {
- if (tp == object)
- tp = nullptr;
- }
-}
-
-void QSGD3D12ShaderEffectNode::preprocess()
-{
- for (QSGTextureProvider *tp : m_material.textureProviders) {
- if (tp) {
- if (QSGDynamicTexture *texture = qobject_cast<QSGDynamicTexture *>(tp->texture()))
- texture->updateTexture();
- }
- }
-}
-
-bool QSGD3D12GuiThreadShaderEffectManager::hasSeparateSamplerAndTextureObjects() const
-{
- return true;
-}
-
-QString QSGD3D12GuiThreadShaderEffectManager::log() const
-{
- return m_log;
-}
-
-QSGGuiThreadShaderEffectManager::Status QSGD3D12GuiThreadShaderEffectManager::status() const
-{
- return m_status;
-}
-
-struct RefGuard {
- RefGuard(IUnknown *p) : p(p) { }
- ~RefGuard() { p->Release(); }
- IUnknown *p;
-};
-
-class QSGD3D12ShaderCompileTask : public QRunnable
-{
-public:
- QSGD3D12ShaderCompileTask(QSGD3D12GuiThreadShaderEffectManager *mgr,
- QSGD3D12GuiThreadShaderEffectManager::ShaderInfo::Type typeHint,
- const QByteArray &src,
- QSGD3D12GuiThreadShaderEffectManager::ShaderInfo *result)
- : mgr(mgr), typeHint(typeHint), src(src), result(result) { }
-
- void run() override;
-
-private:
- QSGD3D12GuiThreadShaderEffectManager *mgr;
- QSGD3D12GuiThreadShaderEffectManager::ShaderInfo::Type typeHint;
- QByteArray src;
- QSGD3D12GuiThreadShaderEffectManager::ShaderInfo *result;
-};
-
-void QSGD3D12ShaderCompileTask::run()
-{
- const char *target = typeHint == QSGD3D12GuiThreadShaderEffectManager::ShaderInfo::TypeVertex ? "vs_5_0" : "ps_5_0";
- ID3DBlob *bytecode = nullptr;
- ID3DBlob *errors = nullptr;
- HRESULT hr = D3DCompile(src.constData(), src.size(), nullptr, nullptr, nullptr,
- "main", target, 0, 0, &bytecode, &errors);
- if (FAILED(hr) || !bytecode) {
- qWarning("HLSL shader compilation failed: 0x%x", hr);
- if (errors) {
- mgr->m_log += QString::fromUtf8(static_cast<const char *>(errors->GetBufferPointer()), errors->GetBufferSize());
- errors->Release();
- }
- mgr->m_status = QSGGuiThreadShaderEffectManager::Error;
- emit mgr->shaderCodePrepared(false, typeHint, src, result);
- emit mgr->logAndStatusChanged();
- return;
- }
-
- result->blob.resize(bytecode->GetBufferSize());
- memcpy(result->blob.data(), bytecode->GetBufferPointer(), result->blob.size());
- bytecode->Release();
-
- const bool ok = mgr->reflect(result);
- mgr->m_status = ok ? QSGGuiThreadShaderEffectManager::Compiled : QSGGuiThreadShaderEffectManager::Error;
- emit mgr->shaderCodePrepared(ok, typeHint, src, result);
- emit mgr->logAndStatusChanged();
-}
-
-static const int BYTECODE_MAGIC = 0x43425844; // 'DXBC'
-
-void QSGD3D12GuiThreadShaderEffectManager::prepareShaderCode(ShaderInfo::Type typeHint, const QByteArray &src, ShaderInfo *result)
-{
- // The D3D12 backend's ShaderEffect implementation supports both HLSL
- // source strings and bytecode or source in files as input. Bytecode is
- // strongly recommended, but in order to make ShaderEffect users' (and
- // anything that stiches shader strings together dynamically, e.g.
- // qtgraphicaleffects) life easier, and since we link to d3dcompiler
- // anyways, compiling from source is also supported.
-
- QByteArray shaderSourceCode = src;
- QUrl srcUrl(QString::fromUtf8(src));
- if (!srcUrl.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) || srcUrl.isLocalFile()) {
- if (!m_fileSelector) {
- m_fileSelector = new QFileSelector(this);
- m_fileSelector->setExtraSelectors(QStringList() << QStringLiteral("hlsl"));
- }
- const QString fn = m_fileSelector->select(QQmlFile::urlToLocalFileOrQrc(srcUrl));
- QFile f(fn);
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("ShaderEffect: Failed to read %s", qPrintable(fn));
- emit shaderCodePrepared(false, typeHint, src, result);
- return;
- }
- QByteArray blob = f.readAll();
- f.close();
- if (blob.size() > 4) {
- const quint32 *p = reinterpret_cast<const quint32 *>(blob.constData());
- if (*p == BYTECODE_MAGIC) {
- // already compiled D3D bytecode, skip straight to reflection
- result->blob = blob;
- const bool ok = reflect(result);
- m_status = ok ? Compiled : Error;
- emit shaderCodePrepared(ok, typeHint, src, result);
- emit logAndStatusChanged();
- return;
- }
- // assume the file contained HLSL source code
- shaderSourceCode = blob;
- }
- }
-
- QThreadPool::globalInstance()->start(new QSGD3D12ShaderCompileTask(this, typeHint, shaderSourceCode, result));
-}
-
-bool QSGD3D12GuiThreadShaderEffectManager::reflect(ShaderInfo *result)
-{
- ID3D12ShaderReflection *reflector;
- HRESULT hr = D3DReflect(result->blob.constData(), result->blob.size(), IID_PPV_ARGS(&reflector));
- if (FAILED(hr)) {
- qWarning("D3D shader reflection failed: 0x%x", hr);
- return false;
- }
- RefGuard rg(reflector);
-
- D3D12_SHADER_DESC shaderDesc;
- reflector->GetDesc(&shaderDesc);
-
- const uint progType = (shaderDesc.Version & 0xFFFF0000) >> 16;
- const uint major = (shaderDesc.Version & 0x000000F0) >> 4;
- const uint minor = (shaderDesc.Version & 0x0000000F);
-
- switch (progType) {
- case D3D12_SHVER_VERTEX_SHADER:
- result->type = ShaderInfo::TypeVertex;
- break;
- case D3D12_SHVER_PIXEL_SHADER:
- result->type = ShaderInfo::TypeFragment;
- break;
- default:
- result->type = ShaderInfo::TypeOther;
- qWarning("D3D shader is of unknown type 0x%x", shaderDesc.Version);
- return false;
- }
-
- if (major < 5) {
- qWarning("D3D shader model version %u.%u is too low", major, minor);
- return false;
- }
-
- const int ieCount = shaderDesc.InputParameters;
- const int cbufferCount = shaderDesc.ConstantBuffers;
- const int boundResCount = shaderDesc.BoundResources;
-
- result->constantDataSize = 0;
-
- if (ieCount < 1) {
- qWarning("Invalid shader: Not enough input parameters (%d)", ieCount);
- return false;
- }
- if (cbufferCount < 1) {
- qWarning("Invalid shader: Shader has no constant buffers");
- return false;
- }
- if (boundResCount < 1) {
- qWarning("Invalid shader: No resources bound. Expected to have at least a constant buffer bound.");
- return false;
- }
-
- if (Q_UNLIKELY(debug_shader()))
- qDebug("Shader reflection size %d type %d v%u.%u input elems %d cbuffers %d boundres %d",
- result->blob.size(), result->type, major, minor, ieCount, cbufferCount, boundResCount);
-
- for (int i = 0; i < boundResCount; ++i) {
- D3D12_SHADER_INPUT_BIND_DESC desc;
- if (FAILED(reflector->GetResourceBindingDesc(i, &desc))) {
- qWarning("D3D reflection: Failed to query resource binding %d", i);
- continue;
- }
- bool gotCBuffer = false;
- if (desc.Type == D3D_SIT_CBUFFER) {
- ID3D12ShaderReflectionConstantBuffer *cbuf = reflector->GetConstantBufferByName(desc.Name);
- D3D12_SHADER_BUFFER_DESC bufDesc;
- if (FAILED(cbuf->GetDesc(&bufDesc))) {
- qWarning("D3D reflection: Failed to query constant buffer description");
- continue;
- }
- if (gotCBuffer) {
- qWarning("D3D reflection: Found more than one constant buffers. Only the first one is used.");
- continue;
- }
- gotCBuffer = true;
- result->constantDataSize = bufDesc.Size;
- for (uint cbIdx = 0; cbIdx < bufDesc.Variables; ++cbIdx) {
- ID3D12ShaderReflectionVariable *cvar = cbuf->GetVariableByIndex(cbIdx);
- D3D12_SHADER_VARIABLE_DESC varDesc;
- if (FAILED(cvar->GetDesc(&varDesc))) {
- qWarning("D3D reflection: Failed to query constant buffer variable %d", cbIdx);
- return false;
- }
- // we report the full size of the buffer but only return variables that are actually used by this shader
- if (!(varDesc.uFlags & D3D_SVF_USED))
- continue;
- ShaderInfo::Variable v;
- v.type = ShaderInfo::Constant;
- v.name = QByteArray(varDesc.Name);
- v.offset = varDesc.StartOffset;
- v.size = varDesc.Size;
- result->variables.append(v);
- }
- } else if (desc.Type == D3D_SIT_TEXTURE) {
- if (desc.Dimension != D3D_SRV_DIMENSION_TEXTURE2D) {
- qWarning("D3D reflection: Texture %s is not a 2D texture, ignoring.", qPrintable(desc.Name));
- continue;
- }
- if (desc.NumSamples != (UINT) -1) {
- qWarning("D3D reflection: Texture %s is multisample (%u), ignoring.", qPrintable(desc.Name), desc.NumSamples);
- continue;
- }
- if (desc.BindCount != 1) {
- qWarning("D3D reflection: Texture %s is an array, ignoring.", qPrintable(desc.Name));
- continue;
- }
- if (desc.Space != 0) {
- qWarning("D3D reflection: Texture %s is not using register space 0, ignoring.", qPrintable(desc.Name));
- continue;
- }
- ShaderInfo::Variable v;
- v.type = ShaderInfo::Texture;
- v.name = QByteArray(desc.Name);
- v.bindPoint = desc.BindPoint;
- result->variables.append(v);
- } else if (desc.Type == D3D_SIT_SAMPLER) {
- if (desc.BindCount != 1) {
- qWarning("D3D reflection: Sampler %s is an array, ignoring.", qPrintable(desc.Name));
- continue;
- }
- if (desc.Space != 0) {
- qWarning("D3D reflection: Sampler %s is not using register space 0, ignoring.", qPrintable(desc.Name));
- continue;
- }
- ShaderInfo::Variable v;
- v.type = ShaderInfo::Sampler;
- v.name = QByteArray(desc.Name);
- v.bindPoint = desc.BindPoint;
- result->variables.append(v);
- } else {
- qWarning("D3D reflection: Resource binding %d has an unknown type of %d and will be ignored.", i, desc.Type);
- continue;
- }
- }
-
- if (Q_UNLIKELY(debug_shader()))
- qDebug() << "Variables:" << result->variables << "cbuffer size" << result->constantDataSize;
-
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
deleted file mode 100644
index dec85fd782..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12SHADEREFFECTNODE_P_H
-#define QSGD3D12SHADEREFFECTNODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgadaptationlayer_p.h>
-#include "qsgd3d12material_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12RenderContext;
-class QSGD3D12GuiThreadShaderEffectManager;
-class QSGD3D12ShaderEffectNode;
-class QSGD3D12Texture;
-class QFileSelector;
-
-class QSGD3D12ShaderLinker
-{
-public:
- void reset(const QByteArray &vertBlob, const QByteArray &fragBlob);
-
- void feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr);
- void feedSamplers(const QSGShaderEffectNode::ShaderData &shader);
- void feedTextures(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr);
- void linkTextureSubRects();
-
- void dump();
-
- struct Constant {
- uint size;
- QSGShaderEffectNode::VariableData::SpecialType specialType;
- QVariant value;
- bool operator==(const Constant &other) const {
- return size == other.size && specialType == other.specialType
- && (specialType == QSGShaderEffectNode::VariableData::None ? value == other.value : true);
- }
- };
-
- bool error;
- QByteArray vs;
- QByteArray fs;
- uint constantBufferSize;
- QHash<uint, Constant> constants; // offset -> Constant
- QSet<int> samplers; // bindpoint
- QHash<int, QVariant> textures; // bindpoint -> value (source ref)
- QHash<QByteArray, int> textureNameMap; // name -> bindpoint
-};
-
-QDebug operator<<(QDebug debug, const QSGD3D12ShaderLinker::Constant &c);
-
-class QSGD3D12ShaderEffectMaterial : public QSGD3D12Material
-{
-public:
- QSGD3D12ShaderEffectMaterial(QSGD3D12ShaderEffectNode *node);
- ~QSGD3D12ShaderEffectMaterial();
-
- QSGMaterialType *type() const override;
- int compare(const QSGMaterial *other) const override;
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- void updateTextureProviders(bool layoutChange);
-
- QSGD3D12ShaderEffectNode *node;
- bool valid = false;
- QSGShaderEffectNode::CullMode cullMode = QSGShaderEffectNode::NoCulling;
- bool hasCustomVertexShader = false;
- bool hasCustomFragmentShader = false;
- QSGD3D12ShaderLinker linker;
- QSGMaterialType *mtype = nullptr;
- QVector<QSGTextureProvider *> textureProviders;
- QSGD3D12Texture *dummy = nullptr;
- bool geometryUsesTextureSubRect = false;
-};
-
-class QSGD3D12ShaderEffectNode : public QObject, public QSGShaderEffectNode
-{
- Q_OBJECT
-
-public:
- QSGD3D12ShaderEffectNode(QSGD3D12RenderContext *rc, QSGD3D12GuiThreadShaderEffectManager *mgr);
-
- QRectF updateNormalizedTextureSubRect(bool supportsAtlasTextures) override;
- void syncMaterial(SyncData *syncData) override;
-
- static void cleanupMaterialTypeCache();
-
- void preprocess() override;
-
- QSGD3D12RenderContext *renderContext() { return m_rc; }
-
-private Q_SLOTS:
- void handleTextureChange();
- void handleTextureProviderDestroyed(QObject *object);
-
-private:
- QSGD3D12RenderContext *m_rc;
- QSGD3D12GuiThreadShaderEffectManager *m_mgr;
- QSGD3D12ShaderEffectMaterial m_material;
-};
-
-class QSGD3D12GuiThreadShaderEffectManager : public QSGGuiThreadShaderEffectManager
-{
-public:
- bool hasSeparateSamplerAndTextureObjects() const override;
-
- QString log() const override;
- Status status() const override;
-
- void prepareShaderCode(ShaderInfo::Type typeHint, const QByteArray &src, ShaderInfo *result) override;
-
-private:
- bool reflect(ShaderInfo *result);
- QString m_log;
- Status m_status = Uncompiled;
- QFileSelector *m_fileSelector = nullptr;
-
- friend class QSGD3D12ShaderCompileTask;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12SHADEREFFECTNODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp
deleted file mode 100644
index 807fbcdcec..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12spritenode_p.h"
-#include "qsgd3d12material_p.h"
-
-#include "vs_sprite.hlslh"
-#include "ps_sprite.hlslh"
-
-QT_BEGIN_NAMESPACE
-
-struct SpriteVertex
-{
- float x;
- float y;
- float tx;
- float ty;
-};
-
-struct SpriteVertices
-{
- SpriteVertex v1;
- SpriteVertex v2;
- SpriteVertex v3;
- SpriteVertex v4;
-};
-
-class QSGD3D12SpriteMaterial : public QSGD3D12Material
-{
-public:
- QSGD3D12SpriteMaterial();
- ~QSGD3D12SpriteMaterial();
-
- QSGMaterialType *type() const override { static QSGMaterialType type; return &type; }
-
- int compare(const QSGMaterial *other) const override
- {
- return this - static_cast<const QSGD3D12SpriteMaterial *>(other);
- }
-
- int constantBufferSize() const override;
- void preparePipeline(QSGD3D12PipelineState *pipelineState) override;
- UpdateResults updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *pipelineState,
- ExtraState *extraState,
- quint8 *constantBuffer) override;
-
- QSGTexture *texture;
-
- float animT;
- float animX1;
- float animY1;
- float animX2;
- float animY2;
- float animW;
- float animH;
-};
-
-QSGD3D12SpriteMaterial::QSGD3D12SpriteMaterial()
- : texture(nullptr),
- animT(0.0f),
- animX1(0.0f),
- animY1(0.0f),
- animX2(0.0f),
- animY2(0.0f),
- animW(1.0f),
- animH(1.0f)
-{
- setFlag(Blending, true);
-}
-
-QSGD3D12SpriteMaterial::~QSGD3D12SpriteMaterial()
-{
- delete texture;
-}
-
-static const int SPRITE_CB_SIZE_0 = 16 * sizeof(float); // float4x4
-static const int SPRITE_CB_SIZE_1 = 4 * sizeof(float); // float4
-static const int SPRITE_CB_SIZE_2 = 3 * sizeof(float); // float3
-static const int SPRITE_CB_SIZE_3 = sizeof(float); // float
-static const int SPRITE_CB_SIZE = SPRITE_CB_SIZE_0 + SPRITE_CB_SIZE_1 + SPRITE_CB_SIZE_2 + SPRITE_CB_SIZE_3;
-
-int QSGD3D12SpriteMaterial::constantBufferSize() const
-{
- return QSGD3D12Engine::alignedConstantBufferSize(SPRITE_CB_SIZE);
-}
-
-void QSGD3D12SpriteMaterial::preparePipeline(QSGD3D12PipelineState *pipelineState)
-{
- pipelineState->shaders.vs = g_VS_Sprite;
- pipelineState->shaders.vsSize = sizeof(g_VS_Sprite);
- pipelineState->shaders.ps = g_PS_Sprite;
- pipelineState->shaders.psSize = sizeof(g_PS_Sprite);
-
- pipelineState->shaders.rootSig.textureViewCount = 1;
-}
-
-QSGD3D12Material::UpdateResults QSGD3D12SpriteMaterial::updatePipeline(const QSGD3D12MaterialRenderState &state,
- QSGD3D12PipelineState *,
- ExtraState *,
- quint8 *constantBuffer)
-{
- QSGD3D12Material::UpdateResults r = UpdatedConstantBuffer;
- quint8 *p = constantBuffer;
-
- if (state.isMatrixDirty())
- memcpy(p, state.combinedMatrix().constData(), SPRITE_CB_SIZE_0);
- p += SPRITE_CB_SIZE_0;
-
- {
- const float v[] = { animX1, animY1, animX2, animY2 };
- memcpy(p, v, SPRITE_CB_SIZE_1);
- }
- p += SPRITE_CB_SIZE_1;
-
- {
- const float v[] = { animW, animH, animT };
- memcpy(p, v, SPRITE_CB_SIZE_2);
- }
- p += SPRITE_CB_SIZE_2;
-
- if (state.isOpacityDirty()) {
- const float opacity = state.opacity();
- memcpy(p, &opacity, SPRITE_CB_SIZE_3);
- }
-
- texture->bind();
-
- return r;
-}
-
-static QSGGeometry::Attribute Sprite_Attributes[] = {
- QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute),
- QSGGeometry::Attribute::createWithAttributeType(1, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute),
-};
-
-static QSGGeometry::AttributeSet Sprite_AttributeSet = { 2, 4 * sizeof(float), Sprite_Attributes };
-
-QSGD3D12SpriteNode::QSGD3D12SpriteNode()
- : m_material(new QSGD3D12SpriteMaterial)
- , m_geometryDirty(true)
- , m_sheetSize(QSize(64, 64))
-{
- m_geometry = new QSGGeometry(Sprite_AttributeSet, 4, 6);
- m_geometry->setDrawingMode(QSGGeometry::DrawTriangles);
-
- quint16 *indices = m_geometry->indexDataAsUShort();
- indices[0] = 0;
- indices[1] = 1;
- indices[2] = 2;
- indices[3] = 1;
- indices[4] = 3;
- indices[5] = 2;
-
- setGeometry(m_geometry);
- setMaterial(m_material);
- setFlag(OwnsGeometry, true);
- setFlag(OwnsMaterial, true);
-}
-
-void QSGD3D12SpriteNode::setTexture(QSGTexture *texture)
-{
- m_material->texture = texture;
- m_geometryDirty = true;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12SpriteNode::setTime(float time)
-{
- m_material->animT = time;
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12SpriteNode::setSourceA(const QPoint &source)
-{
- if (m_sourceA != source) {
- m_sourceA = source;
- m_material->animX1 = static_cast<float>(source.x()) / m_sheetSize.width();
- m_material->animY1 = static_cast<float>(source.y()) / m_sheetSize.height();
- markDirty(DirtyMaterial);
- }
-}
-
-void QSGD3D12SpriteNode::setSourceB(const QPoint &source)
-{
- if (m_sourceB != source) {
- m_sourceB = source;
- m_material->animX2 = static_cast<float>(source.x()) / m_sheetSize.width();
- m_material->animY2 = static_cast<float>(source.y()) / m_sheetSize.height();
- markDirty(DirtyMaterial);
- }
-}
-
-void QSGD3D12SpriteNode::setSpriteSize(const QSize &size)
-{
- if (m_spriteSize != size) {
- m_spriteSize = size;
- m_material->animW = static_cast<float>(size.width()) / m_sheetSize.width();
- m_material->animH = static_cast<float>(size.height()) / m_sheetSize.height();
- markDirty(DirtyMaterial);
- }
-}
-
-void QSGD3D12SpriteNode::setSheetSize(const QSize &size)
-{
- if (m_sheetSize != size) {
- m_sheetSize = size;
-
- // Update all dependent properties
- m_material->animX1 = static_cast<float>(m_sourceA.x()) / m_sheetSize.width();
- m_material->animY1 = static_cast<float>(m_sourceA.y()) / m_sheetSize.height();
- m_material->animX2 = static_cast<float>(m_sourceB.x()) / m_sheetSize.width();
- m_material->animY2 = static_cast<float>(m_sourceB.y()) / m_sheetSize.height();
- m_material->animW = static_cast<float>(m_spriteSize.width()) / m_sheetSize.width();
- m_material->animH = static_cast<float>(m_spriteSize.height()) / m_sheetSize.height();
-
- markDirty(DirtyMaterial);
- }
-}
-
-void QSGD3D12SpriteNode::setSize(const QSizeF &size)
-{
- if (m_size != size) {
- m_size = size;
- m_geometryDirty = true;
- }
-}
-
-void QSGD3D12SpriteNode::setFiltering(QSGTexture::Filtering filtering)
-{
- m_material->texture->setFiltering(filtering);
- markDirty(DirtyMaterial);
-}
-
-void QSGD3D12SpriteNode::update()
-{
- if (m_geometryDirty) {
- m_geometryDirty = false;
- updateGeometry();
- }
-}
-
-void QSGD3D12SpriteNode::updateGeometry()
-{
- if (!m_material->texture)
- return;
-
- SpriteVertices *p = static_cast<SpriteVertices *>(m_geometry->vertexData());
- const QRectF texRect = m_material->texture->normalizedTextureSubRect();
-
- p->v1.tx = texRect.topLeft().x();
- p->v1.ty = texRect.topLeft().y();
-
- p->v2.tx = texRect.topRight().x();
- p->v2.ty = texRect.topRight().y();
-
- p->v3.tx = texRect.bottomLeft().x();
- p->v3.ty = texRect.bottomLeft().y();
-
- p->v4.tx = texRect.bottomRight().x();
- p->v4.ty = texRect.bottomRight().y();
-
- p->v1.x = 0;
- p->v1.y = 0;
-
- p->v2.x = m_size.width();
- p->v2.y = 0;
-
- p->v3.x = 0;
- p->v3.y = m_size.height();
-
- p->v4.x = m_size.width();
- p->v4.y = m_size.height();
-
- markDirty(DirtyGeometry);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12spritenode_p.h
deleted file mode 100644
index 265bec7c78..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12SPRITENODE_H
-#define QSGD3D12SPRITENODE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgadaptationlayer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12SpriteMaterial;
-
-class QSGD3D12SpriteNode : public QSGSpriteNode
-{
-public:
- QSGD3D12SpriteNode();
-
- void setTexture(QSGTexture *texture) override;
- void setTime(float time) override;
- void setSourceA(const QPoint &source) override;
- void setSourceB(const QPoint &source) override;
- void setSpriteSize(const QSize &size) override;
- void setSheetSize(const QSize &size) override;
- void setSize(const QSizeF &size) override;
- void setFiltering(QSGTexture::Filtering filtering) override;
- void update() override;
-
-private:
- void updateGeometry();
-
- QSGD3D12SpriteMaterial *m_material;
- QSGGeometry *m_geometry;
- bool m_geometryDirty;
- QPoint m_sourceA;
- QPoint m_sourceB;
- QSize m_spriteSize;
- QSize m_sheetSize;
- QSizeF m_size;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12SPRITENODE_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
deleted file mode 100644
index b49b851c23..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12texture_p.h"
-#include "qsgd3d12engine_p.h"
-#include <private/qsgcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#define RETAIN_IMAGE
-
-void QSGD3D12Texture::create(const QImage &image, uint flags)
-{
- // ### atlas?
-
- const bool alphaRequest = flags & QSGRenderContext::CreateTexture_Alpha;
- m_alphaWanted = alphaRequest && image.hasAlphaChannel();
-
- // The engine maps 8-bit formats to R8. This is fine for glyphs and such
- // but may not be what apps expect for ordinary image data. The OpenGL
- // implementation maps these to ARGB32_Pre so let's follow suit.
- if (image.depth() != 8)
- m_image = image;
- else
- m_image = image.convertToFormat(m_alphaWanted ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
-
- m_id = m_engine->genTexture();
- Q_ASSERT(m_id);
-
- // We could kick off the texture creation and the async upload right here.
- // Unfortunately we cannot tell at this stage if mipmaps will be enabled
- // via an Image element's mipmap property...so defer to bind().
- m_createPending = true;
-}
-
-QSGD3D12Texture::QSGD3D12Texture(QSGD3D12Engine *engine)
- : QSGTexture(*(new QSGD3D12TexturePrivate)),
- m_engine(engine)
-{
-}
-
-QSGD3D12Texture::~QSGD3D12Texture()
-{
- if (m_id)
- m_engine->releaseTexture(m_id);
-}
-
-int QSGD3D12Texture::textureId() const
-{
- return m_id;
-}
-
-int QSGD3D12TexturePrivate::comparisonKey() const
-{
- Q_Q(const QSGD3D12Texture);
- return q->m_id;
-}
-
-QSize QSGD3D12Texture::textureSize() const
-{
- return m_image.size();
-}
-
-bool QSGD3D12Texture::hasAlphaChannel() const
-{
- return m_alphaWanted;
-}
-
-bool QSGD3D12Texture::hasMipmaps() const
-{
- return mipmapFiltering() != QSGTexture::None;
-}
-
-QRectF QSGD3D12Texture::normalizedTextureSubRect() const
-{
- return QRectF(0, 0, 1, 1);
-}
-
-void QSGD3D12Texture::bind()
-{
- // Called when the texture material updates the pipeline state.
-
- if (!m_createPending && hasMipmaps() != m_createdWithMipMaps) {
-#ifdef RETAIN_IMAGE
- m_engine->releaseTexture(m_id);
- m_id = m_engine->genTexture();
- Q_ASSERT(m_id);
- m_createPending = true;
-#else
- // ### this can be made working some day (something similar to
- // queueTextureResize) but skip for now
- qWarning("D3D12: mipmap property cannot be changed once the texture is created");
-#endif
- }
-
- if (m_createPending) {
- m_createPending = false;
-
- QSGD3D12Engine::TextureCreateFlags createFlags = 0;
- if (m_alphaWanted)
- createFlags |= QSGD3D12Engine::TextureWithAlpha;
-
- m_createdWithMipMaps = hasMipmaps();
- if (m_createdWithMipMaps)
- createFlags |= QSGD3D12Engine::TextureWithMipMaps;
-
- m_engine->createTexture(m_id, m_image.size(), m_image.format(), createFlags);
- m_engine->queueTextureUpload(m_id, m_image);
-
-#ifndef RETAIN_IMAGE
- m_image = QImage();
-#endif
- }
-
- // Here we know that the texture is going to be used in the current frame
- // by the next draw call. Notify the engine so that it can wait for
- // possible pending uploads and set up the pipeline accordingly.
- m_engine->useTexture(m_id);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h
deleted file mode 100644
index f6a5257773..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12TEXTURE_P_H
-#define QSGD3D12TEXTURE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgtexture_p.h>
-#include <basetsd.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-class QSGD3D12TexturePrivate;
-
-class QSGD3D12Texture : public QSGTexture
-{
- Q_DECLARE_PRIVATE(QSGD3D12Texture)
-public:
- QSGD3D12Texture(QSGD3D12Engine *engine);
- ~QSGD3D12Texture();
-
- void create(const QImage &image, uint flags);
-
- int textureId() const override;
- QSize textureSize() const override;
- bool hasAlphaChannel() const override;
- bool hasMipmaps() const override;
- QRectF normalizedTextureSubRect() const override;
- void bind() override;
-
-protected:
- QSGD3D12Engine *m_engine;
- QImage m_image;
- bool m_createPending = false;
- bool m_createdWithMipMaps = false;
- uint m_id = 0;
- bool m_alphaWanted = false;
-};
-
-class QSGD3D12TexturePrivate : public QSGTexturePrivate
-{
- Q_DECLARE_PUBLIC(QSGD3D12Texture)
-public:
- int comparisonKey() const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
deleted file mode 100644
index 4302a9119b..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
+++ /dev/null
@@ -1,1186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qsgd3d12threadedrenderloop_p.h"
-#include "qsgd3d12engine_p.h"
-#include "qsgd3d12context_p.h"
-#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12shadereffectnode_p.h"
-#include <private/qsgrenderer_p.h>
-#include <private/qquickwindow_p.h>
-#include <private/qquickanimatorcontroller_p.h>
-#include <private/qquickprofiler_p.h>
-#include <private/qqmldebugserviceinterfaces_p.h>
-#include <private/qqmldebugconnector_p.h>
-#include <QElapsedTimer>
-#include <QQueue>
-#include <QGuiApplication>
-
-QT_BEGIN_NAMESPACE
-
-// NOTE: Avoid categorized logging. It is slow.
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-
-DECLARE_DEBUG_VAR(loop)
-DECLARE_DEBUG_VAR(time)
-
-
-// NOTE: The threaded renderloop is not currently safe to use in practice as it
-// is prone to deadlocks, in particular when multiple windows are active. This
-// is because DXGI's limitation of relying on the gui message pump in certain
-// cases. See
-// https://msdn.microsoft.com/en-us/library/windows/desktop/ee417025(v=vs.85).aspx#multithreading_and_dxgi
-//
-// This means that if swap chain functions like create, release, and
-// potentially even Present, are called outside the gui thread, then the
-// application must ensure the gui thread does not ever block and wait for the
-// render thread - since on the render thread a DXGI call may be in turn
-// waiting for the gui thread to deliver a window message...
-//
-// Ensuring this is impossible with the current design where the gui thread
-// must block at certain points, waiting for the render thread. Qt moves out
-// rendering from the main thread, in order to make application's life easier,
-// whereas the typical DXGI-compatible model would require moving work, but not
-// windowing and presenting, out to additional threads.
-
-
-/*
- The D3D render loop mostly mirrors the threaded OpenGL render loop.
-
- There are two classes here. QSGD3D12ThreadedRenderLoop and
- QSGD3D12RenderThread. All communication between the two is based on event
- passing and we have a number of custom events.
-
- Render loop is per process, render thread is per window. The
- QSGD3D12RenderContext and QSGD3D12Engine are per window as well. The former
- is created (but not owned) by QQuickWindow. The D3D device is per process.
-
- In this implementation, the render thread is never blocked and the GUI
- thread will initiate a polishAndSync which will block and wait for the
- render thread to pick it up and release the block only after the render
- thread is done syncing. The reason for this is:
-
- 1. Clear blocking paradigm. We only have one real "block" point
- (polishAndSync()) and all blocking is initiated by GUI and picked up by
- Render at specific times based on events. This makes the execution
- deterministic.
-
- 2. Render does not have to interact with GUI. This is done so that the
- render thread can run its own animation system which stays alive even when
- the GUI thread is blocked doing I/O, object instantiation, QPainter-painting
- or any other non-trivial task.
-
- The render thread has affinity to the GUI thread until a window is shown.
- From that moment and until the window is destroyed, it will have affinity to
- the render thread. (moved back at the end of run for cleanup).
- */
-
-// Passed from the RL to the RT when a window is removed obscured and should be
-// removed from the render loop.
-const QEvent::Type WM_Obscure = QEvent::Type(QEvent::User + 1);
-
-// Passed from the RL to RT when GUI has been locked, waiting for sync.
-const QEvent::Type WM_RequestSync = QEvent::Type(QEvent::User + 2);
-
-// Passed by the RL to the RT to maybe release resource if no windows are
-// rendering.
-const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 4);
-
-// Passed by the RL to the RT when a QQuickWindow::grabWindow() is called.
-const QEvent::Type WM_Grab = QEvent::Type(QEvent::User + 5);
-
-// Passed by the window when there is a render job to run.
-const QEvent::Type WM_PostJob = QEvent::Type(QEvent::User + 6);
-
-class QSGD3D12WindowEvent : public QEvent
-{
-public:
- QSGD3D12WindowEvent(QQuickWindow *c, QEvent::Type type) : QEvent(type), window(c) { }
- QQuickWindow *window;
-};
-
-class QSGD3D12TryReleaseEvent : public QSGD3D12WindowEvent
-{
-public:
- QSGD3D12TryReleaseEvent(QQuickWindow *win, bool destroy)
- : QSGD3D12WindowEvent(win, WM_TryRelease), destroying(destroy) { }
- bool destroying;
-};
-
-class QSGD3D12SyncEvent : public QSGD3D12WindowEvent
-{
-public:
- QSGD3D12SyncEvent(QQuickWindow *c, bool inExpose, bool force)
- : QSGD3D12WindowEvent(c, WM_RequestSync)
- , size(c->size())
- , dpr(c->effectiveDevicePixelRatio())
- , syncInExpose(inExpose)
- , forceRenderPass(force) { }
- QSize size;
- float dpr;
- bool syncInExpose;
- bool forceRenderPass;
-};
-
-class QSGD3D12GrabEvent : public QSGD3D12WindowEvent
-{
-public:
- QSGD3D12GrabEvent(QQuickWindow *c, QImage *result)
- : QSGD3D12WindowEvent(c, WM_Grab), image(result) { }
- QImage *image;
-};
-
-class QSGD3D12JobEvent : public QSGD3D12WindowEvent
-{
-public:
- QSGD3D12JobEvent(QQuickWindow *c, QRunnable *postedJob)
- : QSGD3D12WindowEvent(c, WM_PostJob), job(postedJob) { }
- ~QSGD3D12JobEvent() { delete job; }
- QRunnable *job;
-};
-
-class QSGD3D12EventQueue : public QQueue<QEvent *>
-{
-public:
- void addEvent(QEvent *e) {
- mutex.lock();
- enqueue(e);
- if (waiting)
- condition.wakeOne();
- mutex.unlock();
- }
-
- QEvent *takeEvent(bool wait) {
- mutex.lock();
- if (isEmpty() && wait) {
- waiting = true;
- condition.wait(&mutex);
- waiting = false;
- }
- QEvent *e = dequeue();
- mutex.unlock();
- return e;
- }
-
- bool hasMoreEvents() {
- mutex.lock();
- bool has = !isEmpty();
- mutex.unlock();
- return has;
- }
-
-private:
- QMutex mutex;
- QWaitCondition condition;
- bool waiting = false;
-};
-
-static inline int qsgrl_animation_interval()
-{
- const qreal refreshRate = QGuiApplication::primaryScreen() ? QGuiApplication::primaryScreen()->refreshRate() : 0;
- return refreshRate < 1 ? 16 : int(1000 / refreshRate);
-}
-
-class QSGD3D12RenderThread : public QThread
-{
- Q_OBJECT
-
-public:
- QSGD3D12RenderThread(QSGD3D12ThreadedRenderLoop *rl, QSGRenderContext *renderContext)
- : renderLoop(rl)
- {
- rc = static_cast<QSGD3D12RenderContext *>(renderContext);
- vsyncDelta = qsgrl_animation_interval();
- }
-
- ~QSGD3D12RenderThread()
- {
- delete rc;
- }
-
- bool event(QEvent *e);
- void run();
-
- void syncAndRender();
- void sync(bool inExpose);
-
- void requestRepaint()
- {
- if (sleeping)
- stopEventProcessing = true;
- if (exposedWindow)
- pendingUpdate |= RepaintRequest;
- }
-
- void processEventsAndWaitForMore();
- void processEvents();
- void postEvent(QEvent *e);
-
- enum UpdateRequest {
- SyncRequest = 0x01,
- RepaintRequest = 0x02,
- ExposeRequest = 0x04 | RepaintRequest | SyncRequest
- };
-
- QSGD3D12Engine *engine = nullptr;
- QSGD3D12ThreadedRenderLoop *renderLoop;
- QSGD3D12RenderContext *rc;
- QAnimationDriver *rtAnim = nullptr;
- volatile bool active = false;
- uint pendingUpdate = 0;
- bool sleeping = false;
- bool syncResultedInChanges = false;
- float vsyncDelta;
- QMutex mutex;
- QWaitCondition waitCondition;
- QQuickWindow *exposedWindow = nullptr;
- bool stopEventProcessing = false;
- QSGD3D12EventQueue eventQueue;
- QElapsedTimer threadTimer;
- qint64 syncTime;
- qint64 renderTime;
- qint64 sinceLastTime;
-
-public slots:
- void onSceneGraphChanged() {
- syncResultedInChanges = true;
- }
-};
-
-bool QSGD3D12RenderThread::event(QEvent *e)
-{
- switch (e->type()) {
-
- case WM_Obscure:
- Q_ASSERT(!exposedWindow || exposedWindow == static_cast<QSGD3D12WindowEvent *>(e)->window);
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "RT - WM_Obscure" << exposedWindow;
- mutex.lock();
- if (exposedWindow) {
- QQuickWindowPrivate::get(exposedWindow)->fireAboutToStop();
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_Obscure - window removed");
- exposedWindow = nullptr;
- }
- waitCondition.wakeOne();
- mutex.unlock();
- return true;
-
- case WM_RequestSync: {
- QSGD3D12SyncEvent *wme = static_cast<QSGD3D12SyncEvent *>(e);
- if (sleeping)
- stopEventProcessing = true;
- // One thread+engine for each window. However, the native window may
- // change in some (quite artificial) cases, e.g. due to a hide -
- // destroy - show on the QWindow.
- bool needsWindow = !engine->window();
- if (engine->window() && engine->window() != wme->window->winId()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_RequestSync - native window handle changes for active engine");
- engine->waitGPU();
- QQuickWindowPrivate::get(wme->window)->cleanupNodesOnShutdown();
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
- rc->invalidate();
- engine->releaseResources();
- needsWindow = true;
- }
- if (needsWindow) {
- // Must only ever get here when there is no window or releaseResources() has been called.
- const int samples = wme->window->format().samples();
- const bool alpha = wme->window->format().alphaBufferSize() > 0;
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "RT - WM_RequestSync - initializing D3D12 engine" << wme->window
- << wme->size << wme->dpr << samples << alpha;
- engine->attachToWindow(wme->window->winId(), wme->size, wme->dpr, samples, alpha);
- }
- exposedWindow = wme->window;
- engine->setWindowSize(wme->size, wme->dpr);
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "RT - WM_RequestSync" << exposedWindow;
- pendingUpdate |= SyncRequest;
- if (wme->syncInExpose) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_RequestSync - triggered from expose");
- pendingUpdate |= ExposeRequest;
- }
- if (wme->forceRenderPass) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_RequestSync - repaint regardless");
- pendingUpdate |= RepaintRequest;
- }
- return true;
- }
-
- case WM_TryRelease: {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_TryRelease");
- mutex.lock();
- renderLoop->lockedForSync = true;
- QSGD3D12TryReleaseEvent *wme = static_cast<QSGD3D12TryReleaseEvent *>(e);
- // Only when no windows are exposed anymore or we are shutting down.
- if (!exposedWindow || wme->destroying) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_TryRelease - invalidating rc");
- if (wme->window) {
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(wme->window);
- if (wme->destroying) {
- // QSGNode destruction may release graphics resources in use so wait first.
- engine->waitGPU();
- // Bye bye nodes...
- wd->cleanupNodesOnShutdown();
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
- }
- rc->invalidate();
- QCoreApplication::processEvents();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- if (wme->destroying)
- wd->animationController.reset();
- }
- if (wme->destroying)
- active = false;
- if (sleeping)
- stopEventProcessing = true;
- } else {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_TryRelease - not releasing because window is still active");
- }
- waitCondition.wakeOne();
- renderLoop->lockedForSync = false;
- mutex.unlock();
- return true;
- }
-
- case WM_Grab: {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_Grab");
- QSGD3D12GrabEvent *wme = static_cast<QSGD3D12GrabEvent *>(e);
- Q_ASSERT(wme->window);
- Q_ASSERT(wme->window == exposedWindow || !exposedWindow);
- mutex.lock();
- if (wme->window) {
- // Grabbing is generally done by rendering a frame and reading the
- // color buffer contents back, without presenting, and then
- // creating a QImage from the returned data. It is terribly
- // inefficient since it involves a full blocking wait for the GPU.
- // However, our hands are tied by the existing, synchronous APIs of
- // QQuickWindow and such.
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(wme->window);
- rc->initialize(nullptr);
- wd->syncSceneGraph();
- rc->endSync();
- wd->renderSceneGraph(wme->window->size());
- *wme->image = engine->executeAndWaitReadbackRenderTarget();
- }
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_Grab - waking gui to handle result");
- waitCondition.wakeOne();
- mutex.unlock();
- return true;
- }
-
- case WM_PostJob: {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_PostJob");
- QSGD3D12JobEvent *wme = static_cast<QSGD3D12JobEvent *>(e);
- Q_ASSERT(wme->window == exposedWindow);
- if (exposedWindow) {
- wme->job->run();
- delete wme->job;
- wme->job = nullptr;
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_PostJob - job done");
- }
- return true;
- }
-
- default:
- break;
- }
-
- return QThread::event(e);
-}
-
-void QSGD3D12RenderThread::postEvent(QEvent *e)
-{
- eventQueue.addEvent(e);
-}
-
-void QSGD3D12RenderThread::processEvents()
-{
- while (eventQueue.hasMoreEvents()) {
- QEvent *e = eventQueue.takeEvent(false);
- event(e);
- delete e;
- }
-}
-
-void QSGD3D12RenderThread::processEventsAndWaitForMore()
-{
- stopEventProcessing = false;
- while (!stopEventProcessing) {
- QEvent *e = eventQueue.takeEvent(true);
- event(e);
- delete e;
- }
-}
-
-void QSGD3D12RenderThread::run()
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - run()");
-
- engine = new QSGD3D12Engine;
- rc->setEngine(engine);
-
- rtAnim = rc->sceneGraphContext()->createAnimationDriver(nullptr);
- rtAnim->install();
-
- if (QQmlDebugConnector::service<QQmlProfilerService>())
- QQuickProfiler::registerAnimationCallback();
-
- while (active) {
- if (exposedWindow)
- syncAndRender();
-
- processEvents();
- QCoreApplication::processEvents();
-
- if (pendingUpdate == 0 || !exposedWindow) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - done drawing, sleep");
- sleeping = true;
- processEventsAndWaitForMore();
- sleeping = false;
- }
- }
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - run() exiting");
-
- delete rtAnim;
- rtAnim = nullptr;
-
- rc->moveToThread(renderLoop->thread());
- moveToThread(renderLoop->thread());
-
- rc->setEngine(nullptr);
- delete engine;
- engine = nullptr;
-}
-
-void QSGD3D12RenderThread::sync(bool inExpose)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - sync");
-
- mutex.lock();
- Q_ASSERT_X(renderLoop->lockedForSync, "QSGD3D12RenderThread::sync()", "sync triggered with gui not locked");
-
- // Recover from device loss.
- if (!engine->hasResources()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - sync - device was lost, resetting scenegraph");
- QQuickWindowPrivate::get(exposedWindow)->cleanupNodesOnShutdown();
- QSGD3D12ShaderEffectNode::cleanupMaterialTypeCache();
- rc->invalidate();
- }
-
- if (engine->window()) {
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(exposedWindow);
- bool hadRenderer = wd->renderer != nullptr;
- // If the scene graph was touched since the last sync() make sure it sends the
- // changed signal.
- if (wd->renderer)
- wd->renderer->clearChangedFlag();
-
- rc->initialize(nullptr);
- wd->syncSceneGraph();
- rc->endSync();
-
- if (!hadRenderer && wd->renderer) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - created renderer");
- syncResultedInChanges = true;
- connect(wd->renderer, &QSGRenderer::sceneGraphChanged, this,
- &QSGD3D12RenderThread::onSceneGraphChanged, Qt::DirectConnection);
- }
-
- // Process deferred deletes now, directly after the sync as deleteLater
- // on the GUI must now also have resulted in SG changes and the delete
- // is a safe operation.
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- }
-
- if (!inExpose) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - sync complete, waking gui");
- waitCondition.wakeOne();
- mutex.unlock();
- }
-}
-
-void QSGD3D12RenderThread::syncAndRender()
-{
- if (Q_UNLIKELY(debug_time())) {
- sinceLastTime = threadTimer.nsecsElapsed();
- threadTimer.start();
- }
- Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame);
-
- QElapsedTimer waitTimer;
- waitTimer.start();
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - syncAndRender()");
-
- syncResultedInChanges = false;
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(exposedWindow);
-
- const bool repaintRequested = (pendingUpdate & RepaintRequest) || wd->customRenderStage;
- const bool syncRequested = pendingUpdate & SyncRequest;
- const bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest;
- pendingUpdate = 0;
-
- if (syncRequested)
- sync(exposeRequested);
-
-#ifndef QSG_NO_RENDER_TIMING
- if (Q_UNLIKELY(debug_time()))
- syncTime = threadTimer.nsecsElapsed();
-#endif
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopSync);
-
- if (!syncResultedInChanges && !repaintRequested) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - no changes, render aborted");
- int waitTime = vsyncDelta - (int) waitTimer.elapsed();
- if (waitTime > 0)
- msleep(waitTime);
- return;
- }
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - rendering started");
-
- if (rtAnim->isRunning()) {
- wd->animationController->lock();
- rtAnim->advance();
- wd->animationController->unlock();
- }
-
- bool canRender = wd->renderer != nullptr;
- // Recover from device loss.
- if (!engine->hasResources()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - syncAndRender - device was lost, posting FullUpdateRequest");
- // Cannot do anything here because gui is not locked. Request a new
- // sync+render round on the gui thread and let the sync handle it.
- QCoreApplication::postEvent(exposedWindow, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
- canRender = false;
- }
-
- if (canRender) {
- wd->renderSceneGraph(engine->windowSize());
- if (Q_UNLIKELY(debug_time()))
- renderTime = threadTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopRender);
-
- // The engine is able to have multiple frames in flight. This in effect is
- // similar to BufferQueueingOpenGL. Provide an env var to force the
- // traditional blocking swap behavior, just in case.
- static bool blockOnEachFrame = qEnvironmentVariableIntValue("QT_D3D_BLOCKING_PRESENT") != 0;
-
- if (!wd->customRenderStage || !wd->customRenderStage->swap())
- engine->present();
-
- if (blockOnEachFrame)
- engine->waitGPU();
-
- // The concept of "frame swaps" is quite misleading by default, when
- // blockOnEachFrame is not used, but emit it for compatibility.
- wd->fireFrameSwapped();
- } else {
- Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopSync, 1);
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - window not ready, skipping render");
- }
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - rendering done");
-
- if (exposeRequested) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - wake gui after initial expose");
- waitCondition.wakeOne();
- mutex.unlock();
- }
-
- if (Q_UNLIKELY(debug_time()))
- qDebug("Frame rendered with 'd3d12' renderloop in %dms, sync=%d, render=%d, swap=%d - (on render thread)",
- int(threadTimer.elapsed()),
- int((syncTime/1000000)),
- int((renderTime - syncTime) / 1000000),
- int(threadTimer.elapsed() - renderTime / 1000000));
-
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
- QQuickProfiler::SceneGraphRenderLoopSwap);
-
- static int devLossTest = qEnvironmentVariableIntValue("QT_D3D_TEST_DEVICE_LOSS");
- if (devLossTest > 0) {
- static QElapsedTimer kt;
- static bool timerRunning = false;
- if (!timerRunning) {
- kt.start();
- timerRunning = true;
- } else if (kt.elapsed() > 5000) {
- --devLossTest;
- kt.restart();
- engine->simulateDeviceLoss();
- }
- }
-}
-
-template<class T> T *windowFor(const QVector<T> &list, QQuickWindow *window)
-{
- for (const T &t : list) {
- if (t.window == window)
- return const_cast<T *>(&t);
- }
- return nullptr;
-}
-
-QSGD3D12ThreadedRenderLoop::QSGD3D12ThreadedRenderLoop()
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug("d3d12 THREADED render loop ctor");
-
- sg = new QSGD3D12Context;
-
- anim = sg->createAnimationDriver(this);
- connect(anim, &QAnimationDriver::started, this, &QSGD3D12ThreadedRenderLoop::onAnimationStarted);
- connect(anim, &QAnimationDriver::stopped, this, &QSGD3D12ThreadedRenderLoop::onAnimationStopped);
- anim->install();
-}
-
-QSGD3D12ThreadedRenderLoop::~QSGD3D12ThreadedRenderLoop()
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug("d3d12 THREADED render loop dtor");
-
- delete sg;
-}
-
-void QSGD3D12ThreadedRenderLoop::show(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "show" << window;
-}
-
-void QSGD3D12ThreadedRenderLoop::hide(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "hide" << window;
-
- if (window->isExposed())
- handleObscurity(windowFor(windows, window));
-
- releaseResources(window);
-}
-
-void QSGD3D12ThreadedRenderLoop::resize(QQuickWindow *window)
-{
- if (!window->isExposed() || window->size().isEmpty())
- return;
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "resize" << window << window->size();
-}
-
-void QSGD3D12ThreadedRenderLoop::windowDestroyed(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "window destroyed" << window;
-
- WindowData *w = windowFor(windows, window);
- if (!w)
- return;
-
- handleObscurity(w);
- handleResourceRelease(w, true);
-
- QSGD3D12RenderThread *thread = w->thread;
- while (thread->isRunning())
- QThread::yieldCurrentThread();
-
- Q_ASSERT(thread->thread() == QThread::currentThread());
- delete thread;
-
- for (int i = 0; i < windows.size(); ++i) {
- if (windows.at(i).window == window) {
- windows.removeAt(i);
- break;
- }
- }
-
- // Now that we altered the window list, we may need to stop the animation
- // timer even if we didn't via handleObscurity. This covers the case where
- // we destroy a visible & exposed QQuickWindow.
- startOrStopAnimationTimer();
-}
-
-void QSGD3D12ThreadedRenderLoop::exposureChanged(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "exposure changed" << window;
-
- if (window->isExposed()) {
- handleExposure(window);
- } else {
- WindowData *w = windowFor(windows, window);
- if (w)
- handleObscurity(w);
- }
-}
-
-QImage QSGD3D12ThreadedRenderLoop::grab(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "grab" << window;
-
- WindowData *w = windowFor(windows, window);
- // Have to support invisible (but created()'ed) windows as well.
- // Unlike with GL, leaving that case for QQuickWindow to handle is not feasible.
- const bool tempExpose = !w;
- if (tempExpose) {
- handleExposure(window);
- w = windowFor(windows, window);
- Q_ASSERT(w);
- }
-
- if (!w->thread->isRunning())
- return QImage();
-
- if (!window->handle())
- window->create();
-
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
- wd->polishItems();
-
- QImage result;
- w->thread->mutex.lock();
- lockedForSync = true;
- w->thread->postEvent(new QSGD3D12GrabEvent(window, &result));
- w->thread->waitCondition.wait(&w->thread->mutex);
- lockedForSync = false;
- w->thread->mutex.unlock();
-
- result.setDevicePixelRatio(window->effectiveDevicePixelRatio());
-
- if (tempExpose)
- handleObscurity(w);
-
- return result;
-}
-
-void QSGD3D12ThreadedRenderLoop::update(QQuickWindow *window)
-{
- WindowData *w = windowFor(windows, window);
- if (!w)
- return;
-
- if (w->thread == QThread::currentThread()) {
- w->thread->requestRepaint();
- return;
- }
-
- // We set forceRenderPass because we want to make sure the QQuickWindow
- // actually does a full render pass after the next sync.
- w->forceRenderPass = true;
- scheduleUpdate(w);
-}
-
-void QSGD3D12ThreadedRenderLoop::maybeUpdate(QQuickWindow *window)
-{
- WindowData *w = windowFor(windows, window);
- if (w)
- scheduleUpdate(w);
-}
-
-// called in response to window->requestUpdate()
-void QSGD3D12ThreadedRenderLoop::handleUpdateRequest(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "handleUpdateRequest" << window;
-
- WindowData *w = windowFor(windows, window);
- if (w)
- polishAndSync(w, false);
-}
-
-QAnimationDriver *QSGD3D12ThreadedRenderLoop::animationDriver() const
-{
- return anim;
-}
-
-QSGContext *QSGD3D12ThreadedRenderLoop::sceneGraphContext() const
-{
- return sg;
-}
-
-QSGRenderContext *QSGD3D12ThreadedRenderLoop::createRenderContext(QSGContext *) const
-{
- return sg->createRenderContext();
-}
-
-void QSGD3D12ThreadedRenderLoop::releaseResources(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "releaseResources" << window;
-
- WindowData *w = windowFor(windows, window);
- if (w)
- handleResourceRelease(w, false);
-}
-
-void QSGD3D12ThreadedRenderLoop::postJob(QQuickWindow *window, QRunnable *job)
-{
- WindowData *w = windowFor(windows, window);
- if (w && w->thread && w->thread->exposedWindow)
- w->thread->postEvent(new QSGD3D12JobEvent(window, job));
- else
- delete job;
-}
-
-QSurface::SurfaceType QSGD3D12ThreadedRenderLoop::windowSurfaceType() const
-{
- return QSurface::OpenGLSurface;
-}
-
-bool QSGD3D12ThreadedRenderLoop::interleaveIncubation() const
-{
- bool somethingVisible = false;
- for (const WindowData &w : windows) {
- if (w.window->isVisible() && w.window->isExposed()) {
- somethingVisible = true;
- break;
- }
- }
- return somethingVisible && anim->isRunning();
-}
-
-int QSGD3D12ThreadedRenderLoop::flags() const
-{
- return SupportsGrabWithoutExpose;
-}
-
-bool QSGD3D12ThreadedRenderLoop::event(QEvent *e)
-{
- if (e->type() == QEvent::Timer) {
- QTimerEvent *te = static_cast<QTimerEvent *>(e);
- if (te->timerId() == animationTimer) {
- anim->advance();
- emit timeToIncubate();
- return true;
- }
- }
-
- return QObject::event(e);
-}
-
-void QSGD3D12ThreadedRenderLoop::onAnimationStarted()
-{
- startOrStopAnimationTimer();
-
- for (const WindowData &w : qAsConst(windows))
- w.window->requestUpdate();
-}
-
-void QSGD3D12ThreadedRenderLoop::onAnimationStopped()
-{
- startOrStopAnimationTimer();
-}
-
-void QSGD3D12ThreadedRenderLoop::startOrStopAnimationTimer()
-{
- int exposedWindowCount = 0;
- const WindowData *exposed = nullptr;
-
- for (int i = 0; i < windows.size(); ++i) {
- const WindowData &w(windows[i]);
- if (w.window->isVisible() && w.window->isExposed()) {
- ++exposedWindowCount;
- exposed = &w;
- }
- }
-
- if (animationTimer && (exposedWindowCount == 1 || !anim->isRunning())) {
- killTimer(animationTimer);
- animationTimer = 0;
- // If animations are running, make sure we keep on animating
- if (anim->isRunning())
- exposed->window->requestUpdate();
- } else if (!animationTimer && exposedWindowCount != 1 && anim->isRunning()) {
- animationTimer = startTimer(qsgrl_animation_interval());
- }
-}
-
-void QSGD3D12ThreadedRenderLoop::handleExposure(QQuickWindow *window)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "handleExposure" << window;
-
- WindowData *w = windowFor(windows, window);
- if (!w) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("adding window to list");
- WindowData win;
- win.window = window;
- QSGRenderContext *rc = QQuickWindowPrivate::get(window)->context; // will transfer ownership
- win.thread = new QSGD3D12RenderThread(this, rc);
- win.updateDuringSync = false;
- win.forceRenderPass = true; // also covered by polishAndSync(inExpose=true), but doesn't hurt
- windows.append(win);
- w = &windows.last();
- }
-
- // set this early as we'll be rendering shortly anyway and this avoids
- // special casing exposure in polishAndSync.
- w->thread->exposedWindow = window;
-
- if (w->window->size().isEmpty()
- || (w->window->isTopLevel() && !w->window->geometry().intersects(w->window->screen()->availableGeometry()))) {
-#ifndef QT_NO_DEBUG
- qWarning().noquote().nospace() << "QSGD3D12ThreadedRenderLoop: expose event received for window "
- << w->window << " with invalid geometry: " << w->window->geometry()
- << " on " << w->window->screen();
-#endif
- }
-
- if (!w->window->handle())
- w->window->create();
-
- // Start render thread if it is not running
- if (!w->thread->isRunning()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("starting render thread");
- // Push a few things to the render thread.
- QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController.data();
- if (controller->thread() != w->thread)
- controller->moveToThread(w->thread);
- if (w->thread->thread() == QThread::currentThread()) {
- w->thread->rc->moveToThread(w->thread);
- w->thread->moveToThread(w->thread);
- }
-
- w->thread->active = true;
- w->thread->start();
-
- if (!w->thread->isRunning())
- qFatal("Render thread failed to start, aborting application.");
- }
-
- polishAndSync(w, true);
-
- startOrStopAnimationTimer();
-}
-
-void QSGD3D12ThreadedRenderLoop::handleObscurity(WindowData *w)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "handleObscurity" << w->window;
-
- if (w->thread->isRunning()) {
- w->thread->mutex.lock();
- w->thread->postEvent(new QSGD3D12WindowEvent(w->window, WM_Obscure));
- w->thread->waitCondition.wait(&w->thread->mutex);
- w->thread->mutex.unlock();
- }
-
- startOrStopAnimationTimer();
-}
-
-void QSGD3D12ThreadedRenderLoop::scheduleUpdate(WindowData *w)
-{
- if (!QCoreApplication::instance())
- return;
-
- if (!w || !w->thread->isRunning())
- return;
-
- QThread *current = QThread::currentThread();
- if (current != QCoreApplication::instance()->thread() && (current != w->thread || !lockedForSync)) {
- qWarning() << "Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()";
- return;
- }
-
- if (current == w->thread) {
- w->updateDuringSync = true;
- return;
- }
-
- w->window->requestUpdate();
-}
-
-void QSGD3D12ThreadedRenderLoop::handleResourceRelease(WindowData *w, bool destroying)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "handleResourceRelease" << (destroying ? "destroying" : "hide/releaseResources") << w->window;
-
- w->thread->mutex.lock();
- if (w->thread->isRunning() && w->thread->active) {
- QQuickWindow *window = w->window;
-
- // Note that window->handle() is typically null by this time because
- // the platform window is already destroyed. This should not be a
- // problem for the D3D cleanup.
-
- w->thread->postEvent(new QSGD3D12TryReleaseEvent(window, destroying));
- w->thread->waitCondition.wait(&w->thread->mutex);
-
- // Avoid a shutdown race condition.
- // If SG is invalidated and 'active' becomes false, the thread's run()
- // method will exit. handleExposure() relies on QThread::isRunning() (because it
- // potentially needs to start the thread again) and our mutex cannot be used to
- // track the thread stopping, so we wait a few nanoseconds extra so the thread
- // can exit properly.
- if (!w->thread->active)
- w->thread->wait();
- }
- w->thread->mutex.unlock();
-}
-
-void QSGD3D12ThreadedRenderLoop::polishAndSync(WindowData *w, bool inExpose)
-{
- if (Q_UNLIKELY(debug_loop()))
- qDebug() << "polishAndSync" << (inExpose ? "(in expose)" : "(normal)") << w->window;
-
- QQuickWindow *window = w->window;
- if (!w->thread || !w->thread->exposedWindow) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - not exposed, abort");
- return;
- }
-
- // Flush pending touch events.
- QQuickWindowPrivate::get(window)->flushFrameSynchronousEvents();
- // The delivery of the event might have caused the window to stop rendering
- w = windowFor(windows, window);
- if (!w || !w->thread || !w->thread->exposedWindow) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - removed after touch event flushing, abort");
- return;
- }
-
- QElapsedTimer timer;
- qint64 polishTime = 0;
- qint64 waitTime = 0;
- qint64 syncTime = 0;
- if (Q_UNLIKELY(debug_time()))
- timer.start();
- Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync);
-
- QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
- wd->polishItems();
-
- if (Q_UNLIKELY(debug_time()))
- polishTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
- QQuickProfiler::SceneGraphPolishAndSyncPolish);
-
- w->updateDuringSync = false;
-
- emit window->afterAnimating();
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - lock for sync");
- w->thread->mutex.lock();
- lockedForSync = true;
- w->thread->postEvent(new QSGD3D12SyncEvent(window, inExpose, w->forceRenderPass));
- w->forceRenderPass = false;
-
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - wait for sync");
- if (Q_UNLIKELY(debug_time()))
- waitTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
- QQuickProfiler::SceneGraphPolishAndSyncWait);
- w->thread->waitCondition.wait(&w->thread->mutex);
- lockedForSync = false;
- w->thread->mutex.unlock();
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - unlock after sync");
-
- if (Q_UNLIKELY(debug_time()))
- syncTime = timer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
- QQuickProfiler::SceneGraphPolishAndSyncSync);
-
- if (!animationTimer && anim->isRunning()) {
- if (Q_UNLIKELY(debug_loop()))
- qDebug("polishAndSync - advancing animations");
- anim->advance();
- // We need to trigger another sync to keep animations running...
- w->window->requestUpdate();
- emit timeToIncubate();
- } else if (w->updateDuringSync) {
- w->window->requestUpdate();
- }
-
- if (Q_UNLIKELY(debug_time()))
- qDebug().nospace()
- << "Frame prepared with 'd3d12' renderloop"
- << ", polish=" << (polishTime / 1000000)
- << ", lock=" << (waitTime - polishTime) / 1000000
- << ", blockedForSync=" << (syncTime - waitTime) / 1000000
- << ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
- << " - (on gui thread) " << window;
-
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
- QQuickProfiler::SceneGraphPolishAndSyncAnimations);
-}
-
-#include "qsgd3d12threadedrenderloop.moc"
-
-QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop_p.h
deleted file mode 100644
index 46f62948f1..0000000000
--- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QSGD3D12THREADEDRENDERLOOP_P_H
-#define QSGD3D12THREADEDRENDERLOOP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qsgrenderloop_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGD3D12Engine;
-class QSGD3D12Context;
-class QSGD3D12RenderContext;
-class QSGD3D12RenderThread;
-
-class QSGD3D12ThreadedRenderLoop : public QSGRenderLoop
-{
- Q_OBJECT
-
-public:
- QSGD3D12ThreadedRenderLoop();
- ~QSGD3D12ThreadedRenderLoop();
-
- void show(QQuickWindow *window) override;
- void hide(QQuickWindow *window) override;
- void resize(QQuickWindow *window) override;
-
- void windowDestroyed(QQuickWindow *window) override;
-
- void exposureChanged(QQuickWindow *window) override;
-
- QImage grab(QQuickWindow *window) override;
-
- void update(QQuickWindow *window) override;
- void maybeUpdate(QQuickWindow *window) override;
- void handleUpdateRequest(QQuickWindow *window) override;
-
- QAnimationDriver *animationDriver() const override;
-
- QSGContext *sceneGraphContext() const override;
- QSGRenderContext *createRenderContext(QSGContext *) const override;
-
- void releaseResources(QQuickWindow *window) override;
- void postJob(QQuickWindow *window, QRunnable *job) override;
-
- QSurface::SurfaceType windowSurfaceType() const override;
- bool interleaveIncubation() const override;
- int flags() const override;
-
- bool event(QEvent *e) override;
-
-public Q_SLOTS:
- void onAnimationStarted();
- void onAnimationStopped();
-
-private:
- struct WindowData {
- QQuickWindow *window;
- QSGD3D12RenderThread *thread;
- uint updateDuringSync : 1;
- uint forceRenderPass : 1;
- };
-
- void startOrStopAnimationTimer();
- void handleExposure(QQuickWindow *window);
- void handleObscurity(WindowData *w);
- void scheduleUpdate(WindowData *w);
- void handleResourceRelease(WindowData *w, bool destroying);
- void polishAndSync(WindowData *w, bool inExpose);
-
- QSGD3D12Context *sg;
- QAnimationDriver *anim;
- int animationTimer = 0;
- bool lockedForSync = false;
- QVector<WindowData> windows;
-
- friend class QSGD3D12RenderThread;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGD3D12THREADEDRENDERLOOP_P_H
diff --git a/src/plugins/scenegraph/d3d12/shaders/flatcolor.hlsl b/src/plugins/scenegraph/d3d12/shaders/flatcolor.hlsl
deleted file mode 100644
index 034b51435a..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/flatcolor.hlsl
+++ /dev/null
@@ -1,27 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float4 color;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
-};
-
-PSInput VS_FlatColor(VSInput input)
-{
- PSInput result;
- result.position = mul(mvp, input.position);
- return result;
-}
-
-float4 PS_FlatColor(PSInput input) : SV_TARGET
-{
- return color;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl b/src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl
deleted file mode 100644
index 6793b534b0..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl
+++ /dev/null
@@ -1,60 +0,0 @@
-static const uint GROUP_DIM = 8; // 2 ^ (out_mip_count - 1)
-
-Texture2D tex : register(t0);
-SamplerState samp : register(s0);
-
-cbuffer ConstantBuffer : register(b0)
-{
- uint2 mip1Size;
- uint sampleLevel;
- uint totalMips;
-}
-
-RWTexture2D<float4> mip1 : register(u0);
-RWTexture2D<float4> mip2 : register(u1);
-RWTexture2D<float4> mip3 : register(u2);
-RWTexture2D<float4> mip4 : register(u3);
-
-groupshared float4 groupColor[GROUP_DIM][GROUP_DIM];
-
-[numthreads(GROUP_DIM, GROUP_DIM, 1)]
-void CS_Generate4MipMaps(uint3 localId: SV_GroupThreadId, uint3 globalId: SV_DispatchThreadID)
-{
- const float2 coord = float2(1.0f / float(mip1Size.x), 1.0f / float(mip1Size.y)) * (globalId.xy + 0.5);
- float4 c = tex.SampleLevel(samp, coord, sampleLevel);
-
- mip1[globalId.xy] = c;
- groupColor[localId.y][localId.x] = c;
-
- if (sampleLevel + 1 >= totalMips)
- return;
-
- GroupMemoryBarrierWithGroupSync();
-
- if ((localId.x & 1) == 0 && (localId.y & 1) == 0) {
- c = (c + groupColor[localId.y][localId.x + 1] + groupColor[localId.y + 1][localId.x] + groupColor[localId.y + 1][localId.x + 1]) / 4.0;
- mip2[globalId.xy / 2] = c;
- groupColor[localId.y][localId.x] = c;
- }
-
- if (sampleLevel + 2 >= totalMips)
- return;
-
- GroupMemoryBarrierWithGroupSync();
-
- if ((localId.x & 3) == 0 && (localId.y & 3) == 0) {
- c = (c + groupColor[localId.y][localId.x + 2] + groupColor[localId.y + 2][localId.x] + groupColor[localId.y + 2][localId.x + 2]) / 4.0;
- mip3[globalId.xy / 4] = c;
- groupColor[localId.y][localId.x] = c;
- }
-
- if (sampleLevel + 3 >= totalMips)
- return;
-
- GroupMemoryBarrierWithGroupSync();
-
- if ((localId.x & 7) == 0 && (localId.y & 7) == 0) {
- c = (c + groupColor[localId.y][localId.x + 3] + groupColor[localId.y + 3][localId.x] + groupColor[localId.y + 3][localId.x + 3]) / 4.0;
- mip4[globalId.xy / 8] = c;
- }
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/shadereffectdefault.hlsl b/src/plugins/scenegraph/d3d12/shaders/shadereffectdefault.hlsl
deleted file mode 100644
index 94672d6267..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/shadereffectdefault.hlsl
+++ /dev/null
@@ -1,27 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-
-PSInput VS_DefaultShaderEffect(float4 position : POSITION, float2 coord : TEXCOORD0)
-{
- PSInput result;
- result.position = mul(qt_Matrix, position);
- result.coord = coord;
- return result;
-}
-
-float4 PS_DefaultShaderEffect(PSInput input) : SV_TARGET
-{
- return source.Sample(sourceSampler, input.coord) * qt_Opacity;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/shaders.pri b/src/plugins/scenegraph/d3d12/shaders/shaders.pri
deleted file mode 100644
index 963f4c5d8c..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/shaders.pri
+++ /dev/null
@@ -1,141 +0,0 @@
-vertexcolor_VSPS = $$PWD/vertexcolor.hlsl
-vertexcolor_vshader.input = vertexcolor_VSPS
-vertexcolor_vshader.header = vs_vertexcolor.hlslh
-vertexcolor_vshader.entry = VS_VertexColor
-vertexcolor_vshader.type = vs_5_0
-vertexcolor_pshader.input = vertexcolor_VSPS
-vertexcolor_pshader.header = ps_vertexcolor.hlslh
-vertexcolor_pshader.entry = PS_VertexColor
-vertexcolor_pshader.type = ps_5_0
-
-flatcolor_VSPS = $$PWD/flatcolor.hlsl
-flatcolor_vshader.input = flatcolor_VSPS
-flatcolor_vshader.header = vs_flatcolor.hlslh
-flatcolor_vshader.entry = VS_FlatColor
-flatcolor_vshader.type = vs_5_0
-flatcolor_pshader.input = flatcolor_VSPS
-flatcolor_pshader.header = ps_flatcolor.hlslh
-flatcolor_pshader.entry = PS_FlatColor
-flatcolor_pshader.type = ps_5_0
-
-stencilclip_VSPS = $$PWD/stencilclip.hlsl
-stencilclip_vshader.input = stencilclip_VSPS
-stencilclip_vshader.header = vs_stencilclip.hlslh
-stencilclip_vshader.entry = VS_StencilClip
-stencilclip_vshader.type = vs_5_0
-stencilclip_pshader.input = stencilclip_VSPS
-stencilclip_pshader.header = ps_stencilclip.hlslh
-stencilclip_pshader.entry = PS_StencilClip
-stencilclip_pshader.type = ps_5_0
-
-smoothcolor_VSPS = $$PWD/smoothcolor.hlsl
-smoothcolor_vshader.input = smoothcolor_VSPS
-smoothcolor_vshader.header = vs_smoothcolor.hlslh
-smoothcolor_vshader.entry = VS_SmoothColor
-smoothcolor_vshader.type = vs_5_0
-smoothcolor_pshader.input = smoothcolor_VSPS
-smoothcolor_pshader.header = ps_smoothcolor.hlslh
-smoothcolor_pshader.entry = PS_SmoothColor
-smoothcolor_pshader.type = ps_5_0
-
-texture_VSPS = $$PWD/texture.hlsl
-texture_vshader.input = texture_VSPS
-texture_vshader.header = vs_texture.hlslh
-texture_vshader.entry = VS_Texture
-texture_vshader.type = vs_5_0
-texture_pshader.input = texture_VSPS
-texture_pshader.header = ps_texture.hlslh
-texture_pshader.entry = PS_Texture
-texture_pshader.type = ps_5_0
-
-smoothtexture_VSPS = $$PWD/smoothtexture.hlsl
-smoothtexture_vshader.input = smoothtexture_VSPS
-smoothtexture_vshader.header = vs_smoothtexture.hlslh
-smoothtexture_vshader.entry = VS_SmoothTexture
-smoothtexture_vshader.type = vs_5_0
-smoothtexture_pshader.input = smoothtexture_VSPS
-smoothtexture_pshader.header = ps_smoothtexture.hlslh
-smoothtexture_pshader.entry = PS_SmoothTexture
-smoothtexture_pshader.type = ps_5_0
-
-mipmapgen_CS = $$PWD/mipmapgen.hlsl
-mipmapgen_cshader.input = mipmapgen_CS
-mipmapgen_cshader.header = cs_mipmapgen.hlslh
-mipmapgen_cshader.entry = CS_Generate4MipMaps
-mipmapgen_cshader.type = cs_5_0
-
-textmask_VSPS = $$PWD/textmask.hlsl
-textmask_vshader.input = textmask_VSPS
-textmask_vshader.header = vs_textmask.hlslh
-textmask_vshader.entry = VS_TextMask
-textmask_vshader.type = vs_5_0
-textmask_pshader24.input = textmask_VSPS
-textmask_pshader24.header = ps_textmask24.hlslh
-textmask_pshader24.entry = PS_TextMask24
-textmask_pshader24.type = ps_5_0
-textmask_pshader32.input = textmask_VSPS
-textmask_pshader32.header = ps_textmask32.hlslh
-textmask_pshader32.entry = PS_TextMask32
-textmask_pshader32.type = ps_5_0
-textmask_pshader8.input = textmask_VSPS
-textmask_pshader8.header = ps_textmask8.hlslh
-textmask_pshader8.entry = PS_TextMask8
-textmask_pshader8.type = ps_5_0
-styledtext_vshader.input = textmask_VSPS
-styledtext_vshader.header = vs_styledtext.hlslh
-styledtext_vshader.entry = VS_StyledText
-styledtext_vshader.type = vs_5_0
-styledtext_pshader.input = textmask_VSPS
-styledtext_pshader.header = ps_styledtext.hlslh
-styledtext_pshader.entry = PS_StyledText
-styledtext_pshader.type = ps_5_0
-outlinedtext_vshader.input = textmask_VSPS
-outlinedtext_vshader.header = vs_outlinedtext.hlslh
-outlinedtext_vshader.entry = VS_OutlinedText
-outlinedtext_vshader.type = vs_5_0
-outlinedtext_pshader.input = textmask_VSPS
-outlinedtext_pshader.header = ps_outlinedtext.hlslh
-outlinedtext_pshader.entry = PS_OutlinedText
-outlinedtext_pshader.type = ps_5_0
-
-shadereffectdefault_VSPS = $$PWD/shadereffectdefault.hlsl
-shadereffectdefault_vshader.input = shadereffectdefault_VSPS
-shadereffectdefault_vshader.header = vs_shadereffectdefault.hlslh
-shadereffectdefault_vshader.entry = VS_DefaultShaderEffect
-shadereffectdefault_vshader.type = vs_5_0
-shadereffectdefault_pshader.input = shadereffectdefault_VSPS
-shadereffectdefault_pshader.header = ps_shadereffectdefault.hlslh
-shadereffectdefault_pshader.entry = PS_DefaultShaderEffect
-shadereffectdefault_pshader.type = ps_5_0
-
-sprite_VSPS = $$PWD/sprite.hlsl
-sprite_vshader.input = sprite_VSPS
-sprite_vshader.header = vs_sprite.hlslh
-sprite_vshader.entry = VS_Sprite
-sprite_vshader.type = vs_5_0
-sprite_pshader.input = sprite_VSPS
-sprite_pshader.header = ps_sprite.hlslh
-sprite_pshader.entry = PS_Sprite
-sprite_pshader.type = ps_5_0
-
-tdr_CS = $$PWD/tdr.hlsl
-tdr_cshader.input = tdr_CS
-tdr_cshader.header = cs_tdr.hlslh
-tdr_cshader.entry = timeout
-tdr_cshader.type = cs_5_0
-
-HLSL_SHADERS = \
- vertexcolor_vshader vertexcolor_pshader \
- flatcolor_vshader flatcolor_pshader \
- stencilclip_vshader stencilclip_pshader \
- smoothcolor_vshader smoothcolor_pshader \
- texture_vshader texture_pshader \
- smoothtexture_vshader smoothtexture_pshader \
- mipmapgen_cshader \
- textmask_vshader textmask_pshader24 textmask_pshader32 textmask_pshader8 \
- styledtext_vshader styledtext_pshader outlinedtext_vshader outlinedtext_pshader \
- shadereffectdefault_vshader shadereffectdefault_pshader \
- sprite_vshader sprite_pshader \
- tdr_cshader
-
-load(hlsl_bytecode_header)
diff --git a/src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl b/src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl
deleted file mode 100644
index 4f69eea60f..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl
+++ /dev/null
@@ -1,64 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float4 color : COLOR;
- float2 offset : TEXCOORD0;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float opacity;
- float2 pixelSize;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float4 color : COLOR;
-};
-
-PSInput VS_SmoothColor(VSInput input)
-{
- PSInput result;
-
- float4 pos = mul(mvp, input.position);
-
- if (input.offset.x != 0.0) {
- // In HLSL matrix packing is column-major by default (which is good) but the math is row-major (unlike GLSL).
- float4 delta = float4(mvp._11, mvp._21, mvp._31, mvp._41) * input.offset.x;
- float2 dir = delta.xy * pos.w - pos.xy * delta.w;
- float2 ndir = 0.5 * pixelSize * normalize(dir / pixelSize);
- dir -= ndir * delta.w * pos.w;
- float numerator = dot(dir, ndir * pos.w * pos.w);
- float scale = 0.0;
- if (numerator < 0.0)
- scale = 1.0;
- else
- scale = min(1.0, numerator / dot(dir, dir));
- pos += scale * delta;
- }
-
- if (input.offset.y != 0.0) {
- float4 delta = float4(mvp._12, mvp._22, mvp._32, mvp._42) * input.offset.y;
- float2 dir = delta.xy * pos.w - pos.xy * delta.w;
- float2 ndir = 0.5 * pixelSize * normalize(dir / pixelSize);
- dir -= ndir * delta.w * pos.w;
- float numerator = dot(dir, ndir * pos.w * pos.w);
- float scale = 0.0;
- if (numerator < 0.0)
- scale = 1.0;
- else
- scale = min(1.0, numerator / dot(dir, dir));
- pos += scale * delta;
- }
-
- result.position = pos;
- result.color = input.color * opacity;
- return result;
-}
-
-float4 PS_SmoothColor(PSInput input) : SV_TARGET
-{
- return input.color;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl b/src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl
deleted file mode 100644
index 05b1c6e9d4..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl
+++ /dev/null
@@ -1,77 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float2 coord : TEXCOORD0;
- float2 offset : TEXCOORD1;
- float2 coordOffset : TEXCOORD2;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float opacity;
- float2 pixelSize;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
- float vertexOpacity : TEXCOORD3;
-};
-
-Texture2D tex : register(t0);
-SamplerState samp : register(s0);
-
-PSInput VS_SmoothTexture(VSInput input)
-{
- PSInput result;
-
- float4 pos = mul(mvp, input.position);
- float2 coord = input.coord;
-
- if (input.offset.x != 0.0) {
- // In HLSL matrix packing is column-major by default (which is good) but the math is row-major (unlike GLSL).
- float4 delta = float4(mvp._11, mvp._21, mvp._31, mvp._41) * input.offset.x;
- float2 dir = delta.xy * pos.w - pos.xy * delta.w;
- float2 ndir = 0.5 * pixelSize * normalize(dir / pixelSize);
- dir -= ndir * delta.w * pos.w;
- float numerator = dot(dir, ndir * pos.w * pos.w);
- float scale = 0.0;
- if (numerator < 0.0)
- scale = 1.0;
- else
- scale = min(1.0, numerator / dot(dir, dir));
- pos += scale * delta;
- coord.x += scale * input.coordOffset.x;
- }
-
- if (input.offset.y != 0.0) {
- float4 delta = float4(mvp._12, mvp._22, mvp._32, mvp._42) * input.offset.y;
- float2 dir = delta.xy * pos.w - pos.xy * delta.w;
- float2 ndir = 0.5 * pixelSize * normalize(dir / pixelSize);
- dir -= ndir * delta.w * pos.w;
- float numerator = dot(dir, ndir * pos.w * pos.w);
- float scale = 0.0;
- if (numerator < 0.0)
- scale = 1.0;
- else
- scale = min(1.0, numerator / dot(dir, dir));
- pos += scale * delta;
- coord.y += scale * input.coordOffset.y;
- }
-
- if ((input.offset.x != 0.0 || input.offset.y != 0.0) && (input.coordOffset.x == 0.0 && input.coordOffset.y == 0.0))
- result.vertexOpacity = 0.0;
- else
- result.vertexOpacity = opacity;
-
- result.position = pos;
- result.coord = coord;
- return result;
-}
-
-float4 PS_SmoothTexture(PSInput input) : SV_TARGET
-{
- return tex.Sample(samp, input.coord) * input.vertexOpacity;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/sprite.hlsl b/src/plugins/scenegraph/d3d12/shaders/sprite.hlsl
deleted file mode 100644
index d4e3b066ee..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/sprite.hlsl
+++ /dev/null
@@ -1,43 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float2 coord : TEXCOORD0;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float4 animPos;
- float3 animData;
- float opacity;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float4 fTexS : TEXCOORD0;
- float progress : TEXCOORD1;
-};
-
-Texture2D tex : register(t0);
-SamplerState samp : register(s0);
-
-PSInput VS_Sprite(VSInput input)
-{
- PSInput result;
-
- result.position = mul(mvp, input.position);
- result.progress = animData.z;
-
- // Calculate frame location in texture
- result.fTexS.xy = animPos.xy + input.coord.xy * animData.xy;
- // Next frame is also passed, for interpolation
- result.fTexS.zw = animPos.zw + input.coord.xy * animData.xy;
-
- return result;
-}
-
-float4 PS_Sprite(PSInput input) : SV_TARGET
-{
- return lerp(tex.Sample(samp, input.fTexS.xy), tex.Sample(samp, input.fTexS.zw), input.progress) * opacity;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl b/src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl
deleted file mode 100644
index 9aff84d261..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl
+++ /dev/null
@@ -1,26 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
-};
-
-PSInput VS_StencilClip(VSInput input)
-{
- PSInput result;
- result.position = mul(mvp, input.position);
- return result;
-}
-
-float4 PS_StencilClip(PSInput input) : SV_TARGET
-{
- return float4(0.81, 0.83, 0.12, 1.0); // Trolltech green ftw!
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/tdr.hlsl b/src/plugins/scenegraph/d3d12/shaders/tdr.hlsl
deleted file mode 100644
index f32d4fbace..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/tdr.hlsl
+++ /dev/null
@@ -1,11 +0,0 @@
-// http://gamedev.stackexchange.com/questions/108141/how-can-i-test-dxgi-error-device-removed-error-handling
-
-RWBuffer<uint> uav;
-cbuffer ConstantBuffer { uint zero; }
-
-[numthreads(256, 1, 1)]
-void timeout(uint3 id: SV_DispatchThreadID)
-{
- while (zero == 0)
- uav[id.x] = zero;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/textmask.hlsl b/src/plugins/scenegraph/d3d12/shaders/textmask.hlsl
deleted file mode 100644
index bb9381e7c0..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/textmask.hlsl
+++ /dev/null
@@ -1,104 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float2 coord : TEXCOORD0;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float2 textureScale;
- float dpr;
- float color; // for TextMask24 and 32
- float4 colorVec; // for TextMask8 and Styled and Outlined
- float2 shift; // for Styled
- float4 styleColor; // for Styled and Outlined
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
-};
-
-Texture2D tex : register(t0);
-SamplerState samp : register(s0);
-
-PSInput VS_TextMask(VSInput input)
-{
- PSInput result;
- result.position = mul(mvp, floor(input.position * dpr + 0.5) / dpr);
- result.coord = input.coord * textureScale;
- return result;
-}
-
-float4 PS_TextMask24(PSInput input) : SV_TARGET
-{
- float4 glyph = tex.Sample(samp, input.coord);
- return float4(glyph.rgb * color, glyph.a);
-}
-
-float4 PS_TextMask32(PSInput input) : SV_TARGET
-{
- return tex.Sample(samp, input.coord) * color;
-}
-
-float4 PS_TextMask8(PSInput input) : SV_TARGET
-{
- return colorVec * tex.Sample(samp, input.coord).a;
-}
-
-struct StyledPSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
- float2 shiftedCoord : TEXCOORD1;
-};
-
-StyledPSInput VS_StyledText(VSInput input)
-{
- StyledPSInput result;
- result.position = mul(mvp, floor(input.position * dpr + 0.5) / dpr);
- result.coord = input.coord * textureScale;
- result.shiftedCoord = (input.coord - shift) * textureScale;
- return result;
-}
-
-float4 PS_StyledText(StyledPSInput input) : SV_TARGET
-{
- float glyph = tex.Sample(samp, input.coord).a;
- float style = clamp(tex.Sample(samp, input.shiftedCoord).a - glyph, 0.0, 1.0);
- return style * styleColor + glyph * colorVec;
-}
-
-struct OutlinedPSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
- float2 coordUp : TEXCOORD1;
- float2 coordDown : TEXCOORD2;
- float2 coordLeft : TEXCOORD3;
- float2 coordRight : TEXCOORD4;
-};
-
-OutlinedPSInput VS_OutlinedText(VSInput input)
-{
- OutlinedPSInput result;
- result.position = mul(mvp, floor(input.position * dpr + 0.5) / dpr);
- result.coord = input.coord * textureScale;
- result.coordUp = (input.coord - float2(0.0, -1.0)) * textureScale;
- result.coordDown = (input.coord - float2(0.0, 1.0)) * textureScale;
- result.coordLeft = (input.coord - float2(-1.0, 0.0)) * textureScale;
- result.coordRight = (input.coord - float2(1.0, 0.0)) * textureScale;
- return result;
-}
-
-float4 PS_OutlinedText(OutlinedPSInput input) : SV_TARGET
-{
- float glyph = tex.Sample(samp, input.coord).a;
- float outline = clamp(clamp(tex.Sample(samp, input.coordUp).a
- + tex.Sample(samp, input.coordDown).a
- + tex.Sample(samp, input.coordLeft).a
- + tex.Sample(samp, input.coordRight).a, 0.0, 1.0) - glyph, 0.0, 1.0);
- return outline * styleColor + glyph * colorVec;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/texture.hlsl b/src/plugins/scenegraph/d3d12/shaders/texture.hlsl
deleted file mode 100644
index 1ae6579e8d..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/texture.hlsl
+++ /dev/null
@@ -1,33 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float2 coord : TEXCOORD0;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float opacity;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
-};
-
-Texture2D tex : register(t0);
-SamplerState samp : register(s0);
-
-PSInput VS_Texture(VSInput input)
-{
- PSInput result;
- result.position = mul(mvp, input.position);
- result.coord = input.coord;
- return result;
-}
-
-float4 PS_Texture(PSInput input) : SV_TARGET
-{
- return tex.Sample(samp, input.coord) * opacity;
-}
diff --git a/src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl b/src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl
deleted file mode 100644
index a0569bb5c1..0000000000
--- a/src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl
+++ /dev/null
@@ -1,32 +0,0 @@
-struct VSInput
-{
- float4 position : POSITION;
- float4 color : COLOR;
-};
-
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 mvp;
- float opacity;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float4 color : COLOR;
-};
-
-PSInput VS_VertexColor(VSInput input)
-{
- PSInput result;
-
- result.position = mul(mvp, input.position);
- result.color = input.color * opacity;
-
- return result;
-}
-
-float4 PS_VertexColor(PSInput input) : SV_TARGET
-{
- return input.color;
-}
diff --git a/src/plugins/scenegraph/openvg/openvg.pro b/src/plugins/scenegraph/openvg/openvg.pro
index 43c2636343..7f9f4bfec5 100644
--- a/src/plugins/scenegraph/openvg/openvg.pro
+++ b/src/plugins/scenegraph/openvg/openvg.pro
@@ -6,6 +6,18 @@ PLUGIN_TYPE = scenegraph
PLUGIN_CLASS_NAME = QSGOpenVGAdaptation
load(qt_plugin)
+TRACEPOINT_PROVIDER = $$PWD/openvg.tracepoints
+CONFIG += qt_tracepoints
+debug_and_release {
+ CONFIG(debug, debug|release) {
+ INCLUDEPATH += $$OUT_PWD/../../../quick/.tracegen/debug
+ } else {
+ INCLUDEPATH += $$OUT_PWD/../../../quick/.tracegen/release
+ }
+} else {
+ INCLUDEPATH += $$OUT_PWD/../../../quick/.tracegen/
+}
+
QMAKE_TARGET_PRODUCT = "Qt Quick OpenVG Renderer (Qt $$QT_VERSION)"
QMAKE_TARGET_DESCRIPTION = "Quick OpenVG Renderer for Qt."
diff --git a/src/plugins/scenegraph/openvg/openvg.tracepoints b/src/plugins/scenegraph/openvg/openvg.tracepoints
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/plugins/scenegraph/openvg/openvg.tracepoints
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
index 85651ece9d..90ccab2682 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
@@ -47,6 +47,8 @@
#include <private/qquickwindow_p.h>
#include <private/qquickprofiler_p.h>
+#include <qtquick_tracepoints_p.h>
+
#include "qopenvgcontext_p.h"
QT_BEGIN_NAMESPACE
@@ -171,6 +173,8 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (!cd->isRenderable() || !m_windows.contains(window))
return;
+ Q_TRACE_SCOPE(QSG_renderWindow);
+
WindowData &data = const_cast<WindowData &>(m_windows[window]);
if (vg == nullptr) {
@@ -198,14 +202,17 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
renderTimer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
+ Q_TRACE(QSG_polishItems_entry);
cd->polishItems();
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphPolishPolish);
+ Q_TRACE(QSG_sync_entry);
emit window->afterAnimating();
@@ -214,8 +221,10 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync);
+ Q_TRACE(QSG_render_entry);
// setup coordinate system for window
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
@@ -227,8 +236,10 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
if (data.grabOnly) {
grabContent = vg->readFramebuffer(window->size() * window->effectiveDevicePixelRatio());
@@ -243,6 +254,7 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_swap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSwap);
diff --git a/src/plugins/scenegraph/scenegraph.pro b/src/plugins/scenegraph/scenegraph.pro
index 39c0c0815c..9cc521a191 100644
--- a/src/plugins/scenegraph/scenegraph.pro
+++ b/src/plugins/scenegraph/scenegraph.pro
@@ -1,5 +1,4 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += quick
-qtConfig(d3d12): SUBDIRS += d3d12
qtConfig(openvg): SUBDIRS += openvg
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h
index 7abf530996..3e5e4ae11e 100644
--- a/src/qml/common/qv4compileddata_p.h
+++ b/src/qml/common/qv4compileddata_p.h
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
// Also change the comment behind the number to describe the latest change. This has the added
// benefit that if another patch changes the version too, it will result in a merge conflict, and
// not get removed silently.
-#define QV4_DATA_STRUCTURE_VERSION 0x26// support required properties
+#define QV4_DATA_STRUCTURE_VERSION 0x27 // resolved merge
class QIODevice;
class QQmlTypeNameCache;
@@ -195,39 +195,14 @@ struct JSClass
};
static_assert(sizeof(JSClass) == 4, "JSClass structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
-// This data structure is intended to be binary compatible with QStringData/QStaticStringData on
-// 64-bit and 32-bit little-endian architectures, in all directions. So the same structure mapped
-// from a file must be castable to a QStringData regardless of the pointer size. With the first
-// few fields that's easy, they're always 32-bit. However the offset field of QArrayData is a
-// ptrdiff_t and thus variable in size.
-// On 64-bit systems compilers enforce an 8-byte alignment and thus place it at offset 16, while
-// on 32-bit systems offset 12 is sufficient. Therefore the two values don't overlap and contain
-// the same value.
struct String
{
- qint32_le refcount; // -1
qint32_le size;
- quint32_le allocAndCapacityReservedFlag; // 0
- quint32_le offsetOn32Bit;
- quint64_le offsetOn64Bit;
- // uint16 strdata[]
static int calculateSize(const QString &str) {
return (sizeof(String) + (str.length() + 1) * sizeof(quint16) + 7) & ~0x7;
}
};
-static_assert(sizeof(String) == 24, "String structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
-
-// Ensure compatibility with QString
-static_assert(offsetof(QArrayData, ref) == offsetof(String, refcount), "refcount must be at the same location");
-static_assert(offsetof(QArrayData, size) == offsetof(String, size), "size must be at the same location");
-static_assert(offsetof(String, offsetOn64Bit) == 16, "offset must be at 8-byte aligned location");
-static_assert(offsetof(String, offsetOn32Bit) == 12, "offset must be at 4-byte aligned location");
-#if QT_POINTER_SIZE == 8
-static_assert(offsetof(QArrayData, offset) == offsetof(String, offsetOn64Bit), "offset must be at the same location");
-#else
-static_assert(offsetof(QArrayData, offset) == offsetof(String, offsetOn32Bit), "offset must be at the same location");
-#endif
struct CodeOffsetToLine {
quint32_le codeOffset;
@@ -304,13 +279,15 @@ struct Function
quint16_le nLineNumbers;
size_t lineNumberOffset() const { return localsOffset + nLocals * sizeof(quint32); }
quint32_le nestedFunctionIndex; // for functions that only return a single closure, used in signal handlers
+
+ quint32_le nRegisters;
+ Location location;
+ quint32_le nLabelInfos;
+
quint16_le sizeOfLocalTemporalDeadZone;
quint16_le firstTemporalDeadZoneRegister;
quint16_le sizeOfRegisterTemporalDeadZone;
- quint16_le nRegisters;
- Location location;
- quint32_le nLabelInfos;
size_t labelInfosOffset() const { return lineNumberOffset() + nLineNumbers * sizeof(CodeOffsetToLine); }
// Keep all unaligned data at the end
@@ -960,14 +937,13 @@ struct Unit
const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
const quint32_le offset = offsetTable[idx];
const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
+ Q_ASSERT(str->size >= 0);
if (str->size == 0)
return QString();
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- if (flags & StaticData) {
- const QStringDataPtr holder = { const_cast<QStringData *>(reinterpret_cast<const QStringData*>(str)) };
- return QString(holder);
- }
const QChar *characters = reinterpret_cast<const QChar *>(str + 1);
+ if (flags & StaticData)
+ return QString::fromRawData(characters, str->size);
return QString(characters, str->size);
#else
const quint16_le *characters = reinterpret_cast<const quint16_le *>(str + 1);
diff --git a/src/qml/common/qv4stringtoarrayindex_p.h b/src/qml/common/qv4stringtoarrayindex_p.h
index 61bd988d1e..d4b064f865 100644
--- a/src/qml/common/qv4stringtoarrayindex_p.h
+++ b/src/qml/common/qv4stringtoarrayindex_p.h
@@ -65,6 +65,8 @@ inline uint charToUInt(const char *ch) { return static_cast<unsigned char>(*ch);
template <typename T>
uint stringToArrayIndex(const T *ch, const T *end)
{
+ if (ch == end)
+ return std::numeric_limits<uint>::max();
uint i = charToUInt(ch) - '0';
if (i > 9)
return std::numeric_limits<uint>::max();
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index c43ea64e2e..d61456f38d 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1371,6 +1371,40 @@ bool Codegen::visit(BinaryExpression *ast)
setExprResult(Reference::fromAccumulator(this));
}
return false;
+ } else if (ast->op == QSOperator::Coalesce) {
+
+ Reference left = expression(ast->left);
+ if (hasError())
+ return false;
+
+ BytecodeGenerator::Label iftrue = bytecodeGenerator->newLabel();
+ BytecodeGenerator::Label iffalse = bytecodeGenerator->newLabel();
+
+ Instruction::CmpNeNull cmp;
+
+ left = left.storeOnStack();
+ left.loadInAccumulator();
+ bytecodeGenerator->addInstruction(cmp);
+
+ bytecodeGenerator->jumpTrue().link(iftrue);
+ bytecodeGenerator->jumpFalse().link(iffalse);
+
+ blockTailCalls.unblock();
+
+ iftrue.link();
+
+ left.loadInAccumulator();
+
+ BytecodeGenerator::Jump jump_endif = bytecodeGenerator->jump();
+
+ iffalse.link();
+
+ Reference right = expression(ast->right);
+ right.loadInAccumulator();
+ jump_endif.link();
+ setExprResult(Reference::fromAccumulator(this));
+
+ return false;
} else if (ast->op == QSOperator::Assign) {
if (AST::Pattern *p = ast->left->patternCast()) {
RegisterScope scope(this);
@@ -1497,7 +1531,9 @@ bool Codegen::visit(BinaryExpression *ast)
break;
}
-
+ case QSOperator::As:
+ setExprResult(left);
+ break;
} // switch
return false;
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index acc4b02e96..0c0a005689 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
@@ -47,6 +48,7 @@
#include <private/qml_compile_hash_p.h>
#include <private/qqmlirbuilder_p.h>
#include <QCryptographicHash>
+#include <QtEndian>
// Efficient implementation that takes advantage of powers of two.
static inline size_t roundUpToMultipleOf(size_t divisor, size_t x)
@@ -108,19 +110,11 @@ void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit)
QV4::CompiledData::String *s = reinterpret_cast<QV4::CompiledData::String *>(stringData);
Q_ASSERT(reinterpret_cast<uintptr_t>(s) % alignof(QV4::CompiledData::String) == 0);
- s->refcount = -1;
+ Q_ASSERT(qstr.length() >= 0);
s->size = qstr.length();
- s->allocAndCapacityReservedFlag = 0;
- s->offsetOn32Bit = sizeof(QV4::CompiledData::String);
- s->offsetOn64Bit = sizeof(QV4::CompiledData::String);
ushort *uc = reinterpret_cast<ushort *>(reinterpret_cast<char *>(s) + sizeof(*s));
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- memcpy(uc, qstr.constData(), s->size * sizeof(ushort));
-#else
- for (int i = 0; i < s->size; ++i)
- uc[i] = qToLittleEndian<ushort>(qstr.at(i).unicode());
-#endif
+ qToLittleEndian<ushort>(qstr.constData(), s->size, uc);
uc[s->size] = 0;
stringData += QV4::CompiledData::String::calculateSize(qstr);
diff --git a/src/qml/dependencies.json b/src/qml/dependencies.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/src/qml/dependencies.json
@@ -0,0 +1 @@
+[]
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 74d0a3b27c..07ab974289 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -34,20 +34,14 @@ qhp.QtQml.subprojects.qmltypes.sortPages = true
tagfile = ../../../doc/qtqml/qtqml.tags
-depends += qtcore qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets qtxmlpatterns qtquickcontrols
+depends += qtcore qtqmlmodels qtqmlworkerscript qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets qtxmlpatterns qtquickcontrols
headerdirs += .. \
- ../../imports/models \
- ../../qmlmodels \
- ../../qml \
- ../../qmlworkerscript
+ ../../qml
sourcedirs += .. \
- ../../imports/models \
../../imports/statemachine \
- ../../qmlmodels \
- ../../qml \
- ../../qmlworkerscript
+ ../../qml
exampledirs += ../../../examples/qml \
../ \
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index 171b2b6a11..7c2693508c 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -308,6 +308,11 @@ In both the Q_PROPERTY and return from Q_INVOKABLE cases, the elements
of a std::vector are copied. This copying may be an expensive operation,
so std::vector should be used judiciously.
+You can also create a list-like data structure by constructing a QJSValue using
+QJSEngine::newArray(). Such a JavaScript array does not need any conversion
+when passing it between QML and C++. See \l{QJSValue#Working With Arrays} for
+details on how to manipulate JavaScript arrays from C++.
+
Other sequence types are not supported transparently, and instead an
instance of any other sequence type will be passed between QML and C++ as an
opaque QVariantList.
@@ -381,6 +386,14 @@ properties:
Q_DECLARE_METATYPE(Actor)
\endcode
+The usual pattern is to use a gadget class as the type of a property, or to
+emit a gadget as a signal argument. In such cases, the gadget instance is
+passed by value between C++ and QML (because it's a value type). If QML code
+changes a property of a gadget property, the entire gadget is re-created and
+passed back to the C++ property setter. In Qt 5, gadget types cannot be
+instantiated by direct declaration in QML. In contrast, a QObject instance can
+be declared; and QObject instances are always passed by pointer from C++ to QML.
+
\section1 Enumeration Types
To use a custom enumeration as a data type, its class must be registered and
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index 43987354ae..d587173e5a 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -133,10 +133,9 @@ Here is the application \c main.cpp:
\snippet tutorials/extending-qml/chapter1-basics/main.cpp 0
-This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart",
-in a type namespace called "Charts", with a version of 1.0.
-
-Lastly, we write a \c .pro project file that includes the files and the \c declarative library:
+We write a \c .pro project file that includes the files and the \c qml library, and
+defines a type namespace called "Charts" with a version of 1.0 for any types exposed
+to QML:
\quotefile tutorials/extending-qml/chapter1-basics/chapter1-basics.pro
@@ -314,15 +313,13 @@ item when its contents are drawn:
\snippet tutorials/extending-qml/chapter4-customPropertyTypes/piechart.cpp 0
-Like the \c PieChart type, the \c PieSlice type has to be registered
-using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the
-type to the "Charts" type namespace, version 1.0:
+Like the \c PieChart type, the \c PieSlice type has to be exposted to QML
+using QML_ELEMENT. As with \c PieChart, we add the "Charts" type namespace,
+version 1.0 to the .pro file:
-\snippet tutorials/extending-qml/chapter4-customPropertyTypes/main.cpp 0
-\dots
-\snippet tutorials/extending-qml/chapter4-customPropertyTypes/main.cpp 1
+\snippet tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h 0
\dots
-\snippet tutorials/extending-qml/chapter4-customPropertyTypes/main.cpp 2
+\quotefile tutorials/extending-qml/chapter1-basics/chapter4-customPropertyTypes.pro
The source code from the following files are referred to in this chapter:
\generatelist examplefiles .*chapter4.*
diff --git a/src/qml/doc/src/qmldiskcache.qdoc b/src/qml/doc/src/qmldiskcache.qdoc
new file mode 100644
index 0000000000..100334296c
--- /dev/null
+++ b/src/qml/doc/src/qmldiskcache.qdoc
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmldiskcache.html
+\title The QML Disk Cache
+\brief QML caches compiled documents on disk to improve load time.
+
+When your application loads a QML or JavaScript file for the first time,
+the QML engine compiles the file into a byte code representation on the
+fly and runs it. The compiling process can be time consuming, and subsequent
+loads of the same document yield the same result. To optimize this step, the
+QML engine can cache the result. It stores the byte code in a cache file and
+later loads the cache file instead of re-compiling when the same file is
+requested again. Usually the files are stored in a subdirectory \c{qmlcache}
+of the system's cache directory, as denoted by QStandardPaths::CacheLocation.
+Checks are in place to make sure that the cache files are only loaded if all
+of the following conditions are met:
+\list
+ \li The Qt version has not changed
+ \li The source code in the original file has not changed
+ \li The QML debugger is not running
+\endlist
+
+The disk caching behavior can be fine tuned using the following environment
+variables:
+
+\table
+ \header
+ \li Environment Variable
+ \li Description
+ \row
+ \li \c{QML_DISABLE_DISK_CACHE}
+ \li Disables the disk cache and forces re-compilation from source for
+ all QML and JavaScript files.
+ \row
+ \li \c{QML_FORCE_DISK_CACHE}
+ \li Enables the disk cache even when debugging QML. You cannot use the
+ JavaScript debugger this way. It may fail to stop at breakpoints,
+ for example. You can still use the QML inspector to explore the
+ object hierarchy, though. \c{QML_FORCE_DISK_CACHE} overrides
+ \c{QML_DISABLE_DISK_CACHE}.
+ \row
+ \li \c{QML_DISK_CACHE_PATH}
+ \li Specifies a custom location where the cache files shall be stored
+ instead of using the default location.
+\endtable
+
+You can also specify \c{CONFIG += qtquickcompiler} in your \c{.pro} file
+to perform the compilation ahead of time and integrate the resulting byte code
+directly into your executable. For more information, see \l{Qt Quick Compiler}.
+
+*/
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index b2d322465d..67c0f6bb25 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -275,6 +275,7 @@
/*!
\fn int qmlRegisterAnonymousType(const char *uri, int versionMajor)
+ \relates QQmlEngine
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
diff --git a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc
index 01e81e7c19..05447db627 100644
--- a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc
+++ b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc
@@ -29,7 +29,7 @@ Suppose there is a new \c TimeModel C++ class that should be made available
as a new QML type. It provides the current time through \c hour and \c minute
properties.
-\snippet qmlextensionplugins/plugin.cpp 0
+\snippet qmlextensionplugins/timemodel.h 0
\dots
To make this type available, we create a plugin class named \c QExampleQmlPlugin
diff --git a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
index 57e0ba1a14..32106d5bb8 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
@@ -299,6 +299,13 @@ Additional import paths can be added through QQmlEngine::addImportPath() or the
\l{Prototyping with qmlscene}{qmlscene} tool, you can also use the \c -I option
to add an import path.
+You can specify multiple import paths in the \c QML2_IMPORT_PATH environment
+variable by joining them using the path separator. On Windows the path separator
+is a semicolon (;), on other platforms it is a colon (:). This means that you
+cannot specify resource paths or URLs in QML2_IMPORT_PATH, as they contain
+colons themselves. However, you can add resource paths and URLs by calling
+QQmlEngine::addImportPath() programatically.
+
\section1 Debugging
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 68d2b66950..205cbc147d 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -155,6 +155,8 @@ Further information for writing QML applications:
- essential information for application development with QML and Qt Quick
\li \l{Qt Quick} - a module which provides a set of QML types and C++ classes
for building user interfaces and applications with QML
+\li \l{The QML Disk Cache}
+ - how to fine tune if and where the QML engine caches compilation results.
\endlist
\section2 Reference
diff --git a/src/qml/jit/qv4assemblercommon.cpp b/src/qml/jit/qv4assemblercommon.cpp
index e75f35a665..cc8af723b2 100644
--- a/src/qml/jit/qv4assemblercommon.cpp
+++ b/src/qml/jit/qv4assemblercommon.cpp
@@ -146,7 +146,7 @@ void PlatformAssemblerCommon::link(Function *function, const char *jitKind)
// We use debugAddress here because it's actually for debugging and hidden behind an
// environment variable.
const QByteArray name = Function::prettyName(function, linkBuffer.debugAddress()).toUtf8();
- codeRef = linkBuffer.finalizeCodeWithDisassembly(jitKind, "function %s", name.constData());
+ codeRef = linkBuffer.finalizeCodeWithDisassembly(jitKind, name.constData());
WTF::setDataFile(stderr);
printDisassembledOutputWithCalls(buf.data(), functions);
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index a99ec16943..a2fac21b29 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -127,13 +127,17 @@ ReturnedValue ArrayBufferCtor::method_isView(const FunctionObject *, const Value
void Heap::SharedArrayBuffer::init(size_t length)
{
Object::init();
+ QPair<QTypedArrayData<char> *, char *> pair;
if (length < UINT_MAX)
- data = QTypedArrayData<char>::allocate(length + 1);
- if (!data) {
+ pair = QTypedArrayData<char>::allocate(length + 1);
+ if (!pair.first) {
+ new (&d) QArrayDataPointer<char>();
internalClass->engine->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
return;
}
- data->size = int(length);
+ auto data = new (&d) QArrayDataPointer<char>{ pair.first, pair.second, uint(length) };
+
+ // can't use appendInitialize() because we want to set the terminating '\0'
memset(data->data(), 0, length + 1);
isShared = true;
}
@@ -141,41 +145,24 @@ void Heap::SharedArrayBuffer::init(size_t length)
void Heap::SharedArrayBuffer::init(const QByteArray& array)
{
Object::init();
- data = const_cast<QByteArray&>(array).data_ptr();
- data->ref.ref();
+ new (&d) QArrayDataPointer<char>(*const_cast<QByteArray &>(array).data_ptr());
isShared = true;
}
void Heap::SharedArrayBuffer::destroy()
{
- if (data && !data->ref.deref())
- QTypedArrayData<char>::deallocate(data);
+ data().~QArrayDataPointer();
Object::destroy();
}
QByteArray ArrayBuffer::asByteArray() const
{
- QByteArrayDataPtr ba = { d()->data };
- ba.ptr->ref.ref();
- return QByteArray(ba);
+ return QByteArray(d()->data());
}
-void ArrayBuffer::detach() {
- if (!d()->data->ref.isShared())
- return;
-
- QTypedArrayData<char> *oldData = d()->data;
-
- d()->data = QTypedArrayData<char>::allocate(oldData->size + 1);
- if (!d()->data) {
- engine()->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
- return;
- }
-
- memcpy(d()->data->data(), oldData->data(), oldData->size + 1);
-
- if (!oldData->ref.deref())
- QTypedArrayData<char>::deallocate(oldData);
+void ArrayBuffer::detach()
+{
+ d()->data().detach();
}
@@ -200,7 +187,7 @@ ReturnedValue SharedArrayBufferPrototype::method_get_byteLength(const FunctionOb
if (!a || a->isDetachedBuffer() || !a->isSharedArrayBuffer())
return b->engine()->throwTypeError();
- return Encode(a->d()->data->size);
+ return Encode(a->d()->data()->size);
}
ReturnedValue SharedArrayBufferPrototype::method_slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
@@ -217,12 +204,12 @@ ReturnedValue SharedArrayBufferPrototype::slice(const FunctionObject *b, const V
double start = argc > 0 ? argv[0].toInteger() : 0;
double end = (argc < 2 || argv[1].isUndefined()) ?
- a->d()->data->size : argv[1].toInteger();
+ a->d()->data()->size : argv[1].toInteger();
if (scope.hasException())
return QV4::Encode::undefined();
- double first = (start < 0) ? qMax(a->d()->data->size + start, 0.) : qMin(start, (double)a->d()->data->size);
- double final = (end < 0) ? qMax(a->d()->data->size + end, 0.) : qMin(end, (double)a->d()->data->size);
+ double first = (start < 0) ? qMax(a->d()->data()->size + start, 0.) : qMin(start, (double)a->d()->data()->size);
+ double final = (end < 0) ? qMax(a->d()->data()->size + end, 0.) : qMin(end, (double)a->d()->data()->size);
const FunctionObject *constructor = a->speciesConstructor(scope, shared ? scope.engine->sharedArrayBufferCtor() : scope.engine->arrayBufferCtor());
if (!constructor)
@@ -231,13 +218,13 @@ ReturnedValue SharedArrayBufferPrototype::slice(const FunctionObject *b, const V
double newLen = qMax(final - first, 0.);
ScopedValue argument(scope, QV4::Encode(newLen));
QV4::Scoped<SharedArrayBuffer> newBuffer(scope, constructor->callAsConstructor(argument, 1));
- if (!newBuffer || newBuffer->d()->data->size < (int)newLen ||
+ if (!newBuffer || newBuffer->d()->data()->size < newLen ||
newBuffer->isDetachedBuffer() || (newBuffer->isSharedArrayBuffer() != shared) ||
newBuffer->sameValue(*a) ||
a->isDetachedBuffer())
return scope.engine->throwTypeError();
- memcpy(newBuffer->d()->data->data(), a->d()->data->data() + (uint)first, newLen);
+ memcpy(newBuffer->d()->data()->data(), a->d()->data()->data() + (uint)first, newLen);
return newBuffer->asReturnedValue();
}
@@ -265,7 +252,7 @@ ReturnedValue ArrayBufferPrototype::method_get_byteLength(const FunctionObject *
if (!a || a->isDetachedBuffer() || a->isSharedArrayBuffer())
return f->engine()->throwTypeError();
- return Encode(a->d()->data->size);
+ return Encode(a->d()->data()->size);
}
ReturnedValue ArrayBufferPrototype::method_slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h
index 8344fa2554..1873c41261 100644
--- a/src/qml/jsruntime/qv4arraybuffer_p.h
+++ b/src/qml/jsruntime/qv4arraybuffer_p.h
@@ -52,6 +52,7 @@
#include "qv4object_p.h"
#include "qv4functionobject_p.h"
+#include <QtCore/qarraydatapointer.h>
QT_BEGIN_NAMESPACE
@@ -71,12 +72,14 @@ struct Q_QML_PRIVATE_EXPORT SharedArrayBuffer : Object {
void init(size_t length);
void init(const QByteArray& array);
void destroy();
- QTypedArrayData<char> *data;
+ std::aligned_storage_t<sizeof(QArrayDataPointer<char>), alignof(QArrayDataPointer<char>)> d;
+ const QArrayDataPointer<char> &data() const { return *reinterpret_cast<const QArrayDataPointer<char> *>(&d); }
+ QArrayDataPointer<char> &data() { return *reinterpret_cast<QArrayDataPointer<char> *>(&d); }
bool isShared;
- uint byteLength() const { return data ? data->size : 0; }
+ uint byteLength() const { return data().size; }
- bool isDetachedBuffer() const { return !data; }
+ bool isDetachedBuffer() const { return data().isNull(); }
bool isSharedArrayBuffer() const { return isShared; }
};
@@ -90,9 +93,7 @@ struct Q_QML_PRIVATE_EXPORT ArrayBuffer : SharedArrayBuffer {
isShared = false;
}
void detachArrayBuffer() {
- if (data && !data->ref.deref())
- QTypedArrayData<char>::deallocate(data);
- data = nullptr;
+ data().clear();
}
};
@@ -124,11 +125,11 @@ struct Q_QML_PRIVATE_EXPORT SharedArrayBuffer : Object
QByteArray asByteArray() const;
uint byteLength() const { return d()->byteLength(); }
- char *data() { Q_ASSERT(d()->data); return d()->data->data(); }
- const char *constData() { Q_ASSERT(d()->data); return d()->data->data(); }
+ char *data() { return d()->data()->data(); }
+ const char *constData() { return d()->data()->data(); }
- bool isShared() { return d()->data->ref.isShared(); }
- bool isDetachedBuffer() const { return !d()->data; }
+ bool isShared() { return d()->data()->isShared(); }
+ bool isDetachedBuffer() const { return d()->data().isNull(); }
bool isSharedArrayBuffer() const { return d()->isShared; }
};
@@ -140,11 +141,11 @@ struct Q_QML_PRIVATE_EXPORT ArrayBuffer : SharedArrayBuffer
QByteArray asByteArray() const;
uint byteLength() const { return d()->byteLength(); }
- char *data() { detach(); return d()->data ? d()->data->data() : nullptr; }
+ char *data() { if (d()->data().needsDetach()) detach(); return d()->data().data(); }
// ### is that detach needed?
- const char *constData() { detach(); return d()->data ? d()->data->data() : nullptr; }
+ const char *constData() const { return d()->data().data(); }
- bool isShared() { return d()->data && d()->data->ref.isShared(); }
+ bool isShared() { return d()->data()->isShared(); }
void detach();
void detachArrayBuffer() { d()->detachArrayBuffer(); }
};
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 654d33b8d1..1c587d2367 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -586,7 +586,7 @@ uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)
obj->arrayPut(oldSize, os->values.data() + os->offset, chunk);
toCopy -= chunk;
if (toCopy)
- obj->arrayPut(oldSize + chunk, os->values.data(), toCopy);
+ obj->setArrayLength(oldSize + chunk + toCopy);
}
return oldSize + n;
@@ -659,6 +659,12 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const
}
ScopedString p1s(scope, v1.toString(scope.engine));
ScopedString p2s(scope, v2.toString(scope.engine));
+
+ if (!p1s)
+ return false;
+ if (!p2s)
+ return true;
+
return p1s->toQString() < p2s->toQString();
}
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index d8d0d4739f..6c51b4cbcb 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -1048,8 +1048,9 @@ ReturnedValue ArrayPrototype::method_includes(const FunctionObject *b, const Val
}
}
+ ScopedValue val(scope);
while (k < len) {
- ScopedValue val(scope, instance->get(k));
+ val = instance->get(k);
if (val->sameValueZero(argv[0])) {
return Encode(true);
}
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index 5ab8cf2dcb..bb1acb963e 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -85,7 +85,7 @@ ReturnedValue DataViewCtor::virtualCallAsConstructor(const FunctionObject *f, co
if (buffer->isDetachedBuffer())
return scope.engine->throwTypeError();
- uint bufferLength = buffer->d()->data->size;
+ uint bufferLength = buffer->d()->data()->size;
if (offset > bufferLength)
return scope.engine->throwRangeError(QStringLiteral("DataView: constructor arguments out of range"));
@@ -197,7 +197,7 @@ ReturnedValue DataViewPrototype::method_getChar(const FunctionObject *b, const V
return e->throwRangeError(QStringLiteral("index out of range"));
idx += v->d()->byteOffset;
- T t = T(v->d()->buffer->data->data()[idx]);
+ T t = T(v->d()->buffer->data()->data()[idx]);
return Encode((int)t);
}
@@ -221,8 +221,8 @@ ReturnedValue DataViewPrototype::method_get(const FunctionObject *b, const Value
bool littleEndian = argc < 2 ? false : argv[1].toBoolean();
T t = littleEndian
- ? qFromLittleEndian<T>((uchar *)v->d()->buffer->data->data() + idx)
- : qFromBigEndian<T>((uchar *)v->d()->buffer->data->data() + idx);
+ ? qFromLittleEndian<T>((uchar *)v->d()->buffer->data()->data() + idx)
+ : qFromBigEndian<T>((uchar *)v->d()->buffer->data()->data() + idx);
return Encode(t);
}
@@ -252,8 +252,8 @@ ReturnedValue DataViewPrototype::method_getFloat(const FunctionObject *b, const
float f;
} u;
u.i = littleEndian
- ? qFromLittleEndian<uint>((uchar *)v->d()->buffer->data->data() + idx)
- : qFromBigEndian<uint>((uchar *)v->d()->buffer->data->data() + idx);
+ ? qFromLittleEndian<uint>((uchar *)v->d()->buffer->data()->data() + idx)
+ : qFromBigEndian<uint>((uchar *)v->d()->buffer->data()->data() + idx);
return Encode(u.f);
} else {
Q_ASSERT(sizeof(T) == 8);
@@ -262,8 +262,8 @@ ReturnedValue DataViewPrototype::method_getFloat(const FunctionObject *b, const
double d;
} u;
u.i = littleEndian
- ? qFromLittleEndian<quint64>((uchar *)v->d()->buffer->data->data() + idx)
- : qFromBigEndian<quint64>((uchar *)v->d()->buffer->data->data() + idx);
+ ? qFromLittleEndian<quint64>((uchar *)v->d()->buffer->data()->data() + idx)
+ : qFromBigEndian<quint64>((uchar *)v->d()->buffer->data()->data() + idx);
return Encode(u.d);
}
}
@@ -288,7 +288,7 @@ ReturnedValue DataViewPrototype::method_setChar(const FunctionObject *b, const V
return e->throwRangeError(QStringLiteral("index out of range"));
idx += v->d()->byteOffset;
- v->d()->buffer->data->data()[idx] = (char)val;
+ v->d()->buffer->data()->data()[idx] = (char)val;
RETURN_UNDEFINED();
}
@@ -316,9 +316,9 @@ ReturnedValue DataViewPrototype::method_set(const FunctionObject *b, const Value
if (littleEndian)
- qToLittleEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
+ qToLittleEndian<T>(val, (uchar *)v->d()->buffer->data()->data() + idx);
else
- qToBigEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
+ qToBigEndian<T>(val, (uchar *)v->d()->buffer->data()->data() + idx);
RETURN_UNDEFINED();
}
@@ -352,9 +352,9 @@ ReturnedValue DataViewPrototype::method_setFloat(const FunctionObject *b, const
} u;
u.f = val;
if (littleEndian)
- qToLittleEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ qToLittleEndian(u.i, (uchar *)v->d()->buffer->data()->data() + idx);
else
- qToBigEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ qToBigEndian(u.i, (uchar *)v->d()->buffer->data()->data() + idx);
} else {
Q_ASSERT(sizeof(T) == 8);
union {
@@ -363,9 +363,9 @@ ReturnedValue DataViewPrototype::method_setFloat(const FunctionObject *b, const
} u;
u.d = val;
if (littleEndian)
- qToLittleEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ qToLittleEndian(u.i, (uchar *)v->d()->buffer->data()->data() + idx);
else
- qToBigEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ qToBigEndian(u.i, (uchar *)v->d()->buffer->data()->data() + idx);
}
RETURN_UNDEFINED();
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 590cebfa7c..14eaa5bce8 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -43,6 +43,7 @@
#include <private/qqmljsdiagnosticmessage_p.h>
#include <QtCore/QTextStream>
+#include <QtCore/private/qvariant_p.h>
#include <QDateTime>
#include <QDir>
#include <QFileInfo>
@@ -118,6 +119,7 @@
#endif
#include <private/qv4sqlerrors_p.h>
#include <qqmlfile.h>
+#include <qmetatype.h>
#if USE(PTHREADS)
# include <pthread.h>
@@ -185,6 +187,91 @@ static void restoreJSValue(QDataStream &stream, void *data)
}
}
+struct JSArrayIterator {
+ QJSValue const* data;
+ quint32 index;
+};
+
+namespace {
+void createNewIteratorIfNonExisting(void **iterator) {
+ if (*iterator == nullptr)
+ *iterator = new JSArrayIterator;
+}
+}
+
+static QtMetaTypePrivate::QSequentialIterableImpl jsvalueToSequence (const QJSValue& value) {
+ using namespace QtMetaTypePrivate;
+
+ QSequentialIterableImpl iterator {};
+ if (!value.isArray()) {
+ // set up some functions so that non-array QSequentialIterables do not crash
+ // but instead appear as an empty sequence
+ iterator._size = [](const void *) {return 0;};
+ iterator._moveToBegin = [](const void *, void **) {};
+ iterator._moveToEnd = [](const void *, void **) {};
+ iterator._advance = [](void **, int) {};
+ iterator._equalIter = [](void * const *, void * const *){return true; /*all iterators are nullptr*/};
+ iterator._destroyIter = [](void **){};
+ return iterator;
+ }
+
+ iterator._iterable = &value;
+ iterator._iterator = nullptr;
+ iterator._metaType_id = qMetaTypeId<QVariant>();
+ iterator._metaType_flags = QVariantConstructionFlags::ShouldDeleteVariantData;
+ iterator._iteratorCapabilities = RandomAccessCapability | BiDirectionalCapability | ForwardCapability;
+ iterator._size = [](const void *p) -> int {
+ return static_cast<QJSValue const *>(p)->property(QString::fromLatin1("length")).toInt();
+ };
+ /* Lifetime management notes:
+ * _at and _get return a pointer to a JSValue allocated via QMetaType::create
+ * Because we set QVariantConstructionFlags::ShouldDeleteVariantData, QSequentialIterable::at
+ * and QSequentialIterable::operator*() will free that memory
+ */
+
+ iterator._at = [](const void *iterable, int index) -> void const * {
+ auto const value = static_cast<QJSValue const *>(iterable)->property(quint32(index)).toVariant();
+ return QMetaType::create(qMetaTypeId<QVariant>(), &value);
+ };
+ iterator._moveToBegin = [](const void *iterable, void **iterator) {
+ createNewIteratorIfNonExisting(iterator);
+ auto jsArrayIterator = static_cast<JSArrayIterator *>(*iterator);
+ jsArrayIterator->index = 0;
+ jsArrayIterator->data = reinterpret_cast<QJSValue const*>(iterable);
+ };
+ iterator._moveToEnd = [](const void *iterable, void **iterator) {
+ createNewIteratorIfNonExisting(iterator);
+ auto jsArrayIterator = static_cast<JSArrayIterator *>(*iterator);
+ auto length = static_cast<QJSValue const *>(iterable)->property(QString::fromLatin1("length")).toInt();
+ jsArrayIterator->data = reinterpret_cast<QJSValue const*>(iterable);
+ jsArrayIterator->index = quint32(length);
+ };
+ iterator._advance = [](void **iterator, int advanceBy) {
+ static_cast<JSArrayIterator *>(*iterator)->index += quint32(advanceBy);
+ };
+ iterator._get = []( void * const *iterator, int metaTypeId, uint flags) -> VariantData {
+ auto const * const arrayIterator = static_cast<const JSArrayIterator *>(*iterator);
+ QJSValue const * const jsArray = arrayIterator->data;
+ auto const value = jsArray->property(arrayIterator->index).toVariant();
+ Q_ASSERT(flags & QVariantConstructionFlags::ShouldDeleteVariantData);
+ return {metaTypeId, QMetaType::create(qMetaTypeId<QVariant>(), &value), flags};
+ };
+ iterator._destroyIter = [](void **iterator) {
+ delete static_cast<JSArrayIterator *>(*iterator);
+ };
+ iterator._equalIter = [](void * const *p, void * const *other) {
+ auto this_ = static_cast<const JSArrayIterator *>(*p);
+ auto that_ = static_cast<const JSArrayIterator *>(*other);
+ return this_->index == that_->index && this_->data == that_->data;
+ };
+ iterator._copyIter = [](void **iterator, void * const * otherIterator) {
+ auto *otherIter = (static_cast<JSArrayIterator const *>(*otherIterator));
+ static_cast<JSArrayIterator *>(*iterator)->index = otherIter->index;
+ static_cast<JSArrayIterator *>(*iterator)->data = otherIter->data;
+ };
+ return iterator;
+}
+
ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine)
: executableAllocator(new QV4::ExecutableAllocator)
, regExpAllocator(new QV4::ExecutableAllocator)
@@ -222,7 +309,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine)
ok = false;
maxCallDepth = qEnvironmentVariableIntValue("QV4_MAX_CALL_DEPTH", &ok);
if (!ok || maxCallDepth <= 0) {
-#if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !QT_HAS_FEATURE(address_sanitizer)
+#if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(address_sanitizer)
maxCallDepth = 1234;
#else
// no (tail call) optimization is done, so there'll be a lot mare stack frames active
@@ -712,6 +799,8 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine)
QMetaType::registerConverter<QJSValue, QVariantList>(convertJSValueToVariantType<QVariantList>);
if (!QMetaType::hasRegisteredConverterFunction<QJSValue, QStringList>())
QMetaType::registerConverter<QJSValue, QStringList>(convertJSValueToVariantType<QStringList>);
+ if (!QMetaType::hasRegisteredConverterFunction<QJSValue, QtMetaTypePrivate::QSequentialIterableImpl>())
+ QMetaType::registerConverter<QJSValue, QtMetaTypePrivate::QSequentialIterableImpl>(jsvalueToSequence);
QMetaType::registerStreamOperators(qMetaTypeId<QJSValue>(), saveJSValue, restoreJSValue);
QV4::QObjectWrapper::initializeBindings(this);
@@ -1178,8 +1267,11 @@ QUrl ExecutionEngine::resolvedUrl(const QString &file)
void ExecutionEngine::markObjects(MarkStack *markStack)
{
for (int i = 0; i < NClasses; ++i)
- if (classes[i])
+ if (classes[i]) {
classes[i]->mark(markStack);
+ if (markStack->top >= markStack->limit)
+ markStack->drain();
+ }
markStack->drain();
identifierTable->markObjects(markStack);
@@ -2238,4 +2330,9 @@ int ExecutionEngine::registerExtension()
return registrationData()->extensionCount++;
}
+QNetworkAccessManager *QV4::detail::getNetworkAccessManager(ExecutionEngine *engine)
+{
+ return engine->qmlEngine()->networkAccessManager();
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index d233347060..e0025feb00 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -91,7 +91,14 @@ class PageAllocation;
QT_BEGIN_NAMESPACE
-namespace QV4 { struct QObjectMethod; }
+class QNetworkAccessManager;
+
+namespace QV4 {
+struct QObjectMethod;
+namespace detail {
+QNetworkAccessManager *getNetworkAccessManager(ExecutionEngine *engine);
+}
+}
// Used to allow a QObject method take and return raw V4 handles without having to expose
// 48 in the public API.
@@ -348,6 +355,8 @@ public:
FunctionObject *getStackFunction() const { return reinterpret_cast<FunctionObject *>(jsObjects + GetStack_Function); }
FunctionObject *thrower() const { return reinterpret_cast<FunctionObject *>(jsObjects + ThrowerObject); }
+ QNetworkAccessManager* (*networkAccessManager)(ExecutionEngine*) = detail::getNetworkAccessManager;
+
enum JSStrings {
String_Empty,
String_undefined,
diff --git a/src/qml/jsruntime/qv4enginebase_p.h b/src/qml/jsruntime/qv4enginebase_p.h
index 788897bdad..5e62c5bd50 100644
--- a/src/qml/jsruntime/qv4enginebase_p.h
+++ b/src/qml/jsruntime/qv4enginebase_p.h
@@ -86,7 +86,6 @@ struct Q_QML_EXPORT EngineBase {
quint8 isExecutingInRegExpJIT = false;
quint8 padding[3];
MemoryManager *memoryManager = nullptr;
- Runtime runtime;
qint32 callDepth = 0;
Value *jsStackLimit = nullptr;
@@ -146,7 +145,6 @@ Q_STATIC_ASSERT(offsetof(EngineBase, currentStackFrame) == 0);
Q_STATIC_ASSERT(offsetof(EngineBase, jsStackTop) == offsetof(EngineBase, currentStackFrame) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(EngineBase, hasException) == offsetof(EngineBase, jsStackTop) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(EngineBase, memoryManager) == offsetof(EngineBase, hasException) + 8);
-Q_STATIC_ASSERT(offsetof(EngineBase, runtime) == offsetof(EngineBase, memoryManager) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(EngineBase, isInterrupted) + sizeof(EngineBase::isInterrupted) <= offsetof(EngineBase, hasException) + 4);
}
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp
index 7c6368d60a..b1e2879bba 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -94,11 +94,15 @@ ExecutableCompilationUnit::~ExecutableCompilationUnit()
QString ExecutableCompilationUnit::localCacheFilePath(const QUrl &url)
{
+ static const QByteArray envCachePath = qgetenv("QML_DISK_CACHE_PATH");
+
const QString localSourcePath = QQmlFile::urlToLocalFileOrQrc(url);
const QString cacheFileSuffix = QFileInfo(localSourcePath + QLatin1Char('c')).completeSuffix();
QCryptographicHash fileNameHash(QCryptographicHash::Sha1);
fileNameHash.addData(localSourcePath.toUtf8());
- QString directory = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/qmlcache/");
+ QString directory = envCachePath.isEmpty()
+ ? QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/qmlcache/")
+ : QString::fromLocal8Bit(envCachePath) + QLatin1String("/");
QDir::root().mkpath(directory);
return directory + QString::fromUtf8(fileNameHash.result().toHex()) + QLatin1Char('.') + cacheFileSuffix;
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 6fb7946023..dfef52583e 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -364,7 +364,13 @@ ReturnedValue FunctionPrototype::method_apply(const QV4::FunctionObject *b, cons
if (!arr)
return v4->throwTypeError();
- uint len = arr->getLength();
+ const qint64 len64 = arr->getLength();
+ if (len64 < 0ll || len64 > qint64(std::numeric_limits<int>::max()))
+ return v4->throwRangeError(QStringLiteral("Invalid array length."));
+ if (len64 > qint64(v4->jsStackLimit - v4->jsStackTop))
+ return v4->throwRangeError(QStringLiteral("Array too large for apply()."));
+
+ const uint len = uint(len64);
Scope scope(v4);
Value *arguments = scope.alloc<Scope::Uninitialized>(len);
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index f3375929a3..9e901d6a34 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -157,7 +157,7 @@ struct Q_QML_EXPORT Object: Managed {
const Value *propertyData(uint index) const { return d()->propertyData(index); }
Heap::ArrayData *arrayData() const { return d()->arrayData; }
- void setArrayData(ArrayData *a) { d()->arrayData.set(engine(), a->d()); }
+ void setArrayData(ArrayData *a) { d()->arrayData.set(engine(), a ? a->d() : nullptr); }
void getProperty(const InternalClassEntry &entry, Property *p) const;
void setProperty(const InternalClassEntry &entry, const Property *p);
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index e529b8e86b..65f6fa8b12 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -182,7 +182,7 @@ PropertyKey ForInIteratorObject::nextProperty() const
if (d()->current != d()->object) {
o = d()->object;
bool shadowed = false;
- while (o->d() != c->heapObject()) {
+ while (o && o->d() != c->heapObject()) {
if (o->getOwnProperty(key) != Attr_Invalid) {
shadowed = true;
break;
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 3d3b3f413f..7d910a1cbc 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -658,6 +658,7 @@ ReturnedValue ObjectPrototype::method_toString(const FunctionObject *b, const Va
ReturnedValue ObjectPrototype::method_toLocaleString(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
Scope scope(b);
+ CHECK_STACK_LIMITS(scope.engine)
ScopedObject o(scope, thisObject->toObject(scope.engine));
if (!o)
RETURN_UNDEFINED();
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp
index 9325e2e53b..51f96b9003 100644
--- a/src/qml/jsruntime/qv4proxy.cpp
+++ b/src/qml/jsruntime/qv4proxy.cpp
@@ -515,7 +515,7 @@ ProxyObjectOwnPropertyKeyIterator::ProxyObjectOwnPropertyKeyIterator(ArrayObject
PropertyKey ProxyObjectOwnPropertyKeyIterator::next(const Object *m, Property *pd, PropertyAttributes *attrs)
{
- if (index >= len)
+ if (index >= len || m == nullptr)
return PropertyKey::invalid();
Scope scope(m);
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 9e77061882..76daead842 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -73,15 +73,13 @@ DEFINE_MANAGED_VTABLE(RegExp);
uint RegExp::match(const QString &string, int start, uint *matchOffsets)
{
- static const uint offsetJITFail = std::numeric_limits<unsigned>::max() - 1;
- Q_UNUSED(offsetJITFail);
-
if (!isValid())
return JSC::Yarr::offsetNoMatch;
WTF::String s(string);
#if ENABLE(YARR_JIT)
+ static const uint offsetJITFail = std::numeric_limits<unsigned>::max() - 1;
auto *priv = d();
if (priv->hasValidJITCode()) {
uint ret = JSC::Yarr::offsetNoMatch;
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index c1a42c4afa..f1375e4ca4 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -961,8 +961,8 @@ ReturnedValue RegExpPrototype::method_compile(const FunctionObject *b, const Val
return scope.engine->throwTypeError();
Scoped<RegExpObject> re(scope, scope.engine->regExpCtor()->callAsConstructor(argv, argc));
-
- r->d()->value.set(scope.engine, re->value());
+ if (re) // Otherwise the regexp constructor should have thrown an exception
+ r->d()->value.set(scope.engine, re->value());
return Encode::undefined();
}
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 21a0017728..e47a7a0b46 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -408,6 +408,15 @@ QV4::ReturnedValue Runtime::In::call(ExecutionEngine *engine, const Value &left,
double RuntimeHelpers::stringToNumber(const QString &string)
{
+ // The actual maximum valid length is certainly shorter, but due to the sheer number of
+ // different number formatting variants, we rather err on the side of caution here.
+ // For example, you can have up to 772 valid decimal digits left of the dot, as stated in the
+ // libdoubleconversion sources. The same maximum value would be represented by roughly 3.5 times
+ // as many binary digits.
+ const int excessiveLength = 16 * 1024;
+ if (string.length() > excessiveLength)
+ return qQNaN();
+
const QStringRef s = QStringRef(&string).trimmed();
if (s.startsWith(QLatin1Char('0'))) {
int base = -1;
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 7caa122698..ee42342bf2 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -304,8 +304,10 @@ public:
return false;
}
- if (d()->isReadOnly)
+ if (d()->isReadOnly) {
+ engine()->throwTypeError(QLatin1String("Cannot insert into a readonly container"));
return false;
+ }
if (d()->isReference) {
if (!d()->object)
@@ -370,7 +372,7 @@ public:
if (attrs)
*attrs = QV4::Attr_Data;
if (pd)
- pd->value = convertElementToValue(s->engine(), s->d()->container->at(index));
+ pd->value = convertElementToValue(s->engine(), (*s->d()->container)[index]);
return PropertyKey::fromArrayIndex(index);
}
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 223f4a4769..fc004a2ce0 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -91,18 +91,14 @@ bool String::virtualIsEqualTo(Managed *t, Managed *o)
void Heap::String::init(const QString &t)
{
- Base::init();
-
+ QString mutableText(t);
+ StringOrSymbol::init(mutableText.data_ptr());
subtype = String::StringType_Unknown;
-
- text = const_cast<QString &>(t).data_ptr();
- text->ref.ref();
}
void Heap::ComplexString::init(String *l, String *r)
{
- Base::init();
-
+ StringOrSymbol::init();
subtype = String::StringType_AddedString;
left = l;
@@ -125,7 +121,7 @@ void Heap::ComplexString::init(String *l, String *r)
void Heap::ComplexString::init(Heap::String *ref, int from, int len)
{
Q_ASSERT(ref->length() >= from + len);
- Base::init();
+ StringOrSymbol::init();
subtype = String::StringType_SubString;
@@ -136,11 +132,11 @@ void Heap::ComplexString::init(Heap::String *ref, int from, int len)
void Heap::StringOrSymbol::destroy()
{
- if (text) {
- internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(qptrdiff(-text->size) * (int)sizeof(QChar));
- if (!text->ref.deref())
- QStringData::deallocate(text);
+ if (subtype < Heap::String::StringType_AddedString) {
+ internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(
+ qptrdiff(-text()->size) * qptrdiff(sizeof(QChar)));
}
+ text().~QStringPrivate();
Base::destroy();
}
@@ -164,27 +160,27 @@ uint String::toUInt(bool *ok) const
void String::createPropertyKeyImpl() const
{
- if (!d()->text)
+ if (d()->subtype >= Heap::String::StringType_AddedString)
d()->simplifyString();
- Q_ASSERT(d()->text);
+ Q_ASSERT(d()->subtype < Heap::String::StringType_AddedString);
engine()->identifierTable->asPropertyKey(this);
}
void Heap::String::simplifyString() const
{
- Q_ASSERT(!text);
+ Q_ASSERT(subtype >= StringType_AddedString);
int l = length();
QString result(l, Qt::Uninitialized);
QChar *ch = const_cast<QChar *>(result.constData());
append(this, ch);
- text = result.data_ptr();
- text->ref.ref();
+ text() = result.data_ptr();
const ComplexString *cs = static_cast<const ComplexString *>(this);
identifier = PropertyKey::invalid();
cs->left = cs->right = nullptr;
- internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(qptrdiff(text->size) * (qptrdiff)sizeof(QChar));
+ internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(
+ qptrdiff(text().size) * qptrdiff(sizeof(QChar)));
subtype = StringType_Unknown;
}
@@ -206,7 +202,7 @@ bool Heap::String::startsWithUpper() const
offset = cs->from;
}
Q_ASSERT(str->subtype < Heap::String::StringType_Complex);
- return str->text->size > offset && QChar::isUpper(str->text->data()[offset]);
+ return str->text().size > offset && QChar::isUpper(str->text().data()[offset]);
}
void Heap::String::append(const String *data, QChar *ch)
@@ -228,21 +224,21 @@ void Heap::String::append(const String *data, QChar *ch)
memcpy(ch, cs->left->toQString().constData() + cs->from, cs->len*sizeof(QChar));
ch += cs->len;
} else {
- memcpy(static_cast<void *>(ch), static_cast<const void *>(item->text->data()), item->text->size * sizeof(QChar));
- ch += item->text->size;
+ memcpy(static_cast<void *>(ch), item->text().data(), item->text().size * sizeof(QChar));
+ ch += item->text().size;
}
}
}
void Heap::StringOrSymbol::createHashValue() const
{
- if (!text) {
+ if (subtype >= StringType_AddedString) {
Q_ASSERT(internalClass->vtable->isString);
static_cast<const Heap::String *>(this)->simplifyString();
}
- Q_ASSERT(text);
- const QChar *ch = reinterpret_cast<const QChar *>(text->data());
- const QChar *end = ch + text->size;
+ Q_ASSERT(subtype < StringType_AddedString);
+ const QChar *ch = reinterpret_cast<const QChar *>(text().data());
+ const QChar *end = ch + text().size;
stringHash = QV4::String::calculateHashValue(ch, end, &subtype);
}
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 52fe09cd72..d5d11ef660 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -77,7 +77,18 @@ struct Q_QML_PRIVATE_EXPORT StringOrSymbol : Base
StringType_Complex = StringType_AddedString
};
- mutable QStringData *text;
+ void init() {
+ Base::init();
+ new (&textStorage) QStringPrivate;
+ }
+
+ void init(QStringPrivate text)
+ {
+ Base::init();
+ new (&textStorage) QStringPrivate(std::move(text));
+ }
+
+ mutable std::aligned_storage<sizeof(QStringPrivate), alignof(QStringPrivate)>::type textStorage;
mutable PropertyKey identifier;
mutable uint subtype;
mutable uint stringHash;
@@ -85,12 +96,11 @@ struct Q_QML_PRIVATE_EXPORT StringOrSymbol : Base
static void markObjects(Heap::Base *that, MarkStack *markStack);
void destroy();
+ QStringPrivate &text() const { return *reinterpret_cast<QStringPrivate *>(&textStorage); }
+
inline QString toQString() const {
- if (!text)
- return QString();
- QStringDataPtr ptr = { text };
- text->ref.ref();
- return QString(ptr);
+ QStringPrivate dd = text();
+ return QString(std::move(dd));
}
void createHashValue() const;
inline unsigned hashValue() const {
@@ -113,14 +123,12 @@ struct Q_QML_PRIVATE_EXPORT String : StringOrSymbol {
void simplifyString() const;
int length() const;
std::size_t retainedTextSize() const {
- return subtype >= StringType_Complex ? 0 : (std::size_t(text->size) * sizeof(QChar));
+ return subtype >= StringType_Complex ? 0 : (std::size_t(text().size) * sizeof(QChar));
}
inline QString toQString() const {
if (subtype >= StringType_Complex)
simplifyString();
- QStringDataPtr ptr = { text };
- text->ref.ref();
- return QString(ptr);
+ return StringOrSymbol::toQString();
}
inline bool isEqualTo(const String *other) const {
if (this == other)
@@ -158,7 +166,7 @@ Q_STATIC_ASSERT(std::is_trivial< ComplexString >::value);
inline
int String::length() const {
- return text ? text->size : static_cast<const ComplexString *>(this)->len;
+ return subtype < StringType_AddedString ? text().size : static_cast<const ComplexString *>(this)->len;
}
}
@@ -252,7 +260,7 @@ public:
}
if (subtype)
- *subtype = (charToUInt(ch) == '@') ? Heap::StringOrSymbol::StringType_Symbol : Heap::StringOrSymbol::StringType_Regular;
+ *subtype = (ch != end && charToUInt(ch) == '@') ? Heap::StringOrSymbol::StringType_Symbol : Heap::StringOrSymbol::StringType_Regular;
return h;
}
};
diff --git a/src/qml/jsruntime/qv4symbol.cpp b/src/qml/jsruntime/qv4symbol.cpp
index 004a9938e2..be6d821c14 100644
--- a/src/qml/jsruntime/qv4symbol.cpp
+++ b/src/qml/jsruntime/qv4symbol.cpp
@@ -50,10 +50,9 @@ DEFINE_OBJECT_VTABLE(SymbolObject);
void Heap::Symbol::init(const QString &s)
{
Q_ASSERT(s.at(0) == QLatin1Char('@'));
- identifier = PropertyKey::fromStringOrSymbol(this);
QString desc(s);
- text = desc.data_ptr();
- text->ref.ref();
+ StringOrSymbol::init(desc.data_ptr());
+ identifier = PropertyKey::fromStringOrSymbol(this);
}
void Heap::SymbolCtor::init(QV4::ExecutionContext *scope)
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 893fe06e8e..40a434d301 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -338,8 +338,8 @@ ReturnedValue TypedArrayCtor::virtualCallAsConstructor(const FunctionObject *f,
array->d()->byteLength = destByteLength;
array->d()->byteOffset = 0;
- const char *src = buffer->d()->data->data() + typedArray->d()->byteOffset;
- char *dest = newBuffer->d()->data->data();
+ const char *src = buffer->d()->data()->data() + typedArray->d()->byteOffset;
+ char *dest = newBuffer->d()->data()->data();
// check if src and new type have the same size. In that case we can simply memcpy the data
if (srcElementSize == destElementSize) {
@@ -420,7 +420,7 @@ ReturnedValue TypedArrayCtor::virtualCallAsConstructor(const FunctionObject *f,
array->d()->byteOffset = 0;
uint idx = 0;
- char *b = newBuffer->d()->data->data();
+ char *b = newBuffer->d()->data()->data();
ScopedValue val(scope);
while (idx < l) {
val = o->get(idx);
@@ -480,7 +480,7 @@ ReturnedValue TypedArray::virtualGet(const Managed *m, PropertyKey id, const Val
if (hasProperty)
*hasProperty = true;
- return a->d()->type->read(a->d()->buffer->data->data() + byteOffset);
+ return a->d()->type->read(a->d()->buffer->data()->data() + byteOffset);
}
bool TypedArray::virtualHasProperty(const Managed *m, PropertyKey id)
@@ -538,7 +538,7 @@ bool TypedArray::virtualPut(Managed *m, PropertyKey id, const Value &value, Valu
Value v = Value::fromReturnedValue(value.convertedToNumber());
if (scope.hasException() || a->d()->buffer->isDetachedBuffer())
return scope.engine->throwTypeError();
- a->d()->type->write(a->d()->buffer->data->data() + byteOffset, v);
+ a->d()->type->write(a->d()->buffer->data()->data() + byteOffset, v);
return true;
}
@@ -569,7 +569,7 @@ bool TypedArray::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Prop
uint bytesPerElement = a->d()->type->bytesPerElement;
uint byteOffset = a->d()->byteOffset + index * bytesPerElement;
Q_ASSERT(byteOffset + bytesPerElement <= (uint)a->d()->buffer->byteLength());
- a->d()->type->write(a->d()->buffer->data->data() + byteOffset, v);
+ a->d()->type->write(a->d()->buffer->data()->data() + byteOffset, v);
}
return true;
}
@@ -713,7 +713,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_copyWithin(const FunctionObje
if (from != to) {
int elementSize = O->d()->type->bytesPerElement;
- char *data = O->d()->buffer->data->data() + O->d()->byteOffset;
+ char *data = O->d()->buffer->data()->data() + O->d()->byteOffset;
memmove(data + to*elementSize, data + from*elementSize, count*elementSize);
}
@@ -749,7 +749,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_every(const FunctionObject *b
ScopedValue r(scope);
Value *arguments = scope.alloc(3);
- const char *data = v->d()->buffer->data->data();
+ const char *data = v->d()->buffer->data()->data();
uint bytesPerElement = v->d()->type->bytesPerElement;
uint byteOffset = v->d()->byteOffset;
@@ -802,7 +802,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_fill(const FunctionObject *b,
if (scope.hasException() || v->d()->buffer->isDetachedBuffer())
return scope.engine->throwTypeError();
- char *data = v->d()->buffer->data->data();
+ char *data = v->d()->buffer->data()->data();
uint bytesPerElement = v->d()->type->bytesPerElement;
uint byteOffset = v->d()->byteOffset;
@@ -1409,13 +1409,14 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_set(const FunctionObject *b,
if (scope.engine->hasException || l != len)
return scope.engine->throwTypeError();
- if (offset + l > a->length())
+ const uint aLength = a->length();
+ if (offset > aLength || l > aLength - offset)
RETURN_RESULT(scope.engine->throwRangeError(QStringLiteral("TypedArray.set: out of range")));
uint idx = 0;
if (buffer->isDetachedBuffer())
return scope.engine->throwTypeError();
- char *b = buffer->d()->data->data() + a->d()->byteOffset + offset*elementSize;
+ char *b = buffer->d()->data()->data() + a->d()->byteOffset + offset*elementSize;
ScopedValue val(scope);
while (idx < l) {
val = o->get(idx);
@@ -1439,11 +1440,13 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_set(const FunctionObject *b,
return scope.engine->throwTypeError();
uint l = srcTypedArray->length();
- if (offset + l > a->length())
+
+ const uint aLength = a->length();
+ if (offset > aLength || l > aLength - offset)
RETURN_RESULT(scope.engine->throwRangeError(QStringLiteral("TypedArray.set: out of range")));
- char *dest = buffer->d()->data->data() + a->d()->byteOffset + offset*elementSize;
- const char *src = srcBuffer->d()->data->data() + srcTypedArray->d()->byteOffset;
+ char *dest = buffer->d()->data()->data() + a->d()->byteOffset + offset*elementSize;
+ const char *src = srcBuffer->d()->data()->data() + srcTypedArray->d()->byteOffset;
if (srcTypedArray->d()->type == a->d()->type) {
// same type of typed arrays, use memmove (as srcbuffer and buffer could be the same)
memmove(dest, src, srcTypedArray->d()->byteLength);
@@ -1641,6 +1644,158 @@ ReturnedValue IntrinsicTypedArrayCtor::method_of(const FunctionObject *f, const
return newObj->asReturnedValue();
}
+ReturnedValue IntrinsicTypedArrayCtor::method_from(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
+{
+ Scope scope(f);
+ ScopedObject itemsObject(scope, argv[0]);
+ bool usingIterator = false;
+
+ ScopedFunctionObject mapfn(scope, Value::undefinedValue());
+ Value *mapArguments = nullptr;
+ if (argc > 1) {
+ mapfn = ScopedFunctionObject(scope, argv[1]);
+ if (!mapfn)
+ return scope.engine->throwTypeError(QString::fromLatin1("%1 is not a function").arg(argv[1].toQStringNoThrow()));
+ mapArguments = scope.alloc(2);
+ }
+
+ // Iterator validity check goes after map function validity has been checked.
+ if (itemsObject) {
+ // If the object claims to support iterators, then let's try use them.
+ ScopedValue it(scope, itemsObject->get(scope.engine->symbol_iterator()));
+ CHECK_EXCEPTION();
+ if (!it->isNullOrUndefined()) {
+ ScopedFunctionObject itfunc(scope, it);
+ if (!itfunc)
+ return scope.engine->throwTypeError();
+ usingIterator = true;
+ }
+ }
+
+ ScopedValue thisArg(scope);
+ if (argc > 2)
+ thisArg = argv[2];
+
+ const FunctionObject *C = thisObject->as<FunctionObject>();
+
+ if (usingIterator) {
+ // Item iteration supported, so let's go ahead and try use that.
+ CHECK_EXCEPTION();
+
+ qint64 iterableLength = 0;
+ Value *nextValue = scope.alloc(1);
+ ScopedValue done(scope);
+
+ ScopedObject lengthIterator(scope, Runtime::GetIterator::call(scope.engine, itemsObject, true));
+ CHECK_EXCEPTION(); // symbol_iterator threw; whoops.
+ if (!lengthIterator) {
+ return scope.engine->throwTypeError(); // symbol_iterator wasn't an object.
+ }
+
+ forever {
+ // Here we calculate the length of the iterable range.
+ if (iterableLength > (static_cast<qint64>(1) << 53) - 1) {
+ ScopedValue falsey(scope, Encode(false));
+ ScopedValue error(scope, scope.engine->throwTypeError());
+ return Runtime::IteratorClose::call(scope.engine, lengthIterator, falsey);
+ }
+ // Retrieve the next value. If the iteration ends, we're done here.
+ done = Value::fromReturnedValue(Runtime::IteratorNext::call(scope.engine, lengthIterator, nextValue));
+ if (scope.engine->hasException)
+ return Runtime::IteratorClose::call(scope.engine, lengthIterator, Value::fromBoolean(false));
+ if (done->toBoolean()) {
+ break;
+ }
+ iterableLength++;
+ }
+
+ // Constructor validity check goes after we have calculated the length, because that calculation can throw
+ // errors that are not type errors and at least the tests expect those rather than type errors.
+ if (!C || !C->isConstructor())
+ return scope.engine->throwTypeError();
+
+ ScopedObject iterator(scope, Runtime::GetIterator::call(scope.engine, itemsObject, true));
+ CHECK_EXCEPTION(); // symbol_iterator can throw.
+ if (!iterator) {
+ return scope.engine->throwTypeError(); // symbol_iterator wasn't an object.
+ }
+
+ ScopedObject a(scope, Value::undefinedValue());
+ ScopedValue ctorArgument(scope, Value::fromReturnedValue(QV4::Encode(int(iterableLength))));
+ a = C->callAsConstructor(ctorArgument, 1);
+ CHECK_EXCEPTION();
+
+ // We check exceptions above, and only after doing so, check the array's validity after construction.
+ if (!::validateTypedArray(a) || (a->getLength() < iterableLength))
+ return scope.engine->throwTypeError();
+
+
+ // The loop below traverses the iterator, and puts elements into the created array.
+ ScopedValue mappedValue(scope, Value::undefinedValue());
+ for (qint64 k = 0; k < iterableLength; ++k) {
+ done = Value::fromReturnedValue(Runtime::IteratorNext::call(scope.engine, iterator, nextValue));
+ if (scope.engine->hasException)
+ return Runtime::IteratorClose::call(scope.engine, iterator, Value::fromBoolean(false));
+
+ if (mapfn) {
+ mapArguments[0] = *nextValue;
+ mapArguments[1] = Value::fromDouble(k);
+ mappedValue = mapfn->call(thisArg, mapArguments, 2);
+ if (scope.engine->hasException)
+ return Runtime::IteratorClose::call(scope.engine, iterator, Value::fromBoolean(false));
+ } else {
+ mappedValue = *nextValue;
+ }
+
+ a->put(k, mappedValue);
+ if (scope.engine->hasException)
+ return Runtime::IteratorClose::call(scope.engine, iterator, Value::fromBoolean(false));
+ }
+ return a.asReturnedValue();
+ } else {
+ // Array-like fallback. We request elements by index, and put them into the created array.
+ ScopedObject arrayLike(scope, argv[0].toObject(scope.engine));
+ if (!arrayLike)
+ return scope.engine->throwTypeError(QString::fromLatin1("Cannot convert %1 to object").arg(argv[0].toQStringNoThrow()));
+
+ int len = arrayLike->getLength();
+ CHECK_EXCEPTION();
+
+ // Getting the length may throw, and must do so before we check the constructor validity.
+ if (!C || !C->isConstructor())
+ return scope.engine->throwTypeError();
+
+ ScopedObject a(scope, Value::undefinedValue());
+ ScopedValue ctorArgument(scope, Value::fromReturnedValue(QV4::Encode(len)));
+ a = C->callAsConstructor(ctorArgument, 1);
+ CHECK_EXCEPTION();
+
+ // We check exceptions above, and only after doing so, check the array's validity after construction.
+ if (!::validateTypedArray(a) || (a->getLength() < len))
+ return scope.engine->throwTypeError();
+
+ ScopedValue mappedValue(scope, Value::undefinedValue());
+ ScopedValue kValue(scope);
+ for (int k = 0; k < len; ++k) {
+ kValue = arrayLike->get(k);
+ CHECK_EXCEPTION();
+
+ if (mapfn) {
+ mapArguments[0] = kValue;
+ mapArguments[1] = Value::fromDouble(k);
+ mappedValue = mapfn->call(thisArg, mapArguments, 2);
+ CHECK_EXCEPTION();
+ } else {
+ mappedValue = kValue;
+ }
+
+ a->put(k, mappedValue);
+ CHECK_EXCEPTION();
+ }
+ return a.asReturnedValue();
+ }
+}
+
void IntrinsicTypedArrayPrototype::init(ExecutionEngine *engine, IntrinsicTypedArrayCtor *ctor)
{
Scope scope(engine);
@@ -1650,6 +1805,8 @@ void IntrinsicTypedArrayPrototype::init(ExecutionEngine *engine, IntrinsicTypedA
ctor->defineReadonlyConfigurableProperty(engine->id_name(), s);
s = scope.engine->newString(QStringLiteral("of"));
ctor->defineDefaultProperty(s, IntrinsicTypedArrayCtor::method_of);
+ s = scope.engine->newString(QStringLiteral("from"));
+ ctor->defineDefaultProperty(s, IntrinsicTypedArrayCtor::method_from, 1);
ctor->addSymbolSpecies();
defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, nullptr);
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h
index 64792f23a2..e590083bc3 100644
--- a/src/qml/jsruntime/qv4typedarray_p.h
+++ b/src/qml/jsruntime/qv4typedarray_p.h
@@ -156,8 +156,8 @@ struct Q_QML_PRIVATE_EXPORT TypedArray : Object
return d()->byteLength/d()->type->bytesPerElement;
}
- QTypedArrayData<char> *arrayData() {
- return d()->buffer->data;
+ QArrayDataPointer<char> *arrayData() {
+ return &d()->buffer->data();
}
Heap::TypedArray::Type arrayType() const {
@@ -181,6 +181,7 @@ struct IntrinsicTypedArrayCtor: FunctionObject
static constexpr VTable::Call virtualCall = nullptr;
static ReturnedValue method_of(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
+ static ReturnedValue method_from(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
};
struct TypedArrayCtor: FunctionObject
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 4e901721cb..ae12033eb4 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -555,6 +555,8 @@ struct ValueArray {
} else {
while (v < end) {
v->mark(markStack);
+ if (markStack->top >= markStack->limit)
+ markStack->drain();
++v;
}
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index ad5a6ebc8c..fb103d492d 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -341,7 +341,17 @@ static struct InstrCount {
}
#endif
-#define STACK_VALUE(temp) stack[temp]
+static inline QV4::Value &stackValue(QV4::Value *stack, size_t slot, const CppStackFrame *frame)
+{
+ Q_ASSERT(slot < CallData::HeaderSize() / sizeof(QV4::StaticValue)
+ + frame->jsFrame->argc()
+ + frame->v4Function->compiledFunction->nRegisters);
+ Q_UNUSED(frame);
+
+ return stack[slot];
+}
+
+#define STACK_VALUE(temp) stackValue(stack, temp, frame)
// qv4scopedvalue_p.h also defines a CHECK_EXCEPTION macro
#ifdef CHECK_EXCEPTION
@@ -424,7 +434,7 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine)
Function *function = frame->v4Function;
Q_TRACE_SCOPE(QQmlV4_function_call, engine, function->name()->toQString(),
- function->compilationUnit->fileName(),
+ function->executableCompilationUnit()->fileName(),
function->compiledFunction->location.line,
function->compiledFunction->location.column);
Profiling::FunctionCallProfiler profiler(engine, function); // start execution profiling
@@ -521,14 +531,14 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_END_INSTR(LoadImport)
MOTH_BEGIN_INSTR(LoadLocal)
- auto cc = static_cast<Heap::CallContext *>(stack[CallData::Context].m());
+ auto cc = static_cast<Heap::CallContext *>(STACK_VALUE(CallData::Context).m());
Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext);
acc = cc->locals[index].asReturnedValue();
MOTH_END_INSTR(LoadLocal)
MOTH_BEGIN_INSTR(StoreLocal)
CHECK_EXCEPTION;
- auto cc = static_cast<Heap::CallContext *>(stack[CallData::Context].m());
+ auto cc = static_cast<Heap::CallContext *>(STACK_VALUE(CallData::Context).m());
Q_ASSERT(cc->type != QV4::Heap::CallContext::Type_GlobalContext);
QV4::WriteBarrier::write(engine, cc, cc->locals.values[index].data_ptr(), acc);
MOTH_END_INSTR(StoreLocal)
@@ -714,7 +724,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(CallProperty)
STORE_IP();
- acc = Runtime::CallProperty::call(engine, stack[base], name, stack + argv, argc);
+ acc = Runtime::CallProperty::call(engine, STACK_VALUE(base), name, stack + argv, argc);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallProperty)
@@ -722,21 +732,21 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
STORE_IP();
Lookup *l = function->executableCompilationUnit()->runtimeLookups + lookupIndex;
- if (stack[base].isNullOrUndefined()) {
+ if (STACK_VALUE(base).isNullOrUndefined()) {
QString message = QStringLiteral("Cannot call method '%1' of %2")
.arg(engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[l->nameIndex]->toQString())
- .arg(stack[base].toQStringNoThrow());
+ .arg(STACK_VALUE(base).toQStringNoThrow());
acc = engine->throwTypeError(message);
goto handleUnwind;
}
// ok to have the value on the stack here
- Value f = Value::fromReturnedValue(l->getter(l, engine, stack[base]));
+ Value f = Value::fromReturnedValue(l->getter(l, engine, STACK_VALUE(base)));
if (Q_UNLIKELY(!f.isFunctionObject())) {
QString message = QStringLiteral("Property '%1' of object %2 is not a function")
.arg(engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[l->nameIndex]->toQString())
- .arg(stack[base].toQStringNoThrow());
+ .arg(STACK_VALUE(base).toQStringNoThrow());
acc = engine->throwTypeError(message);
goto handleUnwind;
}
@@ -747,7 +757,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(CallElement)
STORE_IP();
- acc = Runtime::CallElement::call(engine, stack[base], STACK_VALUE(index), stack + argv, argc);
+ acc = Runtime::CallElement::call(engine, STACK_VALUE(base), STACK_VALUE(index), stack + argv, argc);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallElement)
@@ -864,7 +874,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(PushWithContext)
STORE_IP();
STORE_ACC();
- acc = Runtime::PushWithContext::call(engine, stack[CallData::Accumulator]);
+ acc = Runtime::PushWithContext::call(engine, STACK_VALUE(CallData::Accumulator));
CHECK_EXCEPTION;
MOTH_END_INSTR(PushWithContext)
@@ -971,12 +981,13 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine,
MOTH_BEGIN_INSTR(ConvertThisToObject)
STORE_ACC();
- stack[CallData::This] = Runtime::ConvertThisToObject::call(engine, stack[CallData::This]);
+ stack[CallData::This] = Runtime::ConvertThisToObject::call(
+ engine, STACK_VALUE(CallData::This));
CHECK_EXCEPTION;
MOTH_END_INSTR(ConvertThisToObject)
MOTH_BEGIN_INSTR(LoadSuperConstructor)
- acc = Runtime::LoadSuperConstructor::call(engine, stack[CallData::Function]);
+ acc = Runtime::LoadSuperConstructor::call(engine, STACK_VALUE(CallData::Function));
CHECK_EXCEPTION;
MOTH_END_INSTR(LoadSuperConstructor)
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 3465036c86..35b2ff2749 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -1220,6 +1220,8 @@ void MemoryManager::collectFromJSStack(MarkStack *markStack) const
Q_ASSERT(m->inUse());
// Skip pointers to already freed objects, they are bogus as well
m->mark(markStack);
+ if (markStack->top >= markStack->limit)
+ markStack->drain();
}
++v;
}
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index e28899883f..6fbb9df164 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -80,6 +80,7 @@
%token T_COMMENT "comment"
%token T_COMPATIBILITY_SEMICOLON
%token T_ARROW "=>"
+%token T_QUESTION_QUESTION "??"
%token T_ENUM "enum"
%token T_ELLIPSIS "..."
%token T_YIELD "yield"
@@ -125,6 +126,7 @@
%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY T_ON T_SET T_GET T_OF T_STATIC T_FROM T_AS T_REQUIRED
%nonassoc REDUCE_HERE
%right T_THEN T_ELSE
+%right T_WITHOUTAS T_AS
%start TopLevel
@@ -1011,15 +1013,27 @@ UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer;
./
-UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_RBRACE;
-/. case $rule_number: Q_FALLTHROUGH(); ./
-UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_COMMA T_RBRACE;
+UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_RBRACE Semicolon;
/.
case $rule_number: {
AST::ObjectPattern *l = new (pool) AST::ObjectPattern(sym(3).PatternPropertyList->finish());
l->lbraceToken = loc(1);
l->rbraceToken = loc(4);
AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(l);
+ node->semicolonToken = loc(5);
+ sym(1).Node = node;
+ } break;
+./
+
+
+UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_COMMA T_RBRACE Semicolon;
+/.
+ case $rule_number: {
+ AST::ObjectPattern *l = new (pool) AST::ObjectPattern(sym(3).PatternPropertyList->finish());
+ l->lbraceToken = loc(1);
+ l->rbraceToken = loc(5);
+ AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(l);
+ node->semicolonToken = loc(6);
sym(1).Node = node;
} break;
./
@@ -2500,6 +2514,20 @@ RelationalExpression_In: RelationalExpression_In T_IN ShiftExpression;
} break;
./
+TypeAssertExpression_In: RelationalExpression_In T_AS Type;
+/. case $rule_number: Q_FALLTHROUGH(); ./
+TypeAssertExpression: RelationalExpression T_AS Type;
+/.
+ case $rule_number: {
+ AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::As, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+ } break;
+./
+
+RelationalExpression_In: TypeAssertExpression_In;
+RelationalExpression: TypeAssertExpression;
+
EqualityExpression_In: RelationalExpression_In;
EqualityExpression: RelationalExpression;
@@ -2611,13 +2639,48 @@ LogicalORExpression_In: LogicalORExpression_In T_OR_OR LogicalANDExpression_In;
} break;
./
+CoalesceExpression: LogicalORExpression;
+CoalesceExpression_In: LogicalORExpression_In;
+
+CoalesceExpression: CoalesceExpression T_QUESTION_QUESTION LogicalORExpression;
+/. case $rule_number: Q_FALLTHROUGH(); ./
+CoalesceExpression_In: CoalesceExpression_In T_QUESTION_QUESTION LogicalORExpression_In;
+/.
+ case $rule_number: {
+
+ auto *lhs = sym(1).Expression;
+ auto *rhs = sym(3).Expression;
+
+ // Check if lhs or rhs contain || or &&
+
+ if (lhs->binaryExpressionCast() != nullptr) {
+ auto *binaryExpr = lhs->binaryExpressionCast();
+ if (binaryExpr->op == QSOperator::And || binaryExpr->op == QSOperator::Or) {
+ syntaxError(binaryExpr->operatorToken, "Left-hand side may not contain || or &&");
+ return false;
+ }
+ }
+
+ if (rhs->binaryExpressionCast() != nullptr) {
+ auto *binaryExpr = rhs->binaryExpressionCast();
+ if (binaryExpr->op == QSOperator::And || binaryExpr->op == QSOperator::Or) {
+ syntaxError(binaryExpr->operatorToken, "Right-hand side may not contain || or &&");
+ return false;
+ }
+ }
+
+ AST::BinaryExpression *node = new (pool) AST::BinaryExpression(lhs, QSOperator::Coalesce, rhs);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+ } break;
+./
-ConditionalExpression: LogicalORExpression;
-ConditionalExpression_In: LogicalORExpression_In;
+ConditionalExpression: CoalesceExpression;
+ConditionalExpression_In: CoalesceExpression_In;
-ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression;
+ConditionalExpression: CoalesceExpression T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression;
/. case $rule_number: Q_FALLTHROUGH(); ./
-ConditionalExpression_In: LogicalORExpression_In T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression_In;
+ConditionalExpression_In: CoalesceExpression_In T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression_In;
/.
case $rule_number: {
AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression);
@@ -4356,7 +4419,10 @@ ImportsList: ImportsList T_COMMA ImportSpecifier;
} break;
./
-ImportSpecifier: ImportedBinding;
+-- When enconutering an IdentifierReference it can resolve to both ImportedBinding and IdentifierName
+-- Using %right and %prec, we tell qlalr that it should not reduce immediately, but rather shift
+-- so that we have a chance of actually parsing the correct rule if there is an "as" identifier
+ImportSpecifier: ImportedBinding %prec T_WITHOUTAS;
/.
case $rule_number: {
auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1));
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index e436c4673d..aa355fed85 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -104,6 +104,8 @@ enum Op {
URShift,
InplaceURightShift,
InplaceXor,
+ As,
+ Coalesce,
Invalid
};
@@ -1782,7 +1784,7 @@ public:
{ return expression->firstSourceLocation(); }
SourceLocation lastSourceLocation() const override
- { return expression->lastSourceLocation(); }
+ { return semicolonToken; }
// attributes
ExpressionNode *expression;
diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp
index 443e1a7476..80d883e52f 100644
--- a/src/qml/parser/qqmljslexer.cpp
+++ b/src/qml/parser/qqmljslexer.cpp
@@ -580,7 +580,14 @@ again:
case ']': return T_RBRACKET;
case '[': return T_LBRACKET;
- case '?': return T_QUESTION;
+ case '?': {
+ if (_char == QLatin1Char('?')) {
+ scanChar();
+ return T_QUESTION_QUESTION;
+ }
+
+ return T_QUESTION;
+ }
case '>':
if (_char == QLatin1Char('>')) {
diff --git a/src/qml/qml.pro b/src/qml/qml.pro
index 3c889244f4..985f7ca383 100644
--- a/src/qml/qml.pro
+++ b/src/qml/qml.pro
@@ -63,8 +63,14 @@ qtConfig(qml-animation) {
include(types/types.pri)
include(../3rdparty/masm/masm-defs.pri)
include(../3rdparty/masm/masm.pri)
-include(../3rdparty/llvm/llvm.pri)
MODULE_PLUGIN_TYPES = \
qmltooling
+
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml
+QML_IMPORT_NAME = QtQml
+IMPORT_VERSION = 2.15
+CONFIG += qmltypes install_qmltypes install_metatypes
+
load(qt_module)
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 7a8fdd0a14..bbe374044d 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
// Copy of QString's qMemCompare
bool QHashedString::compare(const QChar *lhs, const QChar *rhs, int length)
{
- Q_ASSERT(lhs && rhs);
+ Q_ASSERT((lhs && rhs) || !length);
const quint16 *a = (const quint16 *)lhs;
const quint16 *b = (const quint16 *)rhs;
diff --git a/src/qml/qml/ftw/qstringhash_p.h b/src/qml/qml/ftw/qstringhash_p.h
index f9435b4919..fc73fdfa50 100644
--- a/src/qml/qml/ftw/qstringhash_p.h
+++ b/src/qml/qml/ftw/qstringhash_p.h
@@ -54,25 +54,31 @@
#include <private/qhashedstring_p.h>
#include <private/qprimefornumbits_p.h>
-#include <QtCore/qglobal.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
+static inline QString::DataPointer &mutableStringData(const QHashedString &key)
+{
+ return const_cast<QHashedString &>(key).data_ptr();
+}
+
class QStringHashData;
class QStringHashNode
{
public:
QStringHashNode()
- : ckey(nullptr)
{
}
QStringHashNode(const QHashedString &key)
: length(key.length()), hash(key.hash()), symbolId(0)
+ , arrayData(mutableStringData(key).d_ptr())
+ , strData(mutableStringData(key).data())
{
- strData = const_cast<QHashedString &>(key).data_ptr();
+ arrayData->ref();
setQString(true);
- strData->ref.ref();
}
QStringHashNode(const QHashedCStringRef &key)
@@ -81,15 +87,21 @@ public:
}
QStringHashNode(const QStringHashNode &o)
- : length(o.length), hash(o.hash), symbolId(o.symbolId), ckey(o.ckey)
+ : length(o.length), hash(o.hash), symbolId(o.symbolId), arrayData(o.arrayData)
{
setQString(o.isQString());
- if (isQString()) { strData->ref.ref(); }
+ if (isQString()) {
+ strData = o.strData;
+ arrayData->ref();
+ } else {
+ ckey = o.ckey;
+ }
}
~QStringHashNode()
{
- if (isQString()) { if (!strData->ref.deref()) free(strData); }
+ if (isQString() && !arrayData->deref())
+ QTypedArrayData<ushort>::deallocate(arrayData);
}
QFlagPointer<QStringHashNode> next;
@@ -98,15 +110,18 @@ public:
quint32 hash = 0;
quint32 symbolId = 0;
+ QTypedArrayData<ushort> *arrayData = nullptr;
union {
- const char *ckey;
- QStringData *strData;
+ const char *ckey = nullptr;
+ ushort *strData;
};
inline QHashedString key() const
{
- if (isQString())
- return QHashedString(QString((QChar *)strData->data(), length), hash);
+ if (isQString()) {
+ arrayData->ref();
+ return QHashedString(QString(QStringPrivate(arrayData, strData, length)), hash);
+ }
return QHashedString(QString::fromLatin1(ckey, length), hash);
}
@@ -114,16 +129,14 @@ public:
bool isQString() const { return next.flag(); }
void setQString(bool v) { if (v) next.setFlag(); else next.clearFlag(); }
- inline char *cStrData() const { return (char *)ckey; }
- inline quint16 *utf16Data() const { return (quint16 *)strData->data(); }
+ inline qsizetype size() const { return length; }
+ inline const char *cStrData() const { return ckey; }
+ inline const quint16 *utf16Data() const { return strData; }
inline bool equals(const QV4::Value &string) const {
QString s = string.toQStringNoThrow();
if (isQString()) {
- QStringDataPtr dd;
- dd.ptr = strData;
- strData->ref.ref();
- return QString(dd) == s;
+ return QStringView(utf16Data(), length) == s;
} else {
return QLatin1String(cStrData(), length) == s;
}
@@ -133,10 +146,7 @@ public:
if (length != string->d()->length() || hash != string->hashValue())
return false;
if (isQString()) {
- QStringDataPtr dd;
- dd.ptr = strData;
- strData->ref.ref();
- return QString(dd) == string->toQString();
+ return QStringView(utf16Data(), length) == string->toQString();
} else {
return QLatin1String(cStrData(), length) == string->toQString();
}
@@ -510,8 +520,9 @@ void QStringHash<T>::initializeNode(Node *node, const QHashedString &key)
{
node->length = key.length();
node->hash = key.hash();
- node->strData = const_cast<QHashedString &>(key).data_ptr();
- node->strData->ref.ref();
+ node->arrayData = mutableStringData(key).d_ptr();
+ node->strData = mutableStringData(key).data();
+ node->arrayData->ref();
node->setQString(true);
}
@@ -547,10 +558,11 @@ typename QStringHash<T>::Node *QStringHash<T>::takeNode(const Node &o)
Node *rv = nodePool->nodes + nodePool->used++;
rv->length = o.length;
rv->hash = o.hash;
+ rv->arrayData = o.arrayData;
if (o.isQString()) {
rv->strData = o.strData;
- rv->strData->ref.ref();
rv->setQString(true);
+ rv->arrayData->ref();
} else {
rv->ckey = o.ckey;
}
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index adb036e2d0..7f80fe5e1c 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -127,7 +127,7 @@ void QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *c)
switch (c->status()) {
case QQmlComponent::Error:
qWarning() << "QQmlApplicationEngine failed to load component";
- qWarning() << qPrintable(c->errorString());
+ warning(c->errors());
q->objectCreated(nullptr, c->url());
break;
case QQmlComponent::Ready: {
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 112e5b558a..162adf8364 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -54,6 +54,8 @@
#include <private/qv4variantobject_p.h>
#include <private/qv4jscall_p.h>
+#include <qtqml_tracepoints_p.h>
+
#include <QVariant>
#include <QtCore/qdebug.h>
#include <QVector>
@@ -182,6 +184,8 @@ void QQmlBinding::update(QQmlPropertyData::WriteFlags flags)
if (canUseAccessor())
flags.setFlag(QQmlPropertyData::BypassInterceptor);
+ Q_TRACE_SCOPE(QQmlBinding, engine, function() ? function()->name()->toQString() : QString(),
+ sourceLocation().sourceFile, sourceLocation().line, sourceLocation().column);
QQmlBindingProfiler prof(QQmlEnginePrivate::get(engine)->profiler, function());
doUpdate(watcher, flags, scope);
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index ff01e737ca..b347bb3829 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -60,6 +60,7 @@
#include <QtCore/qdebug.h>
+#include <qtqml_tracepoints_p.h>
QT_BEGIN_NAMESPACE
@@ -352,6 +353,10 @@ void QQmlBoundSignal_callback(QQmlNotifierEndpoint *e, void **a)
QQmlEngine *engine;
if (s->m_expression && (engine = s->m_expression->engine())) {
+ Q_TRACE_SCOPE(QQmlHandlingSignal, engine,
+ s->m_expression->function() ? s->m_expression->function()->name()->toQString() : QString(),
+ s->m_expression->sourceLocation().sourceFile, s->m_expression->sourceLocation().line,
+ s->m_expression->sourceLocation().column);
QQmlHandlingSignalProfiler prof(QQmlEnginePrivate::get(engine)->profiler, s->m_expression);
s->m_expression->evaluate(a);
if (s->m_expression && s->m_expression->hasError()) {
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 1d5f974d5c..279998b5de 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -376,7 +376,7 @@ bool QQmlComponentPrivate::setInitialProperty(QObject *component, const QString&
{
QQmlProperty prop = QQmlComponentPrivate::removePropertyFromRequired(component, name, requiredProperties());
QQmlPropertyPrivate *privProp = QQmlPropertyPrivate::get(prop);
- if (!prop.isValid() || !privProp->writeValueProperty(value, nullptr)) {
+ if (!prop.isValid() || !privProp->writeValueProperty(value, {})) {
QQmlError error{};
error.setUrl(url);
error.setDescription(QLatin1String("Could not set property %1").arg(name));
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index a5f34dafdf..87f7fffe41 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -108,12 +108,6 @@ void QQmlCustomParser::error(const QV4::CompiledData::Location &location, const
exceptions << error;
}
-struct StaticQtMetaObject : public QObject
-{
- static const QMetaObject *get()
- { return &staticQtMetaObject; }
-};
-
/*!
If \a script is a simple enumeration expression (eg. Text.AlignLeft),
returns the integer equivalent (eg. 1), and sets \a ok to true.
@@ -164,7 +158,7 @@ int QQmlCustomParser::evaluateEnum(const QByteArray& script, bool *ok) const
}
QByteArray enumValue = script.mid(dot + 1);
- const QMetaObject *mo = StaticQtMetaObject::get();
+ const QMetaObject *mo = &Qt::staticMetaObject;
int i = mo->enumeratorCount();
while (i--) {
int v = mo->enumerator(i).keyToValue(enumValue.constData(), ok);
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 299476f5c8..ee31cb38d9 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -335,7 +335,7 @@ bool QQmlData::wasDeleted(const QObject *object)
return true;
const QObjectPrivate *priv = QObjectPrivate::get(object);
- if (!priv || priv->wasDeleted)
+ if (!priv || priv->wasDeleted || priv->isDeletingChildren)
return true;
const QQmlData *ddata = QQmlData::get(object);
diff --git a/src/qml/qml/qqmldatablob.cpp b/src/qml/qml/qqmldatablob.cpp
index 750fc6de50..1ab6002f0a 100644
--- a/src/qml/qml/qqmldatablob.cpp
+++ b/src/qml/qml/qqmldatablob.cpp
@@ -45,6 +45,8 @@
#include <QtQml/qqmlengine.h>
+#include <qtqml_tracepoints_p.h>
+
#ifdef DATABLOB_DEBUG
#define ASSERT_CALLBACK() do { if (!m_typeLoader || !m_typeLoader->m_thread->isThisThread()) qFatal("QQmlDataBlob: An API call was made outside a callback"); } while (false)
#else
@@ -559,6 +561,7 @@ void QQmlDataBlob::notifyAllWaitingOnMe()
void QQmlDataBlob::notifyComplete(QQmlDataBlob *blob)
{
Q_ASSERT(blob->status() == Error || blob->status() == Complete);
+ Q_TRACE_SCOPE(QQmlCompiling, blob->url());
QQmlCompilingProfiler prof(typeLoader()->profiler(), blob);
m_inCallback = true;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index bde4df1340..f11959b7fb 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -197,25 +197,6 @@ int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject,
bool QQmlEnginePrivate::qml_debugging_enabled = false;
bool QQmlEnginePrivate::s_designerMode = false;
-void QQmlEnginePrivate::defineModule()
-{
- const char uri[] = "QtQml";
-
- qmlRegisterTypesAndRevisions<
- QObjectForeign,
-#if QT_CONFIG(qml_animation)
- QQmlTimer,
-#endif
-#if QT_CONFIG(qml_locale)
- QQmlLocale,
-#endif
- QQmlComponent,
- QQmlBind,
- QQmlConnections,
- QQmlLoggingCategory
- >(uri, 2);
-}
-
bool QQmlEnginePrivate::designerMode()
{
return s_designerMode;
@@ -783,10 +764,12 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
// QQmlEngine to emit signals from a different thread. These signals are then automatically
// marshalled back onto the QObject's thread and handled by QML from there. This is tested
// by the qqmlecmascript::threadSignal() autotest.
- if (ddata->notifyList &&
- QThread::currentThreadId() != QObjectPrivate::get(object)->getThreadData()->threadId.loadRelaxed()) {
+ if (!ddata->notifyList)
+ return;
- if (!QObjectPrivate::get(object)->getThreadData()->thread.loadAcquire())
+ auto objectThreadData = QObjectPrivate::get(object)->threadData.loadRelaxed();
+ if (QThread::currentThreadId() != objectThreadData->threadId.loadRelaxed()) {
+ if (!objectThreadData->thread.loadAcquire())
return;
QMetaMethod m = QMetaObjectPrivate::signal(object->metaObject(), index);
@@ -818,7 +801,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
QQmlThreadNotifierProxyObject *mpo = new QQmlThreadNotifierProxyObject;
mpo->target = object;
- mpo->moveToThread(QObjectPrivate::get(object)->getThreadData()->thread.loadAcquire());
+ mpo->moveToThread(objectThreadData->thread.loadAcquire());
QCoreApplication::postEvent(mpo, ev.take());
} else {
@@ -1002,8 +985,6 @@ QQmlEngine::~QQmlEngine()
Q_D(QQmlEngine);
QJSEnginePrivate::removeFromDebugServer(this);
- d->typeLoader.invalidate();
-
// Emit onDestruction signals for the root context before
// we destroy the contexts, engine, Singleton Types etc. that
// may be required to handle the destruction signal.
@@ -1013,12 +994,14 @@ QQmlEngine::~QQmlEngine()
// we do this here and not in the private dtor since otherwise a crash can
// occur (if we are the QObject parent of the QObject singleton instance)
// XXX TODO: performance -- store list of singleton types separately?
- QList<QQmlType> singletonTypes = QQmlMetaType::qmlSingletonTypes();
+ const QList<QQmlType> singletonTypes = QQmlMetaType::qmlSingletonTypes();
for (const QQmlType &currType : singletonTypes)
d->destroySingletonInstance(currType);
delete d->rootContext;
d->rootContext = nullptr;
+
+ d->typeLoader.invalidate();
}
/*! \fn void QQmlEngine::quit()
@@ -1595,6 +1578,9 @@ static QObject *resolveAttachedProperties(QQmlAttachedPropertiesFunc pf, QQmlDat
}
#if QT_DEPRECATED_SINCE(5, 14)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create)
{
QQmlData *data = QQmlData::get(object, create);
@@ -1605,7 +1591,9 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
return nullptr;
QQmlEnginePrivate *engine = QQmlEnginePrivate::get(data->context);
- return resolveAttachedProperties(QQmlMetaType::attachedPropertiesFuncById(engine, id), data,
+
+ const QQmlType type = QQmlMetaType::qmlType(id, QQmlMetaType::TypeIdCategory::QmlType);
+ return resolveAttachedProperties(type.attachedPropertiesFunction(engine), data,
const_cast<QObject *>(object), create);
}
@@ -1622,6 +1610,8 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+
+QT_WARNING_POP
#endif
QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *object,
@@ -1650,6 +1640,8 @@ QObject *qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc
} // namespace QtQml
#if QT_DEPRECATED_SINCE(5, 1)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
@@ -1680,6 +1672,7 @@ Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *o
return QtQml::qmlAttachedPropertiesObject(idCache, object, attachedMetaObject, create);
}
+QT_WARNING_POP
#endif // QT_DEPRECATED_SINCE(5, 1)
class QQmlDataExtended {
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index 26364661a8..7a62c967e7 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -127,8 +127,6 @@ void QQmlExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
}
/*!
- \fn void QQmlEngineExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
-
Initializes the extension from the \a uri using the \a engine. Here an application
plugin might, for example, expose some data or objects to QML,
as context properties on the engine's root context.
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 21ca24d38b..7da0685872 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -245,9 +245,9 @@ public:
QQmlTypeLoader *typeLoader;
- static bool locateQmldir(const QString &uri, int vmaj, int vmin,
- QQmlImportDatabase *database,
- QString *outQmldirFilePath, QString *outUrl);
+ static QQmlImports::LocalQmldirResult locateLocalQmldir(
+ const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database,
+ QString *outQmldirFilePath, QString *outUrl);
static bool validateQmldirVersion(const QQmlTypeLoaderQmldirContent &qmldir, const QString &uri, int vmaj, int vmin,
QList<QQmlError> *errors);
@@ -1076,7 +1076,13 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
if (qmldirPluginCount == 0)
return true;
- if (!database->qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(qmldirFilePath)) {
+ if (database->qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(qmldirFilePath)) {
+ if ((vmaj >= 0 && vmin >= 0)
+ ? !QQmlMetaType::isModule(uri, vmaj, vmin)
+ : !QQmlMetaType::isAnyModule(uri)) {
+ QQmlMetaType::qmlRegisterModuleTypes(uri, vmaj);
+ }
+ } else {
// First search for listed qmldir plugins dynamically. If we cannot resolve them all, we continue
// searching static plugins that has correct metadata uri. Note that since we only know the uri
// for a static plugin, and not the filename, we cannot know which static plugin belongs to which
@@ -1237,8 +1243,9 @@ Locates the qmldir file for \a uri version \a vmaj.vmin. Returns true if found,
and fills in outQmldirFilePath and outQmldirUrl appropriately. Otherwise returns
false.
*/
-bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database,
- QString *outQmldirFilePath, QString *outQmldirPathUrl)
+QQmlImports::LocalQmldirResult QQmlImportsPrivate::locateLocalQmldir(
+ const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database,
+ QString *outQmldirFilePath, QString *outQmldirPathUrl)
{
Q_ASSERT(vmaj >= 0 && vmin >= 0); // Versions are always specified for libraries
@@ -1246,20 +1253,21 @@ bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQ
QQmlImportDatabase::QmldirCache *cacheHead = nullptr;
{
- QQmlImportDatabase::QmldirCache **cachePtr = database->qmldirCache.value(uri);
- if (cachePtr) {
- cacheHead = *cachePtr;
- QQmlImportDatabase::QmldirCache *cache = cacheHead;
- while (cache) {
- if (cache->versionMajor == vmaj && cache->versionMinor == vmin) {
- *outQmldirFilePath = cache->qmldirFilePath;
- *outQmldirPathUrl = cache->qmldirPathUrl;
- return !cache->qmldirFilePath.isEmpty();
+ QQmlImportDatabase::QmldirCache **cachePtr = database->qmldirCache.value(uri);
+ if (cachePtr) {
+ cacheHead = *cachePtr;
+ QQmlImportDatabase::QmldirCache *cache = cacheHead;
+ while (cache) {
+ if (cache->versionMajor == vmaj && cache->versionMinor == vmin) {
+ *outQmldirFilePath = cache->qmldirFilePath;
+ *outQmldirPathUrl = cache->qmldirPathUrl;
+ return cache->qmldirFilePath.isEmpty() ? QQmlImports::QmldirNotFound
+ : QQmlImports::QmldirFound;
+ }
+ cache = cache->next;
}
- cache = cache->next;
}
}
- }
QQmlTypeLoader &typeLoader = QQmlEnginePrivate::get(database->engine)->typeLoader;
@@ -1269,12 +1277,17 @@ bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQ
interceptor ? QQmlImportDatabase::LocalOrRemote : QQmlImportDatabase::Local);
// Search local import paths for a matching version
- const QStringList qmlDirPaths = QQmlImports::completeQmldirPaths(uri, localImportPaths, vmaj, vmin);
+ const QStringList qmlDirPaths = QQmlImports::completeQmldirPaths(
+ uri, localImportPaths, vmaj, vmin);
+ bool pathTurnedRemote = false;
for (QString qmldirPath : qmlDirPaths) {
if (interceptor) {
- qmldirPath = QQmlFile::urlToLocalFileOrQrc(
- interceptor->intercept(QQmlImports::urlFromLocalFileOrQrcOrUrl(qmldirPath),
- QQmlAbstractUrlInterceptor::QmldirFile));
+ const QUrl intercepted = interceptor->intercept(
+ QQmlImports::urlFromLocalFileOrQrcOrUrl(qmldirPath),
+ QQmlAbstractUrlInterceptor::QmldirFile);
+ qmldirPath = QQmlFile::urlToLocalFileOrQrc(intercepted);
+ if (!pathTurnedRemote && qmldirPath.isEmpty() && !QQmlFile::isLocalFile(intercepted))
+ pathTurnedRemote = true;
}
QString absoluteFilePath = typeLoader.absoluteFilePath(qmldirPath);
@@ -1297,7 +1310,7 @@ bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQ
*outQmldirFilePath = absoluteFilePath;
*outQmldirPathUrl = url;
- return true;
+ return QQmlImports::QmldirFound;
}
}
@@ -1307,7 +1320,7 @@ bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQ
cache->next = cacheHead;
database->qmldirCache.insert(uri, cache);
- return false;
+ return pathTurnedRemote ? QQmlImports::QmldirInterceptedToRemote : QQmlImports::QmldirNotFound;
}
bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoaderQmldirContent &qmldir, const QString &uri, int vmaj, int vmin,
@@ -1701,11 +1714,11 @@ bool QQmlImports::updateQmldirContent(QQmlImportDatabase *importDb,
return d->updateQmldirContent(uri, prefix, qmldirIdentifier, qmldirUrl, importDb, errors);
}
-bool QQmlImports::locateQmldir(QQmlImportDatabase *importDb,
- const QString& uri, int vmaj, int vmin,
- QString *qmldirFilePath, QString *url)
+QQmlImports::LocalQmldirResult QQmlImports::locateLocalQmldir(
+ QQmlImportDatabase *importDb, const QString &uri, int vmaj, int vmin,
+ QString *qmldirFilePath, QString *url)
{
- return d->locateQmldir(uri, vmaj, vmin, importDb, qmldirFilePath, url);
+ return d->locateLocalQmldir(uri, vmaj, vmin, importDb, qmldirFilePath, url);
}
bool QQmlImports::isLocal(const QString &url)
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index 7cf1ae61b9..1f44b22deb 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -163,9 +163,15 @@ public:
const QString &uri, const QString &prefix,
const QString &qmldirIdentifier, const QString &qmldirUrl, QList<QQmlError> *errors);
- bool locateQmldir(QQmlImportDatabase *,
- const QString &uri, int vmaj, int vmin,
- QString *qmldirFilePath, QString *url);
+ enum LocalQmldirResult {
+ QmldirFound,
+ QmldirNotFound,
+ QmldirInterceptedToRemote
+ };
+
+ LocalQmldirResult locateLocalQmldir(
+ QQmlImportDatabase *, const QString &uri, int vmaj, int vmin,
+ QString *qmldirFilePath, QString *url);
void populateCache(QQmlTypeNameCache *cache) const;
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 2bfd2d5bb4..dd401bdb20 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlDebug(const QObject *object)
- \relates QtQml
\since 5.9
Prints debug messages that include the file and line number for the
@@ -91,7 +90,6 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlInfo(const QObject *object)
- \relates QtQml
Prints informational messages that include the file and line number for the
specified QML \a object.
@@ -119,7 +117,6 @@ QT_BEGIN_NAMESPACE
/*!
\fn QQmlInfo QtQml::qmlWarning(const QObject *object)
- \relates QtQml
\since 5.9
Prints warning messages that include the file and line number for the
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index dca13ac8d4..1743410776 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -478,6 +478,23 @@ ReturnedValue QQmlLocaleData::method_get_firstDayOfWeek(const QV4::FunctionObjec
RETURN_RESULT(fdow);
}
+ReturnedValue QQmlLocaleData::method_get_numberOptions(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) {
+ QV4::Scope scope(b);
+ const QLocale *locale = getThisLocale(scope, thisObject);
+ if (!locale)
+ return Encode::undefined();
+ int numberOptions = int(locale->numberOptions());
+ RETURN_RESULT(numberOptions);
+}
+
+ReturnedValue QQmlLocaleData::method_set_numberOptions(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) {
+ QV4::Scope scope(b);
+ QLocale *locale = getThisLocale(scope, thisObject);
+ int const numberOptions = argc ? int(argv[0].toNumber()) : QLocale::DefaultNumberOptions;
+ locale->setNumberOptions(QLocale::NumberOptions {numberOptions});
+ return Encode::undefined();
+}
+
ReturnedValue QQmlLocaleData::method_get_measurementSystem(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
{
QV4::Scope scope(b);
@@ -701,6 +718,7 @@ QV4LocaleDataDeletable::QV4LocaleDataDeletable(QV4::ExecutionEngine *engine)
o->defineAccessorProperty(QStringLiteral("amText"), QQmlLocaleData::method_get_amText, nullptr);
o->defineAccessorProperty(QStringLiteral("measurementSystem"), QQmlLocaleData::method_get_measurementSystem, nullptr);
o->defineAccessorProperty(QStringLiteral("exponential"), QQmlLocaleData::method_get_exponential, nullptr);
+ o->defineAccessorProperty(QStringLiteral("numberOptions"), QQmlLocaleData::method_get_numberOptions, QQmlLocaleData::method_set_numberOptions);
prototype.set(engine, o);
}
@@ -817,7 +835,7 @@ QV4::ReturnedValue QQmlLocale::locale(ExecutionEngine *engine, const QString &lo
{
QLocale qlocale;
if (!localeName.isEmpty())
- qlocale = localeName;
+ qlocale = QLocale(localeName);
return wrap(engine, qlocale);
}
@@ -873,6 +891,16 @@ ReturnedValue QQmlLocale::method_localeCompare(const QV4::FunctionObject *b, con
*/
/*!
+ \qmlproperty enumeration QtQml::Locale::NumberOption
+
+ Holds a set of options for number-to-string and
+ string-to-number conversions.
+
+ \sa Number::toLocaleString()
+ \sa Number::fromLocaleString()
+*/
+
+/*!
\qmlproperty string QtQml::Locale::percent
Holds the percent character of this locale.
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 10e0dfcc38..1d6fdb12a7 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -131,6 +131,16 @@ public:
Saturday = Qt::Saturday
};
Q_ENUM(DayOfWeek)
+ enum NumberOptions {
+ DefaultNumberOptions = QLocale::DefaultNumberOptions,
+ OmitGroupSeparator = QLocale::OmitGroupSeparator,
+ RejectGroupSeparator = QLocale::RejectGroupSeparator,
+ OmitLeadingZeroInExponent = QLocale::OmitLeadingZeroInExponent,
+ RejectLeadingZeroInExponent = QLocale::RejectLeadingZeroInExponent,
+ IncludeTrailingZeroesAfterDot = QLocale::IncludeTrailingZeroesAfterDot,
+ RejectTrailingZeroesAfterDot = QLocale::RejectTrailingZeroesAfterDot
+ };
+ Q_ENUM(NumberOptions)
static QV4::ReturnedValue locale(QV4::ExecutionEngine *engine, const QString &localeName);
static QV4::ReturnedValue wrap(QV4::ExecutionEngine *engine, const QLocale &locale);
@@ -200,6 +210,9 @@ struct QQmlLocaleData : public QV4::Object
static QV4::ReturnedValue method_get_exponential(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
static QV4::ReturnedValue method_get_amText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
static QV4::ReturnedValue method_get_pmText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
+
+ static QV4::ReturnedValue method_get_numberOptions(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
+ static QV4::ReturnedValue method_set_numberOptions(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
};
}
diff --git a/src/qml/qml/qqmlmetaobject.cpp b/src/qml/qml/qqmlmetaobject.cpp
index a967f46b12..a87865fd81 100644
--- a/src/qml/qml/qqmlmetaobject.cpp
+++ b/src/qml/qml/qqmlmetaobject.cpp
@@ -44,12 +44,6 @@
QT_BEGIN_NAMESPACE
-struct StaticQtMetaObject : public QObject
-{
- static const QMetaObject *get()
- { return &staticQtMetaObject; }
-};
-
static bool isNamedEnumeratorInScope(const QMetaObject *resolvedMetaObject, const QByteArray &scope,
const QByteArray &name)
{
@@ -74,7 +68,7 @@ static bool isNamedEnumerator(const QMetaObject *metaObj, const QByteArray &scop
}
if (scope == "Qt")
- return isNamedEnumeratorInScope(StaticQtMetaObject::get(), scope, name);
+ return isNamedEnumeratorInScope(&Qt::staticMetaObject, scope, name);
if (isNamedEnumeratorInScope(metaObj, scope, name))
return true;
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index b8c17c9374..f506cdece3 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -273,11 +273,25 @@ void QQmlMetaType::qmlInsertModuleRegistration(const QString &uri, int majorVers
const QQmlMetaTypeData::VersionedUri versionedUri(uri, majorVersion);
QQmlMetaTypeDataPtr data;
if (data->moduleTypeRegistrationFunctions.contains(versionedUri))
- qFatal("Canot add multiple registrations for %s %d", qPrintable(uri), majorVersion);
+ qFatal("Cannot add multiple registrations for %s %d", qPrintable(uri), majorVersion);
else
data->moduleTypeRegistrationFunctions.insert(versionedUri, registerFunction);
}
+void QQmlMetaType::qmlRemoveModuleRegistration(const QString &uri, int majorVersion)
+{
+ const QQmlMetaTypeData::VersionedUri versionedUri(uri, majorVersion);
+ QQmlMetaTypeDataPtr data;
+
+ if (!data.isValid())
+ return; // shutdown/deletion race. Not a problem.
+
+ if (!data->moduleTypeRegistrationFunctions.contains(versionedUri))
+ qFatal("Cannot remove multiple registrations for %s %d", qPrintable(uri), majorVersion);
+ else
+ data->moduleTypeRegistrationFunctions.remove(versionedUri);
+}
+
bool QQmlMetaType::qmlRegisterModuleTypes(const QString &uri, int majorVersion)
{
QQmlMetaTypeDataPtr data;
@@ -329,7 +343,6 @@ QQmlType QQmlMetaType::registerInterface(const QQmlPrivate::RegisterInterface &t
data->idToType.insert(priv->typeId, priv);
data->idToType.insert(priv->listId, priv);
- // XXX No insertMulti, so no multi-version interfaces?
if (!priv->elementName.isEmpty())
data->nameToType.insert(priv->elementName, priv);
@@ -414,10 +427,10 @@ void addTypeToData(QQmlTypePrivate *type, QQmlMetaTypeData *data)
Q_ASSERT(type);
if (!type->elementName.isEmpty())
- data->nameToType.insertMulti(type->elementName, type);
+ data->nameToType.insert(type->elementName, type);
if (type->baseMetaObject)
- data->metaObjectToType.insertMulti(type->baseMetaObject, type);
+ data->metaObjectToType.insert(type->baseMetaObject, type);
if (type->typeId) {
data->idToType.insert(type->typeId, type);
@@ -492,7 +505,7 @@ QQmlType QQmlMetaType::registerCompositeSingletonType(const QQmlPrivate::Registe
addTypeToData(priv, data);
QQmlMetaTypeData::Files *files = fileImport ? &(data->urlToType) : &(data->urlToNonFileImportType);
- files->insertMulti(QQmlTypeLoader::normalize(type.url), priv);
+ files->insert(QQmlTypeLoader::normalize(type.url), priv);
return QQmlType(priv);
}
@@ -513,7 +526,7 @@ QQmlType QQmlMetaType::registerCompositeType(const QQmlPrivate::RegisterComposit
addTypeToData(priv, data);
QQmlMetaTypeData::Files *files = fileImport ? &(data->urlToType) : &(data->urlToNonFileImportType);
- files->insertMulti(QQmlTypeLoader::normalize(type.url), priv);
+ files->insert(QQmlTypeLoader::normalize(type.url), priv);
return QQmlType(priv);
}
@@ -797,7 +810,7 @@ QQmlType QQmlMetaType::typeForUrl(const QString &urlString,
data->registerType(priv);
addTypeToData(priv, data);
- data->urlToType.insertMulti(url, priv);
+ data->urlToType.insert(url, priv);
return QQmlType(priv);
}
@@ -927,11 +940,11 @@ int QQmlMetaType::attachedPropertiesFuncId(QQmlEnginePrivate *engine, const QMet
for (auto it = data->metaObjectToType.constFind(mo), end = data->metaObjectToType.constEnd();
it != end && it.key() == mo; ++it) {
- const QQmlType type(it.value());
- if (type.attachedPropertiesFunction(engine))
- return type.attachedPropertiesId(engine);
+ if (const QQmlTypePrivate *type = it.value()) {
+ if (const QQmlTypePrivate *base = type->attachedPropertiesBase(engine))
+ return base->index;
+ }
}
-
return -1;
}
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index ed4675046d..80126cbffb 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -200,6 +200,8 @@ public:
static void qmlInsertModuleRegistration(const QString &uri, int majorVersion,
void (*registerFunction)());
+ static void qmlRemoveModuleRegistration(const QString &uri, int majorVersion);
+
static bool qmlRegisterModuleTypes(const QString &uri, int majorVersion);
};
diff --git a/src/qml/qml/qqmlmetatypedata_p.h b/src/qml/qml/qqmlmetatypedata_p.h
index f193e51f5a..e51d4ca1a4 100644
--- a/src/qml/qml/qqmlmetatypedata_p.h
+++ b/src/qml/qml/qqmlmetatypedata_p.h
@@ -71,7 +71,7 @@ struct QQmlMetaTypeData
QSet<QQmlType> undeletableTypes;
typedef QHash<int, QQmlTypePrivate *> Ids;
Ids idToType;
- typedef QHash<QHashedStringRef, QQmlTypePrivate *> Names;
+ typedef QMultiHash<QHashedStringRef, QQmlTypePrivate *> Names;
Names nameToType;
typedef QHash<QUrl, QQmlTypePrivate *> Files; //For file imported composite types only
Files urlToType;
@@ -79,7 +79,7 @@ struct QQmlMetaTypeData
// singleton types. This way we can locate any
// of them by url, even if it was registered as
// a module via QQmlPrivate::RegisterCompositeType
- typedef QHash<const QMetaObject *, QQmlTypePrivate *> MetaObjects;
+ typedef QMultiHash<const QMetaObject *, QQmlTypePrivate *> MetaObjects;
MetaObjects metaObjectToType;
typedef QHash<int, QQmlMetaType::StringConverter> StringConverters;
StringConverters stringConverters;
diff --git a/src/qml/qml/qqmlmoduleregistration.cpp b/src/qml/qml/qqmlmoduleregistration.cpp
index bb82ec1d95..b7bc3555a6 100644
--- a/src/qml/qml/qqmlmoduleregistration.cpp
+++ b/src/qml/qml/qqmlmoduleregistration.cpp
@@ -39,16 +39,28 @@
#include <QtQml/private/qqmlmetatype_p.h>
#include <QtQml/qqmlmoduleregistration.h>
-#include <QtCore/qglobalstatic.h>
QT_BEGIN_NAMESPACE
+struct QQmlModuleRegistrationPrivate
+{
+ const QString uri;
+ const int majorVersion;
+};
+
QQmlModuleRegistration::QQmlModuleRegistration(
const char *uri, int majorVersion,
- void (*registerFunction)())
+ void (*registerFunction)()) :
+ d(new QQmlModuleRegistrationPrivate { QString::fromUtf8(uri), majorVersion })
{
- QQmlMetaType::qmlInsertModuleRegistration(QString::fromUtf8(uri), majorVersion,
+ QQmlMetaType::qmlInsertModuleRegistration(d->uri, d->majorVersion,
registerFunction);
}
+QQmlModuleRegistration::~QQmlModuleRegistration()
+{
+ QQmlMetaType::qmlRemoveModuleRegistration(d->uri, d->majorVersion);
+ delete d;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlmoduleregistration.h b/src/qml/qml/qqmlmoduleregistration.h
index 8924724b48..6f553a2823 100644
--- a/src/qml/qml/qqmlmoduleregistration.h
+++ b/src/qml/qml/qqmlmoduleregistration.h
@@ -44,13 +44,16 @@
QT_BEGIN_NAMESPACE
+struct QQmlModuleRegistrationPrivate;
class Q_QML_EXPORT QQmlModuleRegistration
{
Q_DISABLE_COPY_MOVE(QQmlModuleRegistration)
-
public:
QQmlModuleRegistration(const char *uri, int majorVersion, void (*registerFunction)());
- ~QQmlModuleRegistration() = default;
+ ~QQmlModuleRegistration();
+
+private:
+ QQmlModuleRegistrationPrivate *d = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index fe839a50dc..df3731684a 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -118,8 +118,8 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine
disconnect();
Q_ASSERT(engine);
- if (QObjectPrivate::get(source)->getThreadData()->threadId.loadRelaxed() !=
- QObjectPrivate::get(engine)->getThreadData()->threadId.loadRelaxed()) {
+ if (QObjectPrivate::get(source)->threadData.loadRelaxed()->threadId.loadRelaxed() !=
+ QObjectPrivate::get(engine)->threadData.loadRelaxed()->threadId.loadRelaxed()) {
QString sourceName;
QDebug(&sourceName) << source;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 27667de678..871bec1c17 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -785,7 +785,7 @@ static void removeOldBinding(QObject *object, QQmlPropertyIndex index, QQmlPrope
return;
if (!(flags & QQmlPropertyPrivate::DontEnable))
- oldBinding->setEnabled(false, nullptr);
+ oldBinding->setEnabled(false, {});
oldBinding->removeFromObject();
}
@@ -1451,7 +1451,7 @@ QQmlMetaObject QQmlPropertyPrivate::rawMetaObjectForType(QQmlEnginePrivate *engi
*/
bool QQmlProperty::write(const QVariant &value) const
{
- return QQmlPropertyPrivate::write(*this, value, nullptr);
+ return QQmlPropertyPrivate::write(*this, value, {});
}
/*!
diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h
index 285c34d7fa..8abd83d7b4 100644
--- a/src/qml/qml/qqmlproperty_p.h
+++ b/src/qml/qml/qqmlproperty_p.h
@@ -107,9 +107,9 @@ public:
static bool writeValueProperty(QObject *,
const QQmlPropertyData &, const QQmlPropertyData &valueTypeData,
const QVariant &, QQmlContextData *,
- QQmlPropertyData::WriteFlags flags = nullptr);
+ QQmlPropertyData::WriteFlags flags = {});
static bool write(QObject *, const QQmlPropertyData &, const QVariant &,
- QQmlContextData *, QQmlPropertyData::WriteFlags flags = nullptr);
+ QQmlContextData *, QQmlPropertyData::WriteFlags flags = {});
static void findAliasTarget(QObject *, QQmlPropertyIndex, QObject **, QQmlPropertyIndex *);
enum BindingFlag {
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 69957ab282..6336ff28b3 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1052,13 +1052,10 @@ static inline const QMetaObjectPrivate *priv(const uint* data)
static inline const QByteArray stringData(const QMetaObject *mo, int index)
{
- Q_ASSERT(priv(mo->d.data)->revision >= 7);
- const QByteArrayDataPtr data = { const_cast<QByteArrayData*>(&mo->d.stringdata[index]) };
- Q_ASSERT(data.ptr->ref.isStatic());
- Q_ASSERT(data.ptr->alloc == 0);
- Q_ASSERT(data.ptr->capacityReserved == 0);
- Q_ASSERT(data.ptr->size >= 0);
- return data;
+ uint offset = mo->d.stringdata[2*index];
+ uint length = mo->d.stringdata[2*index + 1];
+ const char *string = reinterpret_cast<const char *>(mo->d.stringdata) + offset;
+ return QByteArray::fromRawData(string, length);
}
bool QQmlPropertyCache::isDynamicMetaObject(const QMetaObject *mo)
diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp
index 874bcd4bca..4a211ffa53 100644
--- a/src/qml/qml/qqmltype.cpp
+++ b/src/qml/qml/qqmltype.cpp
@@ -618,28 +618,16 @@ int QQmlType::metaObjectRevision() const
QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivate *engine) const
{
- if (!d)
- return nullptr;
- if (d->regType == CppType)
- return d->extraData.cd->attachedPropertiesFunc;
-
- QQmlType base;
- if (d->regType == CompositeType)
- base = d->resolveCompositeBaseType(engine);
- return base.attachedPropertiesFunction(engine);
+ if (const QQmlTypePrivate *base = d->attachedPropertiesBase(engine))
+ return base->extraData.cd->attachedPropertiesFunc;
+ return nullptr;
}
const QMetaObject *QQmlType::attachedPropertiesType(QQmlEnginePrivate *engine) const
{
- if (!d)
- return nullptr;
- if (d->regType == CppType)
- return d->extraData.cd->attachedPropertiesType;
-
- QQmlType base;
- if (d->regType == CompositeType)
- base = d->resolveCompositeBaseType(engine);
- return base.attachedPropertiesType(engine);
+ if (const QQmlTypePrivate *base = d->attachedPropertiesBase(engine))
+ return base->extraData.cd->attachedPropertiesType;
+ return nullptr;
}
#if QT_DEPRECATED_SINCE(5, 14)
@@ -650,15 +638,9 @@ Qt 4.7 and QtQuick 1.0).
*/
int QQmlType::attachedPropertiesId(QQmlEnginePrivate *engine) const
{
- if (!d)
- return -1;
- if (d->regType == CppType)
- return d->extraData.cd->attachedPropertiesType ? d->index : -1;
-
- QQmlType base;
- if (d->regType == CompositeType)
- base = d->resolveCompositeBaseType(engine);
- return base.attachedPropertiesId(engine);
+ if (const QQmlTypePrivate *base = d->attachedPropertiesBase(engine))
+ return base->index;
+ return -1;
}
#endif
diff --git a/src/qml/qml/qqmltype_p.h b/src/qml/qml/qqmltype_p.h
index ec27b38a73..af134b21f1 100644
--- a/src/qml/qml/qqmltype_p.h
+++ b/src/qml/qml/qqmltype_p.h
@@ -182,6 +182,7 @@ public:
};
private:
+ friend class QQmlTypePrivate;
friend uint qHash(const QQmlType &t, uint seed);
QQmlRefPointer<const QQmlTypePrivate> d;
};
diff --git a/src/qml/qml/qqmltype_p_p.h b/src/qml/qml/qqmltype_p_p.h
index 6a2d961de8..51f776178c 100644
--- a/src/qml/qml/qqmltype_p_p.h
+++ b/src/qml/qml/qqmltype_p_p.h
@@ -82,6 +82,18 @@ public:
}
}
+ const QQmlTypePrivate *attachedPropertiesBase(QQmlEnginePrivate *engine) const
+ {
+ for (const QQmlTypePrivate *d = this; d; d = d->resolveCompositeBaseType(engine).d.data()) {
+ if (d->regType == QQmlType::CppType)
+ return d->extraData.cd->attachedPropertiesType ? d : nullptr;
+
+ if (d->regType != QQmlType::CompositeType)
+ return nullptr;
+ }
+ return nullptr;
+ }
+
bool isComposite() const
{
return regType == QQmlType::CompositeType || regType == QQmlType::CompositeSingletonType;
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp
index 7b4cf1a580..b4d56c9e49 100644
--- a/src/qml/qml/qqmltypecompiler.cpp
+++ b/src/qml/qml/qqmltypecompiler.cpp
@@ -530,12 +530,6 @@ bool QQmlEnumTypeResolver::resolveEnumBindings()
return true;
}
-struct StaticQtMetaObject : public QObject
-{
- static const QMetaObject *get()
- { return &staticQtMetaObject; }
-};
-
bool QQmlEnumTypeResolver::assignEnumToBinding(QmlIR::Binding *binding, const QStringRef &enumName, int enumValue, bool isQtObject)
{
if (enumName.length() > 0 && enumName[0].isLower() && !isQtObject) {
@@ -626,7 +620,7 @@ bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj,
value = type.enumValue(compiler->enginePrivate(), QHashedStringRef(enumValue), &ok);
} else {
QByteArray enumName = enumValue.toUtf8();
- const QMetaObject *metaObject = StaticQtMetaObject::get();
+ const QMetaObject *metaObject = &Qt::staticMetaObject;
for (int ii = metaObject->enumeratorCount() - 1; !ok && ii >= 0; --ii) {
QMetaEnum e = metaObject->enumerator(ii);
value = e.keyToValue(enumName.constData(), &ok);
@@ -655,7 +649,7 @@ int QQmlEnumTypeResolver::evaluateEnum(const QString &scope, const QStringRef &e
return type.enumValue(compiler->enginePrivate(), QHashedStringRef(enumValue.constData(), enumValue.length()), ok);
}
- const QMetaObject *mo = StaticQtMetaObject::get();
+ const QMetaObject *mo = &Qt::staticMetaObject;
int i = mo->enumeratorCount();
const QByteArray ba = enumValue.toUtf8();
while (i--) {
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index b164f5873c..2de158884b 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -51,6 +51,8 @@
#include <QtQml/qqmlextensioninterface.h>
#include <QtQml/qqmlfile.h>
+#include <qtqml_tracepoints_p.h>
+
#include <QtCore/qdir.h>
#include <QtCore/qdiriterator.h>
#include <QtCore/qfile.h>
@@ -436,6 +438,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QString &fileName)
void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::SourceCodeData &d)
{
+ Q_TRACE_SCOPE(QQmlCompiling, blob->url());
QQmlCompilingProfiler prof(profiler(), blob);
blob->m_inCallback = true;
@@ -455,6 +458,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::SourceCodeD
void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QV4::CompiledData::Unit *unit)
{
+ Q_TRACE_SCOPE(QQmlCompiling, blob->url());
QQmlCompilingProfiler prof(profiler(), blob);
blob->m_inCallback = true;
@@ -573,8 +577,10 @@ bool QQmlTypeLoader::Blob::addImport(QQmlTypeLoader::Blob::PendingImportPtr impo
QString qmldirFilePath;
QString qmldirUrl;
- if (m_importCache.locateQmldir(importDatabase, import->uri, import->majorVersion, import->minorVersion,
- &qmldirFilePath, &qmldirUrl)) {
+ const QQmlImports::LocalQmldirResult qmldirResult = m_importCache.locateLocalQmldir(
+ importDatabase, import->uri, import->majorVersion, import->minorVersion,
+ &qmldirFilePath, &qmldirUrl);
+ if (qmldirResult == QQmlImports::QmldirFound) {
// This is a local library import
if (!m_importCache.addLibraryImport(importDatabase, import->uri, import->qualifier, import->majorVersion,
import->minorVersion, qmldirFilePath, qmldirUrl, false, errors))
@@ -599,7 +605,9 @@ bool QQmlTypeLoader::Blob::addImport(QQmlTypeLoader::Blob::PendingImportPtr impo
} else {
// Is this a module?
if (QQmlMetaType::isAnyModule(import->uri)
- || QQmlMetaType::qmlRegisterModuleTypes(import->uri, import->majorVersion)) {
+ || (qmldirResult != QQmlImports::QmldirInterceptedToRemote
+ && QQmlMetaType::qmlRegisterModuleTypes(import->uri,
+ import->majorVersion))) {
if (!m_importCache.addLibraryImport(importDatabase, import->uri, import->qualifier, import->majorVersion,
import->minorVersion, QString(), QString(), false, errors))
return false;
@@ -710,7 +718,7 @@ bool QQmlTypeLoader::Blob::isDebugging() const
bool QQmlTypeLoader::Blob::diskCacheEnabled() const
{
- return (!disableDiskCache() || forceDiskCache()) && !isDebugging();
+ return (!disableDiskCache() && !isDebugging()) || forceDiskCache();
}
bool QQmlTypeLoader::Blob::qmldirDataAvailable(const QQmlRefPointer<QQmlQmldirData> &data, QList<QQmlError> *errors)
@@ -1129,7 +1137,8 @@ void QQmlTypeLoader::setQmldirContent(const QString &url, const QString &content
m_importQmlDirCache.insert(url, qmldir);
}
- qmldir->setContent(url, content);
+ if (!qmldir->hasContent())
+ qmldir->setContent(url, content);
}
/*!
diff --git a/src/qml/qml/qqmltypeloaderqmldircontent.cpp b/src/qml/qml/qqmltypeloaderqmldircontent.cpp
index 8e983db756..860971d296 100644
--- a/src/qml/qml/qqmltypeloaderqmldircontent.cpp
+++ b/src/qml/qml/qqmltypeloaderqmldircontent.cpp
@@ -74,6 +74,7 @@ QString QQmlTypeLoaderQmldirContent::typeNamespace() const
void QQmlTypeLoaderQmldirContent::setContent(const QString &location, const QString &content)
{
+ Q_ASSERT(!m_hasContent);
m_hasContent = true;
m_location = location;
m_parser.parse(content);
diff --git a/src/qml/qml/qqmltypemodule.cpp b/src/qml/qml/qqmltypemodule.cpp
index 9c9bf3e48f..9d6f269030 100644
--- a/src/qml/qml/qqmltypemodule.cpp
+++ b/src/qml/qml/qqmltypemodule.cpp
@@ -97,10 +97,14 @@ void QQmlTypeModule::add(QQmlTypePrivate *type)
QList<QQmlTypePrivate *> &list = d->typeHash[type->elementName];
for (int ii = 0; ii < list.count(); ++ii) {
- Q_ASSERT(list.at(ii));
- if (list.at(ii)->version_min < type->version_min) {
+ QQmlTypePrivate *in_list = list.at(ii);
+ Q_ASSERT(in_list);
+ if (in_list->version_min < type->version_min) {
list.insert(ii, type);
return;
+ } else if (in_list->version_min == type->version_min) {
+ list[ii] = type;
+ return;
}
}
list.append(type);
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 9b5490b6e5..42a90e234c 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -62,30 +62,78 @@
QT_BEGIN_NAMESPACE
+class ResolvedList
+{
+ Q_DISABLE_COPY_MOVE(ResolvedList)
+
+public:
+ ResolvedList(QQmlListProperty<QObject> *prop) :
+ m_metaObject(static_cast<QQmlVMEMetaObject *>(QObjectPrivate::get(prop->object)->metaObject)),
+ m_id(quintptr(prop->data))
+ {
+ Q_ASSERT(m_metaObject);
+ Q_ASSERT(m_metaObject->object == prop->object);
+ Q_ASSERT(m_id <= quintptr(std::numeric_limits<int>::max() - m_metaObject->methodOffset()));
+
+ // readPropertyAsList() with checks transformed into Q_ASSERT
+ // and without allocation.
+ if (m_metaObject->propertyAndMethodStorage.isUndefined() &&
+ m_metaObject->propertyAndMethodStorage.valueRef()) {
+ return;
+ }
+
+ if (auto *md = static_cast<QV4::MemberData *>(
+ m_metaObject->propertyAndMethodStorage.asManaged())) {
+ const auto *v = (md->data() + m_id)->as<QV4::VariantObject>();
+ Q_ASSERT(v);
+ Q_ASSERT(v->d());
+ QVariant &data = v->d()->data();
+ Q_ASSERT(data.userType() == qMetaTypeId<QVector<QQmlGuard<QObject>>>());
+ m_list = static_cast<QVector<QQmlGuard<QObject>> *>(data.data());
+ Q_ASSERT(m_list);
+ }
+ }
+
+ ~ResolvedList() = default;
+
+ QQmlVMEMetaObject *metaObject() const { return m_metaObject; }
+ QVector<QQmlGuard<QObject>> *list() const { return m_list; }
+ quintptr id() const { return m_id; }
+
+ void activateSignal() const
+ {
+ m_metaObject->activate(m_metaObject->object, int(m_id + m_metaObject->methodOffset()),
+ nullptr);
+ }
+
+private:
+ QQmlVMEMetaObject *m_metaObject = nullptr;
+ QVector<QQmlGuard<QObject>> *m_list = nullptr;
+ quintptr m_id = 0;
+};
+
static void list_append(QQmlListProperty<QObject> *prop, QObject *o)
{
- QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data);
- list->append(o);
- static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), nullptr);
+ const ResolvedList resolved(prop);
+ resolved.list()->append(o);
+ resolved.activateSignal();
}
static int list_count(QQmlListProperty<QObject> *prop)
{
- QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data);
- return list->count();
+ return ResolvedList(prop).list()->count();
}
static QObject *list_at(QQmlListProperty<QObject> *prop, int index)
{
- QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data);
- return list->at(index);
+ return ResolvedList(prop).list()->at(index);
}
static void list_clear(QQmlListProperty<QObject> *prop)
{
- QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data);
- list->clear();
- static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), nullptr);
+ const ResolvedList resolved(prop);
+ resolved.list()->clear();
+ resolved.activateSignal();
}
QQmlVMEVariantQObjectPtr::QQmlVMEVariantQObjectPtr()
@@ -401,57 +449,20 @@ void QQmlVMEMetaObject::writeProperty(int id, double v)
void QQmlVMEMetaObject::writeProperty(int id, const QString& v)
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newString(v));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QUrl& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QDate& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QDateTime& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QPointF& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QSizeF& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
-}
-
-void QQmlVMEMetaObject::writeProperty(int id, const QRectF& v)
-{
- QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, engine->newVariantObject(QVariant::fromValue(v)));
+ if (md) {
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::MemberData>(scope, md)->set(engine, id, engine->newString(v));
+ }
}
void QQmlVMEMetaObject::writeProperty(int id, QObject* v)
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
- if (md)
- md->set(engine, id, QV4::Value::fromReturnedValue(QV4::QObjectWrapper::wrap(engine, v)));
+ if (md) {
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::MemberData>(scope, md)->set(engine, id, QV4::Value::fromReturnedValue(
+ QV4::QObjectWrapper::wrap(engine, v)));
+ }
QQmlVMEVariantQObjectPtr *guard = getQObjectGuardForProperty(id);
if (v && !guard) {
@@ -598,7 +609,7 @@ QObject* QQmlVMEMetaObject::readPropertyAsQObject(int id) const
return wrapper->object();
}
-QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id) const
+QVector<QQmlGuard<QObject>> *QQmlVMEMetaObject::readPropertyAsList(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -606,12 +617,12 @@ QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id) const
QV4::Scope scope(engine);
QV4::Scoped<QV4::VariantObject> v(scope, *(md->data() + id));
- if (!v || (int)v->d()->data().userType() != qMetaTypeId<QList<QObject *> >()) {
- QVariant variant(QVariant::fromValue(QList<QObject*>()));
+ if (!v || (int)v->d()->data().userType() != qMetaTypeId<QVector<QQmlGuard<QObject>> >()) {
+ QVariant variant(QVariant::fromValue(QVector<QQmlGuard<QObject>>()));
v = engine->newVariantObject(variant);
md->set(engine, id, v);
}
- return static_cast<QList<QObject *> *>(v->d()->data().data());
+ return static_cast<QVector<QQmlGuard<QObject>> *>(v->d()->data().data());
}
QRectF QQmlVMEMetaObject::readPropertyAsRectF(int id) const
@@ -720,13 +731,11 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void *
break;
case QV4::CompiledData::BuiltinType::InvalidBuiltin:
if (property.isList) {
- QList<QObject *> *list = readPropertyAsList(id);
- QQmlListProperty<QObject> *p = static_cast<QQmlListProperty<QObject> *>(a[0]);
- *p = QQmlListProperty<QObject>(object, list,
- list_append, list_count, list_at,
- list_clear);
- p->dummy1 = this;
- p->dummy2 = reinterpret_cast<void *>(quintptr(methodOffset() + id));
+ readPropertyAsList(id); // Initializes if necessary
+ *static_cast<QQmlListProperty<QObject> *>(a[0])
+ = QQmlListProperty<QObject>(
+ object, reinterpret_cast<void *>(quintptr(id)),
+ list_append, list_count, list_at, list_clear);
} else {
*reinterpret_cast<QObject **>(a[0]) = readPropertyAsQObject(id);
}
@@ -877,7 +886,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void *
int rv = QMetaObject::metacall(valueType, c, valueTypePropertyIndex, a);
if (c == QMetaObject::WriteProperty)
- valueType->write(target, coreIndex, nullptr);
+ valueType->write(target, coreIndex, {});
return rv;
} else {
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index 5025987586..e17701a968 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -188,18 +188,24 @@ public:
QDateTime readPropertyAsDateTime(int id);
QRectF readPropertyAsRectF(int id) const;
QObject *readPropertyAsQObject(int id) const;
- QList<QObject *> *readPropertyAsList(int id) const;
+ QVector<QQmlGuard<QObject> > *readPropertyAsList(int id) const;
void writeProperty(int id, int v);
void writeProperty(int id, bool v);
void writeProperty(int id, double v);
void writeProperty(int id, const QString& v);
- void writeProperty(int id, const QPointF& v);
- void writeProperty(int id, const QSizeF& v);
- void writeProperty(int id, const QUrl& v);
- void writeProperty(int id, const QDate& v);
- void writeProperty(int id, const QDateTime& v);
- void writeProperty(int id, const QRectF& v);
+
+ template<typename VariantCompatible>
+ void writeProperty(int id, const VariantCompatible &v)
+ {
+ QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
+ if (md) {
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::MemberData>(scope, md)->set(engine, id, engine->newVariantObject(
+ QVariant::fromValue(v)));
+ }
+ }
+
void writeProperty(int id, QObject *v);
void ensureQObjectWrapper();
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 4db0562c0e..2afbdb616b 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -54,6 +54,7 @@
#include <QtCore/qobject.h>
#include <QtQml/qjsvalue.h>
#include <QtQml/qjsengine.h>
+#include <QtQml/qqmlfile.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtCore/qtextcodec.h>
#include <QtCore/qxmlstream.h>
@@ -77,6 +78,8 @@ using namespace QV4;
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(xhrDump, QML_XHR_DUMP);
+DEFINE_BOOL_CONFIG_OPTION(xhrFileWrite, QML_XHR_ALLOW_FILE_WRITE);
+DEFINE_BOOL_CONFIG_OPTION(xhrFileRead, QML_XHR_ALLOW_FILE_READ);
struct QQmlXMLHttpRequestData {
QQmlXMLHttpRequestData();
@@ -1195,6 +1198,37 @@ void QQmlXMLHttpRequest::fillHeadersList()
void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url)
{
QNetworkRequest request = m_request;
+
+ if (QQmlFile::isLocalFile(url)) {
+ if (m_method == QLatin1String("PUT"))
+ {
+ if (!xhrFileWrite()) {
+ if (qEnvironmentVariableIsSet("QML_XHR_ALLOW_FILE_WRITE")) {
+ qWarning("XMLHttpRequest: Tried to use PUT on a local file despite being disabled.");
+ return;
+ } else {
+ qWarning("XMLHttpRequest: Using PUT on a local file is dangerous "
+ "and will be disabled by default in a future Qt version."
+ "Set QML_XHR_ALLOW_FILE_WRITE to 1 if you wish to continue using this feature.");
+ }
+ }
+ } else if (m_method == QLatin1String("GET")) {
+ if (!xhrFileRead()) {
+ if (qEnvironmentVariableIsSet("QML_XHR_ALLOW_FILE_READ")) {
+ qWarning("XMLHttpRequest: Tried to use GET on a local file despite being disabled.");
+ return;
+ } else {
+ qWarning("XMLHttpRequest: Using GET on a local file is dangerous "
+ "and will be disabled by default in a future Qt version."
+ "Set QML_XHR_ALLOW_FILE_READ to 1 if you wish to continue using this feature.");
+ }
+ }
+ } else {
+ qWarning("XMLHttpRequest: Unsupported method used on a local file");
+ return;
+ }
+ }
+
request.setUrl(url);
if(m_method == QLatin1String("POST") ||
m_method == QLatin1String("PUT")) {
@@ -1389,13 +1423,17 @@ void QQmlXMLHttpRequest::finished()
QVariant redirect = m_network->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (redirect.isValid()) {
QUrl url = m_network->url().resolved(redirect.toUrl());
- if (url.scheme() != QLatin1String("file")) {
+ if (!QQmlFile::isLocalFile(url)) {
// See http://www.ietf.org/rfc/rfc2616.txt, section 10.3.4 "303 See Other":
// Result of 303 redirection should be a new "GET" request.
const QVariant code = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute);
if (code.isValid() && code.toInt() == 303 && m_method != QLatin1String("GET"))
m_method = QStringLiteral("GET");
destroyNetwork();
+
+ // Discard redirect response body
+ m_responseEntityBody = QByteArray();
+
requestFromUrl(url);
return;
}
@@ -1647,7 +1685,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Scope scope(f->engine());
const QQmlXMLHttpRequestCtor *ctor = static_cast<const QQmlXMLHttpRequestCtor *>(f);
- QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(scope.engine->qmlEngine()->networkAccessManager(), scope.engine);
+ QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(scope.engine->networkAccessManager(scope.engine), scope.engine);
Scoped<QQmlXMLHttpRequestWrapper> w(scope, scope.engine->memoryManager->allocate<QQmlXMLHttpRequestWrapper>(r));
ScopedObject proto(scope, ctor->d()->proto);
w->setPrototypeUnchecked(proto);
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index d634a48443..2c1956553f 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -93,12 +93,6 @@ DEFINE_OBJECT_VTABLE(QtObject);
return scope.engine->throwTypeError(QString::fromUtf8(msg)); \
} while (false)
-struct StaticQtMetaObject : public QObject
-{
- static const QMetaObject *get()
- { return &staticQtMetaObject; }
-};
-
void Heap::QtObject::init(QQmlEngine *qmlEngine)
{
Heap::Object::init();
@@ -177,7 +171,7 @@ ReturnedValue QtObject::findAndAdd(const QString *name, bool &foundProperty) con
ScopedString key(scope);
ScopedValue value(scope);
- const QMetaObject *qtMetaObject = StaticQtMetaObject::get();
+ const QMetaObject *qtMetaObject = &Qt::staticMetaObject;
for (int enumCount = qtMetaObject->enumeratorCount(); d()->enumeratorIterator < enumCount;
++d()->enumeratorIterator) {
QMetaEnum enumerator = qtMetaObject->enumerator(d()->enumeratorIterator);
@@ -1553,11 +1547,12 @@ static QString jsStack(QV4::ExecutionEngine *engine) {
return stack;
}
-static QString serializeArray(Object *array, ExecutionEngine *v4) {
+static QString serializeArray(Object *array, ExecutionEngine *v4, QSet<QV4::Heap::Object *> &alreadySeen) {
Scope scope(v4);
ScopedValue val(scope);
QString result;
+ alreadySeen.insert(array->d());
result += QLatin1Char('[');
const uint length = array->getLength();
for (uint i = 0; i < length; ++i) {
@@ -1565,12 +1560,15 @@ static QString serializeArray(Object *array, ExecutionEngine *v4) {
result += QLatin1Char(',');
val = array->get(i);
if (val->isManaged() && val->managed()->isArrayLike())
- result += serializeArray(val->objectValue(), v4);
+ if (!alreadySeen.contains(val->objectValue()->d()))
+ result += serializeArray(val->objectValue(), v4, alreadySeen);
+ else
+ result += QLatin1String("[Circular]");
else
result += val->toQStringNoThrow();
}
result += QLatin1Char(']');
-
+ alreadySeen.remove(array->d());
return result;
};
@@ -1600,8 +1598,9 @@ static ReturnedValue writeToConsole(const FunctionObject *b, const Value *, cons
if (i != start)
result.append(QLatin1Char(' '));
+ QSet<QV4::Heap::Object *> alreadySeenElements;
if (argv[i].isManaged() && argv[i].managed()->isArrayLike())
- result.append(serializeArray(argv[i].objectValue(), v4));
+ result.append(serializeArray(argv[i].objectValue(), v4, alreadySeenElements));
else
result.append(argv[i].toQStringNoThrow());
}
diff --git a/src/qml/qmldirparser/qqmldirparser.cpp b/src/qml/qmldirparser/qqmldirparser.cpp
index 6e925ba515..36b47a3302 100644
--- a/src/qml/qmldirparser/qqmldirparser.cpp
+++ b/src/qml/qmldirparser/qqmldirparser.cpp
@@ -73,6 +73,20 @@ static bool parseVersion(const QString &str, int *major, int *minor)
return false;
}
+void QQmlDirParser::clear()
+{
+ _errors.clear();
+ _typeNamespace.clear();
+ _components.clear();
+ _dependencies.clear();
+ _imports.clear();
+ _scripts.clear();
+ _plugins.clear();
+ _designerSupported = false;
+ _typeInfos.clear();
+ _className.clear();
+}
+
inline static void scanSpace(const QChar *&ch) {
while (ch->isSpace() && !ch->isNull() && *ch != QLatin1Char('\n'))
++ch;
@@ -93,13 +107,6 @@ inline static void scanWord(const QChar *&ch) {
*/
bool QQmlDirParser::parse(const QString &source)
{
- _errors.clear();
- _plugins.clear();
- _components.clear();
- _scripts.clear();
- _designerSupported = false;
- _className.clear();
-
quint16 lineNumber = 0;
bool firstLine = true;
@@ -198,7 +205,7 @@ bool QQmlDirParser::parse(const QString &source)
}
Component entry(sections[1], sections[2], -1, -1);
entry.internal = true;
- _components.insertMulti(entry.typeName, entry);
+ _components.insert(entry.typeName, entry);
} else if (sections[0] == QLatin1String("singleton")) {
if (sectionCount < 3 || sectionCount > 4) {
reportError(lineNumber, 0,
@@ -209,7 +216,7 @@ bool QQmlDirParser::parse(const QString &source)
// singleton TestSingletonType TestSingletonType.qml
Component entry(sections[1], sections[2], -1, -1);
entry.singleton = true;
- _components.insertMulti(entry.typeName, entry);
+ _components.insert(entry.typeName, entry);
} else {
// handle qmldir module listing case where singleton is defined in the following pattern:
// singleton TestSingletonType 2.0 TestSingletonType20.qml
@@ -218,7 +225,7 @@ bool QQmlDirParser::parse(const QString &source)
const QString &fileName = sections[3];
Component entry(sections[1], fileName, major, minor);
entry.singleton = true;
- _components.insertMulti(entry.typeName, entry);
+ _components.insert(entry.typeName, entry);
} else {
reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[2]));
}
@@ -264,7 +271,7 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sectionCount == 2) {
// No version specified (should only be used for relative qmldir files)
const Component entry(sections[0], sections[1], -1, -1);
- _components.insertMulti(entry.typeName, entry);
+ _components.insert(entry.typeName, entry);
} else if (sectionCount == 3) {
int major, minor;
if (parseVersion(sections[1], &major, &minor)) {
@@ -276,7 +283,7 @@ bool QQmlDirParser::parse(const QString &source)
_scripts.append(entry);
} else {
const Component entry(sections[0], fileName, major, minor);
- _components.insertMulti(entry.typeName, entry);
+ _components.insert(entry.typeName, entry);
}
} else {
reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[1]));
@@ -343,7 +350,7 @@ QList<QQmlDirParser::Plugin> QQmlDirParser::plugins() const
return _plugins;
}
-QHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const
+QMultiHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const
{
return _components;
}
diff --git a/src/qml/qmldirparser/qqmldirparser_p.h b/src/qml/qmldirparser/qqmldirparser_p.h
index c9d77532c8..3696a1aa12 100644
--- a/src/qml/qmldirparser/qqmldirparser_p.h
+++ b/src/qml/qmldirparser/qqmldirparser_p.h
@@ -64,6 +64,7 @@ class QQmlEngine;
class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlDirParser
{
public:
+ void clear();
bool parse(const QString &source);
bool hasError() const;
@@ -75,7 +76,7 @@ public:
static void checkNonRelative(const char *item, const QString &typeName, const QString &fileName)
{
- if (fileName.startsWith(QLatin1Char('/')) || fileName.contains(QLatin1Char(':'))) {
+ if (fileName.startsWith(QLatin1Char('/'))) {
qWarning() << item << typeName
<< "is specified with non-relative URL" << fileName << "in a qmldir file."
<< "URLs in qmldir files should be relative to the qmldir file's directory.";
@@ -131,7 +132,7 @@ public:
int minorVersion = 0;
};
- QHash<QString,Component> components() const;
+ QMultiHash<QString,Component> components() const;
QHash<QString,Component> dependencies() const;
QStringList imports() const;
QList<Script> scripts() const;
@@ -158,7 +159,7 @@ private:
private:
QList<QQmlJS::DiagnosticMessage> _errors;
QString _typeNamespace;
- QHash<QString,Component> _components; // multi hash
+ QMultiHash<QString,Component> _components;
QHash<QString,Component> _dependencies;
QStringList _imports;
QList<Script> _scripts;
@@ -168,7 +169,7 @@ private:
QString _className;
};
-using QQmlDirComponents = QHash<QString,QQmlDirParser::Component>;
+using QQmlDirComponents = QMultiHash<QString,QQmlDirParser::Component>;
using QQmlDirScripts = QList<QQmlDirParser::Script>;
using QQmlDirPlugins = QList<QQmlDirParser::Plugin>;
diff --git a/src/qml/qtqml.tracepoints b/src/qml/qtqml.tracepoints
index 841748f201..1043d3bae3 100644
--- a/src/qml/qtqml.tracepoints
+++ b/src/qml/qtqml.tracepoints
@@ -6,9 +6,16 @@ class CompilationUnit;
class Object;
} // CompiledData
} // QV4
+class QQmlEngine;
}
QQmlObjectCreator_createInstance_entry(const QV4::CompiledData::CompilationUnit *compilationUnit, const QV4::CompiledData::Object *object, const QUrl &url)
QQmlObjectCreator_createInstance_exit(const QString &typeName)
+QQmlCompiling_entry(const QUrl &url)
+QQmlCompiling_exit()
QQmlV4_function_call_entry(const QV4::ExecutionEngine *engine, const QString &function, const QString &fileName, int line, int column)
QQmlV4_function_call_exit()
+QQmlBinding_entry(const QQmlEngine *engine, const QString &function, const QString &fileName, int line, int column)
+QQmlBinding_exit()
+QQmlHandlingSignal_entry(const QQmlEngine *engine, const QString &function, const QString &fileName, int line, int column)
+QQmlHandlingSignal_exit()
diff --git a/src/qml/doc/images/listmodel-nested.png b/src/qmlmodels/doc/images/listmodel-nested.png
index ee7ffba67a..ee7ffba67a 100644
--- a/src/qml/doc/images/listmodel-nested.png
+++ b/src/qmlmodels/doc/images/listmodel-nested.png
Binary files differ
diff --git a/src/qml/doc/images/listmodel.png b/src/qmlmodels/doc/images/listmodel.png
index 7ab1771f15..7ab1771f15 100644
--- a/src/qml/doc/images/listmodel.png
+++ b/src/qmlmodels/doc/images/listmodel.png
Binary files differ
diff --git a/src/qml/doc/images/objectmodel.png b/src/qmlmodels/doc/images/objectmodel.png
index 5e6d1325b2..5e6d1325b2 100644
--- a/src/qml/doc/images/objectmodel.png
+++ b/src/qmlmodels/doc/images/objectmodel.png
Binary files differ
diff --git a/src/qmlmodels/doc/qtqmlmodels.qdocconf b/src/qmlmodels/doc/qtqmlmodels.qdocconf
index a4153f4a53..3364988559 100644
--- a/src/qmlmodels/doc/qtqmlmodels.qdocconf
+++ b/src/qmlmodels/doc/qtqmlmodels.qdocconf
@@ -23,15 +23,18 @@ qhp.QtQmlModels.sortPages = true
tagfile = qtqmlmodels.tags
-depends += qtcore qtqml qtdoc
+depends += qtcore qtqml qtquick qtdoc qtqmlworkerscript qtquickcontrols qtxmlpatterns
-headerdirs += ..
+headerdirs += .. \
+ ../../imports/labsmodels
sourcedirs += .. \
- ../../imports/models
+ ../../imports/models \
+ ../../imports/labsmodels
-exampledirs += ../../../examples/qml \
- ../ \
+exampledirs += .. \
snippets
+imagedirs += images
+
navigation.qmltypespage = "Qt Qml Models QML Types"
diff --git a/src/qmlmodels/qmlmodels.pro b/src/qmlmodels/qmlmodels.pro
index 78bf579903..6abc5bf186 100644
--- a/src/qmlmodels/qmlmodels.pro
+++ b/src/qmlmodels/qmlmodels.pro
@@ -12,8 +12,7 @@ HEADERS += \
$$PWD/qtqmlmodelsglobal.h
SOURCES += \
- $$PWD/qqmlchangeset.cpp \
- $$PWD/qqmlmodelsmodule.cpp
+ $$PWD/qqmlchangeset.cpp
qtConfig(qml-object-model) {
SOURCES += \
@@ -64,4 +63,10 @@ qtConfig(qml-delegate-model) {
$$PWD/qquickpackage_p.h
}
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml/Models.2
+QML_IMPORT_NAME = QtQml.Models
+IMPORT_VERSION = 2.15
+CONFIG += qmltypes install_qmltypes install_metatypes
+
load(qt_module)
diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp
index 012540244f..cf0d8fbb2f 100644
--- a/src/qmlmodels/qqmladaptormodel.cpp
+++ b/src/qmlmodels/qqmladaptormodel.cpp
@@ -199,12 +199,11 @@ public:
RETURN_RESULT(scope.engine->throwTypeError(QStringLiteral("Not a valid DelegateModel object")));
const QQmlAdaptorModel *const model = static_cast<QQmlDMCachedModelData *>(o->d()->item)->type->model;
- if (o->d()->item->index >= 0 && *model) {
- const QAbstractItemModel * const aim = model->aim();
- RETURN_RESULT(QV4::Encode(aim->hasChildren(aim->index(o->d()->item->index, 0, model->rootIndex))));
- } else {
- RETURN_RESULT(QV4::Encode(false));
+ if (o->d()->item->index >= 0) {
+ if (const QAbstractItemModel *const aim = model->aim())
+ RETURN_RESULT(QV4::Encode(aim->hasChildren(aim->index(o->d()->item->index, 0, model->rootIndex))));
}
+ RETURN_RESULT(QV4::Encode(false));
}
@@ -400,23 +399,24 @@ public:
bool hasModelChildren() const
{
- if (index >= 0 && *type->model) {
- const QAbstractItemModel * const model = type->model->aim();
- return model->hasChildren(model->index(row, column, type->model->rootIndex));
- } else {
- return false;
+ if (index >= 0) {
+ if (const QAbstractItemModel *const model = type->model->aim())
+ return model->hasChildren(model->index(row, column, type->model->rootIndex));
}
+ return false;
}
QVariant value(int role) const override
{
- return type->model->aim()->index(row, column, type->model->rootIndex).data(role);
+ if (const QAbstractItemModel *aim = type->model->aim())
+ return aim->index(row, column, type->model->rootIndex).data(role);
+ return QVariant();
}
void setValue(int role, const QVariant &value) override
{
- type->model->aim()->setData(
- type->model->aim()->index(row, column, type->model->rootIndex), value, role);
+ if (QAbstractItemModel *aim = type->model->aim())
+ aim->setData(aim->index(row, column, type->model->rootIndex), value, role);
}
QV4::ReturnedValue get() override
@@ -444,12 +444,16 @@ public:
int rowCount(const QQmlAdaptorModel &model) const override
{
- return model.aim()->rowCount(model.rootIndex);
+ if (const QAbstractItemModel *aim = model.aim())
+ return aim->rowCount(model.rootIndex);
+ return 0;
}
int columnCount(const QQmlAdaptorModel &model) const override
{
- return model.aim()->columnCount(model.rootIndex);
+ if (const QAbstractItemModel *aim = model.aim())
+ return aim->columnCount(model.rootIndex);
+ return 0;
}
void cleanup(QQmlAdaptorModel &) const override
@@ -464,39 +468,46 @@ public:
dataType->initializeMetaType(model);
}
- QHash<QByteArray, int>::const_iterator it = roleNames.find(role.toUtf8());
- if (it != roleNames.end()) {
- return model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex).data(*it);
- } else if (role == QLatin1String("hasModelChildren")) {
- return QVariant(model.aim()->hasChildren(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)));
- } else {
- return QVariant();
+ if (const QAbstractItemModel *aim = model.aim()) {
+ QHash<QByteArray, int>::const_iterator it = roleNames.find(role.toUtf8());
+ if (it != roleNames.end()) {
+ return aim->index(model.rowAt(index), model.columnAt(index),
+ model.rootIndex).data(*it);
+ } else if (role == QLatin1String("hasModelChildren")) {
+ return QVariant(aim->hasChildren(aim->index(model.rowAt(index),
+ model.columnAt(index),
+ model.rootIndex)));
+ }
}
+ return QVariant();
}
QVariant parentModelIndex(const QQmlAdaptorModel &model) const override
{
- return model
- ? QVariant::fromValue(model.aim()->parent(model.rootIndex))
- : QVariant();
+ if (const QAbstractItemModel *aim = model.aim())
+ return QVariant::fromValue(aim->parent(model.rootIndex));
+ return QVariant();
}
QVariant modelIndex(const QQmlAdaptorModel &model, int index) const override
{
- return model
- ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex))
- : QVariant();
+ if (const QAbstractItemModel *aim = model.aim())
+ return QVariant::fromValue(aim->index(model.rowAt(index), model.columnAt(index),
+ model.rootIndex));
+ return QVariant();
}
bool canFetchMore(const QQmlAdaptorModel &model) const override
{
- return model && model.aim()->canFetchMore(model.rootIndex);
+ if (const QAbstractItemModel *aim = model.aim())
+ return aim->canFetchMore(model.rootIndex);
+ return false;
}
void fetchMore(QQmlAdaptorModel &model) const override
{
- if (model)
- model.aim()->fetchMore(model.rootIndex);
+ if (QAbstractItemModel *aim = model.aim())
+ aim->fetchMore(model.rootIndex);
}
QQmlDelegateModelItem *createItem(
@@ -516,7 +527,8 @@ public:
setModelDataType<QQmlDMAbstractItemModelData>(&builder, this);
const QByteArray propertyType = QByteArrayLiteral("QVariant");
- const QHash<int, QByteArray> names = model.aim()->roleNames();
+ const QAbstractItemModel *aim = model.aim();
+ const QHash<int, QByteArray> names = aim ? aim->roleNames() : QHash<int, QByteArray>();
for (QHash<int, QByteArray>::const_iterator it = names.begin(), cend = names.end(); it != cend; ++it) {
const int propertyId = propertyRoles.count();
propertyRoles.append(it.key());
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index e3c01d040a..7ad53eeb6c 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcItemViewDelegateRecycling, "qt.quick.itemview.delegaterecycling")
+
class QQmlDelegateModelItem;
namespace QV4 {
@@ -205,6 +207,9 @@ QQmlDelegateModelPrivate::~QQmlDelegateModelPrivate()
{
qDeleteAll(m_finishedIncubating);
+ // Free up all items in the pool
+ drainReusableItemsPool(0);
+
if (m_cacheMetaType)
m_cacheMetaType->release();
}
@@ -588,36 +593,47 @@ int QQmlDelegateModel::count() const
return d->m_compositor.count(d->m_compositorGroup);
}
-QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *object)
+QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *object, QQmlInstanceModel::ReusableFlag reusableFlag)
{
if (!object)
- return QQmlDelegateModel::ReleaseFlags(0);
+ return QQmlDelegateModel::ReleaseFlags{};
QQmlDelegateModelItem *cacheItem = QQmlDelegateModelItem::dataForObject(object);
if (!cacheItem)
- return QQmlDelegateModel::ReleaseFlags(0);
+ return QQmlDelegateModel::ReleaseFlags{};
if (!cacheItem->releaseObject())
return QQmlDelegateModel::Referenced;
+ if (reusableFlag == QQmlInstanceModel::Reusable) {
+ removeCacheItem(cacheItem);
+ m_reusableItemsPool.insertItem(cacheItem);
+ emit q_func()->itemPooled(cacheItem->index, cacheItem->object);
+ return QQmlInstanceModel::Pooled;
+ }
+
+ destroyCacheItem(cacheItem);
+ return QQmlInstanceModel::Destroyed;
+}
+
+void QQmlDelegateModelPrivate::destroyCacheItem(QQmlDelegateModelItem *cacheItem)
+{
+ emitDestroyingItem(cacheItem->object);
cacheItem->destroyObject();
- emitDestroyingItem(object);
if (cacheItem->incubationTask) {
releaseIncubator(cacheItem->incubationTask);
cacheItem->incubationTask = nullptr;
}
cacheItem->Dispose();
- return QQmlInstanceModel::Destroyed;
}
/*
Returns ReleaseStatus flags.
*/
-
-QQmlDelegateModel::ReleaseFlags QQmlDelegateModel::release(QObject *item)
+QQmlDelegateModel::ReleaseFlags QQmlDelegateModel::release(QObject *item, QQmlInstanceModel::ReusableFlag reusableFlag)
{
Q_D(QQmlDelegateModel);
- QQmlInstanceModel::ReleaseFlags stat = d->release(item);
+ QQmlInstanceModel::ReleaseFlags stat = d->release(item, reusableFlag);
return stat;
}
@@ -937,13 +953,14 @@ void PropertyUpdater::breakBinding()
void QQDMIncubationTask::initializeRequiredProperties(QQmlDelegateModelItem *modelItemToIncubate, QObject *object)
{
auto incubatorPriv = QQmlIncubatorPrivate::get(this);
- QQmlData *d = QQmlData::get(object);
- auto contextData = d ? d->context : nullptr;
- if (contextData) {
- contextData->hasExtraObject = true;
- contextData->extraObject = modelItemToIncubate;
- }
if (incubatorPriv->hadRequiredProperties()) {
+ QQmlData *d = QQmlData::get(object);
+ auto contextData = d ? d->context : nullptr;
+ if (contextData) {
+ contextData->hasExtraObject = true;
+ contextData->extraObject = modelItemToIncubate;
+ }
+
if (incubatorPriv->requiredProperties().empty())
return;
RequiredProperties &requiredProperties = incubatorPriv->requiredProperties();
@@ -954,21 +971,25 @@ void QQDMIncubationTask::initializeRequiredProperties(QQmlDelegateModelItem *mod
// column, model and more
// the most derived subclass of QQmlDelegateModelItem is QQmlDMAbstractModelData at depth 2,
// so 4 should be plenty
- QVarLengthArray<const QMetaObject *, 4> mos;
+ QVarLengthArray<QPair<const QMetaObject *, QObject *>, 4> mos;
// we first check the dynamic meta object for properties originating from the model
- mos.push_back(qmlMetaObject); // contains abstractitemmodelproperties
+ // contains abstractitemmodelproperties
+ mos.push_back(qMakePair(qmlMetaObject, modelItemToIncubate));
auto delegateModelItemSubclassMO = qmlMetaObject->superClass();
- mos.push_back(delegateModelItemSubclassMO);
+ mos.push_back(qMakePair(delegateModelItemSubclassMO, modelItemToIncubate));
- while (strcmp(delegateModelItemSubclassMO->className(), modelItemToIncubate->staticMetaObject.className())) {
+ while (strcmp(delegateModelItemSubclassMO->className(),
+ modelItemToIncubate->staticMetaObject.className())) {
delegateModelItemSubclassMO = delegateModelItemSubclassMO->superClass();
- mos.push_back(delegateModelItemSubclassMO);
+ mos.push_back(qMakePair(delegateModelItemSubclassMO, modelItemToIncubate));
}
if (proxiedObject)
- mos.push_back(proxiedObject->metaObject());
+ mos.push_back(qMakePair(proxiedObject->metaObject(), proxiedObject));
auto updater = new PropertyUpdater(object);
- for (const QMetaObject *mo : mos) {
+ for (const auto &metaObjectAndObject : mos) {
+ const QMetaObject *mo = metaObjectAndObject.first;
+ QObject *itemOrProxy = metaObjectAndObject.second;
for (int i = mo->propertyOffset(); i < mo->propertyCount() + mo->propertyOffset(); ++i) {
auto prop = mo->property(i);
if (!prop.name())
@@ -980,19 +1001,23 @@ void QQDMIncubationTask::initializeRequiredProperties(QQmlDelegateModelItem *mod
// only write to property if it was actually requested by the component
if (wasInRequired && prop.hasNotifySignal()) {
QMetaMethod changeSignal = prop.notifySignal();
- static QMetaMethod updateSlot = PropertyUpdater::staticMetaObject.method(PropertyUpdater::staticMetaObject.indexOfSlot("doUpdate()"));
- QMetaObject::Connection conn = QObject::connect(modelItemToIncubate, changeSignal, updater, updateSlot);
+ static QMetaMethod updateSlot = PropertyUpdater::staticMetaObject.method(
+ PropertyUpdater::staticMetaObject.indexOfSlot("doUpdate()"));
+ QMetaObject::Connection conn = QObject::connect(itemOrProxy, changeSignal,
+ updater, updateSlot);
auto propIdx = object->metaObject()->indexOfProperty(propName.toUtf8());
- QMetaMethod writeToPropSignal = object->metaObject()->property(propIdx).notifySignal();
+ QMetaMethod writeToPropSignal
+ = object->metaObject()->property(propIdx).notifySignal();
updater->senderToConnection[writeToPropSignal.methodIndex()] = conn;
- static QMetaMethod breakBinding = PropertyUpdater::staticMetaObject.method(PropertyUpdater::staticMetaObject.indexOfSlot("breakBinding()"));
- componentProp.write(prop.read(modelItemToIncubate));
+ static QMetaMethod breakBinding = PropertyUpdater::staticMetaObject.method(
+ PropertyUpdater::staticMetaObject.indexOfSlot("breakBinding()"));
+ componentProp.write(prop.read(itemOrProxy));
// the connection needs to established after the write,
// else the signal gets triggered by it and breakBinding will remove the connection
QObject::connect(object, writeToPropSignal, updater, breakBinding);
}
else if (wasInRequired) // we still have to write, even if there is no change signal
- componentProp.write(prop.read(modelItemToIncubate));
+ componentProp.write(prop.read(itemOrProxy));
}
}
} else {
@@ -1033,6 +1058,71 @@ void QQmlDelegateModelPrivate::releaseIncubator(QQDMIncubationTask *incubationTa
}
}
+void QQmlDelegateModelPrivate::reuseItem(QQmlDelegateModelItem *item, int newModelIndex, int newGroups)
+{
+ Q_ASSERT(item->object);
+
+ // Update/reset which groups the item belongs to
+ item->groups = newGroups;
+
+ // Update context property index (including row and column) on the delegate
+ // item, and inform the application about it. For a list, the row is the same
+ // as the index, and the column is always 0. We set alwaysEmit to true, to
+ // force all bindings to be reevaluated, even if the index didn't change.
+ const bool alwaysEmit = true;
+ item->setModelIndex(newModelIndex, newModelIndex, 0, alwaysEmit);
+
+ // Notify the application that all 'dynamic'/role-based context data has
+ // changed as well (their getter function will use the updated index).
+ auto const itemAsList = QList<QQmlDelegateModelItem *>() << item;
+ auto const updateAllRoles = QVector<int>();
+ m_adaptorModel.notify(itemAsList, newModelIndex, 1, updateAllRoles);
+
+ if (QQmlDelegateModelAttached *att = static_cast<QQmlDelegateModelAttached *>(
+ qmlAttachedPropertiesObject<QQmlDelegateModel>(item->object, false))) {
+ // Update currentIndex of the attached DelegateModel object
+ // to the index the item has in the cache.
+ att->resetCurrentIndex();
+ // emitChanges will emit both group-, and index changes to the application
+ att->emitChanges();
+ }
+
+ // Inform the view that the item is recycled. This will typically result
+ // in the view updating its own attached delegate item properties.
+ emit q_func()->itemReused(newModelIndex, item->object);
+}
+
+void QQmlDelegateModelPrivate::drainReusableItemsPool(int maxPoolTime)
+{
+ m_reusableItemsPool.drain(maxPoolTime, [=](QQmlDelegateModelItem *cacheItem){ destroyCacheItem(cacheItem); });
+}
+
+void QQmlDelegateModel::drainReusableItemsPool(int maxPoolTime)
+{
+ d_func()->drainReusableItemsPool(maxPoolTime);
+}
+
+int QQmlDelegateModel::poolSize()
+{
+ return d_func()->m_reusableItemsPool.size();
+}
+
+QQmlComponent *QQmlDelegateModelPrivate::resolveDelegate(int index)
+{
+ if (!m_delegateChooser)
+ return m_delegate;
+
+ QQmlComponent *delegate = nullptr;
+ QQmlAbstractDelegateComponent *chooser = m_delegateChooser;
+
+ do {
+ delegate = chooser->delegate(&m_adaptorModel, index);
+ chooser = qobject_cast<QQmlAbstractDelegateComponent *>(delegate);
+ } while (chooser);
+
+ return delegate;
+}
+
void QQmlDelegateModelPrivate::addCacheItem(QQmlDelegateModelItem *item, Compositor::iterator it)
{
m_cache.insert(it.cacheIndex, item);
@@ -1124,13 +1214,33 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ
QQmlDelegateModelItem *cacheItem = it->inCache() ? m_cache.at(it.cacheIndex) : 0;
- if (!cacheItem) {
- cacheItem = m_adaptorModel.createItem(m_cacheMetaType, it.modelIndex());
- if (!cacheItem)
+ if (!cacheItem || !cacheItem->delegate) {
+ QQmlComponent *delegate = resolveDelegate(it.modelIndex());
+ if (!delegate)
return nullptr;
- cacheItem->groups = it->flags;
- addCacheItem(cacheItem, it);
+ if (!cacheItem) {
+ cacheItem = m_reusableItemsPool.takeItem(delegate, index);
+ if (cacheItem) {
+ // Move the pooled item back into the cache, update
+ // all related properties, and return the object (which
+ // has already been incubated, otherwise it wouldn't be in the pool).
+ addCacheItem(cacheItem, it);
+ reuseItem(cacheItem, index, it->flags);
+ cacheItem->referenceObject();
+ return cacheItem->object;
+ }
+
+ // Since we could't find an available item in the pool, we create a new one
+ cacheItem = m_adaptorModel.createItem(m_cacheMetaType, it.modelIndex());
+ if (!cacheItem)
+ return nullptr;
+
+ cacheItem->groups = it->flags;
+ addCacheItem(cacheItem, it);
+ }
+
+ cacheItem->delegate = delegate;
}
// Bump the reference counts temporarily so neither the content data or the delegate object
@@ -1145,18 +1255,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ
cacheItem->incubationTask->forceCompletion();
}
} else if (!cacheItem->object) {
- QQmlComponent *delegate = m_delegate;
- if (m_delegateChooser) {
- QQmlAbstractDelegateComponent *chooser = m_delegateChooser;
- do {
- delegate = chooser->delegate(&m_adaptorModel, index);
- chooser = qobject_cast<QQmlAbstractDelegateComponent *>(delegate);
- } while (chooser);
- if (!delegate)
- return nullptr;
- }
-
- QQmlContext *creationContext = delegate->creationContext();
+ QQmlContext *creationContext = cacheItem->delegate->creationContext();
cacheItem->scriptRef += 1;
@@ -1185,10 +1284,10 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ
}
}
- QQmlComponentPrivate *cp = QQmlComponentPrivate::get(delegate);
+ QQmlComponentPrivate *cp = QQmlComponentPrivate::get(cacheItem->delegate);
cp->incubateObject(
cacheItem->incubationTask,
- delegate,
+ cacheItem->delegate,
m_context->engine(),
ctxt,
QQmlContextData::get(m_context));
@@ -2234,7 +2333,7 @@ void QQmlDelegateModelItem::Dispose()
delete this;
}
-void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn)
+void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn, bool alwaysEmit)
{
const int prevIndex = index;
const int prevRow = row;
@@ -2244,11 +2343,11 @@ void QQmlDelegateModelItem::setModelIndex(int idx, int newRow, int newColumn)
row = newRow;
column = newColumn;
- if (idx != prevIndex)
+ if (idx != prevIndex || alwaysEmit)
emit modelIndexChanged();
- if (row != prevRow)
+ if (row != prevRow || alwaysEmit)
emit rowChanged();
- if (column != prevColumn)
+ if (column != prevColumn || alwaysEmit)
emit columnChanged();
}
@@ -3437,7 +3536,7 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat
QObject *part = package->part(m_part);
if (!part)
return nullptr;
- m_packaged.insertMulti(part, package);
+ m_packaged.insert(part, package);
return part;
}
@@ -3451,11 +3550,11 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat
return nullptr;
}
-QQmlInstanceModel::ReleaseFlags QQmlPartsModel::release(QObject *item)
+QQmlInstanceModel::ReleaseFlags QQmlPartsModel::release(QObject *item, ReusableFlag)
{
- QQmlInstanceModel::ReleaseFlags flags = nullptr;
+ QQmlInstanceModel::ReleaseFlags flags;
- QHash<QObject *, QQuickPackage *>::iterator it = m_packaged.find(item);
+ auto it = m_packaged.find(item);
if (it != m_packaged.end()) {
QQuickPackage *package = *it;
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(m_model);
@@ -3496,7 +3595,7 @@ QQmlIncubator::Status QQmlPartsModel::incubationStatus(int index)
int QQmlPartsModel::indexOf(QObject *item, QObject *) const
{
- QHash<QObject *, QQuickPackage *>::const_iterator it = m_packaged.find(item);
+ auto it = m_packaged.find(item);
if (it != m_packaged.end()) {
if (QQmlDelegateModelItem *cacheItem = QQmlDelegateModelItem::dataForObject(*it))
return cacheItem->groupIndex(m_compositorGroup);
@@ -3544,6 +3643,121 @@ void QQmlPartsModel::emitModelUpdated(const QQmlChangeSet &changeSet, bool reset
}
}
+void QQmlReusableDelegateModelItemsPool::insertItem(QQmlDelegateModelItem *modelItem)
+{
+ // Currently, the only way for a view to reuse items is to call release()
+ // in the model class with the second argument explicitly set to
+ // QQmlReuseableDelegateModelItemsPool::Reusable. If the released item is
+ // no longer referenced, it will be added to the pool. Reusing of items can
+ // be specified per item, in case certain items cannot be recycled. A
+ // QQmlDelegateModelItem knows which delegate its object was created from.
+ // So when we are about to create a new item, we first check if the pool
+ // contains an item based on the same delegate from before. If so, we take
+ // it out of the pool (instead of creating a new item), and update all its
+ // context properties and attached properties.
+
+ // When a view is recycling items, it should call drain() regularly. As
+ // there is currently no logic to 'hibernate' items in the pool, they are
+ // only meant to rest there for a short while, ideally only from the time
+ // e.g a row is unloaded on one side of the view, and until a new row is
+ // loaded on the opposite side. Between these times, the application will
+ // see the item as fully functional and 'alive' (just not visible on
+ // screen). Since this time is supposed to be short, we don't take any
+ // action to notify the application about it, since we don't want to
+ // trigger any bindings that can disturb performance.
+
+ // A recommended time for calling drain() is each time a view has finished
+ // loading e.g a new row or column. If there are more items in the pool
+ // after that, it means that the view most likely doesn't need them anytime
+ // soon. Those items should be destroyed to reduce resource consumption.
+
+ // Depending on if a view is a list or a table, it can sometimes be
+ // performant to keep items in the pool for a bit longer than one "row
+ // out/row in" cycle. E.g for a table, if the number of visible rows in a
+ // view is much larger than the number of visible columns. In that case, if
+ // you flick out a row, and then flick in a column, you would throw away a
+ // lot of items in the pool if completely draining it. The reason is that
+ // unloading a row places more items in the pool than what ends up being
+ // recycled when loading a new column. And then, when you next flick in a
+ // new row, you would need to load all those drained items again from
+ // scratch. For that reason, you can specify a maxPoolTime to the
+ // drainReusableItemsPool() that allows you to keep items in the pool for a
+ // bit longer, effectively keeping more items in circulation. A recommended
+ // maxPoolTime would be equal to the number of dimensions in the view,
+ // which means 1 for a list view and 2 for a table view. If you specify 0,
+ // all items will be drained.
+
+ Q_ASSERT(!modelItem->incubationTask);
+ Q_ASSERT(!modelItem->isObjectReferenced());
+ Q_ASSERT(modelItem->object);
+ Q_ASSERT(modelItem->delegate);
+
+ modelItem->poolTime = 0;
+ m_reusableItemsPool.append(modelItem);
+
+ qCDebug(lcItemViewDelegateRecycling)
+ << "item:" << modelItem
+ << "delegate:" << modelItem->delegate
+ << "index:" << modelItem->modelIndex()
+ << "row:" << modelItem->modelRow()
+ << "column:" << modelItem->modelColumn()
+ << "pool size:" << m_reusableItemsPool.size();
+}
+
+QQmlDelegateModelItem *QQmlReusableDelegateModelItemsPool::takeItem(const QQmlComponent *delegate, int newIndexHint)
+{
+ // Find the oldest item in the pool that was made from the same delegate as
+ // the given argument, remove it from the pool, and return it.
+ for (auto it = m_reusableItemsPool.begin(); it != m_reusableItemsPool.end(); ++it) {
+ if ((*it)->delegate != delegate)
+ continue;
+ auto modelItem = *it;
+ m_reusableItemsPool.erase(it);
+
+ qCDebug(lcItemViewDelegateRecycling)
+ << "item:" << modelItem
+ << "delegate:" << delegate
+ << "old index:" << modelItem->modelIndex()
+ << "old row:" << modelItem->modelRow()
+ << "old column:" << modelItem->modelColumn()
+ << "new index:" << newIndexHint
+ << "pool size:" << m_reusableItemsPool.size();
+
+ return modelItem;
+ }
+
+ qCDebug(lcItemViewDelegateRecycling)
+ << "no available item for delegate:" << delegate
+ << "new index:" << newIndexHint
+ << "pool size:" << m_reusableItemsPool.size();
+
+ return nullptr;
+}
+
+void QQmlReusableDelegateModelItemsPool::drain(int maxPoolTime, std::function<void(QQmlDelegateModelItem *cacheItem)> releaseItem)
+{
+ // Rather than releasing all pooled items upon a call to this function, each
+ // item has a poolTime. The poolTime specifies for how many loading cycles an item
+ // has been resting in the pool. And for each invocation of this function, poolTime
+ // will increase. If poolTime is equal to, or exceeds, maxPoolTime, it will be removed
+ // from the pool and released. This way, the view can tweak a bit for how long
+ // items should stay in "circulation", even if they are not recycled right away.
+ qCDebug(lcItemViewDelegateRecycling) << "pool size before drain:" << m_reusableItemsPool.size();
+
+ for (auto it = m_reusableItemsPool.begin(); it != m_reusableItemsPool.end();) {
+ auto modelItem = *it;
+ modelItem->poolTime++;
+ if (modelItem->poolTime <= maxPoolTime) {
+ ++it;
+ } else {
+ it = m_reusableItemsPool.erase(it);
+ releaseItem(modelItem);
+ }
+ }
+
+ qCDebug(lcItemViewDelegateRecycling) << "pool size after drain:" << m_reusableItemsPool.size();
+}
+
//============================================================================
struct QQmlDelegateModelGroupChange : QV4::Object
diff --git a/src/qmlmodels/qqmldelegatemodel_p.h b/src/qmlmodels/qqmldelegatemodel_p.h
index 02904a71d7..adb5f7008b 100644
--- a/src/qmlmodels/qqmldelegatemodel_p.h
+++ b/src/qmlmodels/qqmldelegatemodel_p.h
@@ -113,12 +113,15 @@ public:
int count() const override;
bool isValid() const override { return delegate() != nullptr; }
QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override;
- ReleaseFlags release(QObject *object) override;
+ ReleaseFlags release(QObject *object, ReusableFlag reusableFlag = NotReusable) override;
void cancel(int index) override;
QVariant variantValue(int index, const QString &role) override;
void setWatchedRoles(const QList<QByteArray> &roles) override;
QQmlIncubator::Status incubationStatus(int index) override;
+ void drainReusableItemsPool(int maxPoolTime) override;
+ int poolSize() override;
+
int indexOf(QObject *object, QObject *objectContext) const override;
QString filterGroup() const;
@@ -141,6 +144,8 @@ Q_SIGNALS:
void defaultGroupsChanged();
void rootIndexChanged();
void delegateChanged();
+ void itemPooled(int index, QObject *object);
+ void itemReused(int index, QObject *object);
private Q_SLOTS:
void _q_itemsChanged(int index, int count, const QVector<int> &roles);
diff --git a/src/qmlmodels/qqmldelegatemodel_p_p.h b/src/qmlmodels/qqmldelegatemodel_p_p.h
index 06365a212f..a1c4555d01 100644
--- a/src/qmlmodels/qqmldelegatemodel_p_p.h
+++ b/src/qmlmodels/qqmldelegatemodel_p_p.h
@@ -49,6 +49,8 @@
#include <private/qqmladaptormodel_p.h>
#include <private/qqmlopenmetaobject_p.h>
+#include <QtCore/qloggingcategory.h>
+
//
// W A R N I N G
// -------------
@@ -64,6 +66,8 @@ QT_REQUIRE_CONFIG(qml_delegate_model);
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateRecycling)
+
typedef QQmlListCompositor Compositor;
class QQmlDelegateModelAttachedMetaObject;
@@ -129,7 +133,7 @@ public:
int modelRow() const { return row; }
int modelColumn() const { return column; }
int modelIndex() const { return index; }
- virtual void setModelIndex(int idx, int newRow, int newColumn);
+ virtual void setModelIndex(int idx, int newRow, int newColumn, bool alwaysEmit = false);
virtual QV4::ReturnedValue get() { return QV4::QObjectWrapper::wrap(v4, this); }
@@ -190,7 +194,18 @@ void QV4::Heap::QQmlDelegateModelItemObject::init(QQmlDelegateModelItem *item)
this->item = item;
}
+class QQmlReusableDelegateModelItemsPool
+{
+public:
+ void insertItem(QQmlDelegateModelItem *modelItem);
+ QQmlDelegateModelItem *takeItem(const QQmlComponent *delegate, int newIndexHint);
+ void reuseItem(QQmlDelegateModelItem *item, int newModelIndex);
+ void drain(int maxPoolTime, std::function<void(QQmlDelegateModelItem *cacheItem)> releaseItem);
+ int size() { return m_reusableItemsPool.size(); }
+private:
+ QList<QQmlDelegateModelItem *> m_reusableItemsPool;
+};
class QQmlDelegateModelPrivate;
class QQDMIncubationTask : public QQmlIncubator
@@ -278,7 +293,7 @@ public:
void requestMoreIfNecessary();
QObject *object(Compositor::Group group, int index, QQmlIncubator::IncubationMode incubationMode);
- QQmlDelegateModel::ReleaseFlags release(QObject *object);
+ QQmlDelegateModel::ReleaseFlags release(QObject *object, QQmlInstanceModel::ReusableFlag reusable = QQmlInstanceModel::NotReusable);
QVariant variantValue(Compositor::Group group, int index, const QString &name);
void emitCreatedPackage(QQDMIncubationTask *incubationTask, QQuickPackage *package);
void emitInitPackage(QQDMIncubationTask *incubationTask, QQuickPackage *package);
@@ -290,9 +305,13 @@ public:
void emitDestroyingItem(QObject *item) { Q_EMIT q_func()->destroyingItem(item); }
void addCacheItem(QQmlDelegateModelItem *item, Compositor::iterator it);
void removeCacheItem(QQmlDelegateModelItem *cacheItem);
-
+ void destroyCacheItem(QQmlDelegateModelItem *cacheItem);
void updateFilterGroup();
+ void reuseItem(QQmlDelegateModelItem *item, int newModelIndex, int newGroups);
+ void drainReusableItemsPool(int maxPoolTime);
+ QQmlComponent *resolveDelegate(int index);
+
void addGroups(Compositor::iterator from, int count, Compositor::Group group, int groupFlags);
void removeGroups(Compositor::iterator from, int count, Compositor::Group group, int groupFlags);
void setGroups(Compositor::iterator from, int count, Compositor::Group group, int groupFlags);
@@ -337,6 +356,7 @@ public:
QQmlDelegateModelGroupEmitterList m_pendingParts;
QList<QQmlDelegateModelItem *> m_cache;
+ QQmlReusableDelegateModelItemsPool m_reusableItemsPool;
QList<QQDMIncubationTask *> m_finishedIncubating;
QList<QByteArray> m_watchedRoles;
@@ -380,7 +400,7 @@ public:
int count() const override;
bool isValid() const override;
QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override;
- ReleaseFlags release(QObject *item) override;
+ ReleaseFlags release(QObject *item, ReusableFlag reusable = NotReusable) override;
QVariant variantValue(int index, const QString &role) override;
QList<QByteArray> watchedRoles() const { return m_watchedRoles; }
void setWatchedRoles(const QList<QByteArray> &roles) override;
@@ -399,7 +419,7 @@ Q_SIGNALS:
private:
QQmlDelegateModel *m_model;
- QHash<QObject *, QQuickPackage *> m_packaged;
+ QMultiHash<QObject *, QQuickPackage *> m_packaged;
QString m_part;
QString m_filterGroup;
QList<QByteArray> m_watchedRoles;
diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp
index e0a66e7170..1bbe9360bb 100644
--- a/src/qmlmodels/qqmllistmodel.cpp
+++ b/src/qmlmodels/qqmllistmodel.cpp
@@ -269,19 +269,6 @@ const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const
return r;
}
-StringOrTranslation::StringOrTranslation(const QString &s)
-{
- d.setFlag();
- setString(s);
-}
-
-StringOrTranslation::StringOrTranslation(const QV4::CompiledData::Binding *binding)
-{
- d.setFlag();
- clear();
- d = binding;
-}
-
StringOrTranslation::~StringOrTranslation()
{
clear();
@@ -289,53 +276,48 @@ StringOrTranslation::~StringOrTranslation()
void StringOrTranslation::setString(const QString &s)
{
- d.setFlag();
clear();
- QStringData *stringData = const_cast<QString &>(s).data_ptr();
- d = stringData;
- if (stringData)
- stringData->ref.ref();
+ QString mutableString(s);
+ QString::DataPointer dataPointer = mutableString.data_ptr();
+ arrayData = dataPointer->d_ptr();
+ stringData = dataPointer->data();
+ stringSize = mutableString.length();
+ arrayData->ref();
}
void StringOrTranslation::setTranslation(const QV4::CompiledData::Binding *binding)
{
- d.setFlag();
clear();
- d = binding;
+ this->binding = binding;
}
QString StringOrTranslation::toString(const QQmlListModel *owner) const
{
- if (d.isNull())
- return QString();
- if (d.isT1()) {
- QStringDataPtr holder = { d.asT1() };
- holder.ptr->ref.ref();
- return QString(holder);
+ if (arrayData) {
+ arrayData->ref();
+ return QString(QStringPrivate(arrayData, stringData, stringSize));
}
if (!owner)
return QString();
- return owner->m_compilationUnit->bindingValueAsString(d.asT2());
+ return owner->m_compilationUnit->bindingValueAsString(binding);
}
QString StringOrTranslation::asString() const
{
- if (d.isNull())
+ if (!arrayData)
return QString();
- if (!d.isT1())
- return QString();
- QStringDataPtr holder = { d.asT1() };
- holder.ptr->ref.ref();
- return QString(holder);
+ arrayData->ref();
+ return QString(QStringPrivate(arrayData, stringData, stringSize));
}
void StringOrTranslation::clear()
{
- if (QStringData *strData = d.isT1() ? d.asT1() : nullptr) {
- if (!strData->ref.deref())
- QStringData::deallocate(strData);
- }
- d = static_cast<QStringData *>(nullptr);
+ if (arrayData && !arrayData->deref())
+ QTypedArrayData<ushort>::deallocate(arrayData);
+ arrayData = nullptr;
+ stringData = nullptr;
+ stringSize = 0;
+ binding = nullptr;
}
QObject *ListModel::getOrCreateModelObject(QQmlListModel *model, int elementIndex)
@@ -1148,7 +1130,7 @@ int ListElement::setTranslationProperty(const ListLayout::Role &role, const QV4:
void ListElement::setStringPropertyFast(const ListLayout::Role &role, const QString &s)
{
char *mem = getPropertyMemory(role);
- new (mem) StringOrTranslation(s);
+ reinterpret_cast<StringOrTranslation *>(mem)->setString(s);
}
void ListElement::setDoublePropertyFast(const ListLayout::Role &role, double d)
@@ -1905,11 +1887,11 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index)
Here is an example that uses WorkerScript to periodically append the
current time to a list model:
- \snippet ../quick/threading/threadedlistmodel/timedisplay.qml 0
+ \snippet ../../examples/quick/threading/threadedlistmodel/timedisplay.qml 0
The included file, \tt dataloader.mjs, looks like this:
- \snippet ../quick/threading/threadedlistmodel/dataloader.mjs 0
+ \snippet ../../examples/quick/threading/threadedlistmodel/dataloader.mjs 0
The timer in the main example sends messages to the worker script by calling
\l WorkerScript::sendMessage(). When this message is received,
diff --git a/src/qmlmodels/qqmllistmodel_p_p.h b/src/qmlmodels/qqmllistmodel_p_p.h
index 2ad5158050..f17004ed3b 100644
--- a/src/qmlmodels/qqmllistmodel_p_p.h
+++ b/src/qmlmodels/qqmllistmodel_p_p.h
@@ -252,18 +252,23 @@ private:
struct StringOrTranslation
{
- explicit StringOrTranslation(const QString &s);
- explicit StringOrTranslation(const QV4::CompiledData::Binding *binding);
~StringOrTranslation();
- bool isSet() const { return d.flag(); }
- bool isTranslation() const { return d.isT2(); }
+ bool isSet() const { return binding || arrayData; }
+ bool isTranslation() const { return binding && !arrayData; }
void setString(const QString &s);
void setTranslation(const QV4::CompiledData::Binding *binding);
QString toString(const QQmlListModel *owner) const;
QString asString() const;
private:
void clear();
- QBiPointer<QStringData, const QV4::CompiledData::Binding> d;
+
+ union {
+ ushort *stringData = nullptr;
+ const QV4::CompiledData::Binding *binding;
+ };
+
+ QTypedArrayData<ushort> *arrayData = nullptr;
+ uint stringSize = 0;
};
/*!
diff --git a/src/qmlmodels/qqmlmodelsmodule.cpp b/src/qmlmodels/qqmlmodelsmodule.cpp
deleted file mode 100644
index 8bd9b179b3..0000000000
--- a/src/qmlmodels/qqmlmodelsmodule.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and 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$
-**
-****************************************************************************/
-
-#include "qqmlmodelsmodule_p.h"
-#include <private/qtqmlmodelsglobal_p.h>
-
-#if QT_CONFIG(qml_list_model)
-#include <private/qqmllistmodel_p.h>
-#include <private/qqmllistmodelworkeragent_p.h>
-#endif
-#if QT_CONFIG(qml_delegate_model)
-#include <private/qqmlabstractdelegatecomponent_p.h>
-#include <private/qqmldelegatemodel_p.h>
-#include <private/qquickpackage_p.h>
-#include <private/qqmlcomponentattached_p.h>
-#endif
-#if QT_CONFIG(qml_object_model)
-#include <private/qqmlobjectmodel_p.h>
-#include <private/qqmlinstantiator_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-void QQmlModelsModule::defineModule()
-{
- const char uri[] = "QtQml.Models";
-
-#if QT_CONFIG(qml_list_model)
- qmlRegisterTypesAndRevisions<QQmlListElement, QQmlListModel, QQmlListModelWorkerAgent>(uri, 2);
-#endif
-#if QT_CONFIG(qml_delegate_model)
- // TODO: Get rid of these. It's called DelegateModel and DelegateModelGroup these days.
- qmlRegisterType<QQmlDelegateModel>(uri, 2, 0, "VisualDataModel");
- qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 0, "VisualDataGroup");
-
- qmlRegisterTypesAndRevisions<QQmlDelegateModel, QQmlDelegateModelGroup, QQuickPackage, QQmlAbstractDelegateComponent>(uri, 2);
-#endif
-#if QT_CONFIG(qml_object_model)
- qmlRegisterTypesAndRevisions<QQmlObjectModel, QQmlInstantiator, QQmlInstanceModel>(uri, 2);
-#endif
-#if QT_CONFIG(itemmodel)
- qmlRegisterTypesAndRevisions<QItemSelectionModelForeign>(uri, 2);
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/qmlmodels/qqmlmodelsmodule_p.h b/src/qmlmodels/qqmlmodelsmodule_p.h
index c697b08bf7..e3e43f3922 100644
--- a/src/qmlmodels/qqmlmodelsmodule_p.h
+++ b/src/qmlmodels/qqmlmodelsmodule_p.h
@@ -61,13 +61,6 @@
QT_BEGIN_NAMESPACE
-class Q_QMLMODELS_PRIVATE_EXPORT QQmlModelsModule
-{
-public:
- static void defineModule();
- static void defineLabsModule();
-};
-
#if QT_CONFIG(itemmodel)
struct QItemSelectionModelForeign
{
diff --git a/src/qmlmodels/qqmlobjectmodel.cpp b/src/qmlmodels/qqmlobjectmodel.cpp
index 8e7b0a9b5f..85e64cc2f9 100644
--- a/src/qmlmodels/qqmlobjectmodel.cpp
+++ b/src/qmlmodels/qqmlobjectmodel.cpp
@@ -265,7 +265,7 @@ QObject *QQmlObjectModel::object(int index, QQmlIncubator::IncubationMode)
return item.item;
}
-QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item)
+QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item, ReusableFlag)
{
Q_D(QQmlObjectModel);
int idx = d->indexOf(item);
@@ -273,7 +273,7 @@ QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item)
if (!d->children[idx].deref())
return QQmlInstanceModel::Referenced;
}
- return nullptr;
+ return {};
}
QVariant QQmlObjectModel::variantValue(int index, const QString &role)
diff --git a/src/qmlmodels/qqmlobjectmodel_p.h b/src/qmlmodels/qqmlobjectmodel_p.h
index 0aa818d724..6c68e55012 100644
--- a/src/qmlmodels/qqmlobjectmodel_p.h
+++ b/src/qmlmodels/qqmlobjectmodel_p.h
@@ -72,21 +72,29 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlInstanceModel : public QObject
QML_ANONYMOUS
public:
+ enum ReusableFlag {
+ NotReusable,
+ Reusable
+ };
+
virtual ~QQmlInstanceModel() {}
- enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 };
+ enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02, Pooled = 0x04 };
Q_DECLARE_FLAGS(ReleaseFlags, ReleaseFlag)
virtual int count() const = 0;
virtual bool isValid() const = 0;
virtual QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) = 0;
- virtual ReleaseFlags release(QObject *object) = 0;
+ virtual ReleaseFlags release(QObject *object, ReusableFlag reusableFlag = NotReusable) = 0;
virtual void cancel(int) {}
QString stringValue(int index, const QString &role) { return variantValue(index, role).toString(); }
virtual QVariant variantValue(int, const QString &) = 0;
virtual void setWatchedRoles(const QList<QByteArray> &roles) = 0;
virtual QQmlIncubator::Status incubationStatus(int index) = 0;
+ virtual void drainReusableItemsPool(int maxPoolTime) { Q_UNUSED(maxPoolTime) }
+ virtual int poolSize() { return 0; }
+
virtual int indexOf(QObject *object, QObject *objectContext) const = 0;
virtual const QAbstractItemModel *abstractItemModel() const { return nullptr; }
@@ -125,7 +133,7 @@ public:
int count() const override;
bool isValid() const override;
QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override;
- ReleaseFlags release(QObject *object) override;
+ ReleaseFlags release(QObject *object, ReusableFlag reusable = NotReusable) override;
QVariant variantValue(int index, const QString &role) override;
void setWatchedRoles(const QList<QByteArray> &) override {}
QQmlIncubator::Status incubationStatus(int index) override;
diff --git a/src/qmlmodels/qqmltableinstancemodel.cpp b/src/qmlmodels/qqmltableinstancemodel.cpp
index a538ae4a1f..b4d1e61e31 100644
--- a/src/qmlmodels/qqmltableinstancemodel.cpp
+++ b/src/qmlmodels/qqmltableinstancemodel.cpp
@@ -141,7 +141,7 @@ QQmlDelegateModelItem *QQmlTableInstanceModel::resolveModelItem(int index)
return nullptr;
// Check if the pool contains an item that can be reused
- modelItem = takeFromReusableItemsPool(delegate);
+ modelItem = m_reusableItemsPool.takeItem(delegate, index);
if (modelItem) {
reuseItem(modelItem, index);
m_modelItems.insert(index, modelItem);
@@ -225,16 +225,21 @@ QQmlInstanceModel::ReleaseFlags QQmlTableInstanceModel::release(QObject *object,
m_modelItems.remove(modelItem->index);
if (reusable == Reusable) {
- insertIntoReusableItemsPool(modelItem);
- return QQmlInstanceModel::Referenced;
+ m_reusableItemsPool.insertItem(modelItem);
+ emit itemPooled(modelItem->index, modelItem->object);
+ return QQmlInstanceModel::Pooled;
}
// The item is not reused or referenced by anyone, so just delete it
- modelItem->destroyObject();
- emit destroyingItem(object);
+ destroyModelItem(modelItem);
+ return QQmlInstanceModel::Destroyed;
+}
+void QQmlTableInstanceModel::destroyModelItem(QQmlDelegateModelItem *modelItem)
+{
+ emit destroyingItem(modelItem->object);
+ modelItem->destroyObject();
delete modelItem;
- return QQmlInstanceModel::Destroyed;
}
void QQmlTableInstanceModel::cancel(int index)
@@ -257,94 +262,22 @@ void QQmlTableInstanceModel::cancel(int index)
delete modelItem;
}
-void QQmlTableInstanceModel::insertIntoReusableItemsPool(QQmlDelegateModelItem *modelItem)
-{
- // Currently, the only way for a view to reuse items is to call QQmlTableInstanceModel::release()
- // with the second argument explicitly set to QQmlTableInstanceModel::Reusable. If the released
- // item is no longer referenced, it will be added to the pool. Reusing of items can be specified
- // per item, in case certain items cannot be recycled.
- // A QQmlDelegateModelItem knows which delegate its object was created from. So when we are
- // about to create a new item, we first check if the pool contains an item based on the same
- // delegate from before. If so, we take it out of the pool (instead of creating a new item), and
- // update all its context-, and attached properties.
- // When a view is recycling items, it should call QQmlTableInstanceModel::drainReusableItemsPool()
- // regularly. As there is currently no logic to 'hibernate' items in the pool, they are only
- // meant to rest there for a short while, ideally only from the time e.g a row is unloaded
- // on one side of the view, and until a new row is loaded on the opposite side. In-between
- // this time, the application will see the item as fully functional and 'alive' (just not
- // visible on screen). Since this time is supposed to be short, we don't take any action to
- // notify the application about it, since we don't want to trigger any bindings that can
- // disturb performance.
- // A recommended time for calling drainReusableItemsPool() is each time a view has finished
- // loading e.g a new row or column. If there are more items in the pool after that, it means
- // that the view most likely doesn't need them anytime soon. Those items should be destroyed to
- // not consume resources.
- // Depending on if a view is a list or a table, it can sometimes be performant to keep
- // items in the pool for a bit longer than one "row out/row in" cycle. E.g for a table, if the
- // number of visible rows in a view is much larger than the number of visible columns.
- // In that case, if you flick out a row, and then flick in a column, you would throw away a lot
- // of items in the pool if completely draining it. The reason is that unloading a row places more
- // items in the pool than what ends up being recycled when loading a new column. And then, when you
- // next flick in a new row, you would need to load all those drained items again from scratch. For
- // that reason, you can specify a maxPoolTime to the drainReusableItemsPool() that allows you to keep
- // items in the pool for a bit longer, effectively keeping more items in circulation.
- // A recommended maxPoolTime would be equal to the number of dimenstions in the view, which
- // means 1 for a list view and 2 for a table view. If you specify 0, all items will be drained.
- Q_ASSERT(!modelItem->incubationTask);
- Q_ASSERT(!modelItem->isObjectReferenced());
- Q_ASSERT(!modelItem->isReferenced());
- Q_ASSERT(modelItem->object);
-
- modelItem->poolTime = 0;
- m_reusableItemsPool.append(modelItem);
- emit itemPooled(modelItem->index, modelItem->object);
-}
-
-QQmlDelegateModelItem *QQmlTableInstanceModel::takeFromReusableItemsPool(const QQmlComponent *delegate)
-{
- // Find the oldest item in the pool that was made from the same delegate as
- // the given argument, remove it from the pool, and return it.
- if (m_reusableItemsPool.isEmpty())
- return nullptr;
-
- for (auto it = m_reusableItemsPool.begin(); it != m_reusableItemsPool.end(); ++it) {
- if ((*it)->delegate != delegate)
- continue;
- auto modelItem = *it;
- m_reusableItemsPool.erase(it);
- return modelItem;
- }
-
- return nullptr;
-}
-
void QQmlTableInstanceModel::drainReusableItemsPool(int maxPoolTime)
{
- // Rather than releasing all pooled items upon a call to this function, each
- // item has a poolTime. The poolTime specifies for how many loading cycles an item
- // has been resting in the pool. And for each invocation of this function, poolTime
- // will increase. If poolTime is equal to, or exceeds, maxPoolTime, it will be removed
- // from the pool and released. This way, the view can tweak a bit for how long
- // items should stay in "circulation", even if they are not recycled right away.
- for (auto it = m_reusableItemsPool.begin(); it != m_reusableItemsPool.end();) {
- auto modelItem = *it;
- modelItem->poolTime++;
- if (modelItem->poolTime <= maxPoolTime) {
- ++it;
- } else {
- it = m_reusableItemsPool.erase(it);
- release(modelItem->object, NotReusable);
- }
- }
+ m_reusableItemsPool.drain(maxPoolTime, [=](QQmlDelegateModelItem *modelItem){ destroyModelItem(modelItem); });
}
void QQmlTableInstanceModel::reuseItem(QQmlDelegateModelItem *item, int newModelIndex)
{
// Update the context properties index, row and column on
// the delegate item, and inform the application about it.
+ // Note that we set alwaysEmit to true, to force all bindings
+ // to be reevaluated, even if the index didn't change (since
+ // the model can have changed size since last usage).
+ const bool alwaysEmit = true;
const int newRow = m_adaptorModel.rowAt(newModelIndex);
const int newColumn = m_adaptorModel.columnAt(newModelIndex);
- item->setModelIndex(newModelIndex, newRow, newColumn);
+ item->setModelIndex(newModelIndex, newRow, newColumn, alwaysEmit);
// Notify the application that all 'dynamic'/role-based context data has
// changed as well (their getter function will use the updated index).
diff --git a/src/qmlmodels/qqmltableinstancemodel_p.h b/src/qmlmodels/qqmltableinstancemodel_p.h
index ce5a37bc98..d924455918 100644
--- a/src/qmlmodels/qqmltableinstancemodel_p.h
+++ b/src/qmlmodels/qqmltableinstancemodel_p.h
@@ -86,12 +86,6 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlTableInstanceModel : public QQmlInstanceMod
Q_OBJECT
public:
-
- enum ReusableFlag {
- NotReusable,
- Reusable
- };
-
QQmlTableInstanceModel(QQmlContext *qmlContext, QObject *parent = nullptr);
~QQmlTableInstanceModel() override;
@@ -103,6 +97,9 @@ public:
bool isValid() const override { return true; }
+ bool canFetchMore() const { return m_adaptorModel.canFetchMore(); }
+ void fetchMore() { m_adaptorModel.fetchMore(); }
+
QVariant model() const;
void setModel(const QVariant &model);
@@ -112,14 +109,11 @@ public:
const QAbstractItemModel *abstractItemModel() const override;
QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override;
- ReleaseFlags release(QObject *object) override { return release(object, NotReusable); }
- ReleaseFlags release(QObject *object, ReusableFlag reusable);
+ ReleaseFlags release(QObject *object, ReusableFlag reusable = NotReusable) override;
void cancel(int) override;
- void insertIntoReusableItemsPool(QQmlDelegateModelItem *modelItem);
- QQmlDelegateModelItem *takeFromReusableItemsPool(const QQmlComponent *delegate);
- void drainReusableItemsPool(int maxPoolTime);
- int poolSize() { return m_reusableItemsPool.size(); }
+ void drainReusableItemsPool(int maxPoolTime) override;
+ int poolSize() override { return m_reusableItemsPool.size(); }
void reuseItem(QQmlDelegateModelItem *item, int newModelIndex);
QQmlIncubator::Status incubationStatus(int index) override;
@@ -142,7 +136,7 @@ private:
QQmlDelegateModelItemMetaType *m_metaType;
QHash<int, QQmlDelegateModelItem *> m_modelItems;
- QList<QQmlDelegateModelItem *> m_reusableItemsPool;
+ QQmlReusableDelegateModelItemsPool m_reusableItemsPool;
QList<QQmlIncubator *> m_finishedIncubationTasks;
void incubateModelItem(QQmlDelegateModelItem *modelItem, QQmlIncubator::IncubationMode incubationMode);
@@ -150,6 +144,7 @@ private:
void deleteIncubationTaskLater(QQmlIncubator *incubationTask);
void deleteAllFinishedIncubationTasks();
QQmlDelegateModelItem *resolveModelItem(int index);
+ void destroyModelItem(QQmlDelegateModelItem *modelItem);
void dataChangedCallback(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles);
diff --git a/src/qmltest/dependencies.json b/src/qmltest/dependencies.json
new file mode 100644
index 0000000000..b2c4125178
--- /dev/null
+++ b/src/qmltest/dependencies.json
@@ -0,0 +1 @@
+["QtQuick 2.0", "QtQuick.Window 2.0"]
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro
index d6e4669769..6864203ba4 100644
--- a/src/qmltest/qmltest.pro
+++ b/src/qmltest/qmltest.pro
@@ -4,7 +4,7 @@ QMAKE_DOCS = $$PWD/doc/qtqmltest.qdocconf
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_FOREACH
QT = core testlib-private
-QT_PRIVATE = quick quick-private qml-private gui core-private gui-private
+QT_PRIVATE = quick quick-private qml-private gui core-private
# Testlib is only a private dependency, which results in our users not
# inheriting testlibs's MODULE_CONFIG transitively. Make it explicit.
@@ -17,18 +17,16 @@ qtHaveModule(widgets) {
SOURCES += \
$$PWD/quicktest.cpp \
- $$PWD/quicktestevent.cpp \
- $$PWD/quicktestresult.cpp \
- $$PWD/quicktestutil.cpp
+ $$PWD/quicktestresult.cpp
HEADERS += \
$$PWD/quicktestglobal.h \
$$PWD/quicktest.h \
- $$PWD/quicktestevent_p.h \
$$PWD/quicktestresult_p.h \
- $$PWD/quicktestutil_p.h \
$$PWD/qtestoptions_p.h
qtConfig(qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING
load(qt_module)
+
+CONFIG += metatypes install_metatypes
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index 296e8e5344..81b9d78830 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -76,7 +76,6 @@ class Q_QUICK_TEST_EXPORT QuickTestResult : public QObject
Q_PROPERTY(int skipCount READ skipCount)
Q_PROPERTY(QStringList functionsToRun READ functionsToRun)
Q_PROPERTY(QStringList tagsToRun READ tagsToRun)
- QML_NAMED_ELEMENT(TestResult)
public:
QuickTestResult(QObject *parent = nullptr);
diff --git a/src/qmltyperegistrar/qmltyperegistrar.cpp b/src/qmltyperegistrar/qmltyperegistrar.cpp
index 8813907697..49c9fccb66 100644
--- a/src/qmltyperegistrar/qmltyperegistrar.cpp
+++ b/src/qmltyperegistrar/qmltyperegistrar.cpp
@@ -190,37 +190,44 @@ int main(int argc, char **argv)
parser.addOption(privateIncludesOption);
QCommandLineOption importNameOption(QStringLiteral("import-name"));
- importNameOption.setDescription(QStringLiteral("Name of the module to use with QML type registrations."));
- importNameOption.setValueName(QStringLiteral("QML module name"));
+ importNameOption.setDescription(QStringLiteral("Name of the module to use for type and module "
+ "registrations."));
+ importNameOption.setValueName(QStringLiteral("module name"));
parser.addOption(importNameOption);
QCommandLineOption majorVersionOption(QStringLiteral("major-version"));
- majorVersionOption.setDescription(QStringLiteral("Major version to use for type registrations."));
+ majorVersionOption.setDescription(QStringLiteral("Major version to use for type and module "
+ "registrations."));
majorVersionOption.setValueName(QStringLiteral("major version"));
parser.addOption(majorVersionOption);
QCommandLineOption minorVersionOption(QStringLiteral("minor-version"));
- minorVersionOption.setDescription(QStringLiteral("Minor version to use for module registration."));
+ minorVersionOption.setDescription(QStringLiteral("Minor version to use for module "
+ "registration."));
minorVersionOption.setValueName(QStringLiteral("minor version"));
parser.addOption(minorVersionOption);
- QCommandLineOption pluginTypesOption(QStringLiteral("generate-plugintypes"));
- pluginTypesOption.setDescription(QStringLiteral("Generate plugins.qmltypes into specified directory."));
- pluginTypesOption.setValueName(QStringLiteral("qmltypes target Directory"));
+ QCommandLineOption pluginTypesOption(QStringLiteral("generate-qmltypes"));
+ pluginTypesOption.setDescription(QStringLiteral("Generate qmltypes into specified file."));
+ pluginTypesOption.setValueName(QStringLiteral("qmltypes file"));
parser.addOption(pluginTypesOption);
QCommandLineOption foreignTypesOption(QStringLiteral("foreign-types"));
- foreignTypesOption.setDescription(QStringLiteral("Consider foreign types when generating plugins.qmltypes."));
- foreignTypesOption.setValueName(QStringLiteral("Comma separated list of other modules to consult for types."));
+ foreignTypesOption.setDescription(QStringLiteral(
+ "Comma separated list of other modules' metatypes files "
+ "to consult for foreign types when generating "
+ "qmltypes file."));
+ foreignTypesOption.setValueName(QStringLiteral("foreign types"));
parser.addOption(foreignTypesOption);
QCommandLineOption dependenciesOption(QStringLiteral("dependencies"));
- dependenciesOption.setDescription(QStringLiteral("Dependencies to be stated in plugins.qmltypes"));
- dependenciesOption.setValueName(QStringLiteral("name of JSON file with dependencies"));
+ dependenciesOption.setDescription(QStringLiteral("JSON file with dependencies to be stated in "
+ "qmltypes file."));
+ dependenciesOption.setValueName(QStringLiteral("dependencies.json"));
parser.addOption(dependenciesOption);
parser.addPositionalArgument(QStringLiteral("[MOC generated json file]"),
- QStringLiteral("MOC generated json output"));
+ QStringLiteral("MOC generated json output."));
parser.process(app);
@@ -248,7 +255,8 @@ int main(int argc, char **argv)
"** WARNING! All changes made in this file will be lost!\n"
"*****************************************************************************/\n\n");
fprintf(output,
- "#include <QtQml/qqmlengine.h>\n");
+ "#include <QtQml/qqml.h>\n"
+ "#include <QtQml/qqmlmoduleregistration.h>\n");
QStringList includes;
QVector<QJsonObject> types;
@@ -325,7 +333,10 @@ int main(int argc, char **argv)
sortTypes(types);
- fprintf(output, "\n#include <QtQml/qqmlmoduleregistration.h>");
+ std::sort(includes.begin(), includes.end());
+ const auto newEnd = std::unique(includes.begin(), includes.end());
+ includes.erase(newEnd, includes.end());
+
const bool privateIncludes = parser.isSet(privateIncludesOption);
for (const QString &include : qAsConst(includes)) {
if (privateIncludes && include.endsWith(QLatin1String("_p.h")))
diff --git a/src/qmltyperegistrar/qmltypes.prf b/src/qmltyperegistrar/qmltypes.prf
index ed11ef44cf..fbb00dbe2d 100644
--- a/src/qmltyperegistrar/qmltypes.prf
+++ b/src/qmltyperegistrar/qmltypes.prf
@@ -36,10 +36,12 @@ isEmpty(QMLTYPES_FILENAME) {
qt_module_deps = $$replace(QT, -private$, '')
qt_module_deps += $$replace(QT_PRIVATE, -private$, '')
+qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depends")
qt_module_deps = $$replace(qt_module_deps, _private$, '')
-all_qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depends")
+qt_module_deps = $$unique(qt_module_deps)
+
foreign_types =
-for(dep, all_qt_module_deps) {
+for(dep, qt_module_deps) {
METATYPES_FILENAME = $$lower($$eval(QT.$${dep}.module))_metatypes.json
INSTALLED_METATYPES = $$[QT_INSTALL_LIBS]/metatypes/$$METATYPES_FILENAME
isEmpty(MODULE_BASE_OUTDIR) {
@@ -52,7 +54,7 @@ for(dep, all_qt_module_deps) {
}
QML_TYPEREGISTRAR_FLAGS = \
- --generate-plugintypes=$$QMLTYPES_FILENAME \
+ --generate-qmltypes=$$QMLTYPES_FILENAME \
--import-name=$$QML_IMPORT_NAME \
--major-version=$$QML_IMPORT_MAJOR_VERSION \
--minor-version=$$QML_IMPORT_MINOR_VERSION \
@@ -87,7 +89,7 @@ install_qmltypes {
QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/$$TARGETPATH
do_install_qmltypes.files = $$OUT_PWD/$$QMLTYPES_FILENAME
do_install_qmltypes.path = $$QMLTYPES_INSTALL_DIR
- do_install_qmltypes.CONFIG += no_link
+ do_install_qmltypes.CONFIG += no_check_exist
prefix_build: INSTALLS += do_install_qmltypes
else: COPIES += do_install_qmltypes
}
diff --git a/src/qmltyperegistrar/qmltypescreator.cpp b/src/qmltyperegistrar/qmltypescreator.cpp
index 7bac6a87d8..911120027e 100644
--- a/src/qmltyperegistrar/qmltypescreator.cpp
+++ b/src/qmltyperegistrar/qmltypescreator.cpp
@@ -173,9 +173,9 @@ void QmlTypesCreator::writeMethods(const QJsonArray &methods, const QString &typ
{
for (const QJsonValue &method : methods) {
const QJsonObject obj = method.toObject();
- if (obj[QLatin1String("access")].toString() != QLatin1String("public"))
- continue;
const QString name = obj[QLatin1String("name")].toString();
+ if (name.isEmpty())
+ continue;
const QJsonArray arguments = method[QLatin1String("arguments")].toArray();
const auto revision = obj.find(QLatin1String("revision"));
if (notifySignals.contains(name) && arguments.isEmpty() && revision == obj.end())
diff --git a/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf
index bb883cf39f..e56e1759b3 100644
--- a/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf
+++ b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf
@@ -23,15 +23,13 @@ qhp.QtQmlWorkerScript.sortPages = true
tagfile = qtqmlworkerscript.tags
-depends += qtcore qtqml qtdoc
+depends += qtcore qtqml qtquick qtdoc
headerdirs += ..
sourcedirs += .. \
../../imports/workerscript
-exampledirs += ../../../examples/qml \
- ../ \
- snippets
+exampledirs += snippets
navigation.qmltypespage = "Qt Qml WorkerScript QML Types"
diff --git a/src/qml/doc/snippets/qml/workerscript/script.mjs b/src/qmlworkerscript/doc/snippets/qml/workerscript/script.mjs
index f55dee3507..f55dee3507 100644
--- a/src/qml/doc/snippets/qml/workerscript/script.mjs
+++ b/src/qmlworkerscript/doc/snippets/qml/workerscript/script.mjs
diff --git a/src/qml/doc/snippets/qml/workerscript/workerscript.qml b/src/qmlworkerscript/doc/snippets/qml/workerscript/workerscript.qml
index cc637d34cf..cc637d34cf 100644
--- a/src/qml/doc/snippets/qml/workerscript/workerscript.qml
+++ b/src/qmlworkerscript/doc/snippets/qml/workerscript/workerscript.qml
diff --git a/src/qmlworkerscript/qmlworkerscript.pro b/src/qmlworkerscript/qmlworkerscript.pro
index 9f5e0e809a..b091937796 100644
--- a/src/qmlworkerscript/qmlworkerscript.pro
+++ b/src/qmlworkerscript/qmlworkerscript.pro
@@ -6,17 +6,21 @@ QMAKE_DOCS = $$PWD/doc/qtqmlworkerscript.qdocconf
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH
HEADERS += \
- qqmlworkerscriptmodule_p.h \
qquickworkerscript_p.h \
qtqmlworkerscriptglobal.h \
qtqmlworkerscriptglobal_p.h \
qv4serialize_p.h
SOURCES += \
- qqmlworkerscriptmodule.cpp \
qquickworkerscript.cpp \
qv4serialize.cpp
include(../3rdparty/masm/masm-defs.pri)
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml/WorkerScript.2
+QML_IMPORT_NAME = QtQml.WorkerScript
+IMPORT_VERSION = 2.15
+CONFIG += qmltypes install_qmltypes install_metatypes
+
load(qt_module)
diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp
deleted file mode 100644
index b85456a633..0000000000
--- a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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: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$
-**
-****************************************************************************/
-
-#include "qqmlworkerscriptmodule_p.h"
-#include "qquickworkerscript_p.h"
-
-QT_BEGIN_NAMESPACE
-
-void QQmlWorkerScriptModule::defineModule()
-{
- const char uri[] = "QtQml.WorkerScript";
- qmlRegisterTypesAndRevisions<QQuickWorkerScript>(uri, 2);
-}
-
-QT_END_NAMESPACE
diff --git a/src/qmlworkerscript/qquickworkerscript.cpp b/src/qmlworkerscript/qquickworkerscript.cpp
index 8b236697b9..72ae6d5bd4 100644
--- a/src/qmlworkerscript/qquickworkerscript.cpp
+++ b/src/qmlworkerscript/qquickworkerscript.cpp
@@ -130,6 +130,7 @@ struct WorkerScript : public QV4::ExecutionEngine {
QQuickWorkerScriptEnginePrivate *p = nullptr;
QUrl source;
QQuickWorkerScript *owner = nullptr;
+ QScopedPointer<QNetworkAccessManager> scriptLocalNAM;
int id = -1;
};
@@ -389,6 +390,16 @@ WorkerScript::WorkerScript(int id, QQuickWorkerScriptEnginePrivate *parent)
QV4::ScopedValue sendMessage(scope, QV4::FunctionObject::createBuiltinFunction(this, name, QQuickWorkerScriptEnginePrivate::method_sendMessage, 1));
api->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("sendMessage"))), sendMessage);
globalObject->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("WorkerScript"))), api);
+ networkAccessManager = [](QV4::ExecutionEngine *engine){
+ auto *workerScript = static_cast<WorkerScript *>(engine);
+ if (workerScript->scriptLocalNAM)
+ return workerScript->scriptLocalNAM.get();
+ if (auto *namFactory = workerScript->p->qmlengine->networkAccessManagerFactory())
+ workerScript->scriptLocalNAM.reset(namFactory->create(workerScript->p));
+ else
+ workerScript->scriptLocalNAM.reset(new QNetworkAccessManager(workerScript->p));
+ return workerScript->scriptLocalNAM.get();
+ };
}
int QQuickWorkerScriptEngine::registerWorkerScript(QQuickWorkerScript *owner)
@@ -533,6 +544,17 @@ void QQuickWorkerScript::setSource(const QUrl &source)
}
/*!
+ \qmlproperty url WorkerScript::ready
+
+ This holds whether the WorkerScript has been initialized and is ready
+ for receiving messages via \tt WorkerScript.sendMessage().
+*/
+bool QQuickWorkerScript::ready() const
+{
+ return m_engine != nullptr;
+}
+
+/*!
\qmlmethod WorkerScript::sendMessage(jsobject message)
Sends the given \a message to a worker script handler in another
@@ -592,6 +614,8 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine()
if (m_source.isValid())
m_engine->executeUrl(m_scriptId, m_source);
+ emit readyChanged();
+
return m_engine;
}
return nullptr;
diff --git a/src/qmlworkerscript/qquickworkerscript_p.h b/src/qmlworkerscript/qquickworkerscript_p.h
index 9b5d3587fb..03581089e0 100644
--- a/src/qmlworkerscript/qquickworkerscript_p.h
+++ b/src/qmlworkerscript/qquickworkerscript_p.h
@@ -53,6 +53,7 @@
#include <qqml.h>
+#include <QtQmlWorkerScript/private/qtqmlworkerscriptglobal_p.h>
#include <QtQml/qqmlparserstatus.h>
#include <QtCore/qthread.h>
#include <QtQml/qjsvalue.h>
@@ -83,10 +84,12 @@ private:
};
class QQmlV4Function;
-class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserStatus
+class Q_QMLWORKERSCRIPT_PRIVATE_EXPORT QQuickWorkerScript : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
+
QML_NAMED_ELEMENT(WorkerScript);
Q_INTERFACES(QQmlParserStatus)
@@ -97,11 +100,14 @@ public:
QUrl source() const;
void setSource(const QUrl &);
+ bool ready() const;
+
public Q_SLOTS:
void sendMessage(QQmlV4Function*);
Q_SIGNALS:
void sourceChanged();
+ void readyChanged();
void message(const QJSValue &messageObject);
protected:
diff --git a/src/qmlworkerscript/qv4serialize.cpp b/src/qmlworkerscript/qv4serialize.cpp
index a5e62d3e35..f0a644a8b8 100644
--- a/src/qmlworkerscript/qv4serialize.cpp
+++ b/src/qmlworkerscript/qv4serialize.cpp
@@ -81,6 +81,7 @@ enum Type {
WorkerDate,
WorkerRegexp,
WorkerListModel,
+ WorkerUrl,
#if QT_CONFIG(qml_sequence_object)
WorkerSequence
#endif
@@ -142,10 +143,29 @@ static inline void *popPtr(const char *&data)
return rv;
}
+#define ALIGN(size) (((size) + 3) & ~3)
+static inline void serializeString(QByteArray &data, const QString &str, Type type)
+{
+ int length = str.length();
+ if (length > 0xFFFFFF) {
+ push(data, valueheader(WorkerUndefined));
+ return;
+ }
+ int utf16size = ALIGN(length * sizeof(quint16));
+
+ reserve(data, utf16size + sizeof(quint32));
+ push(data, valueheader(type, length));
+
+ int offset = data.size();
+ data.resize(data.size() + utf16size);
+ char *buffer = data.data() + offset;
+
+ memcpy(buffer, str.constData(), length*sizeof(QChar));
+}
+
// XXX TODO: Check that worker script is exception safe in the case of
// serialization/deserialization failures
-#define ALIGN(size) (((size) + 3) & ~3)
void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine *engine)
{
QV4::Scope scope(engine);
@@ -159,22 +179,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine
} else if (v.isBoolean()) {
push(data, valueheader(v.booleanValue() == true ? WorkerTrue : WorkerFalse));
} else if (v.isString()) {
- const QString &qstr = v.toQString();
- int length = qstr.length();
- if (length > 0xFFFFFF) {
- push(data, valueheader(WorkerUndefined));
- return;
- }
- int utf16size = ALIGN(length * sizeof(quint16));
-
- reserve(data, utf16size + sizeof(quint32));
- push(data, valueheader(WorkerString, length));
-
- int offset = data.size();
- data.resize(data.size() + utf16size);
- char *buffer = data.data() + offset;
-
- memcpy(buffer, qstr.constData(), length*sizeof(QChar));
+ serializeString(data, v.toQString(), WorkerString);
} else if (v.as<FunctionObject>()) {
// XXX TODO: Implement passing function objects between the main and
// worker scripts
@@ -259,6 +264,11 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine
return;
}
#endif
+ const QVariant variant = engine->toVariant(v, QMetaType::QUrl, false);
+ if (variant.userType() == QMetaType::QUrl) {
+ serializeString(data, variant.value<QUrl>().toString(), WorkerUrl);
+ return;
+ }
// regular object
QV4::ScopedValue val(scope, v);
@@ -340,11 +350,14 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine)
case WorkerFalse:
return QV4::Encode(false);
case WorkerString:
+ case WorkerUrl:
{
quint32 size = headersize(header);
QString qstr((const QChar *)data, size);
data += ALIGN(size * sizeof(quint16));
- return QV4::Encode(engine->newString(qstr));
+ return (type == WorkerUrl)
+ ? engine->fromVariant(QVariant::fromValue(QUrl(qstr)))
+ : Encode(engine->newString(qstr));
}
case WorkerFunction:
Q_ASSERT(!"Unreachable");
diff --git a/src/quick/configure.json b/src/quick/configure.json
index 0cb1e7470b..6cd3099a20 100644
--- a/src/quick/configure.json
+++ b/src/quick/configure.json
@@ -3,14 +3,15 @@
"depends": [
"core-private",
"qml-private",
+ "gui",
"gui-private",
"qmlmodels-private"
],
+ "condition": "module.gui",
"testDir": "../../config.tests",
"commandline": {
"options": {
- "d3d12": "boolean",
"quick-animatedimage": "boolean",
"quick-canvas": "boolean",
"quick-designer": "boolean",
@@ -26,24 +27,7 @@
}
},
- "tests": {
- "d3d12": {
- "label": "Direct3D 12",
- "type": "compile",
- "test": "d3d12"
- }
- },
-
"features": {
- "d3d12": {
- "label": "Direct3D 12",
- "purpose": "Provides a Direct3D 12 backend for the scenegraph.",
- "section": "Qt Quick",
- "condition": "tests.d3d12",
- "output": [
- "publicFeature"
- ]
- },
"quick-animatedimage": {
"label": "AnimatedImage item",
"purpose": "Provides the AnimatedImage item.",
@@ -200,7 +184,6 @@
{
"section": "Qt Quick",
"entries": [
- "d3d12",
"quick-animatedimage",
"quick-canvas",
"quick-designer",
diff --git a/src/quick/dependencies.json b/src/quick/dependencies.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/src/quick/dependencies.json
@@ -0,0 +1 @@
+[]
diff --git a/src/quick/designer/qquickdesignercustomobjectdata.cpp b/src/quick/designer/qquickdesignercustomobjectdata.cpp
index 8989de711e..6b39f5157b 100644
--- a/src/quick/designer/qquickdesignercustomobjectdata.cpp
+++ b/src/quick/designer/qquickdesignercustomobjectdata.cpp
@@ -192,7 +192,7 @@ void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext *context, const
QQmlAbstractBinding *binding = QQmlPropertyPrivate::binding(property);
if (binding && !(hasValidResetBinding(propertyName) && getResetBinding(propertyName) == binding)) {
- binding->setEnabled(false, nullptr);
+ binding->setEnabled(false, {});
}
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 91458527dd..0d46e3408d 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -38,7 +38,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtquick/qtquick.tags
-depends += qtcore qtqml qtqmltest qtgui qtlinguist qtquickcontrols qtquickcontrols1 qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns
+depends += qtcore qtqml qtqmlmodels qtqmltest qtgui qtlinguist qtquickcontrols qtquickcontrols1 qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns
headerdirs += ..\
../../quick \
@@ -70,6 +70,9 @@ sourcedirs += ../../plugins
#exclude certain directories
excludedirs += ../../imports/models \
+ ../../imports/labsmodels \
+ ../../imports/testlib \
+ ../../imports/workerscript \
../../imports/statemachine
excludefiles += ../util/qquickpropertychanges_p.h
diff --git a/src/quick/doc/snippets/cmake-macros/examples.cmake b/src/quick/doc/snippets/cmake-macros/examples.cmake
index 8ca6180f9b..cecc59debc 100644
--- a/src/quick/doc/snippets/cmake-macros/examples.cmake
+++ b/src/quick/doc/snippets/cmake-macros/examples.cmake
@@ -3,4 +3,4 @@ find_package(Qt5 COMPONENTS Quick QmlImportScanner)
add_executable(myapp main.cpp)
target_link_libraries(myapp Qt5::Quick)
qt5_import_qml_plugins(myapp)
-#! [qt5_import_plugins]
+#! [qt5_import_qml_plugins]
diff --git a/src/quick/doc/snippets/qml/listview/ReusableDelegate.qml b/src/quick/doc/snippets/qml/listview/ReusableDelegate.qml
new file mode 100644
index 0000000000..050572d5f2
--- /dev/null
+++ b/src/quick/doc/snippets/qml/listview/ReusableDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation 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.15
+
+//![0]
+Component {
+ id: listViewDelegate
+ Rectangle {
+ width: 100
+ height: 50
+
+ ListView.onPooled: rotationAnimation.pause()
+ ListView.onReused: rotationAnimation.resume()
+
+ Rectangle {
+ id: rect
+ anchors.centerIn: parent
+ width: 40
+ height: 5
+ color: "green"
+
+ RotationAnimation {
+ id: rotationAnimation
+ target: rect
+ duration: (Math.random() * 2000) + 200
+ from: 0
+ to: 359
+ running: true
+ loops: Animation.Infinite
+ }
+ }
+ }
+}
+//![0]
diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
index e83aa39734..86292921a6 100644
--- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc
@@ -34,11 +34,10 @@
Originally, Qt Quick always relied on OpenGL (OpenGL ES 2.0 or OpenGL 2.0) to
parse the scene graph and render the results to a render target
-From Qt 5.8 onwards, Qt Quick also supports rendering in software, with OpenVG,
-and with Direct3D 12. This is realized by having additional scene graph
-adaptations, either in form of plugins (d3d12, openvg) or built-in to the Qt
-Quick library (software). The default adaptation continues to rely directly on
-OpenGL.
+From Qt 5.8 onwards, Qt Quick also supports rendering in software, and with
+OpenVG. This is realized by having additional scene graph adaptations, either
+in form of plugins (openvg) or built-in to the Qt Quick library
+(software). The default adaptation continues to rely directly on OpenGL.
From Qt 5.14 onwards, the default adaptation gains the option of rendering via
a graphics abstraction layer, the Qt Rendering Hardware Interface (RHI),
@@ -52,10 +51,10 @@ appropriate for the various graphics APIs.
\target Switching Between the Adaptation Used by the Application
\section1 Switch Between Adaptations in Your Application
-Unlike \c software or \c d3d12, the RHI-based renderer is not an additional
+Unlike \c software, the RHI-based renderer is not an additional
adaptation, and is always built-in. As of Qt 5.14 it can be enabled by setting
the environment variable \c{QSG_RHI} to a non-zero value before starting the
-application, or via \l QQuickWindow::setScenegraphBackend() in combination with
+application, or via \l QQuickWindow::setSceneGraphBackend() in combination with
\l QSGRendererInterface::GraphicsApi. When none of this is done, OpenGL is used
directly like in previous versions.
@@ -75,8 +74,6 @@ The following backends are supported:
different than the ones listed below.
\li Software - Request with the \c{"software"} string or the QSGRendererInterface::Software
enum value.
- \li Direct3D 12 - Request with the \c{"d3d12"} string or the QSGRendererInterface::Direct3D12
- enum value.
\li OpenVG - Request with the \c{"openvg"} string or the QSGRendererInterface::OpenVG enum
value.
\endlist
@@ -111,12 +108,6 @@ The Software adaptation is an alternative renderer for \l{Qt Quick} 2 that uses
engine to render the contents of the scene graph. For more details, see
\l{qtquick-visualcanvas-adaptations-software.html}{Software Adaptation}.
-\section1 Direct3D 12 (experimental)
-
-The Direct3D 12 adaptation is an alternative renderer for \l{Qt Quick} 2 when running on Windows
-10, both for Win32 and UWP applications. For more details, see
-\l{qtquick-visualcanvas-adaptations-d3d12.html}{Direct3D 12 Adaptation}.
-
\section1 OpenVG
The OpenVG adaptation is an alternative renderer for \l{Qt Quick} 2 that renders the contents of
@@ -172,235 +163,6 @@ behavior, which is only present in the default OpenGL adaptation.
/*!
-\title Qt Quick Direct3D 12 Adaptation
-\page qtquick-visualcanvas-adaptations-d3d12.html
-
-The Direct3D 12 adaptation for Windows 10, both in Win32 (\c windows platform plugin) and in UWP
-(\c winrt platform plugin), is shipped as a dynamically loaded plugin. This adaptation doesn't work
-on earlier Windows versions. Building this plugin is enabled automatically, whenever the necessary
-D3D and DXGI develpoment files are present. In practice, this currently means Visual Studio 2015
-and newer.
-
-The adaptation is available both in normal, OpenGL-enabled Qt builds, and also when Qt is
-configured with \c{-no-opengl}. However, it's never the default, meaning that the user or the
-application has to explicitly request it by setting the \c{QT_QUICK_BACKEND} environment variable
-to \c{d3d12} or by calling QQuickWindow::setSceneGraphBackend().
-
-\section2 Motivation
-
-This experimental adaptation is the first Qt Quick backend that focuses on a modern, lower-level
-graphics API in combination with a windowing system interface that's different from the traditional
-approaches used in combination with OpenGL.
-
-This adaptation also allows better integration with Windows, as Direct3D is the primary
-vendor-supported solution. Consequently, there are fewer problems anticipated with drivers,
-operations like window resizes, and special events like graphics device loss caused by device
-resets or graphics driver updates.
-
-Performance-wise, the general expectation is a somewhat lower CPU usage compared to OpenGL, due to
-lower driver overhead, and a higher GPU utilization with less idle time wastage. The backend
-doesn't heavily utilize threads yet, which means there are opportunities for further improvements
-in the future, for example to further optimize image loading.
-
-The D3D12 backend also introduces support for pre-compiled shaders. All the backend's own shaders
-(used by the built-in materials on which the Rectangle, Image, Text, and other QML types are built
-with) are compiled to D3D shader bytecode when you compile Qt. Applications using ShaderEffect
-items can choose to ship bytecode either in regular files, via the Qt resource system, or use
-High Level Shading Language for DirectX (HLSL) source strings. Unlike OpenGL, the compilation for
-HLSL is properly threaded, meaning shader compilation won't block the application and its user
-interface.
-
-\section2 Graphics Adapters
-
-The plugin does not necessarily require hardware acceleration. You can also use WARP, the Direct3D
-software rasterizer. By default, the first adapter providing hardware acceleration is chosen. To
-override this and use another graphics adapter or to force the use of the software rasterizer, set
-the \c{QT_D3D_ADAPTER_INDEX} environment variable to the index of the adapter. The adapters
-discovered are printed at startup when \c{QSG_INFO} or the \c{qt.scenegraph.general} logging
-category is enabled.
-
-\section2 Troubleshooting
-
-If you encounter issues, always set the \c{QSG_INFO} and \c{QT_D3D_DEBUG} environment variables
-to \c 1, to get debug and warning messages printed on the debug output. \c{QT_D3D_DEBUG} enables
-the Direct3D debug layer.
-
-\note The debug layer shouldn't be enabled in production use, since it can significantly impact
-performance (CPU load) due to increased API overhead.
-
-\section2 Render Loops
-
-By default, the D3D12 adaptation uses a single-threaded render loop similar to OpenGL's \c windows
-render loop. A threaded variant is also available, that you can request by setting the
-\c{QSG_RENDER_LOOP} environment variable to \c threaded. However, due to conceptual limitations in
-DXGI, the windowing system interface, the threaded loop is prone to deadlocks when multiple
-QQuickWindow or QQuickView instances are shown. Consequently, for the time being, the default is
-the single-threaded loop. This means that with the D3D12 backend, applications are expected to move
-their work from the main (GUI) thread out to worker threads, instead of expecting Qt to keep the
-GUI thread responsive and suitable for heavy, blocking operations.
-
-For more information see \l{qtquick-visualcanvas-scenegraph.html}{Qt Quick Scene Graph} for
-details on render loops and
-\l{https://docs.microsoft.com/en-us/windows/desktop/direct3darticles/dxgi-best-practices#multithreading-and-dxgi}{Multithreading and DXGI}
-regarding the issues with multithreading.
-
-\section2 Renderer
-
-The scene graph renderer in the D3D12 adaptation currently doesn't perform any batching. This is
-less of an issue, unlike OpenGL, because state changes don't present any problems in the first
-place. The simpler renderer logic can also lead to lower CPU overhead in some cases. The trade-offs
-between the various approaches are currently under research.
-
-\section2 Shader Effects
-
-The ShaderEffect QML type is fully functional with the D3D12 adaptation as well. However, the
-interpretation of the fragmentShader and vertexShader properties is different than with OpenGL.
-
-With D3D12, these strings can either be a URL for a local file, a file in the resource system,
-or an HLSL source string. Using a URL for a local file or a file in the resource system
-indicates that the file in question contains pre-compiled D3D shader bytecode generated by the
-\c fxc tool, or, alternatively, HLSL source code. The type of file is detected automatically.
-This means that the D3D12 backend supports all options from GraphicsInfo.shaderCompilationType
-and GraphicsInfo.shaderSourceType.
-
-Unlike OpenGL, whenever you open a file, there is a QFileSelector with the extra \c hlsl selector
-used. This provides easy creation of ShaderEffect items that are functional across both backends,
-for example by placing the GLSL source code into \c{shaders/effect.frag}, the HLSL source code or
-- preferably - pre-compiled bytecode into \c{shaders/+hlsl/effect.frag}, while simply writing
-\c{fragmentShader: "qrc:shaders/effect.frag"} in QML. For more details, see ShaderEffect.
-
-\section2 Multisample Render Targets
-
-The Direct3D 12 adaptation ignores the QSurfaceFormat set on the QQuickWindow or QQuickView, or
-set via QSurfaceFormat::setDefaultFormat(), with two exceptions: QSurfaceFormat::samples() and
-QSurfaceFormat::alphaBufferSize() are still taken into account. When the sample value is greater
-than 1, multisample offscreen render targets will be created with the specified sample count at
-the maximum supported quality level. The backend automatically performs resolving into the
-non-multisample swapchain buffers after each frame.
-
-\section2 Semi-transparent Windows
-
-When the alpha channel is enabled either via QQuickWindow::setDefaultAlphaBuffer() or by setting
-alphaBufferSize to a non-zero value in the window's QSurfaceFormat or in the global format managed
-by QSurfaceFormat::setDefaultFormat(), the D3D12 backend will create a swapchain for composition
-and go through DirectComposition. This is necessary, because the mandatory flip model swapchain
-wouldn't support transparency otherwise.
-
-Therefore, it's important not to unneccessarily request an alpha channel. When the alphaBufferSize
-is 0 or the default -1, all these extra steps can be avoided and the traditional window-based
-swapchain is sufficient.
-
-On WinRT, this isn't relevant because the backend there always uses a composition swapchain which
-is associated with the ISwapChainPanel that backs QWindow on that platform.
-
-\section2 Mipmaps
-
-Mipmap generation is supported and handled transparently to the applications via a built-in compute
-shader. However, at the moment, this feature is experimental and only supports power-of-two images.
-Textures of other size will work too, but this involves a QImage-based scaling on the CPU first.
-Therefore, avoid enabling mipmapping for Non-Power-Of-Two (NPOT) images whenever possible.
-
-\section2 Image Formats
-
-When creating textures via C++ scene graph APIs like QQuickWindow::createTextureFromImage(), 32-bit
-formats won't involve any conversion, they'll map directly to the corresponding \c{R8G8B8A8_UNORM}
-or \c{B8G8R8A8_UNORM} format. Everything else will trigger a QImage-based format conversion on the
-CPU first.
-
-\section2 Unsupported Features
-
-Particles and some other OpenGL-dependent utilities, like QQuickFramebufferObject, are currently
-not supported.
-
-Like with \l{qtquick-visualcanvas-adaptations-software.html}{Software adaptation}, text is always
-rendered using the native method. Distance field-based text rendering is currently not implemented.
-
-The shader sources in the \l {Qt Graphical Effects} module have not been ported to any format other
-than the OpenGL 2.0 compatible one, meaning that the QML types provided by that module are currently
-not functional with the D3D12 backend.
-
-Texture atlases are currently not in use.
-
-The renderer may lack support for certain minor features, such as drawing points and lines with a
-width other than 1.
-
-Custom Qt Quick items using custom scene graph nodes can be problematic because materials are
-inherently tied to the graphics API. Therefore, only items that use the utility rectangle and image
-nodes are functional across all adaptations.
-
-QQuickWidget and its underlying OpenGL-based compositing architecture is not supported. If you need
-to mix with QWidget-based user interfaces, use QWidget::createWindowContainer() to embed the native
-window of the QQuickWindow or QQuickView.
-
-Finally, rendering via QSGEngine and QSGAbstractRenderer is not feasible with the D3D12 adaptation
-at the moment.
-
-\section2 Related APIs
-
-To integrate custom Direct3D 12 rendering, use QSGRenderNode in combination with
-QSGRendererInterface. This approach doesn't rely on OpenGL contexts or API specifics like
-framebuffers, and allows exposing the graphics device and command buffer from the adaptation. It's
-not necessarily suitable for easy integration of all types of content, in particular true 3D, so
-it'll likely get complemented by an alternative to QQuickFramebufferObject in future releases.
-
-To perform runtime decisions based on the adaptation, use QSGRendererInterface from C++ and
-GraphicsInfo from QML. They can also be used to check the level of shader support: shading
-language, compilation approach, and so on.
-
-When creating custom items, use the new QSGRectangleNode and QSGImageNode classes. These replace
-the now deprecated QSGSimpleRectNode and QSGSimpleTextureNode. Unlike their predecessors, these new
-classes are interfaces, and implementations are created via the QQuickWindow::createRectangleNode()
-and QQuickWindow::createImageNode() factory functions.
-
-\section2 Advanced Configuration
-
-The D3D12 adaptation can keep multiple frames in flight, similar to modern game engines. This is
-somewhat different from the traditional "render - swap - wait for vsync" model and allows for
-better GPU utilization at the expense of higher resource use. This means that the renderer will
-be a number of frames ahead of what is displayed on the screen.
-
-For a discussion of flip model swap chains and the typical configuration parameters, refer to
-\l{https://software.intel.com/en-us/articles/sample-application-for-direct3d-12-flip-model-swap-chains}
-{Sample Application for Direct3D 12 Flip Model Swap Chains}.
-
-Vertical synchronization is always enabled, meaning Present() is invoked with an interval of 1.
-
-The configuration can be changed by setting the following environment variables:
-
-\table
- \header
- \li Environment variable
- \li Description
- \row
- \li \c{QT_D3D_BUFFER_COUNT}
- \li The number of swap chain buffers in range 2 - 4. The default value is 3.
- \row
- \li \c{QT_D3D_FRAME_COUNT}
- \li The number of frames prepared without blocking in range 1 - 4. The default value is 2.
- Present() starts blocking after queuing 3 frames (regardless of
- \c{QT_D3D_BUFFER_COUNT}), unless the waitable object is in use. Every additional frame
- increases GPU resource usage since geometry and constant buffer data needs to be
- duplicated, and involves more bookkeeping on the CPU side.
- \row
- \li \c{QT_D3D_WAITABLE_SWAP_CHAIN_MAX_LATENCY}
- \li The frame latency in range 1 - 16. The default value is 0 (disabled).
- Changes the limit for Present() and triggers a wait for an available swap chain buffer
- when beginning each frame. For a detailed discussion, see the article linked above.
- \note Currently, this behavior is experimental.
- \row
- \li \c{QT_D3D_BLOCKING_PRESENT}
- \li The time the CPU should wait, a non-zero value, for the GPU to finish its work after
- each call to Present(). The default value is 0 (disabled). This behavior effectively
- kills all parallelism but makes the behavior resemble the traditional
- swap-blocks-for-vsync model, which can be useful in some special cases. However, this
- behavior is not the same as setting the frame count to 1 because that still avoids
- blocking after Present(), and may only block when starting to prepare the next frame
- (or may not block at all depending on the time gap between the frames).
-\endtable
-
-*/
-
-/*!
\title Qt Quick OpenVG Adaptation
\page qtquick-visualcanvas-adaptations-openvg.html
diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc
index a913af47c1..9a1308440f 100644
--- a/src/quick/doc/src/examples.qdoc
+++ b/src/quick/doc/src/examples.qdoc
@@ -177,6 +177,7 @@ Creator.
\li \l{Scene Graph - OpenGL Under QML}{OpenGL Under QML}
\li \l{Scene Graph - Direct3D 11 Under QML}{Direct3D 11 Under QML}
\li \l{Scene Graph - Vulkan Under QML}{Vulkan Under QML}
+ \li \l{Scene Graph - Vulkan Texture Import}{Vulkan Texture Import}
\li \l{Scene Graph - Custom Rendering with QSGRenderNode}{Render Node}
\li \l{Scene Graph - Painted Item}{Painted Item}
\li \l{Scene Graph - Graph}{Graph}
diff --git a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
index f4a1616943..abfff7cc11 100644
--- a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
+++ b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc
@@ -402,6 +402,43 @@ property MyMenu optionsMenu
For information on performance in QML and Qt Quick,
see \l {Performance Considerations And Suggestions}.
+\section1 Prefer Declarative Bindings Over Imperative Assignments
+
+In QML, it's possible to use imperative JavaScript code to perform tasks
+such as responding to input events, send data over a network, and so on.
+Imperative code has an important place in QML, but it's also important
+to be aware of when not to use it.
+
+For example, consider the following imperative assignment:
+
+\code
+Rectangle {
+ Component.onCompleted: color = "red"
+}
+\endcode
+
+This has the following disadvantages:
+
+\list
+\li It's slow. The color property will first be evaluated with a
+ default-constructed value, and then again with "red" later on.
+\li It delays errors that could be found at build time to run time, slowing
+ down the development process.
+\li It overwrites any declarative binding that was in place. In most cases this
+ is intended, but sometimes it can be unintentional.
+ See \l {Debugging overwriting of bindings} for more information.
+\li It interferes with tooling; Qt Quick Designer, for example, doesn't support
+ JavaScript.
+\endlist
+
+The code can be rewritten to be a declarative binding instead:
+
+\code
+Rectangle {
+ color: "red"
+}
+\endcode
+
\section1 Tools and Utilities
For information on useful tools and utilies that make working with QML and
diff --git a/src/quick/handlers/qquickmultipointhandler_p.h b/src/quick/handlers/qquickmultipointhandler_p.h
index 480f69035b..c0751aa5c5 100644
--- a/src/quick/handlers/qquickmultipointhandler_p.h
+++ b/src/quick/handlers/qquickmultipointhandler_p.h
@@ -81,7 +81,6 @@ public:
signals:
void minimumPointCountChanged();
void maximumPointCountChanged();
- void marginChanged();
void centroidChanged();
protected:
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp
index 884ebd3b86..c498c96454 100644
--- a/src/quick/handlers/qquickpointerhandler.cpp
+++ b/src/quick/handlers/qquickpointerhandler.cpp
@@ -268,8 +268,25 @@ bool QQuickPointerHandler::approveGrabTransition(QQuickEventPoint *point, QObjec
} else if ((d->grabPermissions & CanTakeOverFromItems)) {
QQuickItem * existingItemGrabber = point->grabberItem();
if (existingItemGrabber && !((existingItemGrabber->keepMouseGrab() && point->pointerEvent()->asPointerMouseEvent()) ||
- (existingItemGrabber->keepTouchGrab() && point->pointerEvent()->asPointerTouchEvent())))
+ (existingItemGrabber->keepTouchGrab() && point->pointerEvent()->asPointerTouchEvent()))) {
allowed = true;
+ // If the handler wants to steal the exclusive grab from an Item, the Item can usually veto
+ // by having its keepMouseGrab flag set. But an exception is if that Item is a parent that
+ // normally filters events (such as a Flickable): it needs to be possible for e.g. a
+ // DragHandler to operate on an Item inside a Flickable. Flickable is aggressive about
+ // grabbing on press (for fear of missing updates), but DragHandler uses a passive grab
+ // at first and then expects to be able to steal the grab later on. It cannot respect
+ // Flickable's wishes in that case, because then it would never have a chance.
+ if (existingItemGrabber->keepMouseGrab() &&
+ !(existingItemGrabber->filtersChildMouseEvents() && existingItemGrabber->isAncestorOf(parentItem()))) {
+ QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(parentItem()->window());
+ if (winPriv->isDeliveringTouchAsMouse() && point->pointId() == winPriv->touchMouseId) {
+ qCDebug(lcPointerHandlerGrab) << this << "wants to grab touchpoint" << point->pointId()
+ << "but declines to steal grab from touch-mouse grabber with keepMouseGrab=true" << existingItemGrabber;
+ allowed = false;
+ }
+ }
+ }
}
}
} else {
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 272ebe6b63..f3674d6fa9 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -132,17 +132,16 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point)
}
break;
case QQuickEventPoint::Stationary:
- // Never react in any way when the point hasn't moved.
- // In autotests, the point's position may not even be correct, because
- // QTest::touchEvent(window, touchDevice).stationary(1)
- // provides no opportunity to give a position, so it ends up being random.
+ // If the point hasn't moved since last time, the return value should be the same as last time.
+ // If we return false here, QQuickPointerHandler::handlePointerEvent() will call setActive(false).
+ ret = point->pointId() == this->point().id();
break;
}
// If this is the grabber, returning false from this function will cancel the grab,
// so onGrabChanged(this, CancelGrabExclusive, point) and setPressed(false) will be called.
// But when m_gesturePolicy is DragThreshold, we don't get an exclusive grab, but
// we still don't want to be pressed anymore.
- if (!ret && point->pointId() == this->point().id() && point->state() != QQuickEventPoint::Stationary)
+ if (!ret && point->pointId() == this->point().id())
setPressed(false, true, point);
return ret;
}
diff --git a/src/quick/handlers/qquickwheelhandler.cpp b/src/quick/handlers/qquickwheelhandler.cpp
index 90e4fef97e..16f38af962 100644
--- a/src/quick/handlers/qquickwheelhandler.cpp
+++ b/src/quick/handlers/qquickwheelhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -49,6 +49,7 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel")
/*!
\qmltype WheelHandler
\instantiates QQuickWheelHandler
+ \inherits SinglePointHandler
\inqmlmodule QtQuick
\ingroup qtquick-input-handlers
\brief Handler for the mouse wheel.
@@ -71,7 +72,7 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel")
\snippet pointerHandlers/handlerFlick.qml 0
- Alternatively if \l targetProperty is not set or \l target is null,
+ Alternatively, if \l property is not set or \l target is null,
WheelHandler will not automatically manipulate anything; but the
\l rotation property can be used in a binding to manipulate another
property, or you can implement \c onWheel and handle the wheel event
@@ -79,15 +80,16 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel")
WheelHandler handles only a rotating mouse wheel by default.
Optionally it can handle smooth-scrolling events from touchpad gestures,
- by setting \l acceptedDevices to \c{PointerDevice.Mouse | PointerDevice.TouchPad}.
+ by setting \l {QtQuick::PointerDeviceHandler::}{acceptedDevices} to
+ \c{PointerDevice.Mouse | PointerDevice.TouchPad}.
\note Some non-mouse hardware (such as a touch-sensitive Wacom tablet, or
a Linux laptop touchpad) generates real wheel events from gestures.
WheelHandler will respond to those events as wheel events regardless of the
- setting of the \l acceptedDevices property.
+ setting of the \l {QtQuick::PointerDeviceHandler::}{acceptedDevices}
+ property.
- \sa MouseArea
- \sa Flickable
+ \sa MouseArea, Flickable
*/
QQuickWheelHandler::QQuickWheelHandler(QQuickItem *parent)
@@ -125,13 +127,13 @@ void QQuickWheelHandler::setOrientation(Qt::Orientation orientation)
\qmlproperty bool QtQuick::WheelHandler::invertible
Whether or not to reverse the direction of property change if
- \l QQuickPointerScrollEvent::inverted is true. The default is \c true.
+ QQuickPointerScrollEvent::inverted is true. The default is \c true.
If the operating system has a "natural scrolling" setting that causes
scrolling to be in the same direction as the finger movement, then if this
property is set to \c true, and WheelHandler is directly setting a property
on \l target, the direction of movement will correspond to the system setting.
- If this property is set to \l false, it will invert the \l rotation so that
+ If this property is set to \c false, it will invert the \l rotation so that
the direction of motion is always the same as the direction of finger movement.
*/
bool QQuickWheelHandler::isInvertible() const
@@ -498,6 +500,13 @@ void QQuickWheelHandler::timerEvent(QTimerEvent *event)
}
}
+/*!
+ \qmlsignal QtQuick::WheelHandler::wheel(PointerScrollEvent event)
+
+ This signal is emitted every time this handler receives a \l QWheelEvent:
+ that is, every time the wheel is moved or the scrolling gesture is updated.
+*/
+
QQuickWheelHandlerPrivate::QQuickWheelHandlerPrivate()
: QQuickSinglePointHandlerPrivate()
{
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index c150e4efa2..2da01e9151 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -433,6 +433,19 @@ void QQuickAccessibleAttached::setRole(QAccessible::Role role)
}
}
+bool QQuickAccessibleAttached::wasNameExplicitlySet() const
+{
+ return m_nameExplicitlySet;
+}
+
+// Allows types to attach an accessible name to an item as a convenience,
+// so long as the user hasn't done so themselves.
+void QQuickAccessibleAttached::setNameImplicitly(const QString &name)
+{
+ setName(name);
+ m_nameExplicitlySet = false;
+}
+
QQuickAccessibleAttached *QQuickAccessibleAttached::qmlAttachedProperties(QObject *obj)
{
return new QQuickAccessibleAttached(obj);
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 678c1361ba..b7254d6686 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -122,7 +122,10 @@ public:
return QString();
return m_name;
}
+
+ bool wasNameExplicitlySet() const;
void setName(const QString &name) {
+ m_nameExplicitlySet = true;
if (name != m_name) {
m_name = name;
Q_EMIT nameChanged();
@@ -130,6 +133,7 @@ public:
QAccessible::updateAccessibility(&ev);
}
}
+ void setNameImplicitly(const QString &name);
QString description() const { return m_description; }
void setDescription(const QString &description)
@@ -220,6 +224,7 @@ private:
QAccessible::State m_state;
QAccessible::State m_stateExplicitlySet;
QString m_name;
+ bool m_nameExplicitlySet = false;
QString m_description;
static QMetaMethod sigPress;
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 89340dd992..03280e4c1f 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -448,7 +448,7 @@ Item {
*/
/*!
- \qmlproperty int QtQuick::WheelEvent::inverted
+ \qmlproperty bool QtQuick::WheelEvent::inverted
Returns whether the delta values delivered with the event are inverted.
@@ -1431,6 +1431,135 @@ QQuickEventPoint *QQuickSinglePointEvent::point(int i) const
return nullptr;
}
+
+/*!
+ \qmltype PointerScrollEvent
+ \instantiates QQuickPointerScrollEvent
+ \inqmlmodule QtQuick
+ \ingroup qtquick-input-events
+ \brief Provides information about a scrolling event, such as from a mouse wheel.
+
+ \sa WheelHandler
+*/
+
+/*!
+ \internal
+ \class QQuickPointerScrollEvent
+*/
+
+/*!
+ \readonly
+ \qmlproperty PointerDevice QtQuick::PointerScrollEvent::device
+
+ This property holds the device that generated the event.
+*/
+
+/*!
+ \qmlproperty int QtQuick::PointerScrollEvent::buttons
+
+ This property holds the mouse buttons pressed when the wheel event was generated.
+
+ It contains a bitwise combination of:
+ \list
+ \li \l {Qt::LeftButton} {Qt.LeftButton}
+ \li \l {Qt::RightButton} {Qt.RightButton}
+ \li \l {Qt::MiddleButton} {Qt.MiddleButton}
+ \endlist
+*/
+
+/*!
+ \readonly
+ \qmlproperty int QtQuick::PointerScrollEvent::modifiers
+
+ This property holds the \l {Qt::KeyboardModifier}{keyboard modifier} keys
+ that were pressed immediately before the event occurred.
+
+ It contains a bitwise combination of the following flags:
+ \value Qt.NoModifier
+ No modifier key is pressed.
+ \value Qt.ShiftModifier
+ A Shift key on the keyboard is pressed.
+ \value Qt.ControlModifier
+ A Ctrl key on the keyboard is pressed.
+ \value Qt.AltModifier
+ An Alt key on the keyboard is pressed.
+ \value Qt.MetaModifier
+ A Meta key on the keyboard is pressed.
+ \value Qt.KeypadModifier
+ A keypad button is pressed.
+
+ For example, to react to a Shift key + Left mouse button click:
+ \qml
+ Item {
+ TapHandler {
+ onTapped: {
+ if ((event.button == Qt.LeftButton) && (event.modifiers & Qt.ShiftModifier))
+ doSomething();
+ }
+ }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlproperty point QtQuick::PointerScrollEvent::angleDelta
+
+ This property holds the distance that the wheel is rotated in wheel degrees.
+ The x and y cordinate of this property holds the delta in horizontal and
+ vertical orientation.
+
+ A positive value indicates that the wheel was rotated up/right;
+ a negative value indicates that the wheel was rotated down/left.
+
+ Most mouse types work in steps of 15 degrees, in which case the delta value is a
+ multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
+*/
+
+/*!
+ \qmlproperty point QtQuick::PointerScrollEvent::pixelDelta
+
+ This property holds the delta in screen pixels and is available in platforms that
+ have high-resolution trackpads, such as \macos.
+ The x and y coordinates of this property hold the delta in horizontal and
+ vertical orientation. The value should be used directly to scroll content on screen.
+
+ For platforms without high-resolution touchpad support, pixelDelta will
+ always be (0,0), and angleDelta should be used instead.
+*/
+
+/*!
+ \qmlproperty bool QtQuick::PointerScrollEvent::hasAngleDelta
+
+ Returns whether the \l angleDelta property has a non-null value.
+*/
+
+/*!
+ \qmlproperty bool QtQuick::PointerScrollEvent::hasPixelDelta
+
+ Returns whether the \l pixelDelta property has a non-null value.
+*/
+
+/*!
+ \qmlproperty bool QtQuick::PointerScrollEvent::inverted
+
+ Returns whether the delta values delivered with the event are inverted.
+
+ Normally, a vertical wheel will produce a PointerScrollEvent with positive delta
+ values if the top of the wheel is rotating away from the hand operating it.
+ Similarly, a horizontal wheel movement will produce a PointerScrollEvent with
+ positive delta values if the top of the wheel is moved to the left.
+
+ However, on some platforms this is configurable, so that the same
+ operations described above will produce negative delta values (but with the
+ same magnitude). In a QML component (such as a tumbler or a slider) where
+ it is appropriate to synchronize the movement or rotation of an item with
+ the direction of the wheel, regardless of the system settings, the wheel
+ event handler can use the inverted property to decide whether to negate the
+ \l angleDelta or \l pixelDelta values.
+
+ \note Many platforms provide no such information. On such platforms,
+ \c inverted always returns false.
+*/
QQuickPointerEvent *QQuickPointerScrollEvent::reset(QEvent *event)
{
m_event = static_cast<QInputEvent*>(event);
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 5acf98d471..4615ce43d2 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -90,7 +90,7 @@ class QQuickKeyEvent : public QObject
public:
QQuickKeyEvent()
- : event(QEvent::None, 0, nullptr)
+ : event(QEvent::None, 0, { })
{}
void reset(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
@@ -144,12 +144,11 @@ public:
QQuickMouseEvent()
: _buttons(Qt::NoButton), _modifiers(Qt::NoModifier)
, _wasHeld(false), _isClick(false), _accepted(false)
- , _flags(Qt::MouseEventFlags(nullptr))
{}
void reset(qreal x, qreal y, Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers, bool isClick = false, bool wasHeld = false,
- Qt::MouseEventFlags flags = nullptr)
+ Qt::MouseEventFlags flags = { })
{
_x = x;
_y = y;
@@ -602,6 +601,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerScrollEvent : public QQuickSinglePoint
Q_PROPERTY(bool hasPixelDelta READ hasPixelDelta CONSTANT)
Q_PROPERTY(bool inverted READ isInverted CONSTANT)
+ QML_NAMED_ELEMENT(PointerScrollEvent)
+ QML_UNCREATABLE("PointerScrollEvent is only available via the WheelHandler::wheel signal.")
+ QML_ADDED_IN_MINOR_VERSION(14)
+
public:
QQuickPointerScrollEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr)
: QQuickSinglePointEvent(parent, device) { }
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index d9ec7de611..8ade5b7e37 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -316,7 +316,7 @@ void QQuickFlickablePrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometr
{
Q_Q(QQuickFlickable);
if (item == contentItem) {
- Qt::Orientations orient = nullptr;
+ Qt::Orientations orient;
if (change.xChange())
orient |= Qt::Horizontal;
if (change.yChange())
diff --git a/src/quick/items/qquickgenericshadereffect.cpp b/src/quick/items/qquickgenericshadereffect.cpp
index df61ee853d..a3d04f5dd3 100644
--- a/src/quick/items/qquickgenericshadereffect.cpp
+++ b/src/quick/items/qquickgenericshadereffect.cpp
@@ -78,7 +78,6 @@ QQuickGenericShaderEffect::QQuickGenericShaderEffect(QQuickShaderEffect *item, Q
, m_mgr(nullptr)
, m_fragNeedsUpdate(true)
, m_vertNeedsUpdate(true)
- , m_dirty(nullptr)
{
qRegisterMetaType<QSGGuiThreadShaderEffectManager::ShaderInfo::Type>("ShaderInfo::Type");
for (int i = 0; i < NShader; ++i)
@@ -311,7 +310,7 @@ QSGNode *QQuickGenericShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQui
m_dirty &= ~QSGShaderEffectNode::DirtyShaderGeometry;
}
- m_dirty = nullptr;
+ m_dirty = {};
for (int i = 0; i < NShader; ++i) {
m_dirtyConstants[i].clear();
m_dirtyTextures[i].clear();
diff --git a/src/quick/items/qquickgraphicsinfo.cpp b/src/quick/items/qquickgraphicsinfo.cpp
index 8f6f4386fb..adf620b256 100644
--- a/src/quick/items/qquickgraphicsinfo.cpp
+++ b/src/quick/items/qquickgraphicsinfo.cpp
@@ -95,7 +95,6 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object)
\li GraphicsInfo.Unknown - the default value when no active scenegraph is associated with the item
\li GraphicsInfo.Software - Qt Quick's software renderer based on QPainter with the raster paint engine
\li GraphicsInfo.OpenGL - OpenGL or OpenGL ES
- \li GraphicsInfo.Direct3D12 - Direct3D 12
\li GraphicsInfo.OpenVG - OpenVG
\li GraphicsInfo.OpenGLRhi - OpenGL on top of QRhi, a graphics abstraction layer
\li GraphicsInfo.Direct3D11Rhi - Direct3D 11 on top of QRhi, a graphics abstraction layer
diff --git a/src/quick/items/qquickgraphicsinfo_p.h b/src/quick/items/qquickgraphicsinfo_p.h
index 066a419c37..aa7d15f72d 100644
--- a/src/quick/items/qquickgraphicsinfo_p.h
+++ b/src/quick/items/qquickgraphicsinfo_p.h
@@ -85,7 +85,6 @@ public:
Unknown = QSGRendererInterface::Unknown,
Software = QSGRendererInterface::Software,
OpenGL = QSGRendererInterface::OpenGL,
- Direct3D12 = QSGRendererInterface::Direct3D12,
OpenVG = QSGRendererInterface::OpenVG,
OpenGLRhi = QSGRendererInterface::OpenGLRhi,
Direct3D11Rhi = QSGRendererInterface::Direct3D11Rhi,
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index e69e9cff46..5f6c194bcf 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -497,7 +497,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal
// We've jumped more than a page. Estimate which items are now
// visible and fill from there.
int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns;
- releaseVisibleItems();
+ releaseVisibleItems(reusableFlag);
modelIndex += count;
if (modelIndex >= model->count())
modelIndex = model->count() - 1;
@@ -576,7 +576,7 @@ void QQuickGridViewPrivate::removeItem(FxViewItem *item)
item->releaseAfterTransition = true;
releasePendingTransition.append(item);
} else {
- releaseItem(item);
+ releaseItem(item, QQmlDelegateModel::NotReusable);
}
}
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 840cfe15da..fccacdcce8 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -76,14 +76,8 @@ QSGTexture *QQuickImageTextureProvider::texture() const {
}
QQuickImagePrivate::QQuickImagePrivate()
- : fillMode(QQuickImage::Stretch)
- , paintedWidth(0)
- , paintedHeight(0)
- , pixmapChanged(false)
+ : pixmapChanged(false)
, mipmap(false)
- , hAlign(QQuickImage::AlignHCenter)
- , vAlign(QQuickImage::AlignVCenter)
- , provider(nullptr)
{
}
diff --git a/src/quick/items/qquickimage_p_p.h b/src/quick/items/qquickimage_p_p.h
index e2c467c311..1c4ba88655 100644
--- a/src/quick/items/qquickimage_p_p.h
+++ b/src/quick/items/qquickimage_p_p.h
@@ -80,19 +80,18 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImagePrivate : public QQuickImageBasePrivate
public:
QQuickImagePrivate();
-
- QQuickImage::FillMode fillMode;
- qreal paintedWidth;
- qreal paintedHeight;
void setImage(const QImage &img);
void setPixmap(const QQuickPixmap &pixmap);
bool pixmapChanged : 1;
bool mipmap : 1;
- QQuickImage::HAlignment hAlign;
- QQuickImage::VAlignment vAlign;
+ QQuickImage::HAlignment hAlign = QQuickImage::AlignHCenter;
+ QQuickImage::VAlignment vAlign = QQuickImage::AlignVCenter;
+ QQuickImage::FillMode fillMode = QQuickImage::Stretch;
- QQuickImageTextureProvider *provider;
+ qreal paintedWidth = 0;
+ qreal paintedHeight = 0;
+ QQuickImageTextureProvider *provider = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4c20b7e2e1..8454010ee9 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2074,10 +2074,10 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
in the GPU equal to \c {width x height x 4}. In memory constrained
configurations, large layers should be used with care.
- In the QPainter / QWidget world, it is some times favorable to
+ In the QPainter / QWidget world, it is sometimes favorable to
cache complex content in a pixmap, image or texture. In Qt Quick,
because of the techniques already applied by the \l {Qt Quick
- Scene Graph OpenGL Renderer} {scene graph renderer}, this will in most
+ Scene Graph Default Renderer} {scene graph renderer}, this will in most
cases not be the case. Excessive draw calls are already reduced
because of batching and a cache will in most cases end up blending
more pixels than the original content. The overhead of rendering
@@ -8812,7 +8812,7 @@ QQuickItemPrivate::ExtraData::ExtraData()
effectRefCount(0), hideRefCount(0),
recursiveEffectRefCount(0),
opacityNode(nullptr), clipNode(nullptr), rootNode(nullptr),
- acceptedMouseButtons(nullptr), origin(QQuickItem::Center),
+ origin(QQuickItem::Center),
transparentForPositioner(false)
{
}
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 7c3325fd90..baef37a0ff 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -336,7 +336,7 @@ public:
struct ChangeListener {
using ChangeTypes = QQuickItemPrivate::ChangeTypes;
- ChangeListener(QQuickItemChangeListener *l = nullptr, ChangeTypes t = nullptr)
+ ChangeListener(QQuickItemChangeListener *l = nullptr, ChangeTypes t = { })
: listener(l)
, types(t)
, gTypes(QQuickGeometryChange::All)
@@ -533,7 +533,7 @@ public:
void refWindow(QQuickWindow *);
void derefWindow();
- QQuickItem *subFocusItem;
+ QPointer<QQuickItem> subFocusItem;
void updateSubFocusItem(QQuickItem *scope, bool focus);
QTransform windowToItemTransform() const;
@@ -937,7 +937,7 @@ private:
Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const
{
return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) |
- (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(nullptr)));
+ (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons{}));
}
QSGContext *QQuickItemPrivate::sceneGraphContext() const
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index f7943630c4..bd6b9d741e 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -177,9 +177,6 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject
static void qt_quickitems_defineModule()
{
- const char *uri = "QtQuick";
- const int major = 2;
-
QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent };
QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent);
@@ -187,205 +184,12 @@ static void qt_quickitems_defineModule()
qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId");
qRegisterMetaType<QQuickHandlerPoint>();
- qmlRegisterModule(uri, major, 15);
-
- // Core QtQuick types
- qmlRegisterTypesAndRevisions<
- QPointingDeviceUniqueIdForeign,
- QQuickAnchorAnimation,
- QQuickAnchorChanges,
- QQuickAnchors,
- QQuickAnchorSet,
- QQuickBorderImage,
- QQuickEnterKeyAttached,
- QQuickEventPoint,
- QQuickEventTouchPoint,
- QQuickFlickable,
- QQuickFlickableVisibleArea,
- QQuickFocusScope,
- QQuickGradient,
- QQuickGradientStop,
- QQuickGraphicsInfo,
- QQuickImage,
- QQuickImageBase,
- QQuickItem,
- QQuickItemGrabResult,
- QQuickKeyNavigationAttached,
- QQuickKeysAttached,
- QQuickLayoutMirroringAttached,
- QQuickLoader,
- QQuickMatrix4x4,
- QQuickMouseArea,
- QQuickMultiPointTouchArea,
- QQuickPaintedItem,
- QQuickParentAnimation,
- QQuickParentChange,
- QQuickPen,
- QQuickPinch,
- QQuickPinchArea,
- QQuickPointerDevice,
- QQuickRectangle,
- QQuickRotation,
- QQuickScale,
- QQuickScaleGrid,
- QQuickTouchPoint,
- QQuickTransform,
- QQuickTranslate
- >(uri, major);
-
- // text-related types
- qmlRegisterTypesAndRevisions<
- QQuickText,
- QQuickTextDocument,
- QQuickTextEdit,
- QQuickTextInput,
- QQuickTextLine
- >(uri, major);
-
- // events
- qmlRegisterTypesAndRevisions<
- QQuickCloseEvent,
- QQuickGrabGestureEvent,
- QQuickKeyEvent,
- QQuickMouseEvent,
- QQuickPinchEvent,
- QQuickPointerEvent,
- QQuickPointerMouseEvent,
- QQuickPointerTouchEvent,
- QQuickWheelEvent
- >(uri, major);
-
- // Input Handlers are part of QtQuick, not a separate module, since 5.12
- qmlRegisterTypesAndRevisions<
- QQuickDragHandler,
- QQuickHoverHandler,
- QQuickPinchHandler,
- QQuickPointerHandler,
- QQuickPointHandler,
- QQuickTapHandler
- >(uri, major);
-
-#if QT_CONFIG(accessibility)
- qmlRegisterTypesAndRevisions<QQuickAccessibleAttached>(uri, major);
-#endif
-
-#if QT_CONFIG(opengl)
- qmlRegisterTypesAndRevisions<QQuickOpenGLInfo>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_animatedimage)
- qmlRegisterTypesAndRevisions<QQuickAnimatedImage>(uri, major);
-#else
+#if !QT_CONFIG(quick_animatedimage)
qmlRegisterTypeNotAvailable(
- uri, major, 15, "AnimatedImage",
+ "QtQuick", 2, 15, "AnimatedImage",
QCoreApplication::translate("QQuickAnimatedImage",
"Qt was built without support for QMovie"));
#endif
-
-#if QT_CONFIG(quick_canvas)
- qmlRegisterTypesAndRevisions<QQuickCanvasItem>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_draganddrop)
- qmlRegisterTypesAndRevisions<
- QQuickDropEvent,
- QQuickDrag,
- QQuickDropArea,
- QQuickDropAreaDrag,
- QQuickDragAttached,
- QQuickDragAxis
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_flipable)
- qmlRegisterTypesAndRevisions<QQuickFlipable>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_positioners)
- qmlRegisterTypesAndRevisions<
- QQuickBasePositioner,
- QQuickColumn,
- QQuickFlow,
- QQuickGrid,
- QQuickRow
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_gridview)
- qmlRegisterTypesAndRevisions<QQuickGridView>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_itemview)
- qmlRegisterTypesAndRevisions<QQuickItemView>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_listview)
- qmlRegisterTypesAndRevisions<
- QQuickViewSection,
- QQuickListView
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_path)
- qmlRegisterTypesAndRevisions<
- QQuickCurve,
- QQuickPath,
- QQuickPathAngleArc,
- QQuickPathAnimation,
- QQuickPathArc,
- QQuickPathAttribute,
- QQuickPathCatmullRomCurve,
- QQuickPathCubic,
- QQuickPathElement,
- QQuickPathInterpolator,
- QQuickPathLine,
- QQuickPathMove,
- QQuickPathMultiline,
- QQuickPathPercent,
- QQuickPathPolyline,
- QQuickPathQuad,
- QQuickPathSvg
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_pathview)
- qmlRegisterTypesAndRevisions<QQuickPathView>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_repeater)
- qmlRegisterTypesAndRevisions<QQuickRepeater>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_shadereffect)
- qmlRegisterTypesAndRevisions<
- QQuickBorderImageMesh,
- QQuickGridMesh,
- QQuickItemLayer,
- QQuickShaderEffect,
- QQuickShaderEffectMesh,
- QQuickShaderEffectSource
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_sprite)
- qmlRegisterTypesAndRevisions<
- QQuickAnimatedSprite,
- QQuickSprite,
- QQuickSpriteSequence
- >(uri, major);
-#endif
-
-#if QT_CONFIG(quick_tableview)
- qmlRegisterTypesAndRevisions<QQuickTableView>(uri, major);
-#endif
-
-#if QT_CONFIG(quick_viewtransitions)
- qmlRegisterTypesAndRevisions<QQuickViewTransitionAttached>(uri, major);
-#endif
-
-#if QT_CONFIG(wheelevent)
- qmlRegisterTypesAndRevisions<QQuickWheelHandler>(uri, major);
-#endif
}
static void initResources()
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 661f19509a..031ac6337a 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -197,6 +197,8 @@ void QQuickItemView::setModel(const QVariant &m)
disconnect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
disconnect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*)));
disconnect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*)));
+ disconnect(d->model, SIGNAL(itemPooled(int, QObject *)), this, SLOT(onItemPooled(int, QObject *)));
+ disconnect(d->model, SIGNAL(itemReused(int, QObject *)), this, SLOT(onItemReused(int, QObject *)));
}
QQmlInstanceModel *oldModel = d->model;
@@ -232,10 +234,14 @@ void QQuickItemView::setModel(const QVariant &m)
connect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*)));
connect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
connect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*)));
+ connect(d->model, SIGNAL(itemPooled(int, QObject *)), this, SLOT(onItemPooled(int, QObject *)));
+ connect(d->model, SIGNAL(itemReused(int, QObject *)), this, SLOT(onItemReused(int, QObject *)));
if (isComponentComplete()) {
d->updateSectionCriteria();
d->refill();
- d->currentIndex = -1;
+ /* Setting currentIndex to -2 ensures that we always enter the "currentIndex changed"
+ code path in setCurrentIndex, updating bindings depending on currentIndex.*/
+ d->currentIndex = -2;
setCurrentIndex(d->model->count() > 0 ? 0 : -1);
d->updateViewport();
@@ -252,6 +258,7 @@ void QQuickItemView::setModel(const QVariant &m)
emit countChanged();
}
emit modelChanged();
+ d->moveReason = QQuickItemViewPrivate::Other;
}
QQmlComponent *QQuickItemView::delegate() const
@@ -691,6 +698,28 @@ void QQuickItemView::setHighlightMoveDuration(int duration)
}
}
+bool QQuickItemView::reuseItems() const
+{
+ return bool(d_func()->reusableFlag == QQmlDelegateModel::Reusable);
+}
+
+void QQuickItemView::setReuseItems(bool reuse)
+{
+ Q_D(QQuickItemView);
+ if (reuseItems() == reuse)
+ return;
+
+ d->reusableFlag = reuse ? QQmlDelegateModel::Reusable : QQmlDelegateModel::NotReusable;
+
+ if (!reuse && d->model) {
+ // When we're told to not reuse items, we
+ // immediately, as documented, drain the pool.
+ d->model->drainReusableItemsPool(0);
+ }
+
+ emit reuseItemsChanged();
+}
+
QQuickTransition *QQuickItemView::populateTransition() const
{
Q_D(const QQuickItemView);
@@ -845,7 +874,7 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
setPosition(qMin(itemPos, maxExtent));
// now release the reference to all the old visible items.
for (FxViewItem *item : oldVisible)
- releaseItem(item);
+ releaseItem(item, reusableFlag);
item = visibleItem(idx);
}
if (item) {
@@ -1088,8 +1117,8 @@ qreal QQuickItemViewPrivate::calculatedMaxExtent() const
void QQuickItemViewPrivate::applyDelegateChange()
{
- releaseVisibleItems();
- releaseItem(currentItem);
+ releaseVisibleItems(QQmlDelegateModel::NotReusable);
+ releaseItem(currentItem, QQmlDelegateModel::NotReusable);
currentItem = nullptr;
updateSectionCriteria();
refill();
@@ -1191,7 +1220,7 @@ void QQuickItemView::destroyRemoved()
} else {
if (hasRemoveTransition)
d->runDelayedRemoveTransition = true;
- d->releaseItem(item);
+ d->releaseItem(item, d->reusableFlag);
it = d->visibleItems.erase(it);
}
} else {
@@ -1635,7 +1664,7 @@ void QQuickItemViewPrivate::updateCurrent(int modelIndex)
if (currentItem) {
if (currentItem->attached)
currentItem->attached->setIsCurrentItem(false);
- releaseItem(currentItem);
+ releaseItem(currentItem, reusableFlag);
currentItem = nullptr;
currentIndex = modelIndex;
emit q->currentIndexChanged();
@@ -1672,7 +1701,7 @@ void QQuickItemViewPrivate::updateCurrent(int modelIndex)
if (oldCurrentItem != currentItem
&& (!oldCurrentItem || !currentItem || oldCurrentItem->item != currentItem->item))
emit q->currentItemChanged();
- releaseItem(oldCurrentItem);
+ releaseItem(oldCurrentItem, reusableFlag);
}
void QQuickItemViewPrivate::clear(bool onDestruction)
@@ -1682,17 +1711,17 @@ void QQuickItemViewPrivate::clear(bool onDestruction)
bufferedChanges.reset();
timeline.clear();
- releaseVisibleItems();
+ releaseVisibleItems(QQmlInstanceModel::NotReusable);
visibleIndex = 0;
for (FxViewItem *item : qAsConst(releasePendingTransition)) {
item->releaseAfterTransition = false;
- releaseItem(item);
+ releaseItem(item, QQmlInstanceModel::NotReusable);
}
releasePendingTransition.clear();
auto oldCurrentItem = currentItem;
- releaseItem(currentItem);
+ releaseItem(currentItem, QQmlDelegateModel::NotReusable);
currentItem = nullptr;
if (oldCurrentItem)
emit q->currentItemChanged();
@@ -1751,7 +1780,7 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
if (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges()) {
currentChanges.reset();
bufferedChanges.reset();
- releaseVisibleItems();
+ releaseVisibleItems(reusableFlag);
}
int prevCount = itemCount;
@@ -1790,6 +1819,7 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
if (prevCount != itemCount)
emit q->countChanged();
} while (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges());
+ storeFirstVisibleItemPosition();
}
void QQuickItemViewPrivate::regenerate(bool orientationChanged)
@@ -1876,6 +1906,7 @@ void QQuickItemViewPrivate::layout()
updateSections();
layoutVisibleItems();
+ storeFirstVisibleItemPosition();
int lastIndexInView = findLastIndexInView();
refill();
@@ -1903,21 +1934,25 @@ void QQuickItemViewPrivate::layout()
prepareVisibleItemTransitions();
- for (auto it = releasePendingTransition.begin(); it != releasePendingTransition.end(); ) {
- auto old_count = releasePendingTransition.count();
- auto success = prepareNonVisibleItemTransition(*it, viewBounds);
- // prepareNonVisibleItemTransition() may invalidate iterators while in fast flicking
- // invisible animating items are kicked in or out the viewPort
- // use old_count to test if the abrupt erasure occurs
- if (old_count > releasePendingTransition.count()) {
+ // We cannot use iterators here as erasing from a container invalidates them.
+ for (int i = 0, count = releasePendingTransition.count(); i < count;) {
+ auto success = prepareNonVisibleItemTransition(releasePendingTransition[i], viewBounds);
+ // prepareNonVisibleItemTransition() may remove items while in fast flicking.
+ // Invisible animating items are kicked in or out the viewPort.
+ // Recheck count to test if the item got removed. In that case the same index points
+ // to a different item now.
+ const int old_count = count;
+ count = releasePendingTransition.count();
+ if (old_count > count)
continue;
- }
+
if (!success) {
- releaseItem(*it);
- it = releasePendingTransition.erase(it);
- continue;
+ releaseItem(releasePendingTransition[i], reusableFlag);
+ releasePendingTransition.remove(i);
+ --count;
+ } else {
+ ++i;
}
- ++it;
}
for (int i=0; i<visibleItems.count(); i++)
@@ -1960,7 +1995,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
prevFirstItemInViewPos = prevFirstItemInView->position();
prevFirstItemInViewIndex = prevFirstItemInView->index;
}
- qreal prevVisibleItemsFirstPos = visibleItems.count() ? visibleItems.constFirst()->position() : 0.0;
+ qreal prevVisibleItemsFirstPos = visibleItems.count() ? firstVisibleItemPosition : 0.0;
totalInsertionResult->visiblePos = prevFirstItemInViewPos;
totalRemovalResult->visiblePos = prevFirstItemInViewPos;
@@ -2006,6 +2041,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
if (!insertions.isEmpty()) {
repositionFirstItem(prevVisibleItemsFirst, prevVisibleItemsFirstPos, prevFirstItemInView, &insertionResult, &removalResult);
layoutVisibleItems(removals.first().index);
+ storeFirstVisibleItemPosition();
}
}
@@ -2026,6 +2062,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
if (i < insertions.count() - 1) {
repositionFirstItem(prevVisibleItemsFirst, prevVisibleItemsFirstPos, prevFirstItemInView, &insertionResult, &removalResult);
layoutVisibleItems(insertions[i].index);
+ storeFirstVisibleItemPosition();
}
itemCount += insertions[i].count;
}
@@ -2056,9 +2093,9 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
// Whatever removed/moved items remain are no longer visible items.
prepareRemoveTransitions(&currentChanges.removedItems);
- for (QHash<QQmlChangeSet::MoveKey, FxViewItem *>::Iterator it = currentChanges.removedItems.begin();
+ for (auto it = currentChanges.removedItems.begin();
it != currentChanges.removedItems.end(); ++it) {
- releaseItem(it.value());
+ releaseItem(it.value(), reusableFlag);
}
currentChanges.removedItems.clear();
@@ -2067,7 +2104,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
if (currentItem->item && currentItem->attached)
currentItem->attached->setIsCurrentItem(false);
auto oldCurrentItem = currentItem;
- releaseItem(currentItem);
+ releaseItem(currentItem, reusableFlag);
currentItem = nullptr;
if (oldCurrentItem)
emit q->currentItemChanged();
@@ -2148,11 +2185,11 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQmlChangeSet::Ch
removeResult->sizeChangesAfterVisiblePos += item->size();
}
if (removal.isMove()) {
- currentChanges.removedItems.insert(removal.moveKey(item->index), item);
+ currentChanges.removedItems.replace(removal.moveKey(item->index), item);
item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
} else {
// track item so it is released later
- currentChanges.removedItems.insertMulti(QQmlChangeSet::MoveKey(), item);
+ currentChanges.removedItems.insert(QQmlChangeSet::MoveKey(), item);
}
if (!removeResult->changedFirstItem && item == *visibleItems.constBegin())
removeResult->changedFirstItem = true;
@@ -2223,15 +2260,14 @@ void QQuickItemViewPrivate::prepareVisibleItemTransitions()
visibleItems[i]->prepareTransition(transitioner, viewBounds);
}
-void QQuickItemViewPrivate::prepareRemoveTransitions(QHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems)
+void QQuickItemViewPrivate::prepareRemoveTransitions(QMultiHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems)
{
if (!transitioner)
return;
if (transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, true)
|| transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, false)) {
- for (QHash<QQmlChangeSet::MoveKey, FxViewItem *>::Iterator it = removedItems->begin();
- it != removedItems->end(); ) {
+ for (auto it = removedItems->begin(); it != removedItems->end(); ) {
bool isRemove = it.key().moveId < 0;
if (isRemove) {
FxViewItem *item = *it;
@@ -2274,7 +2310,7 @@ void QQuickItemViewPrivate::viewItemTransitionFinished(QQuickItemViewTransitiona
{
for (int i=0; i<releasePendingTransition.count(); i++) {
if (releasePendingTransition.at(i)->transitionableItem == item) {
- releaseItem(releasePendingTransition.takeAt(i));
+ releaseItem(releasePendingTransition.takeAt(i), reusableFlag);
return;
}
}
@@ -2380,7 +2416,23 @@ void QQuickItemView::destroyingItem(QObject *object)
}
}
-bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
+void QQuickItemView::onItemPooled(int modelIndex, QObject *object)
+{
+ Q_UNUSED(modelIndex);
+
+ if (auto *attached = d_func()->getAttachedObject(object))
+ emit attached->pooled();
+}
+
+void QQuickItemView::onItemReused(int modelIndex, QObject *object)
+{
+ Q_UNUSED(modelIndex);
+
+ if (auto *attached = d_func()->getAttachedObject(object))
+ emit attached->reused();
+}
+
+bool QQuickItemViewPrivate::releaseItem(FxViewItem *item, QQmlInstanceModel::ReusableFlag reusableFlag)
{
Q_Q(QQuickItemView);
if (!item)
@@ -2391,13 +2443,19 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
QQmlInstanceModel::ReleaseFlags flags = {};
if (model && item->item) {
- flags = model->release(item->item);
+ flags = model->release(item->item, reusableFlag);
if (!flags) {
// item was not destroyed, and we no longer reference it.
- QQuickItemPrivate::get(item->item)->setCulled(true);
+ if (item->item->parentItem() == contentItem) {
+ // Only cull the item if its parent item is still our contentItem.
+ // One case where this can happen is moving an item out of one ObjectModel and into another.
+ QQuickItemPrivate::get(item->item)->setCulled(true);
+ }
unrequestedItems.insert(item->item, model->indexOf(item->item, q));
} else if (flags & QQmlInstanceModel::Destroyed) {
item->item->setParentItem(nullptr);
+ } else if (flags & QQmlInstanceModel::Pooled) {
+ item->setVisible(false);
}
}
delete item;
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index 6bc00411f0..521580d292 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -110,6 +110,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickItemView : public QQuickFlickable
Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd)
Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged)
+ Q_PROPERTY(bool reuseItems READ reuseItems WRITE setReuseItems NOTIFY reuseItemsChanged REVISION 15)
+
QML_NAMED_ELEMENT(ItemView)
QML_UNCREATABLE("ItemView is an abstract base class.")
QML_ADDED_IN_MINOR_VERSION(1)
@@ -226,6 +228,9 @@ public:
int highlightMoveDuration() const;
virtual void setHighlightMoveDuration(int);
+ bool reuseItems() const;
+ void setReuseItems(bool reuse);
+
enum PositionMode { Beginning, Center, End, Visible, Contain, SnapPosition };
Q_ENUM(PositionMode)
@@ -281,6 +286,8 @@ Q_SIGNALS:
void preferredHighlightEndChanged();
void highlightMoveDurationChanged();
+ Q_REVISION(15) void reuseItemsChanged();
+
protected:
void updatePolish() override;
void componentComplete() override;
@@ -296,6 +303,8 @@ protected Q_SLOTS:
virtual void initItem(int index, QObject *item);
void modelUpdated(const QQmlChangeSet &changeSet, bool reset);
void destroyingItem(QObject *item);
+ void onItemPooled(int modelIndex, QObject *object);
+ void onItemReused(int modelIndex, QObject *object);
void animStopped();
void trackedPositionChanged();
@@ -399,6 +408,9 @@ Q_SIGNALS:
void prevSectionChanged();
void nextSectionChanged();
+ void pooled();
+ void reused();
+
public:
QPointer<QQuickItemView> m_view;
bool m_isCurrent : 1;
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 6442fee27d..48f47a356b 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -92,7 +92,7 @@ public:
int itemCount;
int newCurrentIndex;
QQmlChangeSet pendingChanges;
- QHash<QQmlChangeSet::MoveKey, FxViewItem *> removedItems;
+ QMultiHash<QQmlChangeSet::MoveKey, FxViewItem *> removedItems;
bool active : 1;
bool currentChanged : 1;
@@ -174,7 +174,7 @@ public:
void mirrorChange() override;
FxViewItem *createItem(int modelIndex,QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested);
- virtual bool releaseItem(FxViewItem *item);
+ virtual bool releaseItem(FxViewItem *item, QQmlInstanceModel::ReusableFlag reusableFlag);
QQuickItem *createHighlightItem() const;
QQuickItem *createComponentItem(QQmlComponent *component, qreal zValue, bool createDefault = false) const;
@@ -203,7 +203,7 @@ public:
void createTransitioner();
void prepareVisibleItemTransitions();
- void prepareRemoveTransitions(QHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems);
+ void prepareRemoveTransitions(QMultiHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems);
bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds);
void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) override;
@@ -238,15 +238,17 @@ public:
q->polish();
}
- void releaseVisibleItems() {
+ void releaseVisibleItems(QQmlInstanceModel::ReusableFlag reusableFlag) {
// make a copy and clear the visibleItems first to avoid destroyed
// items being accessed during the loop (QTBUG-61294)
const QList<FxViewItem *> oldVisible = visibleItems;
visibleItems.clear();
for (FxViewItem *item : oldVisible)
- releaseItem(item);
+ releaseItem(item, reusableFlag);
}
+ virtual QQuickItemViewAttached *getAttachedObject(const QObject *) const { return nullptr; }
+
QPointer<QQmlInstanceModel> model;
QVariant modelVariant;
int itemCount;
@@ -260,6 +262,12 @@ public:
MovementReason moveReason;
QList<FxViewItem *> visibleItems;
+ qreal firstVisibleItemPosition = 0;
+ void storeFirstVisibleItemPosition() {
+ if (!visibleItems.isEmpty()) {
+ firstVisibleItemPosition = visibleItems.constFirst()->position();
+ }
+ }
int visibleIndex;
int currentIndex;
FxViewItem *currentItem;
@@ -282,6 +290,11 @@ public:
QQmlComponent *footerComponent;
FxViewItem *footer;
+ // Reusing delegate items cannot be on by default for backwards compatibility.
+ // Reusing an item will e.g mean that Component.onCompleted will only be called for an
+ // item when it's created and not when it's reused, which will break legacy applications.
+ QQmlInstanceModel::ReusableFlag reusableFlag = QQmlInstanceModel::NotReusable;
+
struct MovedItem {
FxViewItem *item;
QQmlChangeSet::MoveKey moveKey;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 23925871e5..badd2efe29 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -92,7 +92,7 @@ public:
FxViewItem *newViewItem(int index, QQuickItem *item) override;
void initializeViewItem(FxViewItem *item) override;
- bool releaseItem(FxViewItem *item) override;
+ bool releaseItem(FxViewItem *item, QQmlInstanceModel::ReusableFlag reusableFlag) override;
void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override;
void repositionPackageItemAt(QQuickItem *item, int index) override;
void resetFirstItemPosition(qreal pos = 0.0) override;
@@ -139,6 +139,8 @@ public:
bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) override;
+ QQuickItemViewAttached *getAttachedObject(const QObject *object) const override;
+
QQuickListView::Orientation orient;
qreal visiblePos;
qreal averageSize;
@@ -634,15 +636,15 @@ void QQuickListViewPrivate::initializeViewItem(FxViewItem *item)
}
}
-bool QQuickListViewPrivate::releaseItem(FxViewItem *item)
+bool QQuickListViewPrivate::releaseItem(FxViewItem *item, QQmlInstanceModel::ReusableFlag reusableFlag)
{
if (!item || !model)
- return QQuickItemViewPrivate::releaseItem(item);
+ return QQuickItemViewPrivate::releaseItem(item, reusableFlag);
QPointer<QQuickItem> it = item->item;
QQuickListViewAttached *att = static_cast<QQuickListViewAttached*>(item->attached);
- bool released = QQuickItemViewPrivate::releaseItem(item);
+ bool released = QQuickItemViewPrivate::releaseItem(item, reusableFlag);
if (released && it && att && att->m_sectionItem) {
// We hold no more references to this item
int i = 0;
@@ -682,7 +684,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal
int newModelIdx = qBound(0, modelIndex + count, model->count());
count = newModelIdx - modelIndex;
if (count) {
- releaseVisibleItems();
+ releaseVisibleItems(reusableFlag);
modelIndex = newModelIdx;
visibleIndex = modelIndex;
visiblePos = itemEnd + count * (averageSize + spacing);
@@ -737,7 +739,7 @@ void QQuickListViewPrivate::removeItem(FxViewItem *item)
releasePendingTransition.append(item);
} else {
qCDebug(lcItemViewDelegateLifecycle) << "\treleasing stationary item" << item->index << (QObject *)(item->item);
- releaseItem(item);
+ releaseItem(item, reusableFlag);
}
}
@@ -808,6 +810,7 @@ void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex)
FxViewItem *firstItem = *visibleItems.constBegin();
bool fixedCurrent = currentItem && firstItem->item == currentItem->item;
+ firstVisibleItemPosition = firstItem->position();
qreal sum = firstItem->size();
qreal pos = firstItem->position() + firstItem->size() + spacing;
firstItem->setVisible(firstItem->endPosition() >= from && firstItem->position() <= to);
@@ -1771,6 +1774,12 @@ void QQuickListViewPrivate::setSectionHelper(QQmlContext *context, QQuickItem *s
sectionItem->setProperty("section", section);
}
+QQuickItemViewAttached *QQuickListViewPrivate::getAttachedObject(const QObject *object) const
+{
+ QObject *attachedObject = qmlAttachedPropertiesObject<QQuickListView>(object);
+ return static_cast<QQuickItemViewAttached *>(attachedObject);
+}
+
//----------------------------------------------------------------------------
/*!
@@ -1919,6 +1928,39 @@ void QQuickListViewPrivate::setSectionHelper(QQmlContext *context, QQuickItem *s
of type \l [QML] {real}, so it is possible to set fractional
values like \c 0.1.
+ \section1 Reusing items
+
+ Since 5.15, ListView can be configured to recycle items instead of instantiating
+ from the \l delegate whenever new rows are flicked into view. This approach improves
+ performance, depending on the complexity of the delegate. Reusing
+ items is off by default (for backwards compatibility reasons), but can be switched
+ on by setting the \l reuseItems property to \c true.
+
+ When an item is flicked out, it moves to the \e{reuse pool}, which is an
+ internal cache of unused items. When this happens, the \l ListView::pooled
+ signal is emitted to inform the item about it. Likewise, when the item is
+ moved back from the pool, the \l ListView::reused signal is emitted.
+
+ Any item properties that come from the model are updated when the
+ item is reused. This includes \c index and \c row, but also
+ any model roles.
+
+ \note Avoid storing any state inside a delegate. If you do, reset it
+ manually on receiving the \l ListView::reused signal.
+
+ If an item has timers or animations, consider pausing them on receiving
+ the \l ListView::pooled signal. That way you avoid using the CPU resources
+ for items that are not visible. Likewise, if an item has resources that
+ cannot be reused, they could be freed up.
+
+ \note While an item is in the pool, it might still be alive and respond
+ to connected signals and bindings.
+
+ The following example shows a delegate that animates a spinning rectangle. When
+ it is pooled, the animation is temporarily paused:
+
+ \snippet qml/listview/reusabledelegate.qml 0
+
\sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views}
*/
QQuickListView::QQuickListView(QQuickItem *parent)
@@ -2085,6 +2127,20 @@ QQuickListView::~QQuickListView()
*/
/*!
+ \qmlproperty bool QtQuick::ListView::reuseItems
+
+ This property enables you to reuse items that are instantiated
+ from the \l delegate. If set to \c false, any currently
+ pooled items are destroyed.
+
+ This property is \c false by default.
+
+ \since 5.15
+
+ \sa {Reusing items}, ListView::pooled, ListView::reused
+*/
+
+/*!
\qmlproperty Component QtQuick::ListView::highlight
This property holds the component to use as the highlight.
@@ -2095,7 +2151,7 @@ QQuickListView::~QQuickListView()
highlight item is \c 0.
\sa highlightItem, highlightFollowsCurrentItem,
- {Qt Quick Examples - Views#Highlight}{ListView highlight example},
+ {Qt Quick Examples - Views#Using Highlight}{ListView Highlight Example},
{Stacking Order in ListView}
*/
@@ -2654,21 +2710,25 @@ void QQuickListView::setSnapMode(SnapMode mode)
This property determines the positioning of the \l{headerItem}{header item}.
- The possible values are:
- \list
- \li ListView.InlineHeader (default) - the header is positioned in the beginning
+ \value ListView.InlineHeader (default) The header is positioned at the beginning
of the content and moves together with the content like an ordinary item.
- \li ListView.OverlayHeader - the header is positioned in the beginning of the view.
- \li ListView.PullBackHeader - the header is positioned in the beginning of the view.
+
+ \value ListView.OverlayHeader The header is positioned at the beginning of the view.
+
+ \value ListView.PullBackHeader The header is positioned at the beginning of the view.
The header can be pushed away by moving the content forwards, and pulled back by
moving the content backwards.
- \endlist
\note This property has no effect on the \l {QQuickItem::z}{stacking order}
of the header. For example, if the header should be shown above the
\l delegate items when using \c ListView.OverlayHeader, its Z value
should be set to a value higher than that of the delegates. For more
information, see \l {Stacking Order in ListView}.
+
+ \note If \c headerPositioning is not set to \c ListView.InlineHeader, the
+ user cannot press and flick the list from the header. In any case, the
+ \l{headerItem}{header item} may contain items or event handlers that
+ provide custom handling of mouse or touch input.
*/
QQuickListView::HeaderPositioning QQuickListView::headerPositioning() const
{
@@ -2697,21 +2757,25 @@ void QQuickListView::setHeaderPositioning(QQuickListView::HeaderPositioning posi
This property determines the positioning of the \l{footerItem}{footer item}.
- The possible values are:
- \list
- \li ListView.InlineFooter (default) - the footer is positioned in the end
+ \value ListView.InlineFooter (default) The footer is positioned at the end
of the content and moves together with the content like an ordinary item.
- \li ListView.OverlayFooter - the footer is positioned in the end of the view.
- \li ListView.PullBackFooter - the footer is positioned in the end of the view.
+
+ \value ListView.OverlayFooter The footer is positioned at the end of the view.
+
+ \value ListView.PullBackFooter The footer is positioned at the end of the view.
The footer can be pushed away by moving the content backwards, and pulled back by
moving the content forwards.
- \endlist
\note This property has no effect on the \l {QQuickItem::z}{stacking order}
of the footer. For example, if the footer should be shown above the
\l delegate items when using \c ListView.OverlayFooter, its Z value
should be set to a value higher than that of the delegates. For more
information, see \l {Stacking Order in ListView}.
+
+ \note If \c footerPositioning is not set to \c ListView.InlineFooter, the
+ user cannot press and flick the list from the footer. In any case, the
+ \l{footerItem}{footer item} may contain items or event handlers that
+ provide custom handling of mouse or touch input.
*/
QQuickListView::FooterPositioning QQuickListView::footerPositioning() const
{
@@ -3185,6 +3249,13 @@ void QQuickListView::keyPressEvent(QKeyEvent *event)
void QQuickListView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickListView);
+
+ if (d->model) {
+ // When the view changes size, we force the pool to
+ // shrink by releasing all pooled items.
+ d->model->drainReusableItemsPool(0);
+ }
+
if (d->isRightToLeft()) {
// maintain position relative to the right edge
qreal dx = newGeometry.width() - oldGeometry.width();
@@ -3592,6 +3663,23 @@ QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
return new QQuickListViewAttached(obj);
}
+bool QQuickListView::contains(const QPointF &point) const
+{
+ bool ret = QQuickItemView::contains(point);
+ // QTBUG-74046: if a mouse press "falls through" a floating header or footer, don't allow dragging the list from there
+ if (ret) {
+ if (auto header = headerItem()) {
+ if (headerPositioning() != QQuickListView::InlineHeader && header->contains(mapToItem(header, point)))
+ ret = false;
+ }
+ if (auto footer = footerItem()) {
+ if (footerPositioning() != QQuickListView::InlineFooter && footer->contains(mapToItem(footer, point)))
+ ret = false;
+ }
+ }
+ return ret;
+}
+
QT_END_NAMESPACE
#include "moc_qquicklistview_p.cpp"
diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h
index 1c72a10190..be21b93155 100644
--- a/src/quick/items/qquicklistview_p.h
+++ b/src/quick/items/qquicklistview_p.h
@@ -179,6 +179,8 @@ public:
static QQuickListViewAttached *qmlAttachedProperties(QObject *);
+ bool contains(const QPointF &point) const override;
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index ddf34798d7..57d55172e3 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -62,7 +62,7 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
- propagateComposedEvents(false), overThreshold(false), pressed(nullptr),
+ propagateComposedEvents(false), overThreshold(false),
pressAndHoldInterval(-1)
#if QT_CONFIG(quick_draganddrop)
, drag(nullptr)
@@ -942,6 +942,12 @@ void QQuickMouseArea::mouseUngrabEvent()
ungrabMouse();
}
+void QQuickMouseArea::touchUngrabEvent()
+{
+ // allow a Pointer Handler to steal the grab from MouseArea
+ ungrabMouse();
+}
+
bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event)
{
Q_D(QQuickMouseArea);
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 3d4d113215..806cc41369 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -170,6 +170,7 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseUngrabEvent() override;
+ void touchUngrabEvent() override;
void hoverEnterEvent(QHoverEvent *event) override;
void hoverMoveEvent(QHoverEvent *event) override;
void hoverLeaveEvent(QHoverEvent *event) override;
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index b02e58fae4..9a371207ce 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -42,6 +42,7 @@
#include <private/qsgadaptationlayer_p.h>
#include <private/qevent_p.h>
#include <private/qquickitem_p.h>
+#include <private/qquickwindow_p.h>
#include <private/qguiapplication_p.h>
#include <QEvent>
#include <QMouseEvent>
@@ -448,6 +449,7 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent)
: QQuickItem(parent),
_minimumTouchPoints(0),
_maximumTouchPoints(INT_MAX),
+ _touchMouseDevice(nullptr),
_stealMouse(false),
_mouseEnabled(true)
{
@@ -586,10 +588,10 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
bool ended = false;
bool moved = false;
bool started = false;
- bool isMouseEvent = false;
clearTouchLists();
QList<QTouchEvent::TouchPoint> touchPoints;
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window());
switch (event->type()) {
case QEvent::TouchBegin:
@@ -598,6 +600,9 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
touchPoints = static_cast<QTouchEvent*>(event)->touchPoints();
break;
case QEvent::MouseButtonPress:
+ _mouseQpaTouchPoint = QTouchEvent::TouchPoint(windowPriv->touchMouseId);
+ _touchMouseDevice = windowPriv->touchMouseDevice->qTouchDevice();
+ Q_FALLTHROUGH();
case QEvent::MouseMove:
case QEvent::MouseButtonRelease: {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
@@ -617,7 +622,6 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
_mouseQpaTouchPoint.setState(Qt::TouchPointPressed);
}
touchPoints << _mouseQpaTouchPoint;
- isMouseEvent = true;
break;
}
default:
@@ -625,11 +629,6 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
break;
}
- if (!isMouseEvent && _mouseTouchPoint) {
- QQuickWindow *c = window();
- if (c && c->mouseGrabberItem() == this)
- touchPoints << _mouseQpaTouchPoint;
- }
int numTouchPoints = touchPoints.count();
//always remove released touches, and make sure we handle all releases before adds.
for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) {
@@ -756,7 +755,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e)
dtp = new QQuickTouchPoint(false);
updateTouchPoint(dtp, e);
dtp->setPressed(true);
- _touchPoints.insert(-1, dtp);
+ _touchPoints.insert(_touchMouseDevice && _mouseQpaTouchPoint.id() > 0 ? _mouseQpaTouchPoint.id() : -1, dtp);
_pressedTouchPoints.append(dtp);
_mouseTouchPoint = dtp;
}
@@ -839,8 +838,7 @@ void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event)
setKeepMouseGrab(false);
event->setAccepted(true);
_mousePos = event->localPos();
-
- if (event->source() != Qt::MouseEventNotSynthesized)
+ if (event->source() != Qt::MouseEventNotSynthesized && event->source() != Qt::MouseEventSynthesizedByQt)
return;
if (_touchPoints.count() >= _minimumTouchPoints - 1 && _touchPoints.count() < _maximumTouchPoints) {
@@ -855,7 +853,7 @@ void QQuickMultiPointTouchArea::mouseMoveEvent(QMouseEvent *event)
return;
}
- if (event->source() != Qt::MouseEventNotSynthesized)
+ if (event->source() != Qt::MouseEventNotSynthesized && event->source() != Qt::MouseEventSynthesizedByQt)
return;
_movedTouchPoints.clear();
@@ -870,7 +868,7 @@ void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event)
return;
}
- if (event->source() != Qt::MouseEventNotSynthesized)
+ if (event->source() != Qt::MouseEventNotSynthesized && event->source() != Qt::MouseEventSynthesizedByQt)
return;
if (_mouseTouchPoint) {
@@ -880,18 +878,16 @@ void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event)
_mouseTouchPoint = nullptr;
}
- QQuickWindow *c = window();
- if (c && c->mouseGrabberItem() == this)
- ungrabMouse();
setKeepMouseGrab(false);
}
-void QQuickMultiPointTouchArea::ungrab()
+void QQuickMultiPointTouchArea::ungrab(bool normalRelease)
{
_stealMouse = false;
setKeepMouseGrab(false);
setKeepTouchGrab(false);
- ungrabTouchPoints();
+ if (!normalRelease)
+ ungrabTouchPoints();
if (_touchPoints.count()) {
for (QObject *obj : qAsConst(_touchPoints))
@@ -969,13 +965,25 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEve
if (!isEnabled() || !isVisible())
return QQuickItem::childMouseEventFilter(receiver, event);
switch (event->type()) {
- case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonPress: {
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window());
+ // If we already got a chance to filter the touchpoint that generated this synth-mouse-press,
+ // and chose not to filter it, ignore it now, too.
+ if (static_cast<QMouseEvent *>(event)->source() == Qt::MouseEventSynthesizedByQt &&
+ _lastFilterableTouchPointIds.contains(windowPriv->touchMouseId))
+ return false;
+ } Q_FALLTHROUGH();
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
return sendMouseEvent(static_cast<QMouseEvent *>(event));
- break;
case QEvent::TouchBegin:
+ _lastFilterableTouchPointIds.clear();
+ Q_FALLTHROUGH();
case QEvent::TouchUpdate:
+ for (auto tp : static_cast<QTouchEvent*>(event)->touchPoints()) {
+ if (tp.state() == Qt::TouchPointPressed)
+ _lastFilterableTouchPointIds << tp.id();
+ }
if (!shouldFilter(event))
return false;
updateTouchData(event);
@@ -984,7 +992,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEve
if (!shouldFilter(event))
return false;
updateTouchData(event);
- ungrab();
+ ungrab(true);
}
break;
default:
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index 7506be10a1..42b42a45c5 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -289,7 +289,7 @@ protected:
#endif
private:
- void ungrab();
+ void ungrab(bool normalRelease = false);
QMap<int,QQuickTouchPoint*> _touchPrototypes; //TouchPoints defined in QML
QMap<int,QObject*> _touchPoints; //All current touch points
QList<QObject*> _releasedTouchPoints;
@@ -297,8 +297,10 @@ private:
QList<QObject*> _movedTouchPoints;
int _minimumTouchPoints;
int _maximumTouchPoints;
+ QVector<int> _lastFilterableTouchPointIds;
QPointer<QQuickTouchPoint> _mouseTouchPoint; // exists when mouse button is down and _mouseEnabled is true; null otherwise
QTouchEvent::TouchPoint _mouseQpaTouchPoint; // synthetic QPA touch point to hold state and position of the mouse
+ const QTouchDevice *_touchMouseDevice;
QPointF _mousePos;
bool _stealMouse;
bool _mouseEnabled;
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index cee73ac2e8..df5ec0c3f2 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -133,7 +133,6 @@ QQuickPaintedItemPrivate::QQuickPaintedItemPrivate()
, contentsScale(1.0)
, fillColor(Qt::transparent)
, renderTarget(QQuickPaintedItem::Image)
- , performanceHints(nullptr)
, opaquePainting(false)
, antialiasing(false)
, mipmap(false)
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 6976665134..7ebe174a9e 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1922,9 +1922,10 @@ bool QQuickPathView::childMouseEventFilter(QQuickItem *i, QEvent *e)
void QQuickPathView::mouseUngrabEvent()
{
Q_D(QQuickPathView);
- if (d->stealMouse) {
+ if (d->stealMouse ||
+ (!d->flicking && d->snapMode != NoSnap && !qFuzzyCompare(qRound(d->offset), d->offset))) {
// if our mouse grab has been removed (probably by a Flickable),
- // fix our state
+ // or if we should snap but haven't done it, fix our state
d->stealMouse = false;
setKeepMouseGrab(false);
d->timer.invalidate();
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index b17e505f4f..ed2d7eda3e 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -424,9 +424,6 @@ QScreen *QQuickScreenInfo::wrappedScreen() const
QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
: QQuickScreenInfo(attachee)
- , m_window(nullptr)
- , m_updateMask(nullptr)
- , m_updateMaskSet(false)
{
m_attachee = qobject_cast<QQuickItem*>(attachee);
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 61cbdf7387..b4266d78c7 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -152,10 +152,10 @@ protected Q_SLOTS:
void screenChanged(QScreen*);
private:
- QQuickWindow* m_window;
+ QQuickWindow* m_window = nullptr;
QQuickItem* m_attachee;
Qt::ScreenOrientations m_updateMask;
- bool m_updateMaskSet;
+ bool m_updateMaskSet = false;
};
class Q_QUICK_PRIVATE_EXPORT QQuickScreen : public QObject
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index b3c8386fd9..e71e6dc698 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -179,201 +179,11 @@ QT_BEGIN_NAMESPACE
is a URL with the \c file or \c qrc schema, it is treated as a file
reference and the source code is read from the specified file.
- \section1 Direct3D and HLSL
-
- Direct3D backends provide ShaderEffect support with HLSL. The Direct3D 12
- backend requires using at least Shader Model 5.0 both for vertex and pixel
- shaders. When necessary, GraphicsInfo.shaderType can be used to decide
- at runtime what kind of value to assign to \l fragmentShader or
- \l vertexShader.
-
- All concepts described above for OpenGL and GLSL apply to Direct3D and HLSL
- as well. There are however a number of notable practical differences, which
- are the following:
-
- Instead of uniforms, HLSL shaders are expected to use a single constant
- buffer, assigned to register \c b0. The special names \c qt_Matrix,
- \c qt_Opacity, and \c qt_SubRect_<name> function the same way as with GLSL.
- All other members of the buffer are expected to map to properties in the
- ShaderEffect item.
-
- \note The buffer layout must be compatible for both shaders. This means
- that application-provided shaders must make sure \c qt_Matrix and
- \c qt_Opacity are included in the buffer, starting at offset 0, when custom
- code is provided for one type of shader only, leading to ShaderEffect
- providing the other shader. This is due to ShaderEffect's built-in shader code
- declaring a constant buffer containing \c{float4x4 qt_Matrix; float qt_Opacity;}.
-
- Unlike GLSL's attributes, no names are used for vertex input elements.
- Therefore qt_Vertex and qt_MultiTexCoord0 are not relevant. Instead, the
- standard Direct3D semantics, \c POSITION and \c TEXCOORD (or \c TEXCOORD0)
- are used for identifying the correct input layout.
-
- Unlike GLSL's samplers, texture and sampler objects are separate in HLSL.
- Shaders are expected to expect 2D, non-array, non-multisample textures.
- Both the texture and sampler binding points are expected to be sequential
- and start from 0 (meaning registers \c{t0, t1, ...}, and \c{s0, s1, ...},
- respectively). Unlike with OpenGL, samplers are not mapped to Qt Quick item
- properties and therefore the name of the sampler is not relevant. Instead,
- it is the textures that map to properties referencing \l Image or
- \l ShaderEffectSource items.
-
- Unlike OpenGL, backends for modern APIs will typically prefer offline
- compilation and shipping pre-compiled bytecode with applications instead of
- inlined shader source strings. In this case the string properties for
- vertex and fragment shaders are treated as URLs referring to local files or
- files shipped via the Qt resource system.
-
- To check at runtime what is supported, use the
- GraphicsInfo.shaderSourceType and GraphicsInfo.shaderCompilationType
- properties. Note that these are bitmasks, because some backends may support
- multiple approaches.
-
- In case of Direct3D 12, all combinations are supported. If the vertexShader
- and fragmentShader properties form a valid URL with the \c file or \c qrc
- schema, the bytecode or HLSL source code is read from the specified file.
- The type of the file contents is detected automatically. Otherwise, the
- string is treated as HLSL source code and is compiled at runtime, assuming
- Shader Model 5.0 and an entry point of \c{"main"}. This allows dynamically
- constructing shader strings. However, whenever the shader source code is
- static, it is strongly recommended to pre-compile to bytecode using the
- \c fxc tool and refer to these files from QML. This will be a lot more
- efficient at runtime and allows catching syntax errors in the shaders at
- compile time.
-
- Unlike OpenGL, the Direct3D backend is able to perform runtime shader
- compilation on dedicated threads. This is managed transparently to the
- applications, and means that ShaderEffect items that contain HLSL source
- strings do not block the rendering or other parts of the application until
- the bytecode is ready.
-
- Using files with bytecode is more flexible also when it comes to the entry
- point name (it can be anything, not limited to \c main) and the shader
- model (it can be something newer than 5.0, for instance 5.1).
-
- \table 70%
- \row
- \li \qml
- import QtQuick 2.0
-
- Rectangle {
- width: 200; height: 100
- Row {
- Image { id: img;
- sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
- ShaderEffect {
- width: 100; height: 100
- property variant src: img
- fragmentShader: "qrc:/effect_ps.cso"
- }
- }
- }
- \endqml
- \row
- \li where \c effect_ps.cso is the compiled bytecode for the following HLSL shader:
- \code
- cbuffer ConstantBuffer : register(b0)
- {
- float4x4 qt_Matrix;
- float qt_Opacity;
- };
- Texture2D src : register(t0);
- SamplerState srcSampler : register(s0);
- float4 ExamplePixelShader(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
- {
- float4 tex = src.Sample(srcSampler, coord);
- float3 col = dot(tex.rgb, float3(0.344, 0.5, 0.156));
- return float4(col, tex.a) * qt_Opacity;
- }
- \endcode
- \endtable
-
- The above is equivalent to the OpenGL example presented earlier. The vertex
- shader is provided implicitly by ShaderEffect. Note that the output of the
- pixel shader is using premultiplied alpha and that \c qt_Matrix is present
- in the constant buffer at offset 0, even though the pixel shader does not
- use the value.
-
- If desired, the HLSL source code can be placed directly into the QML
- source, similarly to how its done with GLSL. The only difference in this
- case is the entry point name, which must be \c main when using inline
- source strings.
-
- Alternatively, we could also have referred to a file containing the source
- of the effect instead of the compiled bytecode version.
-
- Some effects will want to provide a vertex shader as well. Below is a
- similar effect with both the vertex and fragment shader provided by the
- application. This time the colorization factor is provided by the QML item
- instead of hardcoding it in the shader. This can allow, among others,
- animating the value using QML's and Qt Quick's standard facilities.
-
- \table 70%
- \row
- \li \qml
- import QtQuick 2.0
-
- Rectangle {
- width: 200; height: 100
- Row {
- Image { id: img;
- sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
- ShaderEffect {
- width: 100; height: 100
- property variant src: img
- property variant color: Qt.vector3d(0.344, 0.5, 0.156)
- vertexShader: "qrc:/effect_vs.cso"
- fragmentShader: "qrc:/effect_ps.cso"
- }
- }
- }
- \endqml
- \row
- \li where \c effect_vs.cso and \c effect_ps.cso are the compiled bytecode
- for \c ExampleVertexShader and \c ExamplePixelShader. The source code is
- presented as one snippet here, the shaders can however be placed in
- separate source files as well.
- \code
- cbuffer ConstantBuffer : register(b0)
- {
- float4x4 qt_Matrix;
- float qt_Opacity;
- float3 color;
- };
- Texture2D src : register(t0);
- SamplerState srcSampler : register(s0);
- struct PSInput
- {
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
- };
- PSInput ExampleVertexShader(float4 position : POSITION, float2 coord : TEXCOORD0)
- {
- PSInput result;
- result.position = mul(qt_Matrix, position);
- result.coord = coord;
- return result;
- }
- float4 ExamplePixelShader(PSInput input) : SV_TARGET
- {
- float4 tex = src.Sample(srcSampler, coord);
- float3 col = dot(tex.rgb, color);
- return float4(col, tex.a) * qt_Opacity;
- }
- \endcode
- \endtable
-
- \note With OpenGL the \c y coordinate runs from bottom to top whereas with
- Direct 3D it goes top to bottom. For shader effect sources Qt Quick hides
- the difference by treating QtQuick::ShaderEffectSource::textureMirroring as
- appropriate, meaning texture coordinates in HLSL version of the shaders
- will not need any adjustments compared to the equivalent GLSL code.
-
\section1 Cross-platform, Cross-API ShaderEffect Items
- Some applications will want to be functional with multiple accelerated
- graphics backends. This has consequences for ShaderEffect items because the
- supported shading languages may vary from backend to backend.
+ Some applications will want to be functional with multiple graphics
+ APIs. This has consequences for ShaderEffect items because the supported
+ shading languages may vary from backend to backend.
There are two approaches to handle this: either write conditional property
values based on GraphicsInfo.shaderType, or use file selectors. In practice
@@ -404,20 +214,8 @@ QT_BEGIN_NAMESPACE
gl_FragColor = vec4(vec3(dot(tex.rgb,
vec3(0.344, 0.5, 0.156))),
tex.a) * qt_Opacity;"
- : GraphicsInfo.shaderType === GraphicsInfo.HLSL ?
- "cbuffer ConstantBuffer : register(b0)
- {
- float4x4 qt_Matrix;
- float qt_Opacity;
- };
- Texture2D src : register(t0);
- SamplerState srcSampler : register(s0);
- float4 ExamplePixelShader(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
- {
- float4 tex = src.Sample(srcSampler, coord);
- float3 col = dot(tex.rgb, float3(0.344, 0.5, 0.156));
- return float4(col, tex.a) * qt_Opacity;
- }"
+ : GraphicsInfo.shaderType === GraphicsInfo.RhiShader ?
+ "qrc:/shader.frag.qsb"
: ""
}
}
@@ -429,15 +227,14 @@ QT_BEGIN_NAMESPACE
reported by GraphicsInfo is not up-to-date until the ShaderEffect item gets
associated with a QQuickWindow. Before that, the reported value is
GraphicsInfo.UnknownShadingLanguage. The alternative is to place the GLSL
- source code and the compiled D3D bytecode into the files
- \c{shaders/effect.frag} and \c{shaders/+hlsl/effect.frag}, include them in
- the Qt resource system, and let the ShaderEffect's internal QFileSelector
- do its job. The selector-less version is the GLSL source, while the \c hlsl
- selector is used when running on the D3D12 backend. The file under
- \c{+hlsl} can then contain either HLSL source code or compiled bytecode
- from the \c fxc tool. Additionally, when using a version 3.2 or newer core
- profile context with OpenGL, GLSL sources with a core profile compatible
- syntax can be placed under \c{+glslcore}.
+ source code and the RHI-compatible shader pack into the files
+ \c{shaders/effect.frag} and \c{shaders/+qsb/effect.frag}, include them in
+ the Qt resource system, and let the ShaderEffect's internal QFileSelector do
+ its job. The selector-less version is the GLSL source, while the \c qsb
+ selector is used when running with the Qt graphics abstraction (RHI).
+ Additionally, when using a version 3.2 or newer core profile context with
+ OpenGL, GLSL sources with a core profile compatible syntax can be placed
+ under \c{+glslcore}.
\qml
import QtQuick 2.8 // for GraphicsInfo
@@ -552,11 +349,7 @@ QQuickShaderEffect::~QQuickShaderEffect()
With GLSL the default shader expects the texture coordinate to be passed
from the vertex shader as \c{varying highp vec2 qt_TexCoord0}, and it
- samples from a sampler2D named \c source. With HLSL the texture is named
- \c source, while the vertex shader is expected to provide
- \c{float2 coord : TEXCOORD0} in its output in addition to
- \c{float4 position : SV_POSITION} (names can differ since linking is done
- based on the semantics).
+ samples from a sampler2D named \c source.
\sa vertexShader, GraphicsInfo
*/
@@ -593,9 +386,7 @@ void QQuickShaderEffect::setFragmentShader(const QByteArray &code)
filesystem or bundled with the executable via Qt's resource system.
With GLSL the default shader passes the texture coordinate along to the
- fragment shader as \c{varying highp vec2 qt_TexCoord0}. With HLSL it is
- enough to use the standard \c TEXCOORD0 semantic, for example
- \c{float2 coord : TEXCOORD0}.
+ fragment shader as \c{varying highp vec2 qt_TexCoord0}.
\sa fragmentShader, GraphicsInfo
*/
diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp
index 07767d377d..ddaa1979b6 100644
--- a/src/quick/items/qquickstateoperations.cpp
+++ b/src/quick/items/qquickstateoperations.cpp
@@ -600,11 +600,6 @@ class QQuickAnchorSetPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickAnchorSet)
public:
- QQuickAnchorSetPrivate()
- : usedAnchors(nullptr), resetAnchors(nullptr)
- {
- }
-
QQuickAnchors::Anchors usedAnchors;
QQuickAnchors::Anchors resetAnchors;
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 295c6898bc..fd511bc2ee 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -520,10 +520,10 @@ int QQuickTableViewPrivate::nextVisibleEdgeIndexAroundLoadedTable(Qt::Edge edge)
// visible, and should be loaded next if the content item moves.
int startIndex = -1;
switch (edge) {
- case Qt::LeftEdge: startIndex = loadedColumns.firstKey() - 1; break;
- case Qt::RightEdge: startIndex = loadedColumns.lastKey() + 1; break;
- case Qt::TopEdge: startIndex = loadedRows.firstKey() - 1; break;
- case Qt::BottomEdge: startIndex = loadedRows.lastKey() + 1; break;
+ case Qt::LeftEdge: startIndex = leftColumn() - 1; break;
+ case Qt::RightEdge: startIndex = rightColumn() + 1; break;
+ case Qt::TopEdge: startIndex = topRow() - 1; break;
+ case Qt::BottomEdge: startIndex = bottomRow() + 1; break;
}
return nextVisibleEdgeIndex(edge, startIndex);
@@ -628,6 +628,12 @@ void QQuickTableViewPrivate::updateContentWidth()
return;
}
+ if (loadedItems.isEmpty()) {
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
+ q->QQuickFlickable::setContentWidth(0);
+ return;
+ }
+
const int nextColumn = nextVisibleEdgeIndexAroundLoadedTable(Qt::RightEdge);
const int columnsRemaining = nextColumn == kEdgeIndexAtEnd ? 0 : tableSize.width() - nextColumn;
const qreal remainingColumnWidths = columnsRemaining * averageEdgeSize.width();
@@ -655,6 +661,12 @@ void QQuickTableViewPrivate::updateContentHeight()
return;
}
+ if (loadedItems.isEmpty()) {
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
+ q->QQuickFlickable::setContentHeight(0);
+ return;
+ }
+
const int nextRow = nextVisibleEdgeIndexAroundLoadedTable(Qt::BottomEdge);
const int rowsRemaining = nextRow == kEdgeIndexAtEnd ? 0 : tableSize.height() - nextRow;
const qreal remainingRowHeights = rowsRemaining * averageEdgeSize.height();
@@ -871,17 +883,13 @@ void QQuickTableViewPrivate::syncLoadedTableRectFromLoadedTable()
loadedTableInnerRect = QRectF(topLeftRect.bottomRight(), bottomRightRect.topLeft());
}
-void QQuickTableViewPrivate::forceLayout()
+QQuickTableViewPrivate::RebuildOptions QQuickTableViewPrivate::checkForVisibilityChanges()
{
- if (loadedItems.isEmpty())
- return;
-
- clearEdgeSizeCache();
- RebuildOptions rebuildOptions = RebuildOption::LayoutOnly;
-
// Go through all columns from first to last, find the columns that used
// to be hidden and not loaded, and check if they should become visible
// (and vice versa). If there is a change, we need to rebuild.
+ RebuildOptions rebuildOptions = RebuildOption::None;
+
for (int column = leftColumn(); column <= rightColumn(); ++column) {
const bool wasVisibleFromBefore = loadedColumns.contains(column);
const bool isVisibleNow = !qFuzzyIsNull(getColumnWidth(column));
@@ -916,6 +924,28 @@ void QQuickTableViewPrivate::forceLayout()
break;
}
+ return rebuildOptions;
+}
+
+void QQuickTableViewPrivate::forceLayout()
+{
+ if (loadedItems.isEmpty())
+ return;
+
+ clearEdgeSizeCache();
+ RebuildOptions rebuildOptions = RebuildOption::None;
+
+ const QSize actualTableSize = calculateTableSize();
+ if (tableSize != actualTableSize) {
+ // This can happen if the app is calling forceLayout while
+ // the model is updated, but before we're notified about it.
+ rebuildOptions = RebuildOption::All;
+ } else {
+ rebuildOptions = checkForVisibilityChanges();
+ if (!rebuildOptions)
+ rebuildOptions = RebuildOption::LayoutOnly;
+ }
+
scheduleRebuildTable(rebuildOptions);
auto rootView = rootSyncView();
@@ -1036,21 +1066,16 @@ void QQuickTableViewPrivate::releaseLoadedItems(QQmlTableInstanceModel::Reusable
void QQuickTableViewPrivate::releaseItem(FxTableItem *fxTableItem, QQmlTableInstanceModel::ReusableFlag reusableFlag)
{
Q_Q(QQuickTableView);
+ // Note that fxTableItem->item might already have been destroyed, in case
+ // the item is owned by the QML context rather than the model (e.g ObjectModel etc).
auto item = fxTableItem->item;
- Q_TABLEVIEW_ASSERT(item, fxTableItem->index);
if (fxTableItem->ownItem) {
+ Q_TABLEVIEW_ASSERT(item, fxTableItem->index);
delete item;
- } else {
- // Only QQmlTableInstanceModel supports reusing items
- auto releaseFlag = tableModel ?
- tableModel->release(item, reusableFlag) :
- model->release(item);
-
- if (releaseFlag != QQmlInstanceModel::Destroyed) {
- // When items are not destroyed, it typically means that the
- // item is reused, or that the model is an ObjectModel. If
- // so, we just hide the item instead.
+ } else if (item) {
+ auto releaseFlag = model->release(item, reusableFlag);
+ if (releaseFlag == QQmlInstanceModel::Pooled) {
fxTableItem->setVisible(false);
// If the item (or a descendant) has focus, remove it, so
@@ -1183,19 +1208,14 @@ qreal QQuickTableViewPrivate::sizeHintForRow(int row)
return rowHeight;
}
-void QQuickTableViewPrivate::calculateTableSize()
+void QQuickTableViewPrivate::updateTableSize()
{
// tableSize is the same as row and column count, and will always
// be the same as the number of rows and columns in the model.
Q_Q(QQuickTableView);
- QSize prevTableSize = tableSize;
- if (tableModel)
- tableSize = QSize(tableModel->columns(), tableModel->rows());
- else if (model)
- tableSize = QSize(1, model->count());
- else
- tableSize = QSize(0, 0);
+ const QSize prevTableSize = tableSize;
+ tableSize = calculateTableSize();
if (prevTableSize.width() != tableSize.width())
emit q->columnsChanged();
@@ -1203,6 +1223,16 @@ void QQuickTableViewPrivate::calculateTableSize()
emit q->rowsChanged();
}
+QSize QQuickTableViewPrivate::calculateTableSize()
+{
+ if (tableModel)
+ return QSize(tableModel->columns(), tableModel->rows());
+ else if (model)
+ return QSize(1, model->count());
+
+ return QSize(0, 0);
+}
+
qreal QQuickTableViewPrivate::getColumnLayoutWidth(int column)
{
// Return the column width specified by the application, or go
@@ -1229,9 +1259,9 @@ qreal QQuickTableViewPrivate::getColumnLayoutWidth(int column)
if (qIsNaN(columnWidth) || columnWidth <= 0) {
if (!layoutWarningIssued) {
layoutWarningIssued = true;
- qmlWarning(q_func()) << "the delegate's implicitHeight needs to be greater than zero";
+ qmlWarning(q_func()) << "the delegate's implicitWidth needs to be greater than zero";
}
- columnWidth = kDefaultRowHeight;
+ columnWidth = kDefaultColumnWidth;
}
return columnWidth;
@@ -1589,6 +1619,8 @@ void QQuickTableViewPrivate::processRebuildTable()
if (rebuildState == RebuildState::VerifyTable) {
if (loadedItems.isEmpty()) {
qCDebug(lcTableViewDelegateLifecycle()) << "no items loaded!";
+ updateContentWidth();
+ updateContentHeight();
rebuildState = RebuildState::Done;
} else if (!moveToNextRebuildState()) {
return;
@@ -1755,16 +1787,18 @@ void QQuickTableViewPrivate::calculateTopLeft(QPoint &topLeftCell, QPointF &topL
void QQuickTableViewPrivate::beginRebuildTable()
{
- calculateTableSize();
+ updateTableSize();
QPoint topLeft;
QPointF topLeftPos;
calculateTopLeft(topLeft, topLeftPos);
- if (rebuildOptions & RebuildOption::All)
- releaseLoadedItems(QQmlTableInstanceModel::NotReusable);
- else if (rebuildOptions & RebuildOption::ViewportOnly)
- releaseLoadedItems(reusableFlag);
+ if (!loadedItems.isEmpty()) {
+ if (rebuildOptions & RebuildOption::All)
+ releaseLoadedItems(QQmlTableInstanceModel::NotReusable);
+ else if (rebuildOptions & RebuildOption::ViewportOnly)
+ releaseLoadedItems(reusableFlag);
+ }
if (rebuildOptions & RebuildOption::All) {
origin = QPointF(0, 0);
@@ -1879,7 +1913,7 @@ void QQuickTableViewPrivate::loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMo
const int edgeIndex = nextVisibleEdgeIndexAroundLoadedTable(edge);
qCDebug(lcTableViewDelegateLifecycle) << edge << edgeIndex;
- const QList<int> visibleCells = edge & (Qt::LeftEdge | Qt::RightEdge)
+ const auto visibleCells = edge & (Qt::LeftEdge | Qt::RightEdge)
? loadedRows.keys() : loadedColumns.keys();
loadRequest.begin(edge, edgeIndex, visibleCells, incubationMode);
processLoadRequest();
@@ -2016,7 +2050,8 @@ bool QQuickTableViewPrivate::updateTableRecursive()
if (!updateComplete)
return false;
- for (auto syncChild : qAsConst(syncChildren)) {
+ const auto children = syncChildren;
+ for (auto syncChild : children) {
auto syncChild_d = syncChild->d_func();
syncChild_d->scheduledRebuildOptions |= rebuildOptions;
@@ -2196,13 +2231,15 @@ void QQuickTableViewPrivate::syncRebuildOptions()
void QQuickTableViewPrivate::syncDelegate()
{
- if (tableModel && assignedDelegate == tableModel->delegate())
+ if (!tableModel) {
+ // Only the tableModel uses the delegate assigned to a
+ // TableView. DelegateModel has it's own delegate, and
+ // ObjectModel etc. doesn't use one.
return;
+ }
- if (!tableModel)
- createWrapperModel();
-
- tableModel->setDelegate(assignedDelegate);
+ if (assignedDelegate != tableModel->delegate())
+ tableModel->setDelegate(assignedDelegate);
}
void QQuickTableViewPrivate::syncModel()
@@ -2210,8 +2247,10 @@ void QQuickTableViewPrivate::syncModel()
if (modelVariant == assignedModel)
return;
- if (model)
+ if (model) {
disconnectFromModel();
+ releaseLoadedItems(QQmlTableInstanceModel::NotReusable);
+ }
modelVariant = assignedModel;
QVariant effectiveModelVariant = modelVariant;
@@ -2291,6 +2330,7 @@ void QQuickTableViewPrivate::syncSyncView()
void QQuickTableViewPrivate::connectToModel()
{
+ Q_Q(QQuickTableView);
Q_TABLEVIEW_ASSERT(model, "");
QObjectPrivate::connect(model, &QQmlInstanceModel::createdItem, this, &QQuickTableViewPrivate::itemCreatedCallback);
@@ -2300,6 +2340,8 @@ void QQuickTableViewPrivate::connectToModel()
const auto tm = tableModel.data();
QObjectPrivate::connect(tm, &QQmlTableInstanceModel::itemPooled, this, &QQuickTableViewPrivate::itemPooledCallback);
QObjectPrivate::connect(tm, &QQmlTableInstanceModel::itemReused, this, &QQuickTableViewPrivate::itemReusedCallback);
+ // Connect atYEndChanged to a function that fetches data if more is available
+ QObjectPrivate::connect(q, &QQuickTableView::atYEndChanged, this, &QQuickTableViewPrivate::fetchMoreData);
}
if (auto const aim = model->abstractItemModel()) {
@@ -2323,6 +2365,7 @@ void QQuickTableViewPrivate::connectToModel()
void QQuickTableViewPrivate::disconnectFromModel()
{
+ Q_Q(QQuickTableView);
Q_TABLEVIEW_ASSERT(model, "");
QObjectPrivate::disconnect(model, &QQmlInstanceModel::createdItem, this, &QQuickTableViewPrivate::itemCreatedCallback);
@@ -2332,6 +2375,7 @@ void QQuickTableViewPrivate::disconnectFromModel()
const auto tm = tableModel.data();
QObjectPrivate::disconnect(tm, &QQmlTableInstanceModel::itemPooled, this, &QQuickTableViewPrivate::itemPooledCallback);
QObjectPrivate::disconnect(tm, &QQmlTableInstanceModel::itemReused, this, &QQuickTableViewPrivate::itemReusedCallback);
+ QObjectPrivate::disconnect(q, &QQuickTableView::atYEndChanged, this, &QQuickTableViewPrivate::fetchMoreData);
}
if (auto const aim = model->abstractItemModel()) {
@@ -2413,6 +2457,14 @@ void QQuickTableViewPrivate::layoutChangedCallback(const QList<QPersistentModelI
scheduleRebuildTable(RebuildOption::ViewportOnly);
}
+void QQuickTableViewPrivate::fetchMoreData()
+{
+ if (tableModel && tableModel->canFetchMore()) {
+ tableModel->fetchMore();
+ scheduleRebuildTable(RebuildOption::ViewportOnly);
+ }
+}
+
void QQuickTableViewPrivate::modelResetCallback()
{
scheduleRebuildTable(RebuildOption::All);
@@ -2678,6 +2730,23 @@ void QQuickTableView::setContentHeight(qreal height)
QQuickFlickable::setContentHeight(height);
}
+/*!
+ \qmlproperty TableView QtQuick::TableView::syncView
+
+ If this property of a TableView is set to another TableView, both the
+ tables will synchronize with regard to flicking, column widths/row heights,
+ and spacing according to \l syncDirection.
+
+ If \l syncDirection contains \l Qt.Horizontal, current tableView's column
+ widths, column spacing, and horizontal flicking movement synchronizes with
+ syncView's.
+
+ If \l syncDirection contains \l Qt.Vertical, current tableView's row
+ heights, row spacing, and vertical flicking movement synchronizes with
+ syncView's.
+
+ \sa syncDirection
+*/
QQuickTableView *QQuickTableView::syncView() const
{
return d_func()->assignedSyncView;
@@ -2695,6 +2764,24 @@ void QQuickTableView::setSyncView(QQuickTableView *view)
emit syncViewChanged();
}
+/*!
+ \qmlproperty Qt::Orientations QtQuick::TableView::syncDirection
+
+ If the \l syncView is set on a TableView, this property controls
+ synchronization of flicking direction(s) for both tables. The default is \c
+ {Qt.Horizontal | Qt.Vertical}, which means that if you flick either table
+ in either direction, the other table is flicked the same amount in the
+ same direction.
+
+ This property and \l syncView can be used to make two tableViews
+ synchronize with each other smoothly in flicking regardless of the different
+ overshoot/undershoot, velocity, acceleration/deceleration or rebound
+ animation, and so on.
+
+ A typical use case is to make several headers flick along with the table.
+
+ \sa syncView, headerView
+*/
Qt::Orientations QQuickTableView::syncDirection() const
{
return d_func()->assignedSyncDirection;
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index b66ac66dec..7c81882d44 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -54,6 +54,7 @@
#include "qquicktableview_p.h"
#include <QtCore/qtimer.h>
+#include <QtCore/private/qflatmap_p.h>
#include <QtQmlModels/private/qqmltableinstancemodel_p.h>
#include <QtQml/private/qqmlincubator_p.h>
#include <QtQmlModels/private/qqmlchangeset_p.h>
@@ -119,7 +120,7 @@ public:
qCDebug(lcTableViewDelegateLifecycle()) << "begin top-left:" << toString();
}
- void begin(Qt::Edge edgeToLoad, int edgeIndex, const QList<int> visibleCellsInEdge, QQmlIncubator::IncubationMode incubationMode)
+ void begin(Qt::Edge edgeToLoad, int edgeIndex, const QVector<int> visibleCellsInEdge, QQmlIncubator::IncubationMode incubationMode)
{
Q_ASSERT(!m_active);
m_active = true;
@@ -169,7 +170,7 @@ public:
private:
Qt::Edge m_edge = Qt::Edge(0);
- QList<int> m_visibleCellsInEdge;
+ QVector<int> m_visibleCellsInEdge;
int m_edgeIndex = 0;
int m_currentIndex = 0;
bool m_active = false;
@@ -246,8 +247,8 @@ public:
// we need to fill up with more rows/columns. loadedTableInnerRect describes the pixels
// that the loaded table covers if you remove one row/column on each side of the table, and
// is used to determine rows/columns that are no longer visible and can be unloaded.
- QMap<int, int> loadedColumns;
- QMap<int, int> loadedRows;
+ QFlatMap<int, int> loadedColumns;
+ QFlatMap<int, int> loadedRows;
QRectF loadedTableOuterRect;
QRectF loadedTableInnerRect;
@@ -322,7 +323,8 @@ public:
qreal sizeHintForColumn(int column);
qreal sizeHintForRow(int row);
- void calculateTableSize();
+ QSize calculateTableSize();
+ void updateTableSize();
inline bool isColumnHidden(int column);
inline bool isRowHidden(int row);
@@ -332,10 +334,10 @@ public:
qreal getColumnWidth(int column);
qreal getRowHeight(int row);
- inline int topRow() const { return loadedRows.firstKey(); }
- inline int bottomRow() const { return loadedRows.lastKey(); }
- inline int leftColumn() const { return loadedColumns.firstKey(); }
- inline int rightColumn() const { return loadedColumns.lastKey(); }
+ inline int topRow() const { return loadedRows.cbegin().key(); }
+ inline int bottomRow() const { return (--loadedRows.cend()).key(); }
+ inline int leftColumn() const { return loadedColumns.cbegin().key(); }
+ inline int rightColumn() const { return (--loadedColumns.cend()).key(); }
QQuickTableView *rootSyncView() const;
@@ -351,6 +353,7 @@ public:
void updateContentWidth();
void updateContentHeight();
void updateAverageEdgeSize();
+ RebuildOptions checkForVisibilityChanges();
void forceLayout();
void updateExtents();
@@ -424,6 +427,8 @@ public:
void setLocalViewportY(qreal contentY);
void syncViewportPosRecursive();
+ void fetchMoreData();
+
void _q_componentFinalized();
void registerCallbackWhenBindingsAreEvaluated();
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index a83b9beaa5..eda2029783 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1140,7 +1140,10 @@ QString QQuickTextInput::inputMask() const
void QQuickTextInput::setInputMask(const QString &im)
{
Q_D(QQuickTextInput);
- if (d->inputMask() == im)
+ QString canonicalInputMask = im;
+ if (im.lastIndexOf(QLatin1Char(';')) == -1)
+ canonicalInputMask.append(QLatin1String("; "));
+ if (d->inputMask() == canonicalInputMask)
return;
d->setInputMask(im);
@@ -3954,7 +3957,7 @@ bool QQuickTextInputPrivate::isValidInput(QChar key, QChar mask) const
return true;
break;
case 'X':
- if (key.isPrint())
+ if (key.isPrint() && key != m_blank)
return true;
break;
case 'x':
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 9998dc3605..84488dcaca 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -240,13 +240,12 @@ void QQuickView::setSource(const QUrl& url)
}
/*!
- Sets the initial properties with which the QML component gets initialized after
- calling \l QQuickView::setSource.
+ Sets the initial properties \a initialProperties with which the QML
+ component gets initialized after calling \l QQuickView::setSource().
+ \note You can only use this function to initialize top-level properties.
- Note that you can only use this function to initialize toplevel properties.
-
- \sa QQmlComponent::createWithInitialProperties
+ \sa QQmlComponent::createWithInitialProperties()
\since 5.14
*/
void QQuickView::setInitialProperties(const QVariantMap &initialProperties)
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 9b45750a3b..2eee98a738 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -527,7 +527,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa
renderer->setDeviceRect(rect);
renderer->setViewportRect(rect);
const bool flipY = rhi ? !rhi->isYUpInNDC() : false;
- QSGAbstractRenderer::MatrixTransformFlags matrixFlags = 0;
+ QSGAbstractRenderer::MatrixTransformFlags matrixFlags;
if (flipY)
matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), logicalSize), matrixFlags);
@@ -1768,6 +1768,8 @@ bool QQuickWindow::event(QEvent *e)
if (e->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest))
update();
+ else if (e->type() == QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure))
+ d->windowManager->handleContextCreationFailure(this);
return QWindow::event(e);
}
@@ -3254,10 +3256,9 @@ bool QQuickWindowPrivate::isRenderable() const
void QQuickWindowPrivate::contextCreationFailureMessage(const QSurfaceFormat &format,
QString *translatedMessage,
- QString *untranslatedMessage,
- bool isEs)
+ QString *untranslatedMessage)
{
- const QString contextType = QLatin1String(isEs ? "EGL" : "OpenGL");
+ const QString contextType = QLatin1String("OpenGL");
QString formatStr;
QDebug(&formatStr) << format;
#if defined(Q_OS_WIN32)
@@ -3282,6 +3283,16 @@ void QQuickWindowPrivate::contextCreationFailureMessage(const QSurfaceFormat &fo
#endif // !Q_OS_WIN32
}
+void QQuickWindowPrivate::rhiCreationFailureMessage(const QString &backendName,
+ QString *translatedMessage,
+ QString *untranslatedMessage)
+{
+ const char msg[] = QT_TRANSLATE_NOOP("QQuickWindow",
+ "Failed to initialize graphics backend for %1.");
+ *translatedMessage = QQuickWindow::tr(msg).arg(backendName);
+ *untranslatedMessage = QString::fromLatin1(msg).arg(backendName);
+}
+
#if QT_DEPRECATED_SINCE(5, 8)
// ### Qt6: remove
@@ -4034,7 +4045,7 @@ QImage QQuickWindow::grabWindow()
Q_D(QQuickWindow);
if (!isVisible() && !d->renderControl) {
- // backends like software and d3d12 can grab regardless of the window state
+ // backends like software can grab regardless of the window state
if (d->windowManager && (d->windowManager->flags() & QSGRenderLoop::SupportsGrabWithoutExpose))
return d->windowManager->grab(this);
}
@@ -4444,7 +4455,7 @@ bool QQuickWindow::clearBeforeRendering() const
QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
{
- return createTextureFromImage(image, nullptr);
+ return createTextureFromImage(image, {});
}
@@ -4603,7 +4614,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
\a nativeLayout is only used for APIs like Vulkan. When applicable, it must
specify the current image layout, such as, a VkImageLayout value.
- \sa sceneGraphInitialized(), QSGTextures
+ \sa sceneGraphInitialized(), QSGTexture, QSGTexture::nativeTexture()
\since 5.14
*/
@@ -5503,9 +5514,6 @@ void QQuickWindow::setSceneGraphBackend(QSGRendererInterface::GraphicsApi api)
case QSGRendererInterface::Software:
setSceneGraphBackend(QStringLiteral("software"));
break;
- case QSGRendererInterface::Direct3D12:
- setSceneGraphBackend(QStringLiteral("d3d12"));
- break;
default:
break;
}
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index af7d65dac5..ef10ba3fe8 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -112,7 +112,8 @@ public:
Q_DECLARE_PUBLIC(QQuickWindow)
enum CustomEvents {
- FullUpdateRequest = QEvent::User + 1
+ FullUpdateRequest = QEvent::User + 1,
+ TriggerContextCreationFailure = QEvent::User + 2
};
static inline QQuickWindowPrivate *get(QQuickWindow *c) { return c->d_func(); }
@@ -206,8 +207,8 @@ public:
};
Q_DECLARE_FLAGS(FocusOptions, FocusOption)
- void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = nullptr);
- void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = nullptr);
+ void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = { });
+ void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = { });
static void notifyFocusChangesRecur(QQuickItem **item, int remaining);
void clearFocusObject() override;
@@ -300,8 +301,10 @@ public:
static void contextCreationFailureMessage(const QSurfaceFormat &format,
QString *translatedMessage,
- QString *untranslatedMessage,
- bool isEs);
+ QString *untranslatedMessage);
+ static void rhiCreationFailureMessage(const QString &backendName,
+ QString *translatedMessage,
+ QString *untranslatedMessage);
static void emitBeforeRenderPassRecording(void *ud);
static void emitAfterRenderPassRecording(void *ud);
diff --git a/src/quick/qtquick.tracepoints b/src/quick/qtquick.tracepoints
new file mode 100644
index 0000000000..f6518444d2
--- /dev/null
+++ b/src/quick/qtquick.tracepoints
@@ -0,0 +1,48 @@
+QSG_renderWindow_entry()
+QSG_renderWindow_exit()
+QSG_renderScene_entry()
+QSG_renderScene_exit()
+QSG_syncAndRender_entry()
+QSG_syncAndRender_exit()
+QSG_polishAndSync_entry()
+QSG_polishAndSync_exit()
+QSG_preprocess_entry()
+QSG_preprocess_exit()
+QSG_update_entry()
+QSG_update_exit()
+
+QSG_polishItems_entry()
+QSG_polishItems_exit()
+QSG_sync_entry()
+QSG_sync_exit()
+QSG_wait_entry()
+QSG_wait_exit()
+QSG_render_entry()
+QSG_render_exit()
+QSG_swap_entry()
+QSG_swap_exit()
+QSG_animations_entry()
+QSG_animations_exit()
+
+QSG_texture_prepare_entry()
+QSG_texture_prepare_exit()
+QSG_texture_bind_entry()
+QSG_texture_bind_exit()
+QSG_texture_delete_entry()
+QSG_texture_delete_exit()
+QSG_texture_upload_entry()
+QSG_texture_upload_exit()
+QSG_texture_mipmap_entry()
+QSG_texture_mipmap_exit()
+
+QSG_binding_entry()
+QSG_binding_exit()
+QSG_prepareMaterial_entry()
+QSG_prepareMaterial_exit()
+
+QSGDistanceFieldGlyphCache_update_entry(int count)
+QSGDistanceFieldGlyphCache_update_exit()
+QSGDistanceFieldGlyphCache_glyphRender_entry()
+QSGDistanceFieldGlyphCache_glyphRender_exit()
+QSGDistanceFieldGlyphCache_glyphStore_entry()
+QSGDistanceFieldGlyphCache_glyphStore_exit()
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 527742ab8a..4ba7e896db 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -39,7 +39,6 @@
#include "qtquick2_p.h"
#include <private/qqmlengine_p.h>
-#include <private/qquickutilmodule_p.h>
#include <private/qquickvaluetypes_p.h>
#include <private/qquickitemsmodule_p.h>
#include <private/qquickaccessiblefactory_p.h>
@@ -55,6 +54,10 @@
#include <qqmlproperty.h>
#include <QtCore/QPointer>
+#if QT_CONFIG(shortcut)
+Q_DECLARE_METATYPE(QKeySequence::StandardKey)
+#endif
+
QT_BEGIN_NAMESPACE
#if !QT_CONFIG(qml_debug)
@@ -182,10 +185,12 @@ void QQmlQtQuick2Module::defineModule()
{
QQuick_initializeProviders();
- QQuickUtilModule::defineModule();
- QQuickItemsModule::defineModule();
+#if QT_CONFIG(shortcut)
+ qRegisterMetaType<QKeySequence::StandardKey>();
+#endif
QQuickValueTypes::registerValueTypes();
+ QQuickItemsModule::defineModule();
#if QT_CONFIG(accessibility)
QAccessible::installFactory(&qQuickAccessibleFactory);
diff --git a/src/quick/quick.pro b/src/quick/quick.pro
index 700f794af4..42bb4b6ec8 100644
--- a/src/quick/quick.pro
+++ b/src/quick/quick.pro
@@ -4,6 +4,9 @@ QT = core-private gui-private qml-private qmlmodels-private
qtConfig(qml-network): \
QT_PRIVATE += network
+TRACEPOINT_PROVIDER = $$PWD/qtquick.tracepoints
+CONFIG += qt_tracepoints
+
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES
msvc:DEFINES *= _CRT_SECURE_NO_WARNINGS
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
@@ -47,3 +50,9 @@ SOURCES += qtquick2.cpp
INCLUDEPATH += $$PWD
load(qt_module)
+
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick.2
+QML_IMPORT_NAME = QtQuick
+IMPORT_VERSION = 2.15
+CONFIG += qmltypes install_qmltypes install_metatypes
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index ca620965a8..49151551b1 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -77,6 +77,12 @@ QSGSoftwareRenderableNode *QSGAbstractSoftwareRenderer::renderableNode(QSGNode *
return m_nodes.value(node, nullptr);
}
+// Used by GammaRay
+const QVector<QSGSoftwareRenderableNode*> &QSGAbstractSoftwareRenderer::renderableNodes() const
+{
+ return m_renderableNodes;
+}
+
void QSGAbstractSoftwareRenderer::addNodeMapping(QSGNode *node, QSGSoftwareRenderableNode *renderableNode)
{
m_nodes.insert(node, renderableNode);
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
index e1b477ab97..d4bfb5a9f7 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
@@ -87,6 +87,7 @@ protected:
QRect backgroundRect();
// only known after calling optimizeRenderList()
bool isOpaque() const { return m_isOpaque; }
+ const QVector<QSGSoftwareRenderableNode*> &renderableNodes() const;
private:
void nodeAdded(QSGNode *node);
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
index 7b5ee66df6..f1d0e28fc8 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
@@ -206,12 +206,12 @@ QSGRendererInterface::ShaderType QSGSoftwareContext::shaderType() const
QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const
{
- return nullptr;
+ return {};
}
QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const
{
- return nullptr;
+ return {};
}
void *QSGSoftwareContext::getResource(QQuickWindow *window, Resource resource) const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
index da5d39db20..214f7d790b 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp
@@ -465,7 +465,7 @@ void QSGSoftwareInternalImageNode::paint(QPainter *painter)
m_targetRect.right() - m_innerTargetRect.right(), m_targetRect.bottom() - m_innerTargetRect.bottom());
QSGSoftwareHelpers::QTileRules tilerules(getTileRule(m_subSourceRect.width()), getTileRule(m_subSourceRect.height()));
QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_targetRect.toRect(), margins, pm, QRect(0, 0, pm.width(), pm.height()),
- margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr));
+ margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints{});
return;
}
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
index 141d8f3c6d..a10a94125c 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp
@@ -205,7 +205,7 @@ void QSGSoftwareNinePatchNode::paint(QPainter *painter)
painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height()));
else
QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()),
- m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr));
+ m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints{});
}
QRectF QSGSoftwareNinePatchNode::bounds() const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index c97dcb9326..c010e0cae5 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -52,6 +52,8 @@
#include <QtGui/QBackingStore>
+#include <qtquick_tracepoints_p.h>
+
QT_BEGIN_NAMESPACE
QSGSoftwareRenderLoop::QSGSoftwareRenderLoop()
@@ -133,20 +135,25 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
if (!m_windows.contains(window))
return;
}
+
+ Q_TRACE_SCOPE(QSG_renderWindow)
QElapsedTimer renderTimer;
qint64 renderTime = 0, syncTime = 0, polishTime = 0;
bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
renderTimer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
+ Q_TRACE(QSG_polishItems_entry);
cd->polishItems();
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphPolishPolish);
+ Q_TRACE(QSG_sync_entry);
emit window->afterAnimating();
@@ -155,8 +162,10 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync);
+ Q_TRACE(QSG_render_entry);
//Tell the renderer about the windows backing store
auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);
@@ -167,8 +176,10 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
if (data.grabOnly) {
grabContent = m_backingStores[window]->handle()->toImage();
@@ -187,6 +198,7 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_swap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSwap);
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index c6b463bb02..1de9415dd0 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -60,6 +60,8 @@
#include <QtGui/QBackingStore>
#include <QtQuick/QQuickWindow>
+#include <qtquick_tracepoints_p.h>
+
QT_BEGIN_NAMESPACE
// Passed from the RL to the RT when a window is removed obscured and should be
@@ -421,7 +423,7 @@ void QSGSoftwareRenderThread::sync(bool inExpose)
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - sync");
mutex.lock();
- Q_ASSERT_X(renderLoop->lockedForSync, "QSGD3D12RenderThread::sync()", "sync triggered with gui not locked");
+ Q_ASSERT_X(renderLoop->lockedForSync, "QSGSoftwareRenderThread::sync()", "sync triggered with gui not locked");
if (exposedWindow) {
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(exposedWindow);
@@ -457,6 +459,8 @@ void QSGSoftwareRenderThread::sync(bool inExpose)
void QSGSoftwareRenderThread::syncAndRender()
{
+ Q_TRACE_SCOPE(QSG_syncAndRender);
+ Q_TRACE(QSG_sync_entry);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame);
QElapsedTimer waitTimer;
@@ -475,6 +479,7 @@ void QSGSoftwareRenderThread::syncAndRender()
if (syncRequested)
sync(exposeRequested);
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync);
@@ -487,6 +492,7 @@ void QSGSoftwareRenderThread::syncAndRender()
}
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - rendering started");
+ Q_TRACE(QSG_render_entry);
if (rtAnim->isRunning()) {
wd->animationController->lock();
@@ -502,8 +508,10 @@ void QSGSoftwareRenderThread::syncAndRender()
softwareRenderer->setBackingStore(backingStore);
wd->renderSceneGraph(exposedWindow->size());
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
if (softwareRenderer && (!wd->customRenderStage || !wd->customRenderStage->swap()))
backingStore->flush(softwareRenderer->flushRegion());
@@ -519,8 +527,10 @@ void QSGSoftwareRenderThread::syncAndRender()
wd->fireFrameSwapped();
} else {
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync, 1);
+ Q_TRACE(QSG_swap_entry);
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - window not ready, skipping render");
}
@@ -532,6 +542,7 @@ void QSGSoftwareRenderThread::syncAndRender()
mutex.unlock();
}
+ Q_TRACE(QSG_swap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSwap);
}
@@ -947,13 +958,18 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
return;
}
+ Q_TRACE_SCOPE(QSG_polishAndSync);
+
+ Q_TRACE(QSG_polishItems_entry);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync);
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
wd->polishItems();
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncPolish);
+ Q_TRACE(QSG_sync_entry);
w->updateDuringSync = false;
@@ -967,15 +983,19 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - wait for sync");
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncWait);
+ Q_TRACE(QSG_wait_entry);
w->thread->waitCondition.wait(&w->thread->mutex);
lockedForSync = false;
w->thread->mutex.unlock();
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - unlock after sync");
+ Q_TRACE(QSG_wait_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncSync);
+ Q_TRACE(QSG_animations_entry);
if (!animationTimer && m_anim->isRunning()) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "polishAndSync - advancing animations");
@@ -987,6 +1007,7 @@ void QSGSoftwareThreadedRenderLoop::polishAndSync(QSGSoftwareThreadedRenderLoop:
w->window->requestUpdate();
}
+ Q_TRACE(QSG_animations_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
index 1a8bddaa6e..65abb2a1af 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
@@ -296,7 +296,7 @@ void QSGCompressedTexturePrivate::updateRhiTexture(QRhi *rhi, QRhiResourceUpdate
return;
}
- QRhiTexture::Flags texFlags = 0;
+ QRhiTexture::Flags texFlags;
if (fmt.second)
texFlags |= QRhiTexture::sRGB;
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 45b00d43c4..5401401a0e 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -62,6 +62,8 @@
#include "qsgopenglvisualizer_p.h"
#include "qsgrhivisualizer_p.h"
+#include <qtquick_tracepoints_p.h>
+
#include <algorithm>
#ifndef GL_DOUBLE
@@ -270,6 +272,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material, boo
return nullptr;
}
+ Q_TRACE_SCOPE(QSG_prepareMaterial);
if (QSG_LOG_TIME_COMPILATION().isDebugEnabled())
qsg_renderer_timer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame);
@@ -332,6 +335,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
return nullptr;
}
+ Q_TRACE_SCOPE(QSG_prepareMaterial);
if (QSG_LOG_TIME_COMPILATION().isDebugEnabled())
qsg_renderer_timer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame);
@@ -379,6 +383,9 @@ void ShaderManager::invalidated()
qDeleteAll(srbCache);
srbCache.clear();
+
+ qDeleteAll(pipelineCache);
+ pipelineCache.clear();
}
void ShaderManager::clearCachedRendererData()
@@ -546,7 +553,7 @@ void Updater::visitNode(Node *n)
m_added = count;
m_force_update = force;
- n->dirtyState = nullptr;
+ n->dirtyState = {};
}
void Updater::visitClipNode(Node *n)
@@ -1103,13 +1110,9 @@ void Renderer::destroyGraphicsResources()
// are going to destroy.
m_shaderManager->clearCachedRendererData();
- qDeleteAll(m_pipelines);
qDeleteAll(m_samplers);
-
m_stencilClipCommon.reset();
-
delete m_dummyTexture;
-
m_visualizer->releaseResources();
}
@@ -1119,7 +1122,6 @@ void Renderer::releaseCachedResources()
destroyGraphicsResources();
- m_pipelines.clear();
m_samplers.clear();
m_dummyTexture = nullptr;
@@ -2627,7 +2629,7 @@ QRhiGraphicsPipeline *Renderer::buildStencilPipeline(const Batch *batch, bool fi
QRhiGraphicsPipeline *ps = m_rhi->newGraphicsPipeline();
ps->setFlags(QRhiGraphicsPipeline::UsesStencilRef);
QRhiGraphicsPipeline::TargetBlend blend;
- blend.colorWrite = 0;
+ blend.colorWrite = {};
ps->setTargetBlends({ blend });
ps->setSampleCount(renderTarget()->sampleCount());
ps->setStencilTest(true);
@@ -3237,15 +3239,17 @@ static inline bool needsBlendConstant(QRhiGraphicsPipeline::BlendFactor f)
bool Renderer::ensurePipelineState(Element *e, const ShaderManager::Shader *sms) // RHI only, [prepare step]
{
- // In unmerged batches the srbs in the elements are all compatible layout-wise.
+ // In unmerged batches the srbs in the elements are all compatible
+ // layout-wise. Note the key's == and qHash implementations: the rp desc and
+ // srb are tested for (layout) compatibility, not pointer equality.
const GraphicsPipelineStateKey k { m_gstate, sms, renderPassDescriptor(), e->srb };
// Note: dynamic state (viewport rect, scissor rect, stencil ref, blend
// constant) is never a part of GraphicsState/QRhiGraphicsPipeline.
// See if there is an existing, matching pipeline state object.
- auto it = m_pipelines.constFind(k);
- if (it != m_pipelines.constEnd()) {
+ auto it = m_shaderManager->pipelineCache.constFind(k);
+ if (it != m_shaderManager->pipelineCache.constEnd()) {
e->ps = *it;
return true;
}
@@ -3257,7 +3261,7 @@ bool Renderer::ensurePipelineState(Element *e, const ShaderManager::Shader *sms)
ps->setShaderResourceBindings(e->srb);
ps->setRenderPassDescriptor(renderPassDescriptor());
- QRhiGraphicsPipeline::Flags flags = 0;
+ QRhiGraphicsPipeline::Flags flags;
if (needsBlendConstant(m_gstate.srcColor) || needsBlendConstant(m_gstate.dstColor))
flags |= QRhiGraphicsPipeline::UsesBlendConstants;
if (m_gstate.usesScissor)
@@ -3302,7 +3306,7 @@ bool Renderer::ensurePipelineState(Element *e, const ShaderManager::Shader *sms)
return false;
}
- m_pipelines.insert(k, ps);
+ m_shaderManager->pipelineCache.insert(k, ps);
e->ps = ps;
return true;
}
@@ -4643,7 +4647,7 @@ bool operator==(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKe
{
return a.state == b.state
&& a.sms->programRhi.program == b.sms->programRhi.program
- && a.rpDesc == b.rpDesc
+ && a.compatibleRenderPassDescriptor->isCompatible(b.compatibleRenderPassDescriptor)
&& a.layoutCompatibleSrb->isLayoutCompatible(b.layoutCompatibleSrb);
}
@@ -4654,7 +4658,8 @@ bool operator!=(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKe
uint qHash(const GraphicsPipelineStateKey &k, uint seed) Q_DECL_NOTHROW
{
- return qHash(k.state, seed) + qHash(k.sms->programRhi.program, seed) + qHash(k.rpDesc, seed);
+ // no srb and rp included due to their special comparison semantics and lack of hash keys
+ return qHash(k.state, seed) + qHash(k.sms->programRhi.program, seed);
}
Visualizer::Visualizer(Renderer *renderer)
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 297df2232a..878b63fc8c 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -626,27 +626,65 @@ private:
QMatrix4x4 m_identityMatrix;
};
+struct GraphicsState
+{
+ bool depthTest = false;
+ bool depthWrite = false;
+ QRhiGraphicsPipeline::CompareOp depthFunc = QRhiGraphicsPipeline::Less;
+ bool blending = false;
+ QRhiGraphicsPipeline::BlendFactor srcColor = QRhiGraphicsPipeline::One;
+ QRhiGraphicsPipeline::BlendFactor dstColor = QRhiGraphicsPipeline::OneMinusSrcAlpha;
+ QRhiGraphicsPipeline::ColorMask colorWrite = QRhiGraphicsPipeline::ColorMask(0xF);
+ QRhiGraphicsPipeline::CullMode cullMode = QRhiGraphicsPipeline::None;
+ bool usesScissor = false;
+ bool stencilTest = false;
+ int sampleCount = 1;
+ QSGGeometry::DrawingMode drawMode = QSGGeometry::DrawTriangles;
+ float lineWidth = 1.0f;
+};
+
+bool operator==(const GraphicsState &a, const GraphicsState &b) Q_DECL_NOTHROW;
+bool operator!=(const GraphicsState &a, const GraphicsState &b) Q_DECL_NOTHROW;
+uint qHash(const GraphicsState &s, uint seed = 0) Q_DECL_NOTHROW;
+
+struct ShaderManagerShader;
+
+struct GraphicsPipelineStateKey
+{
+ GraphicsState state;
+ const ShaderManagerShader *sms;
+ const QRhiRenderPassDescriptor *compatibleRenderPassDescriptor;
+ const QRhiShaderResourceBindings *layoutCompatibleSrb;
+};
+
+bool operator==(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) Q_DECL_NOTHROW;
+bool operator!=(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) Q_DECL_NOTHROW;
+uint qHash(const GraphicsPipelineStateKey &k, uint seed = 0) Q_DECL_NOTHROW;
+
+struct ShaderManagerShader
+{
+ ~ShaderManagerShader() {
+ delete programRhi.program;
+ delete programGL.program;
+ }
+ struct {
+ QSGMaterialShader *program = nullptr;
+ int pos_order;
+ } programGL;
+ struct {
+ QSGMaterialRhiShader *program = nullptr;
+ QRhiVertexInputLayout inputLayout;
+ QVarLengthArray<QRhiGraphicsShaderStage, 2> shaderStages;
+ } programRhi;
+
+ float lastOpacity;
+};
+
class ShaderManager : public QObject
{
Q_OBJECT
public:
- struct Shader {
- ~Shader() {
- delete programRhi.program;
- delete programGL.program;
- }
- struct {
- QSGMaterialShader *program = nullptr;
- int pos_order;
- } programGL;
- struct {
- QSGMaterialRhiShader *program = nullptr;
- QRhiVertexInputLayout inputLayout;
- QVarLengthArray<QRhiGraphicsShaderStage, 2> shaderStages;
- } programRhi;
-
- float lastOpacity;
- };
+ using Shader = ShaderManagerShader;
ShaderManager(QSGDefaultRenderContext *ctx) : blitProgram(nullptr), context(ctx) { }
~ShaderManager() {
@@ -657,9 +695,10 @@ public:
void clearCachedRendererData();
using ShaderResourceBindingList = QVarLengthArray<QRhiShaderResourceBinding, 8>;
-
QRhiShaderResourceBindings *srb(const ShaderResourceBindingList &bindings);
+ QHash<GraphicsPipelineStateKey, QRhiGraphicsPipeline *> pipelineCache;
+
public Q_SLOTS:
void invalidated();
@@ -677,39 +716,6 @@ private:
QHash<ShaderResourceBindingList, QRhiShaderResourceBindings *> srbCache;
};
-struct GraphicsState
-{
- bool depthTest = false;
- bool depthWrite = false;
- QRhiGraphicsPipeline::CompareOp depthFunc = QRhiGraphicsPipeline::Less;
- bool blending = false;
- QRhiGraphicsPipeline::BlendFactor srcColor = QRhiGraphicsPipeline::One;
- QRhiGraphicsPipeline::BlendFactor dstColor = QRhiGraphicsPipeline::OneMinusSrcAlpha;
- QRhiGraphicsPipeline::ColorMask colorWrite = QRhiGraphicsPipeline::ColorMask(0xF);
- QRhiGraphicsPipeline::CullMode cullMode = QRhiGraphicsPipeline::None;
- bool usesScissor = false;
- bool stencilTest = false;
- int sampleCount = 1;
- QSGGeometry::DrawingMode drawMode = QSGGeometry::DrawTriangles;
- float lineWidth = 1.0f;
-};
-
-bool operator==(const GraphicsState &a, const GraphicsState &b) Q_DECL_NOTHROW;
-bool operator!=(const GraphicsState &a, const GraphicsState &b) Q_DECL_NOTHROW;
-uint qHash(const GraphicsState &s, uint seed = 0) Q_DECL_NOTHROW;
-
-struct GraphicsPipelineStateKey
-{
- GraphicsState state;
- const ShaderManager::Shader *sms;
- const QRhiRenderPassDescriptor *rpDesc;
- const QRhiShaderResourceBindings *layoutCompatibleSrb;
-};
-
-bool operator==(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) Q_DECL_NOTHROW;
-bool operator!=(const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) Q_DECL_NOTHROW;
-uint qHash(const GraphicsPipelineStateKey &k, uint seed = 0) Q_DECL_NOTHROW;
-
struct RenderPassState
{
QRhiViewport viewport;
@@ -903,7 +909,6 @@ private:
GraphicsState m_gstate;
RenderPassState m_pstate;
QStack<GraphicsState> m_gstateStack;
- QHash<GraphicsPipelineStateKey, QRhiGraphicsPipeline *> m_pipelines;
QHash<QSGSamplerDescription, QRhiSampler *> m_samplers;
QRhiTexture *m_dummyTexture = nullptr;
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index c8ae26311b..087c3c4cbf 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -153,7 +153,6 @@ static void qt_print_material_count()
*/
QSGMaterial::QSGMaterial()
- : m_flags(nullptr)
{
Q_UNUSED(m_reserved);
#ifndef QT_NO_DEBUG
diff --git a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
index 117d477f9a..c5cbd0c979 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp
@@ -97,14 +97,14 @@ static inline QRhiShaderResourceBinding::StageFlags toSrbStage(QShader::Stage st
Q_UNREACHABLE();
break;
}
- return 0;
+ return { };
}
void QSGMaterialRhiShaderPrivate::prepare(QShader::Variant vertexShaderVariant)
{
ubufBinding = -1;
ubufSize = 0;
- ubufStages = 0;
+ ubufStages = { };
memset(combinedImageSamplerBindings, 0, sizeof(combinedImageSamplerBindings));
vertexShader = fragmentShader = nullptr;
masterUniformData.clear();
@@ -319,7 +319,7 @@ bool QSGMaterialRhiShader::updateUniformData(RenderState &state,
each variable in the material's shaders'
\l{QShaderDescription::combinedImageSamplers()}.
- When \c{*texture} is null, it must be set to a QSGTexture pointer before
+ When *\a{texture} is null, it must be set to a QSGTexture pointer before
returning. When non-null, it is up to the material to decide if a new
\c{QSGTexture *} is stored to it, or if it updates some parameters on the
already known QSGTexture. The ownership of the QSGTexture is not
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 7d9b74bc2b..a35629d874 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -245,7 +245,6 @@ static void qt_print_node_count()
*/
QSGNode::QSGNode()
: m_nodeFlags(OwnedByParent)
- , m_dirtyState(nullptr)
{
init();
}
@@ -264,7 +263,6 @@ QSGNode::QSGNode(NodeType type)
, m_previousSibling(nullptr)
, m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
, m_nodeFlags(OwnedByParent)
- , m_dirtyState(nullptr)
{
init();
}
@@ -283,7 +281,6 @@ QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type)
, m_previousSibling(nullptr)
, m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
, m_nodeFlags(OwnedByParent)
- , m_dirtyState(nullptr)
, d_ptr(&dd)
{
init();
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index cb677de030..5a7faed5e0 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -146,7 +146,7 @@ public:
QT_DEPRECATED void clearDirty() { }
void markDirty(DirtyState bits);
- QT_DEPRECATED DirtyState dirtyState() const { return nullptr; }
+ QT_DEPRECATED DirtyState dirtyState() const { return { }; }
virtual bool isSubtreeBlocked() const;
diff --git a/src/quick/scenegraph/coreapi/qsgopenglvisualizer.cpp b/src/quick/scenegraph/coreapi/qsgopenglvisualizer.cpp
index 6c2ff0b176..9282b6c308 100644
--- a/src/quick/scenegraph/coreapi/qsgopenglvisualizer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgopenglvisualizer.cpp
@@ -202,7 +202,7 @@ void OpenGLVisualizer::visualizeChanges(Node *n)
// This is because many changes don't propegate their dirty state to the
// parent so the node updater will not unset these states. They are
// not used for anything so, unsetting it should have no side effects.
- n->dirtyState = nullptr;
+ n->dirtyState = {};
}
SHADOWNODE_TRAVERSE(n) {
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index 7af932eeb5..90090e1cc0 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -45,6 +45,7 @@
# include <QtGui/QOpenGLFunctions>
#endif
#include <private/qquickprofiler_p.h>
+#include <qtquick_tracepoints_p.h>
#include <QtCore/QElapsedTimer>
@@ -221,6 +222,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
if (!rootNode())
return;
+ Q_TRACE_SCOPE(QSG_renderScene);
m_is_rendering = true;
@@ -235,11 +237,14 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
m_bindable = &bindable;
preprocess();
+ Q_TRACE(QSG_binding_entry);
bindable.bind();
if (profileFrames)
bindTime = frameTimer.nsecsElapsed();
+ Q_TRACE(QSG_binding_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
QQuickProfiler::SceneGraphRendererBinding);
+ Q_TRACE(QSG_render_entry);
#if QT_CONFIG(opengl)
// Sanity check that attribute registers are disabled
@@ -259,6 +264,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
if (profileFrames)
renderTime = frameTimer.nsecsElapsed();
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame,
QQuickProfiler::SceneGraphRendererRender);
@@ -305,6 +311,8 @@ void QSGRenderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state)
void QSGRenderer::preprocess()
{
+ Q_TRACE(QSG_preprocess_entry);
+
m_is_preprocessing = true;
QSGRootNode *root = rootNode();
@@ -331,13 +339,16 @@ void QSGRenderer::preprocess()
bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled();
if (profileFrames)
preprocessTime = frameTimer.nsecsElapsed();
+ Q_TRACE(QSG_preprocess_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
QQuickProfiler::SceneGraphRendererPreprocess);
+ Q_TRACE(QSG_update_entry);
nodeUpdater()->updateStates(root);
if (profileFrames)
updatePassTime = frameTimer.nsecsElapsed();
+ Q_TRACE(QSG_update_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame,
QQuickProfiler::SceneGraphRendererUpdate);
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
index 0fee1486cf..9b5701df5a 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
@@ -76,7 +76,6 @@ QT_BEGIN_NAMESPACE
\value Unknown An unknown graphics API is in use
\value Software The Qt Quick 2D Renderer is in use
\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. 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.
@@ -189,10 +188,10 @@ QSGRendererInterface::~QSGRendererInterface()
not supported or not available.
When successful, the returned pointer is either a direct pointer to an
- interface (and can be cast, for example, to \c{ID3D12Device *}) or a
- pointer to an opaque handle that needs to be dereferenced first (for
- example, \c{VkDevice dev = *static_cast<VkDevice *>(result)}). The latter
- is necessary since such handles may have sizes different from a pointer.
+ interface, or a pointer to an opaque handle that needs to be dereferenced
+ first (for example, \c{VkDevice dev = *static_cast<VkDevice
+ *>(result)}). The latter is necessary since such handles may have sizes
+ different from a pointer.
\note The ownership of the returned pointer is never transferred to the caller.
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.h b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
index 7aa7d0e769..6224e08e84 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.h
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
@@ -53,7 +53,6 @@ public:
Unknown,
Software,
OpenGL,
- Direct3D12,
OpenVG,
OpenGLRhi,
Direct3D11Rhi,
diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
index 2892f2f966..519e3cd017 100644
--- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
@@ -99,8 +99,8 @@ QSGRenderNodePrivate::QSGRenderNodePrivate()
With APIs other than OpenGL, the only relevant values are the ones that
correspond to dynamic state changes recorded on the command list/buffer.
- For example, RSSetViewports, RSSetScissorRects, OMSetBlendFactor,
- OMSetStencilRef in case of D3D12, or vkCmdSetViewport, vkCmdSetScissor,
+ For example, RSSetViewports, RSSetScissorRects, OMSetBlendState,
+ OMSetDepthStencilState in case of D3D11, or vkCmdSetViewport, vkCmdSetScissor,
vkCmdSetBlendConstants, vkCmdSetStencilRef in case of Vulkan, and only when
such commands were added to the scenegraph's command list queried via the
QSGRendererInterface::CommandList resource enum. States set in pipeline
@@ -131,7 +131,7 @@ QSGRenderNodePrivate::QSGRenderNodePrivate()
*/
QSGRenderNode::StateFlags QSGRenderNode::changedStates() const
{
- return nullptr;
+ return {};
}
/*!
@@ -311,7 +311,7 @@ void QSGRenderNode::releaseResources()
*/
QSGRenderNode::RenderingFlags QSGRenderNode::flags() const
{
- return nullptr;
+ return {};
}
/*!
@@ -381,11 +381,6 @@ QSGRenderNode::RenderState::~RenderState()
\return the current scissor rectangle when clipping is active. x and y are
the bottom left coordinates.
-
- \note Be aware of the differences between graphics APIs: for some the
- scissor rect is only active when scissoring is enabled (for example,
- OpenGL), while for others the scissor rect is equal to the viewport rect
- when there is no need to scissor away anything (for example, Direct3D 12).
*/
/*!
diff --git a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp
index 38d4c4440f..a0131a3f67 100644
--- a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp
@@ -400,7 +400,7 @@ void RhiVisualizer::ChangeVis::gather(Node *n)
// This is because many changes don't propegate their dirty state to the
// parent so the node updater will not unset these states. They are
// not used for anything so, unsetting it should have no side effects.
- n->dirtyState = nullptr;
+ n->dirtyState = { };
}
SHADOWNODE_TRAVERSE(n) {
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp
index edcee96bdb..715633fdba 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.cpp
+++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp
@@ -317,6 +317,34 @@ static void qt_debug_remove_texture(QSGTexture* texture)
\since 5.9
*/
+/*!
+ \class QSGTexture::NativeTexture
+ \brief Contains information about the underlying native resources of a texture.
+ \since 5.15
+ */
+
+/*!
+ \variable QSGTexture::NativeTexture::object
+ \brief a pointer to the native object handle.
+
+ With OpenGL, the native handle is a GLuint value, so \c object is then a
+ pointer to a GLuint. With Vulkan, the native handle is a VkImage, so \c
+ object is a pointer to a VkImage. With Direct3D 11 and Metal \c
+ object is a pointer to a ID3D11Texture2D or MTLTexture pointer, respectively.
+
+ \note Pay attention to the fact that \a object is always a pointer
+ to the native texture handle type, even if the native type itself is a
+ pointer.
+ */
+
+/*!
+ \variable QSGTexture::NativeTexture::layout
+ \brief Specifies the current image layout for APIs like Vulkan.
+
+ For Vulkan, \c layout contains a \c VkImageLayout value.
+ */
+
+
#ifndef QT_NO_DEBUG
Q_QUICK_PRIVATE_EXPORT void qsg_set_material_failure();
#endif
@@ -395,6 +423,9 @@ QSGTexture::~QSGTexture()
Binding a texture may also include uploading the texture data from
a previously set QImage.
+ \warning This function should only be called when running with the
+ direct OpenGL rendering path.
+
\warning This function can only be called from the rendering thread.
*/
@@ -701,8 +732,8 @@ void QSGTexture::updateBindOptions(bool force) // legacy (GL-only)
data (for example, because there was no setImage() since the last call to
this function), the function does nothing.
- Materials involving textures are expected to call this function from their
- updateSampledImage() implementation, typically without any conditions.
+ Materials involving \a rhi textures are expected to call this function from
+ their updateSampledImage() implementation, typically without any conditions.
\note This function is only used when running the graphics API independent
rendering path of the scene graph.
@@ -718,6 +749,28 @@ void QSGTexture::updateRhiTexture(QRhi *rhi, QRhiResourceUpdateBatch *resourceUp
}
/*!
+ \return the platform-specific texture data for this texture.
+
+ \note This is only available when running the graphics API independent
+ rendering path of the scene graph. Use textureId() otherwise.
+
+ Returns an empty result (\c object is null) if there is no available
+ underlying native texture.
+
+ \since 5.15
+ \sa QQuickWindow::createTextureFromNativeObject()
+ */
+QSGTexture::NativeTexture QSGTexture::nativeTexture() const
+{
+ Q_D(const QSGTexture);
+ if (auto *tex = d->rhiTexture()) {
+ auto nativeTexture = tex->nativeTexture();
+ return {nativeTexture.object, nativeTexture.layout};
+ }
+ return {};
+}
+
+/*!
\internal
*/
void QSGTexture::setWorkResourceUpdateBatch(QRhiResourceUpdateBatch *resourceUpdates)
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.h b/src/quick/scenegraph/coreapi/qsgtexture.h
index 2efdd8b7c3..207ef52f4e 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture.h
@@ -80,7 +80,13 @@ public:
Anisotropy16x
};
+ struct NativeTexture {
+ const void *object;
+ int layout;
+ };
+
virtual int textureId() const = 0; // ### Qt 6: remove
+ NativeTexture nativeTexture() const;
virtual QSize textureSize() const = 0;
virtual bool hasAlphaChannel() const = 0;
virtual bool hasMipmaps() const = 0;
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index f7b07d724a..eab0369be7 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -50,6 +50,8 @@
#include <private/qquickprofiler_p.h>
#include <QElapsedTimer>
+#include <qtquick_tracepoints_p.h>
+
QT_BEGIN_NAMESPACE
static QElapsedTimer qsg_render_timer;
@@ -169,10 +171,13 @@ void QSGDistanceFieldGlyphCache::update()
if (m_pendingGlyphs.isEmpty())
return;
+ Q_TRACE_SCOPE(QSGDistanceFieldGlyphCache_update, m_pendingGlyphs.size());
+
bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled();
if (profileFrames)
qsg_render_timer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphAdaptationLayerFrame);
+ Q_TRACE(QSGDistanceFieldGlyphCache_glyphRender_entry);
QList<QDistanceField> distanceFields;
const int pendingGlyphsSize = m_pendingGlyphs.size();
@@ -189,8 +194,11 @@ void QSGDistanceFieldGlyphCache::update()
int count = m_pendingGlyphs.size();
if (profileFrames)
renderTime = qsg_render_timer.nsecsElapsed();
+
+ Q_TRACE(QSGDistanceFieldGlyphCache_glyphRender_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
QQuickProfiler::SceneGraphAdaptationLayerGlyphRender);
+ Q_TRACE(QSGDistanceFieldGlyphCache_glyphStore_entry);
m_pendingGlyphs.reset();
@@ -210,6 +218,7 @@ void QSGDistanceFieldGlyphCache::update()
int(renderTime / 1000000),
int((now - (renderTime / 1000000))));
}
+ Q_TRACE(QSGDistanceFieldGlyphCache_glyphStore_exit);
Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
QQuickProfiler::SceneGraphAdaptationLayerGlyphStore,
(qint64)count);
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index 66add51c55..7dfb8488ae 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -87,7 +87,6 @@ struct QSGAdaptationBackendData
};
QSGAdaptationBackendData::QSGAdaptationBackendData()
- : flags(nullptr)
{
// Fill in the table with the built-in adaptations.
builtIns.append(new QSGSoftwareAdaptation);
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index f609055677..94f15b55d4 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -60,6 +60,7 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <private/qquickprofiler_p.h>
+#include <qtquick_tracepoints_p.h>
#include <private/qsgrhishadereffectnode_p.h>
@@ -195,8 +196,16 @@ public:
bool eventFilter(QObject *watched, QEvent *event) override;
struct WindowData {
+ WindowData()
+ : updatePending(false),
+ grabOnly(false),
+ rhiDeviceLost(false),
+ rhiDoomed(false)
+ { }
bool updatePending : 1;
bool grabOnly : 1;
+ bool rhiDeviceLost : 1;
+ bool rhiDoomed : 1;
};
QHash<QQuickWindow *, WindowData> m_windows;
@@ -316,15 +325,19 @@ void QSGRenderLoop::setInstance(QSGRenderLoop *instance)
s_instance = instance;
}
-void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window,
- bool isEs)
+void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window)
{
QString translatedMessage;
QString untranslatedMessage;
- QQuickWindowPrivate::contextCreationFailureMessage(window->requestedFormat(),
+ if (QSGRhiSupport::instance()->isRhiEnabled()) {
+ QQuickWindowPrivate::rhiCreationFailureMessage(QSGRhiSupport::instance()->rhiBackendName(),
&translatedMessage,
- &untranslatedMessage,
- isEs);
+ &untranslatedMessage);
+ } else {
+ QQuickWindowPrivate::contextCreationFailureMessage(window->requestedFormat(),
+ &translatedMessage,
+ &untranslatedMessage);
+ }
// If there is a slot connected to the error signal, emit it and leave it to
// the application to do something with the message. If nothing is connected,
// show a message on our own and terminate.
@@ -362,10 +375,7 @@ QSGGuiThreadRenderLoop::~QSGGuiThreadRenderLoop()
void QSGGuiThreadRenderLoop::show(QQuickWindow *window)
{
- WindowData data;
- data.updatePending = false;
- data.grabOnly = false;
- m_windows[window] = data;
+ m_windows[window] = WindowData();
maybeUpdate(window);
}
@@ -451,8 +461,10 @@ void QSGGuiThreadRenderLoop::handleDeviceLoss()
rc->invalidate();
- for (auto it = m_windows.constBegin(), itEnd = m_windows.constEnd(); it != itEnd; ++it)
+ for (auto it = m_windows.begin(), itEnd = m_windows.end(); it != itEnd; ++it) {
releaseSwapchain(it.key());
+ it->rhiDeviceLost = true;
+ }
delete rhi;
rhi = nullptr;
@@ -508,6 +520,13 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
const bool enableRhi = rhiSupport->isRhiEnabled();
if (enableRhi && !rhi) {
+ // This block below handles both the initial QRhi initialization and
+ // also the subsequent reinitialization attempts after a device lost
+ // (reset) situation.
+
+ if (data.rhiDoomed) // no repeated attempts if the initial attempt failed
+ return;
+
if (!offscreenSurface)
offscreenSurface = rhiSupport->maybeCreateOffscreenSurface(window);
@@ -517,6 +536,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (rhiSupport->isProfilingRequested())
QSGRhiProfileConnection::instance()->initialize(rhi);
+ data.rhiDeviceLost = false;
+
current = true;
rhi->makeThreadLocalNativeContextCurrent();
@@ -533,7 +554,11 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
rcParams.maybeSurface = window;
cd->context->initialize(&rcParams);
} else {
- handleContextCreationFailure(window, false);
+ if (!data.rhiDeviceLost) {
+ data.rhiDoomed = true;
+ handleContextCreationFailure(window);
+ }
+ // otherwise no error, will retry on a subsequent rendering attempt
}
} else if (!enableRhi && !gl) {
gl = new QOpenGLContext();
@@ -542,10 +567,9 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (qt_gl_global_share_context())
gl->setShareContext(qt_gl_global_share_context());
if (!gl->create()) {
- const bool isEs = gl->isOpenGLES();
delete gl;
gl = nullptr;
- handleContextCreationFailure(window, isEs);
+ handleContextCreationFailure(window);
} else {
if (!offscreenSurface) {
offscreenSurface = new QOffscreenSurface;
@@ -619,7 +643,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
i++;
}
- // Check for context loss.
+ // Check for context loss. (legacy GL only)
if (!current && !rhi && !gl->isValid()) {
for (auto it = m_windows.constBegin() ; it != m_windows.constEnd(); it++) {
QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(it.key());
@@ -657,20 +681,25 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
return;
}
+ Q_TRACE_SCOPE(QSG_renderWindow);
QElapsedTimer renderTimer;
qint64 renderTime = 0, syncTime = 0, polishTime = 0;
bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
renderTimer.start();
+ Q_TRACE(QSG_polishItems_entry);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
cd->polishItems();
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
+
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphPolishPolish);
+ Q_TRACE(QSG_sync_entry);
emit window->afterAnimating();
@@ -725,15 +754,20 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
+
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync);
+ Q_TRACE(QSG_render_entry);
cd->renderSceneGraph(window->size(), effectiveOutputSize);
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
if (data.grabOnly) {
const bool alpha = window->format().alphaBufferSize() > 0 && window->color().alpha() != 255;
@@ -747,7 +781,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
const bool needsPresent = alsoSwap && window->isVisible();
if (cd->swapchain) {
- QRhi::EndFrameFlags flags = 0;
+ QRhi::EndFrameFlags flags;
if (!needsPresent)
flags |= QRhi::SkipPresent;
QRhi::FrameOpResult frameResult = rhi->endFrame(cd->swapchain, flags);
@@ -767,6 +801,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
+
+ Q_TRACE(QSG_swap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSwap);
diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h
index 02d0b84de1..9fd0ab02f5 100644
--- a/src/quick/scenegraph/qsgrenderloop_p.h
+++ b/src/quick/scenegraph/qsgrenderloop_p.h
@@ -112,12 +112,11 @@ public:
static void cleanup();
+ void handleContextCreationFailure(QQuickWindow *window);
+
Q_SIGNALS:
void timeToIncubate();
-protected:
- void handleContextCreationFailure(QQuickWindow *window, bool isEs);
-
private:
static QSGRenderLoop *s_instance;
diff --git a/src/quick/scenegraph/qsgrhilayer.cpp b/src/quick/scenegraph/qsgrhilayer.cpp
index 757410eded..952279a3ff 100644
--- a/src/quick/scenegraph/qsgrhilayer.cpp
+++ b/src/quick/scenegraph/qsgrhilayer.cpp
@@ -388,7 +388,7 @@ void QSGRhiLayer::grab()
m_mirrorHorizontal ? -m_rect.width() : m_rect.width(),
m_mirrorVertical ? m_rect.height() : -m_rect.height());
}
- QSGAbstractRenderer::MatrixTransformFlags matrixFlags = 0;
+ QSGAbstractRenderer::MatrixTransformFlags matrixFlags;
if (!m_rhi->isYUpInNDC())
matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
m_renderer->setProjectionMatrixToRect(mirrored, matrixFlags);
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 12c6742342..9194d3e730 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -159,7 +159,7 @@ void QSGRhiSupport::applySettings()
} else {
#if defined(Q_OS_WIN)
m_rhiBackend = QRhi::D3D11;
-#elif defined(Q_OS_DARWIN)
+#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
m_rhiBackend = QRhi::Metal;
#else
m_rhiBackend = QRhi::OpenGLES2;
@@ -185,29 +185,10 @@ void QSGRhiSupport::applySettings()
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) {
- case QRhi::Null:
- backendName = "Null";
- break;
- case QRhi::Vulkan:
- backendName = "Vulkan";
- break;
- case QRhi::OpenGLES2:
- backendName = "OpenGL";
- break;
- case QRhi::D3D11:
- backendName = "D3D11";
- break;
- case QRhi::Metal:
- backendName = "Metal";
- break;
- default:
- break;
- }
+ const QString backendName = rhiBackendName();
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);
+ qPrintable(backendName), m_debugLayer, m_profile);
if (m_preferSoftwareRenderer)
qCDebug(QSG_LOG_INFO, "Prioritizing software renderers");
}
@@ -247,6 +228,27 @@ QSGRhiSupport *QSGRhiSupport::instance()
return inst;
}
+QString QSGRhiSupport::rhiBackendName() const
+{
+ if (m_enableRhi) {
+ switch (m_rhiBackend) {
+ case QRhi::Null:
+ return QLatin1String("Null");
+ case QRhi::Vulkan:
+ return QLatin1String("Vulkan");
+ case QRhi::OpenGLES2:
+ return QLatin1String("OpenGL");
+ case QRhi::D3D11:
+ return QLatin1String("D3D11");
+ case QRhi::Metal:
+ return QLatin1String("Metal");
+ default:
+ return QLatin1String("Unknown");
+ }
+ }
+ return QLatin1String("Unknown (RHI not enabled)");
+}
+
QSGRendererInterface::GraphicsApi QSGRhiSupport::graphicsApi() const
{
if (!m_enableRhi)
@@ -350,7 +352,7 @@ static const void *qsgrhi_d3d11_rifResource(QSGRendererInterface::Resource res,
}
#endif
-#ifdef Q_OS_DARWIN
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
static const void *qsgrhi_mtl_rifResource(QSGRendererInterface::Resource res, const QRhiNativeHandles *nat,
const QRhiNativeHandles *cbNat)
{
@@ -408,7 +410,7 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res, const
case QRhi::D3D11:
return qsgrhi_d3d11_rifResource(res, nat);
#endif
-#ifdef Q_OS_DARWIN
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
case QRhi::Metal:
{
QRhiCommandBuffer *cb = rc->currentFrameCommandBuffer();
@@ -463,9 +465,13 @@ QOffscreenSurface *QSGRhiSupport::maybeCreateOffscreenSurface(QWindow *window)
// must be called on the render thread
QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurface)
{
+#if !QT_CONFIG(opengl) && !QT_CONFIG(vulkan)
+ Q_UNUSED(window);
+#endif
+
QRhi *rhi = nullptr;
- QRhi::Flags flags = 0;
+ QRhi::Flags flags;
if (isProfilingRequested())
flags |= QRhi::EnableProfiling | QRhi::EnableDebugMarkers;
if (isSoftwareRendererRequested())
@@ -485,6 +491,8 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf
rhiParams.window = window;
rhi = QRhi::create(backend, &rhiParams, flags);
}
+#else
+ Q_UNUSED(offscreenSurface);
#endif
#if QT_CONFIG(vulkan)
if (backend == QRhi::Vulkan) {
@@ -507,7 +515,7 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf
rhi = QRhi::create(backend, &rhiParams, flags);
}
#endif
-#ifdef Q_OS_DARWIN
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
if (backend == QRhi::Metal) {
QRhiMetalInitParams rhiParams;
rhi = QRhi::create(backend, &rhiParams, flags);
diff --git a/src/quick/scenegraph/qsgrhisupport_p.h b/src/quick/scenegraph/qsgrhisupport_p.h
index d008ecd0af..0a95a09ad2 100644
--- a/src/quick/scenegraph/qsgrhisupport_p.h
+++ b/src/quick/scenegraph/qsgrhisupport_p.h
@@ -70,7 +70,7 @@
#include <QtGui/private/qrhid3d11_p.h>
#endif
-#ifdef Q_OS_DARWIN
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
#include <QtGui/private/qrhimetal_p.h>
#endif
@@ -109,6 +109,7 @@ public:
bool isRhiEnabled() const { return m_enableRhi; }
QRhi::Implementation rhiBackend() const { return m_rhiBackend; }
+ QString rhiBackendName() const;
QSGRendererInterface::GraphicsApi graphicsApi() const;
bool isDebugLayerRequested() const { return m_debugLayer; }
diff --git a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
index d0108bc56e..89c9ea4d5b 100644
--- a/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
+++ b/src/quick/scenegraph/qsgrhitextureglyphcache.cpp
@@ -145,7 +145,9 @@ void QSGRhiTextureGlyphCache::prepareGlyphImage(QImage *img)
{
const int maskWidth = img->width();
const int maskHeight = img->height();
+#if Q_BYTE_ORDER != Q_BIG_ENDIAN
const bool supportsBgra = m_rhi->isTextureFormatSupported(QRhiTexture::BGRA8);
+#endif
m_bgra = false;
if (img->format() == QImage::Format_Mono) {
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index dc1f97de54..4777f46f0a 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -70,6 +70,8 @@
#include <private/qsgrhishadereffectnode_p.h>
#include <private/qsgdefaultrendercontext_p.h>
+#include <qtquick_tracepoints_p.h>
+
/*
Overall design:
@@ -368,6 +370,9 @@ public:
QSize windowSize;
float dpr = 1;
int rhiSampleCount = 1;
+ bool rhiDeviceLost = false;
+ bool rhiDoomed = false;
+ bool guiNotifiedAboutRhiFailure = false;
// Local event queue stuff...
bool stopEventProcessing;
@@ -622,13 +627,15 @@ void QSGRenderThread::sync(bool inExpose, bool inGrab)
sgrc->initialize(&rcParams);
}
}
- } else {
+ } else if (rhi) {
// With the rhi making the (OpenGL) context current serves only one
// purpose: to enable external OpenGL rendering connected to one of
// the QQuickWindow signals (beforeSynchronizing, beforeRendering,
// etc.) to function like it did on the direct OpenGL path. For our
// own rendering this call would not be necessary.
rhi->makeThreadLocalNativeContextCurrent();
+ } else {
+ current = false;
}
if (current) {
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
@@ -669,6 +676,7 @@ void QSGRenderThread::handleDeviceLoss()
QQuickWindowPrivate::get(window)->cleanupNodesOnShutdown();
sgrc->invalidate();
wm->releaseSwapchain(window);
+ rhiDeviceLost = true;
delete rhi;
rhi = nullptr;
}
@@ -680,7 +688,9 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
sinceLastTime = threadTimer.nsecsElapsed();
threadTimer.start();
}
+ Q_TRACE_SCOPE(QSG_syncAndRender);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_TRACE(QSG_sync_entry);
QElapsedTimer waitTimer;
waitTimer.start();
@@ -693,8 +703,9 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
const bool repaintRequested = (pendingUpdate & RepaintRequest) || d->customRenderStage || grabImage;
const bool syncRequested = (pendingUpdate & SyncRequest) || grabImage;
const bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest;
- pendingUpdate = 0;
const bool grabRequested = grabImage != nullptr;
+ if (!grabRequested)
+ pendingUpdate = 0;
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
// Begin the frame before syncing -> sync is where we may invoke
@@ -767,33 +778,46 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
if (profileFrames)
syncTime = threadTimer.nsecsElapsed();
#endif
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync);
- if (!syncResultedInChanges && !repaintRequested && sgrc->isValid() && !grabImage) {
- if (gl || !rhi->isRecordingFrame()) {
- qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- no changes, render aborted");
- int waitTime = vsyncDelta - (int) waitTimer.elapsed();
- if (waitTime > 0)
- msleep(waitTime);
- return;
- }
+ if (!syncResultedInChanges
+ && !repaintRequested
+ && !(pendingUpdate & RepaintRequest) // may have been set in sync()
+ && sgrc->isValid()
+ && !grabRequested
+ && (gl || (rhi && !rhi->isRecordingFrame())))
+ {
+ qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- no changes, render aborted");
+ int waitTime = vsyncDelta - (int) waitTimer.elapsed();
+ if (waitTime > 0)
+ msleep(waitTime);
+ return;
}
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- rendering started");
+ Q_TRACE(QSG_render_entry);
+
+ // RepaintRequest may have been set in pendingUpdate in an
+ // updatePaintNode() invoked from sync(). We are about to do a repaint
+ // right now, so reset the flag. (bits other than RepaintRequest cannot
+ // be set in pendingUpdate at this point)
+ if (!grabRequested)
+ pendingUpdate = 0;
- if (animatorDriver->isRunning() && !grabImage) {
+ if (animatorDriver->isRunning() && !grabRequested) {
d->animationController->lock();
animatorDriver->advance();
d->animationController->unlock();
}
bool current = true;
- if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0) {
+ if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0 && (gl || rhi)) {
if (gl)
current = gl->makeCurrent(window);
- else if (rhi)
+ else
rhi->makeThreadLocalNativeContextCurrent();
} else {
current = false;
@@ -811,21 +835,23 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
// With the rhi grabs can only be done by adding a readback and then
// blocking in a real frame. The legacy GL path never gets here with
// grabs as it rather invokes sync/render directly without going
// through syncAndRender().
- if (grabImage) {
+ if (grabRequested) {
Q_ASSERT(rhi && !gl && cd->swapchain);
*grabImage = QSGRhiSupport::instance()->grabAndBlockInCurrentFrame(rhi, cd->swapchain);
}
if (cd->swapchain) {
- QRhi::EndFrameFlags flags = 0;
- if (grabImage)
+ QRhi::EndFrameFlags flags;
+ if (grabRequested)
flags |= QRhi::SkipPresent;
QRhi::FrameOpResult frameResult = rhi->endFrame(cd->swapchain, flags);
if (frameResult != QRhi::FrameOpSuccess) {
@@ -841,12 +867,13 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
gl->swapBuffers(window);
}
- if (!grabImage)
+ if (!grabRequested)
d->fireFrameSwapped();
-
} else {
+ Q_TRACE(QSG_render_exit);
Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSync, 1);
+ Q_TRACE(QSG_swap_entry);
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window not ready, skipping render");
}
@@ -870,7 +897,7 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
int((renderTime - syncTime) / 1000000),
int(threadTimer.elapsed() - renderTime / 1000000));
-
+ Q_TRACE(QSG_swap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphRenderLoopSwap);
@@ -912,14 +939,21 @@ void QSGRenderThread::processEventsAndWaitForMore()
void QSGRenderThread::ensureRhi()
{
if (!rhi) {
+ if (rhiDoomed) // no repeated attempts if the initial attempt failed
+ return;
QSGRhiSupport *rhiSupport = QSGRhiSupport::instance();
rhi = rhiSupport->createRhi(window, offscreenSurface);
if (rhi) {
+ rhiDeviceLost = false;
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 (!rhiDeviceLost) {
+ rhiDoomed = true;
+ qWarning("Failed to create QRhi on the render thread; scenegraph is not functional");
+ }
+ // otherwise no error, will retry on a subsequent rendering attempt
return;
}
}
@@ -975,9 +1009,24 @@ void QSGRenderThread::run()
if (window) {
if (enableRhi) {
+
ensureRhi();
- if (rhi)
- syncAndRender();
+
+ // We absolutely have to syncAndRender() here, even when QRhi
+ // failed to initialize otherwise the gui thread will be left
+ // in a blocked state. It is up to syncAndRender() to
+ // gracefully skip all graphics stuff when rhi is null.
+
+ syncAndRender();
+
+ // Now we can do something about rhi init failures. (reinit
+ // failure after device reset does not count)
+ if (rhiDoomed && !guiNotifiedAboutRhiFailure) {
+ guiNotifiedAboutRhiFailure = true;
+ QEvent *e = new QEvent(QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure));
+ QCoreApplication::postEvent(window, e);
+ }
+
} else {
if (!sgrc->openglContext() && windowSize.width() > 0 && windowSize.height() > 0 && gl->makeCurrent(window)) {
QSGDefaultRenderContext::InitParams rcParams;
@@ -1282,10 +1331,9 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
w->thread->gl->setFormat(w->window->requestedFormat());
w->thread->gl->setScreen(w->window->screen());
if (!w->thread->gl->create()) {
- const bool isEs = w->thread->gl->isOpenGLES();
delete w->thread->gl;
w->thread->gl = nullptr;
- handleContextCreationFailure(w->window, isEs);
+ handleContextCreationFailure(w->window);
return;
}
@@ -1508,7 +1556,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
return;
}
-
+ Q_TRACE_SCOPE(QSG_polishAndSync);
QElapsedTimer timer;
qint64 polishTime = 0;
qint64 waitTime = 0;
@@ -1517,14 +1565,17 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
timer.start();
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync);
+ Q_TRACE(QSG_polishItems_entry);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
d->polishItems();
if (profileFrames)
polishTime = timer.nsecsElapsed();
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncPolish);
+ Q_TRACE(QSG_wait_entry);
w->updateDuringSync = false;
@@ -1539,8 +1590,11 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qCDebug(QSG_LOG_RENDERLOOP, "- wait for sync");
if (profileFrames)
waitTime = timer.nsecsElapsed();
+ Q_TRACE(QSG_wait_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncWait);
+ Q_TRACE(QSG_sync_entry);
+
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
@@ -1548,8 +1602,10 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
syncTime = timer.nsecsElapsed();
+ Q_TRACE(QSG_sync_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncSync);
+ Q_TRACE(QSG_animations_entry);
if (m_animation_timer == 0 && m_animation_driver->isRunning()) {
qCDebug(QSG_LOG_RENDERLOOP, "- advancing animations");
@@ -1570,6 +1626,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
<< ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
<< " - (on Gui thread) " << window;
+ Q_TRACE(QSG_animations_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync,
QQuickProfiler::SceneGraphPolishAndSyncAnimations);
}
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 5b48b86568..20d7c4557f 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -60,6 +60,8 @@
#include <private/qquickopenglshadereffectnode_p.h>
#endif
+#include <qtquick_tracepoints_p.h>
+
QT_BEGIN_NAMESPACE
// Single-threaded render loop with a custom animation driver. Like a
@@ -180,10 +182,9 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window)
m_gl->setShareContext(qt_gl_global_share_context());
bool created = m_gl->create();
if (!created) {
- const bool isEs = m_gl->isOpenGLES();
delete m_gl;
m_gl = nullptr;
- handleContextCreationFailure(window, isEs);
+ handleContextCreationFailure(window);
return;
}
@@ -393,6 +394,7 @@ bool QSGWindowsRenderLoop::event(QEvent *event)
void QSGWindowsRenderLoop::render()
{
RLDEBUG("render");
+ Q_TRACE(QSG_render_entry);
bool rendered = false;
for (const WindowData &wd : qAsConst(m_windows)) {
if (wd.pendingUpdate) {
@@ -407,10 +409,13 @@ void QSGWindowsRenderLoop::render()
QThread::msleep(m_vsyncDelta);
}
+ Q_TRACE(QSG_render_exit);
+
if (m_animationDriver->isRunning()) {
RLDEBUG("advancing animations");
QSG_LOG_TIME_SAMPLE(time_start);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphWindowsAnimations);
+ Q_TRACE(QSG_animations_entry);
m_animationDriver->advance();
RLDEBUG("animations advanced");
@@ -418,6 +423,7 @@ void QSGWindowsRenderLoop::render()
"animations ticked in %dms",
int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
+ Q_TRACE(QSG_animations_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations, 1);
// It is not given that animations triggered another maybeUpdate()
@@ -476,15 +482,20 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
if (!windowData(window))
return;
+ Q_TRACE_SCOPE(QSG_renderWindow);
+
QSG_LOG_TIME_SAMPLE(time_start);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
+ Q_TRACE(QSG_polishItems_entry);
RLDEBUG(" - polishing");
d->polishItems();
QSG_LOG_TIME_SAMPLE(time_polished);
+ Q_TRACE(QSG_polishItems_exit);
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
QQuickProfiler::SceneGraphRenderLoopFrame,
QQuickProfiler::SceneGraphPolishPolish);
+ Q_TRACE(QSG_sync_entry);
emit window->afterAnimating();
@@ -492,17 +503,22 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
d->syncSceneGraph();
if (lastDirtyWindow)
m_rc->endSync();
+ Q_TRACE(QSG_sync_exit);
QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced,
QQuickProfiler::SceneGraphRenderLoopSync);
+ Q_TRACE(QSG_render_entry);
RLDEBUG(" - rendering");
d->renderSceneGraph(window->size());
+ Q_TRACE(QSG_render_exit);
QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered,
QQuickProfiler::SceneGraphRenderLoopRender);
+ Q_TRACE(QSG_swap_entry);
RLDEBUG(" - swapping");
if (!d->customRenderStage || !d->customRenderStage->swap())
m_gl->swapBuffers(window);
+ Q_TRACE(QSG_swap_exit);
QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped,
QQuickProfiler::SceneGraphRenderLoopSwap);
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index 56d97226fb..b12f57d8ef 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -53,7 +53,6 @@ HEADERS += \
$$PWD/util/qsgengine.h \
$$PWD/util/qsgengine_p.h \
$$PWD/util/qsgplaintexture_p.h \
- $$PWD/util/qsgrhinativetextureimporter_p.h \
$$PWD/util/qsgsimplerectnode.h \
$$PWD/util/qsgsimpletexturenode.h \
$$PWD/util/qsgtextureprovider.h \
@@ -70,7 +69,6 @@ SOURCES += \
$$PWD/util/qsgareaallocator.cpp \
$$PWD/util/qsgengine.cpp \
$$PWD/util/qsgplaintexture.cpp \
- $$PWD/util/qsgrhinativetextureimporter.cpp \
$$PWD/util/qsgsimplerectnode.cpp \
$$PWD/util/qsgsimpletexturenode.cpp \
$$PWD/util/qsgtextureprovider.cpp \
diff --git a/src/quick/scenegraph/shaders/outlinedtext.vert b/src/quick/scenegraph/shaders/outlinedtext.vert
index ced8afd034..9df832de3c 100644
--- a/src/quick/scenegraph/shaders/outlinedtext.vert
+++ b/src/quick/scenegraph/shaders/outlinedtext.vert
@@ -1,6 +1,7 @@
uniform highp mat4 matrix;
uniform highp vec2 textureScale;
uniform highp vec2 shift;
+uniform highp float dpr;
attribute highp vec4 vCoord;
attribute highp vec2 tCoord;
@@ -18,5 +19,6 @@ void main()
sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale;
sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale;
sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale;
- gl_Position = matrix * vCoord;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
} \ No newline at end of file
diff --git a/src/quick/scenegraph/shaders/outlinedtext_core.vert b/src/quick/scenegraph/shaders/outlinedtext_core.vert
index 4aa13101fd..a854355460 100644
--- a/src/quick/scenegraph/shaders/outlinedtext_core.vert
+++ b/src/quick/scenegraph/shaders/outlinedtext_core.vert
@@ -12,6 +12,7 @@ out vec2 sCoordRight;
uniform mat4 matrix;
uniform vec2 textureScale;
uniform vec2 shift;
+uniform float dpr;
void main()
{
@@ -20,5 +21,6 @@ void main()
sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale;
sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale;
sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale;
- gl_Position = matrix * vCoord;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
} \ No newline at end of file
diff --git a/src/quick/scenegraph/shaders/styledtext.vert b/src/quick/scenegraph/shaders/styledtext.vert
index 7001bbc262..29c9902609 100644
--- a/src/quick/scenegraph/shaders/styledtext.vert
+++ b/src/quick/scenegraph/shaders/styledtext.vert
@@ -13,5 +13,6 @@ void main()
{
sampleCoord = tCoord * textureScale;
shiftedSampleCoord = (tCoord - shift) * textureScale;
- gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert
index c522877bb3..04a0e88da8 100644
--- a/src/quick/scenegraph/shaders/styledtext_core.vert
+++ b/src/quick/scenegraph/shaders/styledtext_core.vert
@@ -15,5 +15,6 @@ void main()
{
sampleCoord = tCoord * textureScale;
shiftedSampleCoord = (tCoord - shift) * textureScale;
- gl_Position = matrix * round(vCoord * dpr) / dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders/textmask.vert b/src/quick/scenegraph/shaders/textmask.vert
index 4c678270d0..1692159d2c 100644
--- a/src/quick/scenegraph/shaders/textmask.vert
+++ b/src/quick/scenegraph/shaders/textmask.vert
@@ -10,5 +10,6 @@ varying highp vec2 sampleCoord;
void main()
{
sampleCoord = tCoord * textureScale;
- gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert
index f996040f70..b0efc1e731 100644
--- a/src/quick/scenegraph/shaders/textmask_core.vert
+++ b/src/quick/scenegraph/shaders/textmask_core.vert
@@ -12,5 +12,6 @@ uniform float dpr;
void main()
{
sampleCoord = tCoord * textureScale;
- gl_Position = matrix * round(vCoord * dpr) / dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
index b16da4d76a..c49cf9a6d8 100644
--- a/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
index 1a12a35b49..f5b3cf91e5 100644
--- a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
index 2d0d23d813..3e0731802d 100644
--- a/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
index 65d9af4736..51cfa99402 100644
--- a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
index 5753794649..aecf6ef18d 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb
index 6026960d68..e62ec89964 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
index 451ccbac5b..c6e5d2d102 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb
index 41ebc12abf..bf6e902f5a 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb
index 0c37ccb6ed..398b6adaa2 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb
index b92235eec3..e243f3300a 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb
index 28ba15e3de..504d586915 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb
index 2877ab92db..f020de9f8c 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb
index 2e6085aa39..0c80f6dbc4 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb
index a528c667fd..7bc588b806 100644
--- a/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb
index e83de529e6..7ad211c5cf 100644
--- a/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb
index 81c51321bb..3d31b99fca 100644
--- a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb
index 6bf01658a1..82b4a63b65 100644
--- a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb
index 4a9ac900a6..ab27f73163 100644
--- a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb
index 76c2459edf..9fae9961c7 100644
--- a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb
index 7bfa7ccd4a..53c8c3ef48 100644
--- a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb
index 8f8304fb49..f7ab8301f3 100644
--- a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb b/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb
index 0b4554568b..a30e7868c7 100644
--- a/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb b/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb
index 2872af0200..8a62c79ba4 100644
--- a/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
index 5ab92fecca..bec0a086af 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.vert b/src/quick/scenegraph/shaders_ng/outlinedtext.vert
index c683a4273c..023f9dfdc2 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.vert
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.vert
@@ -28,5 +28,6 @@ void main()
sCoordDown = (tCoord - vec2(0.0, 1.0)) * ubuf.textureScale;
sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * ubuf.textureScale;
sCoordRight = (tCoord - vec2(1.0, 0.0)) * ubuf.textureScale;
- gl_Position = ubuf.matrix * vCoord;
+ vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
+ gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
index 6aee048faa..3f9464dd7c 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
index 6e6b1ab6c2..7f08bcee9e 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb b/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb
index 4b08ee2ce4..dc3b174553 100644
--- a/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb b/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb
index 4a8c646a21..06e1e3704a 100644
--- a/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb
index f99cdf1176..2ad3229e4a 100644
--- a/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb
index 59c4104a2c..7d3a742650 100644
--- a/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb b/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb
index ffaecbb56c..d5b738cc38 100644
--- a/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb b/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb
index b7715d4dd5..50be6d62e0 100644
--- a/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/sprite.frag.qsb b/src/quick/scenegraph/shaders_ng/sprite.frag.qsb
index 45d5bc14ee..f6a7913054 100644
--- a/src/quick/scenegraph/shaders_ng/sprite.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/sprite.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/sprite.vert.qsb b/src/quick/scenegraph/shaders_ng/sprite.vert.qsb
index b55f881734..c11191feef 100644
--- a/src/quick/scenegraph/shaders_ng/sprite.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/sprite.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb b/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb
index 6ae7a51f7a..0fcd1d3f80 100644
--- a/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb b/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb
index ce2ed3c5b3..6381f6c8d9 100644
--- a/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
index 66ebc5f827..ff7eceba83 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert b/src/quick/scenegraph/shaders_ng/styledtext.vert
index 10565107c6..beadf07c79 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext.vert
+++ b/src/quick/scenegraph/shaders_ng/styledtext.vert
@@ -22,5 +22,6 @@ void main()
{
sampleCoord = tCoord * ubuf.textureScale;
shiftedSampleCoord = (tCoord - ubuf.shift) * ubuf.textureScale;
- gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
+ gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
index 9a27ed0eb8..26f791be7f 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
index 9dd4137072..5e023b086b 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/textmask.frag.qsb b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
index b16da4d76a..4cc598c5f8 100644
--- a/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert b/src/quick/scenegraph/shaders_ng/textmask.vert
index d7d3bf892e..9d80d5dadb 100644
--- a/src/quick/scenegraph/shaders_ng/textmask.vert
+++ b/src/quick/scenegraph/shaders_ng/textmask.vert
@@ -17,5 +17,6 @@ out gl_PerVertex { vec4 gl_Position; };
void main()
{
sampleCoord = tCoord * ubuf.textureScale;
- gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr;
+ vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
+ gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
}
diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert.qsb b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
index ae196ed0ad..03be2e457d 100644
--- a/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/texture.frag.qsb b/src/quick/scenegraph/shaders_ng/texture.frag.qsb
index 3f4aa3713c..55e8c23335 100644
--- a/src/quick/scenegraph/shaders_ng/texture.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/texture.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/texture.vert.qsb b/src/quick/scenegraph/shaders_ng/texture.vert.qsb
index bf0bc7d9fa..7ce3600447 100644
--- a/src/quick/scenegraph/shaders_ng/texture.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/texture.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb
index 93965a55dd..2ad3229e4a 100644
--- a/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb
index 98abe4ef6f..1bea18c036 100644
--- a/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/visualization.frag.qsb b/src/quick/scenegraph/shaders_ng/visualization.frag.qsb
index eadad927dc..6b1a6a6c74 100644
--- a/src/quick/scenegraph/shaders_ng/visualization.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/visualization.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/visualization.vert.qsb b/src/quick/scenegraph/shaders_ng/visualization.vert.qsb
index 7ba27cb4b5..5f64c84705 100644
--- a/src/quick/scenegraph/shaders_ng/visualization.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/visualization.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/util/qsgopenglatlastexture.cpp b/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
index 75a874424a..18c72286d1 100644
--- a/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
@@ -59,6 +59,8 @@
#include <private/qquickprofiler_p.h>
+#include <qtquick_tracepoints_p.h>
+
QT_BEGIN_NAMESPACE
#ifndef GL_BGRA
@@ -250,14 +252,17 @@ void AtlasBase::bind(QSGTexture::Filtering filtering)
if (profileFrames)
qsg_renderer_timer.start();
+ Q_TRACE_SCOPE(QSG_texture_prepare);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphTexturePrepare);
// Skip bind, convert, swizzle; they're irrelevant
Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareStart, 3);
+ Q_TRACE(QSG_texture_upload_entry);
uploadPendingTexture(i);
+ Q_TRACE(QSG_texture_upload_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareUpload);
diff --git a/src/quick/scenegraph/util/qsgplaintexture.cpp b/src/quick/scenegraph/util/qsgplaintexture.cpp
index fdebe03494..f00918bb4e 100644
--- a/src/quick/scenegraph/util/qsgplaintexture.cpp
+++ b/src/quick/scenegraph/util/qsgplaintexture.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qsgplaintexture_p.h"
-#include "qsgrhinativetextureimporter_p.h"
#include <QtQuick/private/qsgcontext_p.h>
#include <qmath.h>
#include <private/qquickprofiler_p.h>
@@ -53,6 +52,8 @@
#endif
#include <QtGui/private/qrhi_p.h>
+#include <qtquick_tracepoints_p.h>
+
#if QT_CONFIG(opengl)
static QElapsedTimer qsg_renderer_timer;
#endif
@@ -150,9 +151,11 @@ void QSGPlainTexture::setTextureId(int id) // legacy (GL-only)
void QSGPlainTexture::bind() // legacy (GL-only)
{
#if QT_CONFIG(opengl)
+ Q_TRACE_SCOPE(QSG_texture_prepare);
QOpenGLContext *context = QOpenGLContext::currentContext();
QOpenGLFunctions *funcs = context->functions();
if (!m_dirty_texture) {
+ Q_TRACE_SCOPE(QSG_texture_bind);
funcs->glBindTexture(GL_TEXTURE_2D, m_texture_id);
if (mipmapFiltering() != QSGTexture::None && !m_mipmaps_generated) {
funcs->glGenerateMipmap(GL_TEXTURE_2D);
@@ -174,6 +177,7 @@ void QSGPlainTexture::bind() // legacy (GL-only)
if (m_image.isNull()) {
if (m_texture_id && m_owns_texture) {
+ Q_TRACE_SCOPE(QSG_texture_delete);
funcs->glDeleteTextures(1, &m_texture_id);
qCDebug(QSG_LOG_TIME_TEXTURE, "plain texture deleted in %dms - %dx%d",
(int) qsg_renderer_timer.elapsed(),
@@ -189,6 +193,8 @@ void QSGPlainTexture::bind() // legacy (GL-only)
return;
}
+ Q_TRACE(QSG_texture_bind_entry);
+
if (m_texture_id == 0)
funcs->glGenTextures(1, &m_texture_id);
funcs->glBindTexture(GL_TEXTURE_2D, m_texture_id);
@@ -196,8 +202,10 @@ void QSGPlainTexture::bind() // legacy (GL-only)
qint64 bindTime = 0;
if (profileFrames)
bindTime = qsg_renderer_timer.nsecsElapsed();
+ Q_TRACE(QSG_texture_bind_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareBind);
+ Q_TRACE(QSG_texture_upload_entry);
// ### TODO: check for out-of-memory situations...
@@ -232,8 +240,10 @@ void QSGPlainTexture::bind() // legacy (GL-only)
qint64 uploadTime = 0;
if (profileFrames)
uploadTime = qsg_renderer_timer.nsecsElapsed();
+ Q_TRACE(QSG_texture_upload_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareUpload);
+ Q_TRACE(QSG_texture_mipmap_entry);
if (mipmapFiltering() != QSGTexture::None) {
funcs->glGenerateMipmap(GL_TEXTURE_2D);
@@ -252,6 +262,7 @@ void QSGPlainTexture::bind() // legacy (GL-only)
int((mipmapTime - uploadTime)/1000000),
m_texture_size != m_image.size() ? " (scaled to GL_MAX_TEXTURE_SIZE)" : "");
}
+ Q_TRACE(QSG_texture_mipmap_exit);
Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareMipmap);
@@ -281,14 +292,14 @@ void QSGPlainTexture::setTextureFromNativeObject(QRhi *rhi, QQuickWindow::Native
{
Q_UNUSED(type);
- QRhiTexture::Flags flags = 0;
+ QRhiTexture::Flags flags;
if (mipmap)
flags |= QRhiTexture::MipMapped | QRhiTexture::UsedWithGenerateMips;
QRhiTexture *t = rhi->newTexture(QRhiTexture::RGBA8, size, 1, flags);
// ownership of the native object is never taken
- QSGRhiNativeTextureImporter::buildWrapper(rhi, t, nativeObjectPtr, nativeLayout);
+ t->buildFrom({nativeObjectPtr, nativeLayout});
setTexture(t);
}
@@ -421,7 +432,7 @@ void QSGPlainTexturePrivate::updateRhiTexture(QRhi *rhi, QRhiResourceUpdateBatch
}
if (!q->m_texture) {
- QRhiTexture::Flags f = 0;
+ QRhiTexture::Flags f;
if (hasMipMaps)
f |= QRhiTexture::MipMapped | QRhiTexture::UsedWithGenerateMips;
diff --git a/src/quick/scenegraph/util/qsgrhiatlastexture.cpp b/src/quick/scenegraph/util/qsgrhiatlastexture.cpp
index 3dc1f5f526..6b5f1aec4f 100644
--- a/src/quick/scenegraph/util/qsgrhiatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgrhiatlastexture.cpp
@@ -49,6 +49,9 @@
#include <private/qquickprofiler_p.h>
#include <private/qsgdefaultrendercontext_p.h>
#include <private/qsgtexture_p.h>
+
+#include <qtquick_tracepoints_p.h>
+
#if 0
#include <private/qsgcompressedtexture_p.h>
#include <private/qsgcompressedatlastexture_p.h>
@@ -197,14 +200,17 @@ void AtlasBase::updateRhiTexture(QRhiResourceUpdateBatch *resourceUpdates)
if (profileFrames)
qsg_renderer_timer.start();
+ Q_TRACE_SCOPE(QSG_texture_prepare);
Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphTexturePrepare);
// Skip bind, convert, swizzle; they're irrelevant
Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareStart, 3);
+ Q_TRACE(QSG_texture_upload_entry);
enqueueTextureUpload(t, resourceUpdates);
+ Q_TRACE(QSG_texture_upload_exit);
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare,
QQuickProfiler::SceneGraphTexturePrepareUpload);
diff --git a/src/quick/scenegraph/util/qsgrhinativetextureimporter.cpp b/src/quick/scenegraph/util/qsgrhinativetextureimporter.cpp
deleted file mode 100644
index 7a7c19f587..0000000000
--- a/src/quick/scenegraph/util/qsgrhinativetextureimporter.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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$
-**
-****************************************************************************/
-
-#include "qsgrhinativetextureimporter_p.h"
-#include <private/qsgrhisupport_p.h> // to get all the relevant qrhi headers
-
-QT_BEGIN_NAMESPACE
-
-void QSGRhiNativeTextureImporter::buildWrapper(QRhi *rhi, QRhiTexture *t,
- const void *nativeObjectPtr, int nativeLayout)
-{
-#if !QT_CONFIG(vulkan)
- Q_UNUSED(nativeLayout);
-#endif
-#if !QT_CONFIG(opengl) && !QT_CONFIG(vulkan) && !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
- Q_UNUSED(nativeObjectPtr);
-#endif
-
- switch (rhi->backend()) {
- case QRhi::OpenGLES2:
- {
-#if QT_CONFIG(opengl)
- QRhiGles2TextureNativeHandles h;
- h.texture = *reinterpret_cast<const uint *>(nativeObjectPtr);
- t->buildFrom(&h);
-#endif
- }
- break;
- case QRhi::Vulkan:
- {
-#if QT_CONFIG(vulkan)
- QRhiVulkanTextureNativeHandles h;
- h.image = *reinterpret_cast<const VkImage *>(nativeObjectPtr);
- h.layout = VkImageLayout(nativeLayout);
- t->buildFrom(&h);
-#endif
- }
- break;
- case QRhi::D3D11:
- {
-#ifdef Q_OS_WIN
- QRhiD3D11TextureNativeHandles h;
- h.texture = *reinterpret_cast<void * const *>(nativeObjectPtr);
- t->buildFrom(&h);
-#endif
- }
- break;
- case QRhi::Metal:
- {
-#ifdef Q_OS_DARWIN
- QRhiMetalTextureNativeHandles h;
- h.texture = *reinterpret_cast<void * const *>(nativeObjectPtr);
- t->buildFrom(&h);
-#endif
- }
- break;
- case QRhi::Null:
- t->build();
- break;
- default:
- qWarning("QSGRhiNativeTextureImporter: encountered an unsupported QRhi backend (%d)",
- int(rhi->backend()));
- t->build();
- break;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgrhinativetextureimporter_p.h b/src/quick/scenegraph/util/qsgrhinativetextureimporter_p.h
deleted file mode 100644
index e811109a94..0000000000
--- a/src/quick/scenegraph/util/qsgrhinativetextureimporter_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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$
-**
-****************************************************************************/
-
-#ifndef QSGRHINATIVETEXTUREIMPORTER_P_H
-#define QSGRHINATIVETEXTUREIMPORTER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qtquickglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRhi;
-class QRhiTexture;
-
-class QSGRhiNativeTextureImporter
-{
-public:
- static void buildWrapper(QRhi *rhi, QRhiTexture *t,
- const void *nativeObjectPtr, int nativeLayout);
-};
-
-QT_END_NAMESPACE
-
-#endif // QSGRHINATIVETEXTUREIMPORTER_P_H
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index ae5c481e2f..eee8562a2a 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -196,7 +196,7 @@ void QQuickBehavior::write(const QVariant &value)
bool bypass = !d->enabled || !d->finalized || QQmlEnginePrivate::designerMode();
if (!bypass)
qmlExecuteDeferred(this);
- if (!d->animation || bypass) {
+ if (QQmlData::wasDeleted(d->animation) || bypass) {
if (d->animationInstance)
d->animationInstance->stop();
QQmlPropertyPrivate::write(d->property, value, QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding);
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 61319c388c..24b22f00c1 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -918,7 +918,7 @@ QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &path
When curves are present, the percentage argument is mapped to the \c t
parameter of the Bezier equations.
- \sa QPainterPath::pointAt
+ \sa QPainterPath::pointAtPercent()
\since QtQuick 2.14
*/
@@ -2370,8 +2370,8 @@ void QQuickPathPercent::setValue(qreal value)
The example below creates a triangular path consisting of four vertices
on the edge of the containing Shape's bounding box.
- Through the containing shape's \l scale property, the path will be
- rescaled together with its containing shape.
+ Through the containing shape's \l {QtQuick::Path::}{scale} property,
+ the path will be rescaled together with its containing shape.
\qml
PathPolyline {
@@ -2488,7 +2488,7 @@ void QQuickPathPolyline::addToPath(QPainterPath &path, const QQuickPathData &/*d
The example below creates a high voltage symbol by adding each path
of the symbol to the list of paths.
The coordinates of the vertices are normalized, and through the containing shape's
- \l scale property, the path will be rescaled together with its containing shape.
+ \l {QtQuick::Path::}{scale} property, the path will be rescaled together with its containing shape.
\qml
PathMultiline {
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 56ad8ebf0b..e1b30f2b2c 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -567,9 +567,10 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply)
QBuffer buff(&all);
buff.open(QIODevice::ReadOnly);
int frameCount;
- if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, job->data->frame))
+ int const frame = job->data ? job->data->frame : 0;
+ if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, frame))
error = QQuickPixmapReply::Decoding;
- else
+ else if (job->data)
job->data->frameCount = frameCount;
}
// send completion event to the QQuickPixmapReply
@@ -882,7 +883,8 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u
return;
} else {
int frameCount;
- if (!readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, runningJob->data->frame)) {
+ int const frame = runningJob->data ? runningJob->data->frame : 0;
+ if ( !readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, frame)) {
errorCode = QQuickPixmapReply::Loading;
if (f.fileName() != localFile)
errorStr += QString::fromLatin1(" (%1)").arg(f.fileName());
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index 7d545cdb2f..08d06c66ab 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -89,8 +89,8 @@ public:
QQmlContext *context,
bool preloadImages,
bool *fontSizeModified)
- : text(t), layout(l), imgTags(&imgTags), baseFont(layout.font()), baseUrl(baseUrl), hasNewLine(true), nbImages(0), updateImagePositions(false)
- , preFormat(false), prependSpace(false), hasSpace(true), preloadImages(preloadImages), fontSizeModified(fontSizeModified), context(context)
+ : text(t), layout(l), imgTags(&imgTags), baseFont(layout.font()), baseUrl(baseUrl),
+ fontSizeModified(fontSizeModified), context(context), preloadImages(preloadImages)
{
}
@@ -122,15 +122,15 @@ public:
QFont baseFont;
QStack<List> listStack;
QUrl baseUrl;
- bool hasNewLine;
- int nbImages;
- bool updateImagePositions;
- bool preFormat;
- bool prependSpace;
- bool hasSpace;
- bool preloadImages;
bool *fontSizeModified;
QQmlContext *context;
+ int nbImages = 0;
+ bool hasNewLine = true;
+ bool updateImagePositions = false;
+ bool preFormat = false;
+ bool prependSpace = false;
+ bool hasSpace = true;
+ bool preloadImages;
static const QChar lessThan;
static const QChar greaterThan;
diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp
deleted file mode 100644
index 650a8c7e81..0000000000
--- a/src/quick/util/qquickutilmodule.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquickutilmodule_p.h"
-#include "qquickanimation_p.h"
-#include "qquickanimation_p_p.h"
-#include "qquickapplication_p.h"
-#include "qquickbehavior_p.h"
-#include "qquicksmoothedanimation_p.h"
-#include "qquickfontloader_p.h"
-#include "qquickfontmetrics_p.h"
-#include "qquickpropertychanges_p.h"
-#include "qquickspringanimation_p.h"
-#include "qquickstategroup_p.h"
-#include "qquickstatechangescript_p.h"
-#include "qquickstate_p.h"
-#include "qquickstate_p_p.h"
-#include "qquicksystempalette_p.h"
-#include "qquicktextmetrics_p.h"
-#include "qquicktransition_p.h"
-#include "qquickanimator_p.h"
-#if QT_CONFIG(shortcut)
-#include "qquickshortcut_p.h"
-#endif
-#include "qquickvalidator_p.h"
-#include "qquickforeignutils_p.h"
-#include <qqmlinfo.h>
-#include <private/qqmltypenotavailable_p.h>
-#include <private/qquickanimationcontroller_p.h>
-#include <QtCore/qcoreapplication.h>
-
-#if QT_CONFIG(shortcut)
-Q_DECLARE_METATYPE(QKeySequence::StandardKey)
-#endif
-
-void QQuickUtilModule::defineModule()
-{
-#if QT_CONFIG(shortcut)
- qRegisterMetaType<QKeySequence::StandardKey>();
-#endif
-
- qmlRegisterTypesAndRevisions<
-#if QT_CONFIG(validator)
- QValidatorForeign,
- QQuickIntValidator,
- QQuickDoubleValidator,
- QRegExpValidatorForeign,
-#if QT_CONFIG(regularexpression)
- QRegularExpressionValidatorForeign,
-#endif // QT_CONFIG(regularexpression)
-#endif // QT_CONFIG(validator)
-#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl)
- QQuickUniformAnimator,
-#endif
-#if QT_CONFIG(shortcut)
- QQuickShortcut,
- QKeySequenceForeign,
-#endif
-#if QT_CONFIG(im)
- QInputMethodForeign,
-#endif
- QQuickAbstractAnimation,
- QQuickBehavior,
- QQuickColorAnimation,
- QQuickSmoothedAnimation,
- QQuickFontLoader,
- QQuickNumberAnimation,
- QQuickParallelAnimation,
- QQuickPauseAnimation,
- QQuickPropertyAction,
- QQuickPropertyAnimation,
- QQuickRotationAnimation,
- QQuickScriptAction,
- QQuickSequentialAnimation,
- QQuickSpringAnimation,
- QQuickAnimationController,
- QQuickStateChangeScript,
- QQuickStateGroup,
- QQuickState,
- QQuickSystemPalette,
- QQuickTransition,
- QQuickVector3dAnimation,
- QQuickAnimator,
- QQuickXAnimator,
- QQuickYAnimator,
- QQuickScaleAnimator,
- QQuickRotationAnimator,
- QQuickOpacityAnimator,
- QQuickStateOperation,
- QQuickPropertyChanges,
- QQuickFontMetrics,
- QQuickTextMetrics,
- QQuickApplication
- >("QtQuick", 2);
-}
diff --git a/src/quick/util/qquickutilmodule_p.h b/src/quick/util/qquickutilmodule_p.h
deleted file mode 100644
index b03eeddede..0000000000
--- a/src/quick/util/qquickutilmodule_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#ifndef QQUICKUTILMODULE_H
-#define QQUICKUTILMODULE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickUtilModule
-{
-public:
- static void defineModule();
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKUTILMODULE_H
diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp
index 0af29aed1c..b47e1a082d 100644
--- a/src/quick/util/qquickvaluetypes.cpp
+++ b/src/quick/util/qquickvaluetypes.cpp
@@ -50,7 +50,6 @@ namespace QQuickValueTypes {
void registerValueTypes()
{
QQmlValueTypeFactory::registerValueTypes("QtQuick", 2, 0);
- qmlRegisterValueTypeEnums<QQuickFontValueType>("QtQuick", 2, 0, "Font");
}
}
diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri
index 3a1addfcd4..f61a967959 100644
--- a/src/quick/util/util.pri
+++ b/src/quick/util/util.pri
@@ -1,6 +1,5 @@
SOURCES += \
$$PWD/qquickapplication.cpp\
- $$PWD/qquickutilmodule.cpp\
$$PWD/qquickanimation.cpp \
$$PWD/qquicksystempalette.cpp \
$$PWD/qquickspringanimation.cpp \
@@ -32,7 +31,6 @@ qtConfig(qml-debug): SOURCES += $$PWD/qquickprofiler.cpp
HEADERS += \
$$PWD/qquickapplication_p.h\
- $$PWD/qquickutilmodule_p.h\
$$PWD/qquickanimation_p.h \
$$PWD/qquickanimation_p_p.h \
$$PWD/qquicksystempalette_p.h \
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp
index a7db65f16f..563303b84a 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -49,12 +49,12 @@
#include <QLoggingCategory>
#include <QtGui/private/qrhi_p.h>
-#if defined(QT_STATIC)
static void initResources()
{
+#if defined(QT_STATIC)
Q_INIT_RESOURCE(qtquickshapes);
-}
#endif
+}
QT_BEGIN_NAMESPACE
@@ -73,6 +73,11 @@ Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync")
\endqml
*/
+void QQuickShapesModule::defineModule()
+{
+ initResources();
+}
+
QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
: strokeColor(Qt::white),
strokeWidth(1),
@@ -595,8 +600,6 @@ void QQuickShapePath::resetFillGradient()
\li The \c software backend is fully supported. The path is rendered via
QPainter::strokePath() and QPainter::fillPath() in this case.
- \li The Direct 3D 12 backend is not currently supported.
-
\li The OpenVG backend is not currently supported.
\endlist
@@ -667,22 +670,9 @@ void QQuickShapePrivate::setStatus(QQuickShape::Status newStatus)
}
}
-struct QQuickShapeResourceInitializer
-{
- QQuickShapeResourceInitializer()
- {
-#if defined(QT_STATIC)
- initResources();
-#endif
- }
-};
-
-Q_GLOBAL_STATIC(QQuickShapeResourceInitializer, initQQuickShapeResources)
-
QQuickShape::QQuickShape(QQuickItem *parent)
: QQuickItem(*(new QQuickShapePrivate), parent)
{
- initQQuickShapeResources();
setFlag(ItemHasContents);
}
diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h
index cadc65f7cd..f86f2b03d6 100644
--- a/src/quickshapes/qquickshape_p.h
+++ b/src/quickshapes/qquickshape_p.h
@@ -63,6 +63,12 @@ QT_BEGIN_NAMESPACE
class QQuickShapePathPrivate;
class QQuickShapePrivate;
+class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapesModule
+{
+public:
+ static void defineModule();
+};
+
class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient
{
Q_OBJECT
diff --git a/src/quickshapes/qquickshape_p_p.h b/src/quickshapes/qquickshape_p_p.h
index bfeb0d2f9f..e9b89d2ab3 100644
--- a/src/quickshapes/qquickshape_p_p.h
+++ b/src/quickshapes/qquickshape_p_p.h
@@ -89,7 +89,7 @@ public:
virtual void beginSync(int totalCount) = 0;
virtual void endSync(bool async) = 0;
virtual void setAsyncCallback(void (*)(void *), void *) { }
- virtual Flags flags() const { return 0; }
+ virtual Flags flags() const { return {}; }
virtual void setPath(int index, const QQuickPath *path) = 0;
virtual void setStrokeColor(int index, const QColor &color) = 0;
virtual void setStrokeWidth(int index, qreal w) = 0;
diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp
index 06cc442fc7..e0df739987 100644
--- a/src/quickshapes/qquickshapegenericrenderer.cpp
+++ b/src/quickshapes/qquickshapegenericrenderer.cpp
@@ -470,14 +470,14 @@ void QQuickShapeGenericRenderer::triangulateStroke(const QPainterPath &path,
stroker.setInvScale(inverseScale);
if (pen.style() == Qt::SolidLine) {
- stroker.process(vp, pen, clip, nullptr);
+ stroker.process(vp, pen, clip, {});
} else {
QDashedStrokeProcessor dashStroker;
dashStroker.setInvScale(inverseScale);
- dashStroker.process(vp, pen, clip, nullptr);
+ dashStroker.process(vp, pen, clip, {});
QVectorPath dashStroke(dashStroker.points(), dashStroker.elementCount(),
dashStroker.elementTypes(), 0);
- stroker.process(dashStroke, pen, clip, nullptr);
+ stroker.process(dashStroke, pen, clip, {});
}
if (!stroker.vertexCount()) {
diff --git a/src/quickshapes/qquickshapesoftwarerenderer.cpp b/src/quickshapes/qquickshapesoftwarerenderer.cpp
index 0f5c3604b5..d6a9d85643 100644
--- a/src/quickshapes/qquickshapesoftwarerenderer.cpp
+++ b/src/quickshapes/qquickshapesoftwarerenderer.cpp
@@ -266,7 +266,7 @@ void QQuickShapeSoftwareRenderNode::render(const RenderState *state)
QSGRenderNode::StateFlags QQuickShapeSoftwareRenderNode::changedStates() const
{
- return nullptr;
+ return {};
}
QSGRenderNode::RenderingFlags QQuickShapeSoftwareRenderNode::flags() const
diff --git a/src/quickshapes/quickshapes.pro b/src/quickshapes/quickshapes.pro
index 5a59dec18e..7c71aa4f4a 100644
--- a/src/quickshapes/quickshapes.pro
+++ b/src/quickshapes/quickshapes.pro
@@ -31,3 +31,9 @@ qtConfig(opengl) {
RESOURCES += qtquickshapes.qrc
load(qt_module)
+
+QMLTYPES_FILENAME = plugins.qmltypes
+QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick/Shapes
+QML_IMPORT_NAME = QtQuick.Shapes
+IMPORT_VERSION = 1.15
+CONFIG += qmltypes install_qmltypes install_metatypes
diff --git a/src/quickshapes/shaders_ng/conicalgradient.frag.qsb b/src/quickshapes/shaders_ng/conicalgradient.frag.qsb
index 9aa59ca651..cee844fab4 100644
--- a/src/quickshapes/shaders_ng/conicalgradient.frag.qsb
+++ b/src/quickshapes/shaders_ng/conicalgradient.frag.qsb
Binary files differ
diff --git a/src/quickshapes/shaders_ng/conicalgradient.vert.qsb b/src/quickshapes/shaders_ng/conicalgradient.vert.qsb
index 7f5985ef64..50508e242a 100644
--- a/src/quickshapes/shaders_ng/conicalgradient.vert.qsb
+++ b/src/quickshapes/shaders_ng/conicalgradient.vert.qsb
Binary files differ
diff --git a/src/quickshapes/shaders_ng/lineargradient.frag.qsb b/src/quickshapes/shaders_ng/lineargradient.frag.qsb
index 470de007b5..d25d5e7a79 100644
--- a/src/quickshapes/shaders_ng/lineargradient.frag.qsb
+++ b/src/quickshapes/shaders_ng/lineargradient.frag.qsb
Binary files differ
diff --git a/src/quickshapes/shaders_ng/lineargradient.vert.qsb b/src/quickshapes/shaders_ng/lineargradient.vert.qsb
index 8d054efbb4..c48646b036 100644
--- a/src/quickshapes/shaders_ng/lineargradient.vert.qsb
+++ b/src/quickshapes/shaders_ng/lineargradient.vert.qsb
Binary files differ
diff --git a/src/quickshapes/shaders_ng/radialgradient.frag.qsb b/src/quickshapes/shaders_ng/radialgradient.frag.qsb
index 166eb2f92d..207e4d3429 100644
--- a/src/quickshapes/shaders_ng/radialgradient.frag.qsb
+++ b/src/quickshapes/shaders_ng/radialgradient.frag.qsb
Binary files differ
diff --git a/src/quickshapes/shaders_ng/radialgradient.vert.qsb b/src/quickshapes/shaders_ng/radialgradient.vert.qsb
index 293e23947a..dadbfd60d6 100644
--- a/src/quickshapes/shaders_ng/radialgradient.vert.qsb
+++ b/src/quickshapes/shaders_ng/radialgradient.vert.qsb
Binary files differ
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 3854a8bd0b..655923856c 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -500,7 +500,7 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
\section1 Support when not using OpenGL
In addition to OpenGL, the \c software backend of Qt Quick also supports
- QQuickWidget. Other backends, for example the Direct 3D 12 one, are not
+ QQuickWidget. Other backends, for example OpenVG, are not
compatible however and attempting to construct a QQuickWidget will lead to
problems.
@@ -525,7 +525,7 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
*/
QQuickWidget::QQuickWidget(QWidget *parent)
-: QWidget(*(new QQuickWidgetPrivate), parent, nullptr)
+ : QWidget(*(new QQuickWidgetPrivate), parent, {})
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
@@ -553,7 +553,7 @@ QQuickWidget::QQuickWidget(const QUrl &source, QWidget *parent)
\sa Status, status(), errors()
*/
QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent)
- : QWidget(*(new QQuickWidgetPrivate), parent, nullptr)
+ : QWidget(*(new QQuickWidgetPrivate), parent, {})
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
@@ -848,13 +848,13 @@ QSize QQuickWidgetPrivate::rootObjectSize() const
return rootObjectSize;
}
-void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &format, bool isEs)
+void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &format)
{
Q_Q(QQuickWidget);
QString translatedMessage;
QString untranslatedMessage;
- QQuickWindowPrivate::contextCreationFailureMessage(format, &translatedMessage, &untranslatedMessage, isEs);
+ QQuickWindowPrivate::contextCreationFailureMessage(format, &translatedMessage, &untranslatedMessage);
static const QMetaMethod errorSignal = QMetaMethod::fromSignal(&QQuickWidget::sceneGraphError);
const bool signalConnected = q->isSignalConnected(errorSignal);
@@ -896,10 +896,9 @@ void QQuickWidgetPrivate::createContext()
context->setScreen(shareContext->screen());
}
if (!context->create()) {
- const bool isEs = context->isOpenGLES();
delete context;
context = nullptr;
- handleContextCreationFailure(offscreenWindow->requestedFormat(), isEs);
+ handleContextCreationFailure(offscreenWindow->requestedFormat());
return;
}
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index f4f9db7772..881f7f9220 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -97,7 +97,7 @@ public:
void renderSceneGraph();
void createContext();
void destroyContext();
- void handleContextCreationFailure(const QSurfaceFormat &format, bool isEs);
+ void handleContextCreationFailure(const QSurfaceFormat &format);
#if QT_CONFIG(opengl)
GLuint textureId() const override;